diff --git a/chart-sync/go.mod b/chart-sync/go.mod index 63ec7a8da..afb578682 100644 --- a/chart-sync/go.mod +++ b/chart-sync/go.mod @@ -4,7 +4,7 @@ go 1.24.0 toolchain go1.24.3 -replace github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072256-6c8429c6cc72 +replace github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260227055702-7fe9d47354a0 require ( github.com/caarlos0/env v3.5.0+incompatible diff --git a/chart-sync/go.sum b/chart-sync/go.sum index 1c22835e9..a1f3d5844 100644 --- a/chart-sync/go.sum +++ b/chart-sync/go.sum @@ -43,8 +43,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072256-6c8429c6cc72 h1:L1XupZ+tdjzcMjtzncAszzTeDZKUm7h9HThDIFYkTz4= -github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072256-6c8429c6cc72/go.mod h1:CqHnvltrng2O40hNGVl56qcAhv7tiXK3SKx47LKyE/A= +github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260227055702-7fe9d47354a0 h1:KnmMU3qEy/QRtEJaUQNnXvCrintij+BYhOJtw+OjxYw= +github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260227055702-7fe9d47354a0/go.mod h1:d6awSGcXQc57s4PJlwcyACovJ4PgBmR9jZJ7h6CScUM= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/distribution/distribution/v3 v3.0.0 h1:q4R8wemdRQDClzoNNStftB2ZAfqOiN6UX90KJc4HjyM= diff --git a/chart-sync/vendor/modules.txt b/chart-sync/vendor/modules.txt index adfe19d21..ed19a8626 100644 --- a/chart-sync/vendor/modules.txt +++ b/chart-sync/vendor/modules.txt @@ -95,7 +95,7 @@ github.com/containerd/platforms # github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc ## explicit github.com/davecgh/go-spew/spew -# github.com/devtron-labs/common-lib v0.19.1 => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072256-6c8429c6cc72 +# github.com/devtron-labs/common-lib v0.19.1 => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260227055702-7fe9d47354a0 ## explicit; go 1.24.0 github.com/devtron-labs/common-lib/constants github.com/devtron-labs/common-lib/fetchAllEnv @@ -975,4 +975,4 @@ sigs.k8s.io/structured-merge-diff/v4/value sigs.k8s.io/yaml sigs.k8s.io/yaml/goyaml.v2 sigs.k8s.io/yaml/goyaml.v3 -# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072256-6c8429c6cc72 +# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260227055702-7fe9d47354a0 diff --git a/ci-runner/env_gen.json b/ci-runner/env_gen.json index 5334f14fd..4ad2a1d33 100644 --- a/ci-runner/env_gen.json +++ b/ci-runner/env_gen.json @@ -1 +1 @@ -[{"Category":"DEVTRON","Fields":[{"Env":"AZURE_ACCOUNT_KEY","EnvType":"string","EnvValue":"","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"AZURE_ACCOUNT_NAME","EnvType":"string","EnvValue":"","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"AZURE_BLOB_CONTAINER_CI_CACHE","EnvType":"string","EnvValue":"","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"AZURE_BLOB_CONTAINER_CI_LOG","EnvType":"string","EnvValue":"","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"AZURE_GATEWAY_CONNECTION_INSECURE","EnvType":"bool","EnvValue":"true","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"AZURE_GATEWAY_URL","EnvType":"string","EnvValue":"","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"BLOB_STORAGE_GCP_CREDENTIALS_JSON","EnvType":"string","EnvValue":"","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"BLOB_STORAGE_PROVIDER","EnvType":"","EnvValue":"","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"BLOB_STORAGE_S3_ACCESS_KEY","EnvType":"string","EnvValue":"","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"BLOB_STORAGE_S3_BUCKET_VERSIONED","EnvType":"bool","EnvValue":"true","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"BLOB_STORAGE_S3_ENDPOINT","EnvType":"string","EnvValue":"","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"BLOB_STORAGE_S3_ENDPOINT_INSECURE","EnvType":"bool","EnvValue":"false","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"BLOB_STORAGE_S3_SECRET_KEY","EnvType":"string","EnvValue":"","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"CONSUMER_CONFIG_JSON","EnvType":"string","EnvValue":"","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"DEFAULT_BUILD_LOGS_BUCKET","EnvType":"string","EnvValue":"","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"DEFAULT_CACHE_BUCKET","EnvType":"string","EnvValue":"","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"DEFAULT_CACHE_BUCKET_REGION","EnvType":"string","EnvValue":"","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"DEFAULT_CD_LOGS_BUCKET_REGION","EnvType":"string","EnvValue":"","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"DEFAULT_LOG_TIME_LIMIT","EnvType":"int64","EnvValue":"1","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"IMAGE_SCANNER_ENDPOINT","EnvType":"string","EnvValue":"http://image-scanner-new-demo-devtroncd-service.devtroncd:80","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"LOG_LEVEL","EnvType":"int","EnvValue":"0","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"NATS_MSG_ACK_WAIT_IN_SECS","EnvType":"int","EnvValue":"120","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"NATS_MSG_BUFFER_SIZE","EnvType":"int","EnvValue":"-1","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"NATS_MSG_MAX_AGE","EnvType":"int","EnvValue":"86400","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"NATS_MSG_PROCESSING_BATCH_SIZE","EnvType":"int","EnvValue":"1","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"NATS_MSG_REPLICAS","EnvType":"int","EnvValue":"0","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"NATS_SERVER_HOST","EnvType":"string","EnvValue":"nats://devtron-nats.devtroncd:4222","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"PG_EXPORT_PROM_METRICS","EnvType":"bool","EnvValue":"true","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"PG_LOG_ALL_FAILURE_QUERIES","EnvType":"bool","EnvValue":"true","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"PG_LOG_ALL_QUERY","EnvType":"bool","EnvValue":"false","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"PG_LOG_SLOW_QUERY","EnvType":"bool","EnvValue":"true","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"PG_QUERY_DUR_THRESHOLD","EnvType":"int64","EnvValue":"5000","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"SHOW_DOCKER_BUILD_ARGS","EnvType":"bool","EnvValue":"true","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"STREAM_CONFIG_JSON","EnvType":"string","EnvValue":"","EnvDescription":"","Example":"","Deprecated":"false"}]}] \ No newline at end of file +[{"Category":"DEVTRON","Fields":[{"Env":"AZURE_ACCOUNT_KEY","EnvType":"string","EnvValue":"","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"AZURE_ACCOUNT_NAME","EnvType":"string","EnvValue":"","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"AZURE_BLOB_CONTAINER_CI_CACHE","EnvType":"string","EnvValue":"","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"AZURE_BLOB_CONTAINER_CI_LOG","EnvType":"string","EnvValue":"","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"AZURE_GATEWAY_CONNECTION_INSECURE","EnvType":"bool","EnvValue":"true","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"AZURE_GATEWAY_URL","EnvType":"string","EnvValue":"","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"BLOB_STORAGE_GCP_CREDENTIALS_JSON","EnvType":"string","EnvValue":"","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"BLOB_STORAGE_PROVIDER","EnvType":"","EnvValue":"","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"BLOB_STORAGE_S3_ACCESS_KEY","EnvType":"string","EnvValue":"","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"BLOB_STORAGE_S3_BUCKET_VERSIONED","EnvType":"bool","EnvValue":"true","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"BLOB_STORAGE_S3_ENDPOINT","EnvType":"string","EnvValue":"","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"BLOB_STORAGE_S3_ENDPOINT_INSECURE","EnvType":"bool","EnvValue":"false","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"BLOB_STORAGE_S3_SECRET_KEY","EnvType":"string","EnvValue":"","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"CONSUMER_CONFIG_JSON","EnvType":"string","EnvValue":"","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"DEFAULT_BUILD_LOGS_BUCKET","EnvType":"string","EnvValue":"","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"DEFAULT_CACHE_BUCKET","EnvType":"string","EnvValue":"","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"DEFAULT_CACHE_BUCKET_REGION","EnvType":"string","EnvValue":"","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"DEFAULT_CD_LOGS_BUCKET_REGION","EnvType":"string","EnvValue":"","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"DEFAULT_LOG_TIME_LIMIT","EnvType":"int64","EnvValue":"1","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"DOCKERFILE_SCAN_FAIL_ON_ERROR","EnvType":"bool","EnvValue":"false","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"DOCKERFILE_SCAN_MAX_RETRIES","EnvType":"int","EnvValue":"3","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"DOCKERFILE_SCAN_RETRY_WAIT_SECONDS","EnvType":"int","EnvValue":"5","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"IMAGE_SCANNER_ENDPOINT","EnvType":"string","EnvValue":"http://image-scanner-service.devtroncd:80","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"LOG_LEVEL","EnvType":"int","EnvValue":"0","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"NATS_MSG_ACK_WAIT_IN_SECS","EnvType":"int","EnvValue":"120","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"NATS_MSG_BUFFER_SIZE","EnvType":"int","EnvValue":"-1","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"NATS_MSG_MAX_AGE","EnvType":"int","EnvValue":"86400","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"NATS_MSG_PROCESSING_BATCH_SIZE","EnvType":"int","EnvValue":"1","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"NATS_MSG_REPLICAS","EnvType":"int","EnvValue":"0","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"NATS_SERVER_HOST","EnvType":"string","EnvValue":"nats://devtron-nats.devtroncd:4222","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"PG_EXPORT_PROM_METRICS","EnvType":"bool","EnvValue":"true","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"PG_LOG_ALL_FAILURE_QUERIES","EnvType":"bool","EnvValue":"true","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"PG_LOG_ALL_QUERY","EnvType":"bool","EnvValue":"false","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"PG_LOG_SLOW_QUERY","EnvType":"bool","EnvValue":"true","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"PG_QUERY_DUR_THRESHOLD","EnvType":"int64","EnvValue":"5000","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"SHOW_DOCKER_BUILD_ARGS","EnvType":"bool","EnvValue":"true","EnvDescription":"","Example":"","Deprecated":"false"},{"Env":"STREAM_CONFIG_JSON","EnvType":"string","EnvValue":"","EnvDescription":"","Example":"","Deprecated":"false"}]}] \ No newline at end of file diff --git a/ci-runner/env_gen.md b/ci-runner/env_gen.md index 033d7a119..7705664d7 100644 --- a/ci-runner/env_gen.md +++ b/ci-runner/env_gen.md @@ -22,7 +22,10 @@ | DEFAULT_CACHE_BUCKET_REGION | string | | | | false | | DEFAULT_CD_LOGS_BUCKET_REGION | string | | | | false | | DEFAULT_LOG_TIME_LIMIT | int64 |1 | | | false | - | IMAGE_SCANNER_ENDPOINT | string |http://image-scanner-new-demo-devtroncd-service.devtroncd:80 | | | false | + | DOCKERFILE_SCAN_FAIL_ON_ERROR | bool |false | | | false | + | DOCKERFILE_SCAN_MAX_RETRIES | int |3 | | | false | + | DOCKERFILE_SCAN_RETRY_WAIT_SECONDS | int |5 | | | false | + | IMAGE_SCANNER_ENDPOINT | string |http://image-scanner-service.devtroncd:80 | | | false | | LOG_LEVEL | int |0 | | | false | | NATS_MSG_ACK_WAIT_IN_SECS | int |120 | | | false | | NATS_MSG_BUFFER_SIZE | int |-1 | | | false | diff --git a/ci-runner/executor/stage/ciStages.go b/ci-runner/executor/stage/ciStages.go index 220cdc397..42da4ffae 100644 --- a/ci-runner/executor/stage/ciStages.go +++ b/ci-runner/executor/stage/ciStages.go @@ -348,6 +348,28 @@ func (impl *CiStage) runBuildArtifact(ciCdRequest *helper.CiCdTriggerEvent, metr // build start := time.Now() metrics.BuildStartTime = start + + // Trigger Dockerfile scan right before build (git clone has definitely completed) + // Check BOTH flags: user's choice OR policy override + if ciCdRequest.CommonWorkflowRequest.DockerfileScanEnabled || ciCdRequest.CommonWorkflowRequest.ForceDockerfileScan { + log.Println(util.DEVTRON, "dockerfile scan triggered at build start (git clone completed)", + "buildId", ciCdRequest.CommonWorkflowRequest.WorkflowId, + "pipelineId", ciCdRequest.CommonWorkflowRequest.PipelineId, + "appId", ciCdRequest.CommonWorkflowRequest.AppId, + "checkoutPath", ciCdRequest.CommonWorkflowRequest.CheckoutPath) + // Trigger scan asynchronously (non-blocking, runs parallel to build) + go func() { + log.Println(util.DEVTRON, "dockerfile scan started", + "appId", ciCdRequest.CommonWorkflowRequest.AppId, + "buildId", ciCdRequest.CommonWorkflowRequest.WorkflowId, + "pipelineId", ciCdRequest.CommonWorkflowRequest.PipelineId, + "checkoutPath", ciCdRequest.CommonWorkflowRequest.CheckoutPath) + helper.InitiateDockerfileScan(ciCdRequest.CommonWorkflowRequest) + log.Println(util.DEVTRON, "dockerfile scan request sent to image-scanner", + "buildId", ciCdRequest.CommonWorkflowRequest.WorkflowId) + }() + } + dest, err := impl.dockerHelper.BuildArtifact(ciCdRequest.CommonWorkflowRequest) // TODO make it skipable metrics.BuildDuration = time.Since(start).Seconds() if err != nil { diff --git a/ci-runner/go.mod b/ci-runner/go.mod index 8048db3c0..3cd587bd2 100644 --- a/ci-runner/go.mod +++ b/ci-runner/go.mod @@ -4,7 +4,7 @@ go 1.24.0 toolchain go1.24.3 -replace github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072256-6c8429c6cc72 +replace github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260227055702-7fe9d47354a0 require ( github.com/Knetic/govaluate v3.0.0+incompatible @@ -136,12 +136,12 @@ require ( go.uber.org/zap v1.27.0 // indirect go.yaml.in/yaml/v2 v2.4.2 // indirect golang.org/x/crypto v0.40.0 // indirect - golang.org/x/net v0.41.0 // indirect + golang.org/x/net v0.42.0 // indirect golang.org/x/oauth2 v0.30.0 // indirect golang.org/x/sys v0.34.0 // indirect golang.org/x/term v0.33.0 // indirect golang.org/x/text v0.27.0 // indirect - golang.org/x/time v0.11.0 // indirect + golang.org/x/time v0.12.0 // indirect google.golang.org/api v0.234.0 // indirect google.golang.org/genproto v0.0.0-20250519155744-55703ea1f237 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20250519155744-55703ea1f237 // indirect diff --git a/ci-runner/go.sum b/ci-runner/go.sum index cbf89bc5e..ce2ab1c17 100644 --- a/ci-runner/go.sum +++ b/ci-runner/go.sum @@ -114,8 +114,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072256-6c8429c6cc72 h1:L1XupZ+tdjzcMjtzncAszzTeDZKUm7h9HThDIFYkTz4= -github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072256-6c8429c6cc72/go.mod h1:CqHnvltrng2O40hNGVl56qcAhv7tiXK3SKx47LKyE/A= +github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260227055702-7fe9d47354a0 h1:KnmMU3qEy/QRtEJaUQNnXvCrintij+BYhOJtw+OjxYw= +github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260227055702-7fe9d47354a0/go.mod h1:d6awSGcXQc57s4PJlwcyACovJ4PgBmR9jZJ7h6CScUM= github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk= github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= github.com/docker/cli v28.1.1+incompatible h1:eyUemzeI45DY7eDPuwUcmDyDj1pM98oD5MdSpiItp8k= @@ -393,8 +393,8 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= -golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw= -golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA= +golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= +golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI= golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -450,8 +450,8 @@ golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4= golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU= -golang.org/x/time v0.11.0 h1:/bpjEDfN9tkoN/ryeYHnv5hcMlc8ncjMcM4XBk5NWV0= -golang.org/x/time v0.11.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg= +golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE= +golang.org/x/time v0.12.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= diff --git a/ci-runner/helper/DockerHelper.go b/ci-runner/helper/DockerHelper.go index 35498897c..d9fae1c43 100644 --- a/ci-runner/helper/DockerHelper.go +++ b/ci-runner/helper/DockerHelper.go @@ -23,6 +23,19 @@ import ( "encoding/json" "errors" "fmt" + "io" + "io/ioutil" + "log" + "os" + "os/exec" + "path" + "path/filepath" + "strconv" + "strings" + "sync" + "syscall" + "time" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds" @@ -38,18 +51,6 @@ import ( "github.com/devtron-labs/common-lib/utils/dockerOperations" "github.com/devtron-labs/common-lib/utils/retryFunc" "golang.org/x/sync/errgroup" - "io" - "io/ioutil" - "log" - "os" - "os/exec" - "path" - "path/filepath" - "strconv" - "strings" - "sync" - "syscall" - "time" ) const ( @@ -74,15 +75,23 @@ type DockerHelper interface { GetDockerAuthConfigForPrivateRegistries(workflowRequest *CommonWorkflowRequest) *bean.DockerAuthConfig } +// BuildxK8sClientFactory creates a BuildxK8sInterface from deployment names. +// Abstracted for testability — production code uses newBuildxK8sClient as the default. +type BuildxK8sClientFactory func(deploymentNames []string) (BuildxK8sInterface, error) + type DockerHelperImpl struct { DockerCommandEnv []string cmdExecutor CommandExecutor + k8sClientFactory BuildxK8sClientFactory } func NewDockerHelperImpl(cmdExecutor CommandExecutor) *DockerHelperImpl { return &DockerHelperImpl{ DockerCommandEnv: os.Environ(), cmdExecutor: cmdExecutor, + k8sClientFactory: func(names []string) (BuildxK8sInterface, error) { + return newBuildxK8sClient(names) + }, } } @@ -300,9 +309,27 @@ func (impl *DockerHelperImpl) DockerLogin(ciContext cicxt.CiContext, dockerCrede return performDockerLogin() } +// waitForBuilderPods waits until all buildx k8s driver pods reach Running state, +// or returns an error if the deadline is exceeded. Extracted for testability. +func waitForBuilderPods(ctx context.Context, k8sClient BuildxK8sInterface, duration time.Duration) error { + log.Println(util.DEVTRON, fmt.Sprintf("waiting for builder pods to be ready (timeout: %v)", duration)) + initDone := make(chan bool, 1) + initCtx, initCancel := context.WithTimeout(ctx, duration) + defer initCancel() + go k8sClient.WaitUntilBuilderPodLive(initCtx, initDone) + select { + case <-initDone: + log.Println(util.DEVTRON, "builder pods are ready for build") + return nil + case <-initCtx.Done(): + return fmt.Errorf("builder pods did not reach Running state within %v", duration) + } +} + func (impl *DockerHelperImpl) executeDockerReBuild(ciContext cicxt.CiContext, k8sClient BuildxK8sInterface, useBuildxK8sDriver bool, dockerBuild string, deploymentNames []string, - dockerBuildStageMetadata bean2.DockerBuildStageMetadata, reBuildLogs []any) error { + dockerBuildStageMetadata bean2.DockerBuildStageMetadata, reBuildLogs []any, + builderPodWaitDuration time.Duration) error { if !useBuildxK8sDriver { return nil } @@ -311,7 +338,7 @@ func (impl *DockerHelperImpl) executeDockerReBuild(ciContext cicxt.CiContext, k8 log.Println(util.DEVTRON, fmt.Sprintf(" error in RestartBuilders : %s", k8sErr.Error())) return k8sErr } - k8sClient, err := newBuildxK8sClient(deploymentNames) + k8sClient, err := impl.k8sClientFactory(deploymentNames) if err != nil { log.Println(util.DEVTRON, " error in creating buildxK8sClient , err : ", err.Error()) return err @@ -324,18 +351,15 @@ func (impl *DockerHelperImpl) executeDockerReBuild(ciContext cicxt.CiContext, k8 rebuildImageStage := func() error { // wait for the builder pod to be up again startTime := time.Now() - util.LogInfo("Waiting for builder pod to be ready,", "timeout: 2 minutes") - done := make(chan bool) - ctx, cancel := context.WithCancel(ciContext) + util.LogInfo("Waiting for builder pod to be ready,", fmt.Sprintf("timeout: %v", builderPodWaitDuration)) + done := make(chan bool, 1) // buffered to prevent goroutine leak on timeout + ctx, cancel := context.WithTimeout(ciContext, builderPodWaitDuration) defer cancel() go k8sClient.WaitUntilBuilderPodLive(ctx, done) select { case <-done: // builder pod is up again, continue with the build - cancel() - case <-time.After(2 * time.Minute): - // timeout after 2 minutes - cancel() + case <-ctx.Done(): return BuilderPodDeletedError } util.LogInfo("DONE -->", time.Since(startTime).Seconds()) @@ -403,6 +427,10 @@ func (impl *DockerHelperImpl) BuildArtifact(ciRequest *CommonWorkflowRequest) (s if err != nil { log.Println("Error while parsing environment variables", err) } + builderPodWaitDuration := 2 * time.Minute // backward-compat default + if ciRequest.BuildxBuilderPodWaitDurationSecs > 0 { + builderPodWaitDuration = time.Duration(ciRequest.BuildxBuilderPodWaitDurationSecs) * time.Second + } if ciRequest.DockerImageTag == "" { ciRequest.DockerImageTag = "latest" } @@ -453,12 +481,12 @@ func (impl *DockerHelperImpl) BuildArtifact(ciRequest *CommonWorkflowRequest) (s } useBuildxK8sDriver, eligibleK8sDriverNodes = dockerBuildConfig.CheckForBuildXK8sDriver() if useBuildxK8sDriver { - deploymentNames, err = impl.createBuildxBuilderWithK8sDriver(ciContext, ciRequest.PropagateLabelsInBuildxPod, ciRequest.DockerConnection, dockerBuildConfig.BuildxDriverImage, eligibleK8sDriverNodes, ciRequest.PipelineId, ciRequest.WorkflowId) + deploymentNames, err = impl.createBuildxBuilderWithK8sDriver(ciContext, ciRequest.PropagateLabelsInBuildxPod, ciRequest.DockerConnection, dockerBuildConfig.BuildxDriverImage, eligibleK8sDriverNodes, ciRequest.PipelineId, ciRequest.WorkflowId, builderPodWaitDuration) if err != nil { log.Println(util.DEVTRON, " error in creating buildxDriver , err : ", err.Error()) return err } - k8sClient, err = newBuildxK8sClient(deploymentNames) + k8sClient, err = impl.k8sClientFactory(deploymentNames) if err != nil { log.Println(util.DEVTRON, " error in creating buildxK8sClient , err : ", err.Error()) return err @@ -469,6 +497,11 @@ func (impl *DockerHelperImpl) BuildArtifact(ciRequest *CommonWorkflowRequest) (s log.Println(util.DEVTRON, " error in registering builder pods ", " err: ", err) return err } + // Wait for builder pods to reach Running state before starting the build. + // Prevents false-positive BuilderPodDeletedError from pod startup latency. + if err = waitForBuilderPods(ciContext, k8sClient, builderPodWaitDuration); err != nil { + return err + } } else { err = impl.createBuildxBuilderForMultiArchBuild(ciContext, ciRequest.DockerConnection, dockerBuildConfig.BuildxDriverImage) if err != nil { @@ -534,7 +567,7 @@ func (impl *DockerHelperImpl) BuildArtifact(ciRequest *CommonWorkflowRequest) (s reBuildLogs = []any{fmt.Sprintf("Starting re docker build (Attempt %d) : ", attempt), dockerBuild} } return impl.executeDockerReBuild(ciContext, k8sClient, useBuildxK8sDriver, dockerBuild, - deploymentNames, dockerBuildStageMetadata, reBuildLogs) + deploymentNames, dockerBuildStageMetadata, reBuildLogs, builderPodWaitDuration) } err = retryFunc.RetryWithOutLogging(callback, retryFunc.IsRetryableError, maxRetry, 1*time.Second) if err != nil { @@ -1097,14 +1130,14 @@ func (impl *DockerHelperImpl) createBuildxBuilderForMultiArchBuild(ciContext cic return nil } -func (impl *DockerHelperImpl) createBuildxBuilderWithK8sDriver(ciContext cicxt.CiContext, propagateLabelsInBuildxPod bool, dockerConnection, buildxDriverImage string, builderNodes []map[string]string, ciPipelineId, ciWorkflowId int) ([]string, error) { +func (impl *DockerHelperImpl) createBuildxBuilderWithK8sDriver(ciContext cicxt.CiContext, propagateLabelsInBuildxPod bool, dockerConnection, buildxDriverImage string, builderNodes []map[string]string, ciPipelineId, ciWorkflowId int, timeout time.Duration) ([]string, error) { deploymentNames := make([]string, 0) if len(builderNodes) == 0 { return deploymentNames, errors.New("atleast one node is expected for builder with kubernetes driver") } for i := 0; i < len(builderNodes); i++ { nodeOpts := builderNodes[i] - builderCmd, deploymentName, err := getBuildxK8sDriverCmd(propagateLabelsInBuildxPod, dockerConnection, buildxDriverImage, nodeOpts, ciPipelineId, ciWorkflowId) + builderCmd, deploymentName, err := getBuildxK8sDriverCmd(propagateLabelsInBuildxPod, dockerConnection, buildxDriverImage, nodeOpts, ciPipelineId, ciWorkflowId, timeout) if err != nil { return deploymentNames, err } @@ -1181,7 +1214,7 @@ func (impl *DockerHelperImpl) runCmd(cmd string) (error, *bytes.Buffer) { return err, errBuf } -func getBuildxK8sDriverCmd(propagateLabelsInBuildxPod bool, dockerConnection, buildxDriverImage string, driverOpts map[string]string, ciPipelineId, ciWorkflowId int) (string, string, error) { +func getBuildxK8sDriverCmd(propagateLabelsInBuildxPod bool, dockerConnection, buildxDriverImage string, driverOpts map[string]string, ciPipelineId, ciWorkflowId int, timeout time.Duration) (string, string, error) { buildxCreate := "docker buildx create --buildkitd-flags '--allow-insecure-entitlement network.host --allow-insecure-entitlement security.insecure' --name=%s --driver=kubernetes --node=%s --bootstrap " nodeName := driverOpts["node"] if nodeName == "" { @@ -1203,6 +1236,9 @@ func getBuildxK8sDriverCmd(propagateLabelsInBuildxPod bool, dockerConnection, bu } driverOpts["driverOptions"] = getBuildXDriverOptionsWithImage(buildxDriverImage, driverOpts["driverOptions"]) + if timeout > 0 { + driverOpts["driverOptions"] = getBuildXDriverOptionsWithTimeout(timeout, driverOpts["driverOptions"]) + } if len(driverOpts["driverOptions"]) > 0 { buildxCreate += " '--driver-opt=%s' " buildxCreate = fmt.Sprintf(buildxCreate, driverOpts["driverOptions"]) @@ -1227,6 +1263,21 @@ func getBuildXDriverOptionsWithImage(buildxDriverImage, driverOptions string) st return driverOptions } +func getBuildXDriverOptionsWithTimeout(timeout time.Duration, driverOptions string) string { + if strings.HasPrefix(driverOptions, "timeout=") || + strings.Contains(driverOptions, ",timeout=") { + // if timeout is already present in driver options then do not override it, just return the existing options + return driverOptions + } + timeoutOption := fmt.Sprintf("\"timeout=%s\"", timeout.String()) + if len(driverOptions) > 0 { + driverOptions += fmt.Sprintf(",%s", timeoutOption) + } else { + driverOptions = timeoutOption + } + return driverOptions +} + func getBuildXDriverOptionsWithLabelsAndAnnotations(driverOptions string) (string, error) { // not passing annotation as of now because --driver-opt=annotations is not supported by buildx if contains quotes labels := make(map[string]string) diff --git a/ci-runner/helper/DockerHelper_test.go b/ci-runner/helper/DockerHelper_test.go index 8e150719f..fa8fece14 100644 --- a/ci-runner/helper/DockerHelper_test.go +++ b/ci-runner/helper/DockerHelper_test.go @@ -41,7 +41,7 @@ func TestCreateBuildXK8sDriver(t *testing.T) { eligibleK8sNodes := dockerBuildConfig.GetEligibleK8sDriverNodes() impl := getDockerHelperImpl() ciContext := cicxt.BuildCiContext(context.Background(), true) - _, err := impl.createBuildxBuilderWithK8sDriver(ciContext, false, "", "", eligibleK8sNodes, 1, 1) + _, err := impl.createBuildxBuilderWithK8sDriver(ciContext, false, "", "", eligibleK8sNodes, 1, 1, 0) t.Cleanup(func() { buildxDelete := fmt.Sprintf("docker buildx rm %s", BUILDX_K8S_DRIVER_NAME) builderRemoveCmd := exec.Command("/bin/sh", "-c", buildxDelete) @@ -64,7 +64,7 @@ func TestCleanBuildxK8sDriver(t *testing.T) { eligibleK8sNodes := dockerBuildConfig.GetEligibleK8sDriverNodes() impl := getDockerHelperImpl() ciContext := cicxt.BuildCiContext(context.Background(), true) - _, err := impl.createBuildxBuilderWithK8sDriver(ciContext, false, "", "", eligibleK8sNodes, 1, 1) + _, err := impl.createBuildxBuilderWithK8sDriver(ciContext, false, "", "", eligibleK8sNodes, 1, 1, 0) if err != nil { fmt.Println(err.Error()) t.Fail() diff --git a/ci-runner/helper/DockerfileScanHelper.go b/ci-runner/helper/DockerfileScanHelper.go new file mode 100644 index 000000000..1adbda79b --- /dev/null +++ b/ci-runner/helper/DockerfileScanHelper.go @@ -0,0 +1,180 @@ +package helper + +import ( + "crypto/tls" + "encoding/json" + "fmt" + "log" + "net/http" + "os" + "path/filepath" + "time" + + "github.com/caarlos0/env" + "github.com/devtron-labs/ci-runner/util" + "github.com/go-resty/resty/v2" +) + +// DockerfileScanRequest represents the request to scan a Dockerfile +type DockerfileScanRequest struct { + AppId int `json:"appId"` + BuildId int `json:"buildId"` + PipelineId int `json:"pipelineId"` + DockerfileContent string `json:"dockerfileContent"` + DockerfileScanEnabled bool `json:"dockerfileScanEnabled"` + ForceDockerfileScan bool `json:"forceDockerfileScan"` + IgnoredRules []string `json:"ignoredRules"` +} + +// ScanConfig holds configuration for Dockerfile scanning +type ScanConfig struct { + ImageScannerEndpoint string `env:"IMAGE_SCANNER_ENDPOINT" envDefault:"http://image-scanner-service.devtroncd:80"` + FailOnError bool `env:"DOCKERFILE_SCAN_FAIL_ON_ERROR" envDefault:"false"` + MaxRetries int `env:"DOCKERFILE_SCAN_MAX_RETRIES" envDefault:"3"` + RetryWaitTimeSeconds int `env:"DOCKERFILE_SCAN_RETRY_WAIT_SECONDS" envDefault:"5"` +} + +// MaxDockerfileSize is the maximum allowed Dockerfile size (1MB) +const MaxDockerfileSize = 1 * 1024 * 1024 // 1MB + +// InitiateDockerfileScan initiates a Dockerfile scan using hadolint +// It reads the Dockerfile from filesystem and sends content to image-scanner service +// Note: The decision to run the scan is made by the caller (runBuildArtifact) +// which handles FORCE_DOCKERFILE_SCAN flag and pipeline-level DockerfileScanEnabled settings +func InitiateDockerfileScan(ciRequest *CommonWorkflowRequest) { + log.Println(util.DEVTRON, "initiating Dockerfile scan") + + // Validate config exists + if ciRequest.CiBuildConfig == nil || ciRequest.CiBuildConfig.DockerBuildConfig == nil { + log.Println(util.DEVTRON, "docker build config not found, skipping Dockerfile scan") + return + } + + // Wait for git clone to complete (checkout path to exist) + // Use the SAME path resolution as Docker build (getDockerfilePath) + var dockerfilePath string + if ciRequest.CiBuildConfig.CiBuildType == "managed-dockerfile-build" { + // For managed Dockerfile, use GetSelfManagedDockerfilePath + dockerfilePath = filepath.Join(util.WORKINGDIR, ciRequest.CheckoutPath, "./Dockerfile") + } else { + // For self-managed Dockerfile, use the configured path + dockerfilePath = ciRequest.CiBuildConfig.DockerBuildConfig.DockerfilePath + } + // Convert to absolute path (same as Docker build) + dockerfilePath, _ = filepath.Abs(dockerfilePath) + + // Fallback wait (should not be needed - scan triggered at Docker build start) + maxWait := 2 * time.Minute + waitInterval := 10 * time.Second + startTime := time.Now() + + log.Println(util.DEVTRON, "dockerfile scan: waiting for git clone to complete", "path", dockerfilePath, "buildId", ciRequest.WorkflowId) + + for time.Since(startTime) < maxWait { + if _, err := os.Stat(dockerfilePath); err == nil { + log.Println(util.DEVTRON, "dockerfile scan: Dockerfile found, proceeding", "path", dockerfilePath, "elapsed", time.Since(startTime).Round(time.Second)) + break // File exists, proceed + } + // Log progress every 30 seconds + if int(time.Since(startTime).Seconds())%30 == 0 { + log.Println(util.DEVTRON, "dockerfile scan: waiting for git clone to complete...", "path", dockerfilePath, "elapsed", time.Since(startTime).Round(time.Second), "maxWait", maxWait) + } + time.Sleep(waitInterval) + } + + // Read Dockerfile from filesystem (single source of truth) + dockerfileContent, err := os.ReadFile(dockerfilePath) + if err != nil { + log.Println(util.DEVTRON, "error in reading Dockerfile for scanning", + "path", dockerfilePath, "err", err) + if err := handleScanError(fmt.Sprintf("Failed to read Dockerfile from %s: %v", dockerfilePath, err), ciRequest.DockerfileScanEnabled); err != nil { + return + } + return + } + + // Prepare scan request with Dockerfile content + // CRITICAL FIX: Read DockerfileScanEnabled from ciRequest.DockerfileScanEnabled (CommonWorkflowRequest level) + // NOT from ciRequest.CiBuildConfig.DockerBuildConfig.DockerfileScanEnabled (which may be out of sync) + // ForceDockerfileScan is only available at CommonWorkflowRequest level + scanRequest := &DockerfileScanRequest{ + AppId: ciRequest.AppId, + BuildId: ciRequest.WorkflowId, + PipelineId: ciRequest.PipelineId, + DockerfileContent: string(dockerfileContent), + DockerfileScanEnabled: ciRequest.DockerfileScanEnabled, + ForceDockerfileScan: ciRequest.ForceDockerfileScan, + IgnoredRules: []string{}, // Can be populated from config in future + } + + jsonBody, err := json.Marshal(scanRequest) + if err != nil { + log.Println(util.DEVTRON, "error in marshalling Dockerfile scan request", "err", err) + if err := handleScanError(fmt.Sprintf("Failed to marshal scan request: %v", err), ciRequest.DockerfileScanEnabled); err != nil { + return + } + return + } + + cfg := &ScanConfig{} + err = env.Parse(cfg) + if err != nil { + log.Println(util.DEVTRON, "error in parsing scan config", "err", err) + if err := handleScanError(fmt.Sprintf("Failed to parse scan config: %v", err), ciRequest.DockerfileScanEnabled); err != nil { + return + } + return + } + + // Create HTTP client with timeout and configurable retries + client := resty.New() + client.SetTimeout(2 * time.Minute) + client. + SetTLSClientConfig(&tls.Config{InsecureSkipVerify: true}). + SetRetryCount(cfg.MaxRetries). + SetRetryWaitTime(time.Duration(cfg.RetryWaitTimeSeconds) * time.Second) + + resp, err := client.R(). + SetHeader("Content-Type", "application/json"). + SetBody(jsonBody). + Post(fmt.Sprintf("%s/%s", cfg.ImageScannerEndpoint, "scanner/dockerfile/scan")) + + // Record success/failure in circuit breaker + if err != nil || (resp != nil && (resp.StatusCode() != http.StatusAccepted && resp.StatusCode() != http.StatusOK)) { + log.Println(util.DEVTRON, "circuit breaker recorded FAILURE", "buildId", ciRequest.WorkflowId) + } else { + log.Println(util.DEVTRON, "circuit breaker recorded SUCCESS", "buildId", ciRequest.WorkflowId) + } + + if err != nil { + log.Println(util.DEVTRON, "error in calling image-scanner for Dockerfile scan", "err", err) + if err := handleScanError(fmt.Sprintf("Dockerfile scan failed: %v", err), cfg.FailOnError); err != nil { + return + } + return + } + + // Accept both 202 (Accepted) and 200 (OK - for cached results) + if resp.StatusCode() != http.StatusAccepted && resp.StatusCode() != http.StatusOK { + log.Println(util.DEVTRON, "image-scanner returned non-202/200 status for Dockerfile scan", + "status", resp.StatusCode(), "body", string(resp.Body())) + if err := handleScanError(fmt.Sprintf("Dockerfile scan failed with status: %d", resp.StatusCode()), cfg.FailOnError); err != nil { + return + } + return + } + + log.Println(util.DEVTRON, "successfully initiated Dockerfile scan", + "statusCode", resp.StatusCode(), "buildId", ciRequest.WorkflowId) +} + +// handleScanError handles scan errors based on FailOnError configuration +func handleScanError(message string, failOnError bool) error { + if failOnError { + log.Println(util.DEVTRON, "Dockerfile scan failed (fail-on-error enabled)", "message", message) + return fmt.Errorf("Dockerfile scan failed: %s", message) + } + // Log warning but don't fail the build + log.Println(util.DEVTRON, "Dockerfile scan failed (fail-on-error disabled)", "message", message) + return nil +} diff --git a/ci-runner/helper/EventHelper.go b/ci-runner/helper/EventHelper.go index 69d4c7b15..cce459fc2 100644 --- a/ci-runner/helper/EventHelper.go +++ b/ci-runner/helper/EventHelper.go @@ -20,8 +20,6 @@ import ( "crypto/tls" "encoding/json" "fmt" - bean2 "github.com/devtron-labs/common-lib/imageScan/bean" - "github.com/devtron-labs/common-lib/utils/remoteConnection/bean" "log" "net/http" "strings" @@ -31,7 +29,9 @@ import ( "github.com/devtron-labs/ci-runner/pubsub" "github.com/devtron-labs/ci-runner/util" blobStorage "github.com/devtron-labs/common-lib/blob-storage" + bean2 "github.com/devtron-labs/common-lib/imageScan/bean" pubSub "github.com/devtron-labs/common-lib/pubsub-lib" + "github.com/devtron-labs/common-lib/utils/remoteConnection/bean" "github.com/go-resty/resty/v2" ) @@ -170,39 +170,42 @@ type CommonWorkflowRequest struct { EnableSecretMasking bool `json:"enableSecretMasking"` PropagateLabelsInBuildxPod bool `json:"propagateLabelsInBuildxPod"` // Data from CD Workflow service - WorkflowRunnerId int `json:"workflowRunnerId"` - CdPipelineId int `json:"cdPipelineId"` - StageYaml string `json:"stageYaml"` - ArtifactLocation string `json:"artifactLocation"` - CiArtifactDTO CiArtifactDTO `json:"ciArtifactDTO"` - CdImage string `json:"cdImage"` - StageType string `json:"stageType"` - CdCacheLocation string `json:"cdCacheLocation"` - CdCacheRegion string `json:"cdCacheRegion"` - WorkflowPrefixForLog string `json:"workflowPrefixForLog"` - DeploymentTriggeredBy string `json:"deploymentTriggeredBy,omitempty"` - DeploymentTriggerTime time.Time `json:"deploymentTriggerTime,omitempty"` - DeploymentReleaseCounter int `json:"deploymentReleaseCounter,omitempty"` - PrePostDeploySteps []*StepObject `json:"prePostDeploySteps"` - TaskYaml *TaskYaml `json:"-"` - IsVirtualExecution bool `json:"isVirtualExecution"` - CiArtifactLastFetch time.Time `json:"ciArtifactLastFetch"` - CiPipelineType string `json:"CiPipelineType"` - RegistryDestinationImageMap map[string][]string `json:"registryDestinationImageMap"` - RegistryCredentialMap map[string]RegistryCredentials `json:"registryCredentialMap"` - PluginArtifactStage string `json:"pluginArtifactStage"` - PushImageBeforePostCI bool `json:"pushImageBeforePostCI"` - IntermediateDockerRegistryUrl string `json:"-"` // this URL will be used for all operations and can be mutated - BuildxCacheModeMin bool `json:"buildxCacheModeMin"` - AsyncBuildxCacheExport bool `json:"asyncBuildxCacheExport"` - BuildxInterruptionMaxRetry int `json:"buildxInterruptionMaxRetry"` - UseDockerApiToGetDigest bool `json:"useDockerApiToGetDigest"` - HostUrl string `json:"hostUrl"` - ImageScanningSteps []*ImageScanningSteps `json:"imageScanningSteps,omitempty"` - ExecuteImageScanningVia bean2.ScanExecutionMedium `json:"executeImageScanningVia,omitempty"` - AwsInspectorConfig string `json:"awsInspectorConfig,omitempty"` - PartSize int64 `json:"partSize,omitempty"` - ConcurrencyMultiplier int `json:"concurrencyMultiplier,omitempty"` + WorkflowRunnerId int `json:"workflowRunnerId"` + CdPipelineId int `json:"cdPipelineId"` + StageYaml string `json:"stageYaml"` + ArtifactLocation string `json:"artifactLocation"` + CiArtifactDTO CiArtifactDTO `json:"ciArtifactDTO"` + CdImage string `json:"cdImage"` + StageType string `json:"stageType"` + CdCacheLocation string `json:"cdCacheLocation"` + CdCacheRegion string `json:"cdCacheRegion"` + WorkflowPrefixForLog string `json:"workflowPrefixForLog"` + DeploymentTriggeredBy string `json:"deploymentTriggeredBy,omitempty"` + DeploymentTriggerTime time.Time `json:"deploymentTriggerTime,omitempty"` + DeploymentReleaseCounter int `json:"deploymentReleaseCounter,omitempty"` + PrePostDeploySteps []*StepObject `json:"prePostDeploySteps"` + TaskYaml *TaskYaml `json:"-"` + IsVirtualExecution bool `json:"isVirtualExecution"` + CiArtifactLastFetch time.Time `json:"ciArtifactLastFetch"` + CiPipelineType string `json:"CiPipelineType"` + RegistryDestinationImageMap map[string][]string `json:"registryDestinationImageMap"` + RegistryCredentialMap map[string]RegistryCredentials `json:"registryCredentialMap"` + PluginArtifactStage string `json:"pluginArtifactStage"` + PushImageBeforePostCI bool `json:"pushImageBeforePostCI"` + IntermediateDockerRegistryUrl string `json:"-"` // this URL will be used for all operations and can be mutated + BuildxCacheModeMin bool `json:"buildxCacheModeMin"` + AsyncBuildxCacheExport bool `json:"asyncBuildxCacheExport"` + BuildxInterruptionMaxRetry int `json:"buildxInterruptionMaxRetry"` + BuildxBuilderPodWaitDurationSecs int `json:"buildxBuilderPodWaitDurationSecs"` + UseDockerApiToGetDigest bool `json:"useDockerApiToGetDigest"` + HostUrl string `json:"hostUrl"` + ImageScanningSteps []*ImageScanningSteps `json:"imageScanningSteps,omitempty"` + ExecuteImageScanningVia bean2.ScanExecutionMedium `json:"executeImageScanningVia,omitempty"` + AwsInspectorConfig string `json:"awsInspectorConfig,omitempty"` + PartSize int64 `json:"partSize,omitempty"` + ConcurrencyMultiplier int `json:"concurrencyMultiplier,omitempty"` + DockerfileScanEnabled bool `json:"dockerfileScanEnabled,omitempty"` + ForceDockerfileScan bool `json:"forceDockerfileScan,omitempty"` } func (c *CommonWorkflowRequest) IsPreCdStage() bool { diff --git a/ci-runner/helper/GitManager_test.go b/ci-runner/helper/GitManager_test.go index 5a555b680..c268ce1c5 100644 --- a/ci-runner/helper/GitManager_test.go +++ b/ci-runner/helper/GitManager_test.go @@ -38,7 +38,7 @@ func TestGitHelper(t *testing.T) { os.RemoveAll(util.WORKINGDIR) // Call the function - err := gitManagerImpl.CloneAndCheckout(ciProjectDetails) + err := gitManagerImpl.CloneAndCheckout(ciProjectDetails, false) // Assert the expected results if err != nil { @@ -54,7 +54,7 @@ func TestGitHelper(t *testing.T) { os.RemoveAll(util.WORKINGDIR) // Call the function - err := gitManagerImpl.CloneAndCheckout(ciProjectDetails) + err := gitManagerImpl.CloneAndCheckout(ciProjectDetails, false) // Assert the expected results if err != nil { @@ -70,7 +70,7 @@ func TestGitHelper(t *testing.T) { os.RemoveAll(util.WORKINGDIR) // Call the function - err := gitManagerImpl.CloneAndCheckout(ciProjectDetails) + err := gitManagerImpl.CloneAndCheckout(ciProjectDetails, false) // Assert the expected results if err != nil { @@ -86,7 +86,7 @@ func TestGitHelper(t *testing.T) { os.RemoveAll(util.WORKINGDIR) // Call the function - err := gitManagerImpl.CloneAndCheckout(ciProjectDetails) + err := gitManagerImpl.CloneAndCheckout(ciProjectDetails, false) // Assert the expected results if err != nil { @@ -102,7 +102,7 @@ func TestGitHelper(t *testing.T) { os.RemoveAll(util.WORKINGDIR) // Call the function - err := gitManagerImpl.CloneAndCheckout(ciProjectDetails) + err := gitManagerImpl.CloneAndCheckout(ciProjectDetails, false) // Assert the expected results if err != nil { @@ -118,7 +118,7 @@ func TestGitHelper(t *testing.T) { os.RemoveAll(util.WORKINGDIR) // Call the function - err := gitManagerImpl.CloneAndCheckout(ciProjectDetails) + err := gitManagerImpl.CloneAndCheckout(ciProjectDetails, false) // Assert the expected results if err != nil { @@ -134,7 +134,7 @@ func TestGitHelper(t *testing.T) { os.RemoveAll(util.WORKINGDIR) // Call the function - err := gitManagerImpl.CloneAndCheckout(ciProjectDetails) + err := gitManagerImpl.CloneAndCheckout(ciProjectDetails, false) // Assert the expected results if err != nil { @@ -150,7 +150,7 @@ func TestGitHelper(t *testing.T) { os.RemoveAll(util.WORKINGDIR) // Call the function - err := gitManagerImpl.CloneAndCheckout(ciProjectDetails) + err := gitManagerImpl.CloneAndCheckout(ciProjectDetails, false) // Assert the expected results if err != nil { @@ -167,7 +167,7 @@ func TestGitHelper(t *testing.T) { clonedRepo := ciProjectDetails[0].GitRepository[strings.LastIndex(ciProjectDetails[0].GitRepository, "/"):] os.RemoveAll(util.WORKINGDIR) // Call the function - err := gitManagerImpl.CloneAndCheckout(ciProjectDetails) + err := gitManagerImpl.CloneAndCheckout(ciProjectDetails, false) err = os.Chdir(util.WORKINGDIR + clonedRepo) // Assert the expected results if err == nil { @@ -185,7 +185,7 @@ func TestGitHelper(t *testing.T) { clonedRepo := ciProjectDetails[0].GitRepository[strings.LastIndex(ciProjectDetails[0].GitRepository, "/"):] os.RemoveAll(util.WORKINGDIR) // Call the function - err := gitManagerImpl.CloneAndCheckout(ciProjectDetails) + err := gitManagerImpl.CloneAndCheckout(ciProjectDetails, false) err = os.Chdir(util.WORKINGDIR + clonedRepo) // Assert the expected results if err == nil { diff --git a/ci-runner/helper/buildx_rebuild_test.go b/ci-runner/helper/buildx_rebuild_test.go new file mode 100644 index 000000000..9bacac73b --- /dev/null +++ b/ci-runner/helper/buildx_rebuild_test.go @@ -0,0 +1,406 @@ +/* + * Copyright (c) 2024. Devtron Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package helper + +import ( + "context" + "encoding/json" + "errors" + "os/exec" + "strings" + "testing" + "time" + + cicxt "github.com/devtron-labs/ci-runner/executor/context" + bean2 "github.com/devtron-labs/ci-runner/helper/bean" + "github.com/devtron-labs/common-lib/utils/retryFunc" +) + +// --------------------------------------------------------------------------- +// MockBuildxK8sInterface +// --------------------------------------------------------------------------- + +type MockBuildxK8sInterface struct { + RestartErr error + RegisterErr error + WaitBlocks bool // true = WaitUntilBuilderPodLive never sends on done + WaitDelay time.Duration // 0 = immediate send; >0 = delay before send + CatchErr error // error CatchBuilderPodLivenessError returns +} + +func (m *MockBuildxK8sInterface) PatchOwnerReferenceInBuilders() {} + +func (m *MockBuildxK8sInterface) RegisterBuilderPods(_ context.Context) error { + return m.RegisterErr +} + +func (m *MockBuildxK8sInterface) RestartBuilders(_ context.Context) error { + return m.RestartErr +} + +func (m *MockBuildxK8sInterface) CatchBuilderPodLivenessError(ctx context.Context) error { + if m.CatchErr != nil { + return m.CatchErr + } + <-ctx.Done() + return nil +} + +func (m *MockBuildxK8sInterface) WaitUntilBuilderPodLive(ctx context.Context, done chan<- bool) { + if m.WaitBlocks { + <-ctx.Done() + return + } + if m.WaitDelay > 0 { + select { + case <-time.After(m.WaitDelay): + case <-ctx.Done(): + return + } + } + done <- true +} + +// --------------------------------------------------------------------------- +// MockCommandExecutor — returns a configurable error without running docker +// --------------------------------------------------------------------------- + +type MockCommandExecutor struct { + Err error +} + +func (m *MockCommandExecutor) RunCommand(_ cicxt.CiContext, _ *exec.Cmd) error { + return m.Err +} + +func (m *MockCommandExecutor) RunCommandWithCtx(_ cicxt.CiContext, _ *exec.Cmd) error { + return m.Err +} + +// --------------------------------------------------------------------------- +// Factory helpers +// --------------------------------------------------------------------------- + +func mockFactory(mock BuildxK8sInterface) BuildxK8sClientFactory { + return func(_ []string) (BuildxK8sInterface, error) { + return mock, nil + } +} + +func errorFactory(err error) BuildxK8sClientFactory { + return func(_ []string) (BuildxK8sInterface, error) { + return nil, err + } +} + +// --------------------------------------------------------------------------- +// Test helpers +// --------------------------------------------------------------------------- + +func newTestImpl(factory BuildxK8sClientFactory) *DockerHelperImpl { + return &DockerHelperImpl{ + DockerCommandEnv: []string{}, + cmdExecutor: &MockCommandExecutor{Err: errors.New("docker not available in test")}, + k8sClientFactory: factory, + } +} + +func makeCiContext() cicxt.CiContext { + return cicxt.BuildCiContext(context.Background(), false) +} + +// computeBuilderPodWaitDuration mirrors the logic in BuildArtifact. +func computeBuilderPodWaitDuration(secs int) time.Duration { + if secs > 0 { + return time.Duration(secs) * time.Second + } + return 2 * time.Minute +} + +// --------------------------------------------------------------------------- +// Group A: builderPodWaitDuration computation +// --------------------------------------------------------------------------- + +func TestBuilderPodWaitDuration(t *testing.T) { + tests := []struct { + name string + secs int + want time.Duration + }{ + {name: "A1: zero → default 2m", secs: 0, want: 2 * time.Minute}, + {name: "A2: negative → default 2m", secs: -1, want: 2 * time.Minute}, + {name: "A3: 300 → 5m", secs: 300, want: 5 * time.Minute}, + {name: "A4: 1 → 1s", secs: 1, want: 1 * time.Second}, + } + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + got := computeBuilderPodWaitDuration(tc.secs) + if got != tc.want { + t.Errorf("computeBuilderPodWaitDuration(%d) = %v, want %v", tc.secs, got, tc.want) + } + }) + } +} + +// --------------------------------------------------------------------------- +// Group B: executeDockerReBuild +// --------------------------------------------------------------------------- + +func TestBuildxRebuild(t *testing.T) { + emptyCiCtx := makeCiContext() + emptyMetadata := bean2.DockerBuildStageMetadata{} + + t.Run("B1: useBuildxK8sDriver=false returns nil immediately", func(t *testing.T) { + impl := newTestImpl(errorFactory(errors.New("should not be called"))) + err := impl.executeDockerReBuild( + emptyCiCtx, + nil, + false, // useBuildxK8sDriver=false + "docker buildx build", + []string{}, + emptyMetadata, + []any{}, + 5*time.Second, + ) + if err != nil { + t.Errorf("expected nil, got %v", err) + } + }) + + t.Run("B2: RestartErr is propagated", func(t *testing.T) { + restartErr := errors.New("restart fail") + mock := &MockBuildxK8sInterface{RestartErr: restartErr} + impl := newTestImpl(mockFactory(mock)) + err := impl.executeDockerReBuild( + emptyCiCtx, + mock, + true, + "docker buildx build", + []string{}, + emptyMetadata, + []any{}, + 5*time.Second, + ) + if err == nil { + t.Fatal("expected error, got nil") + } + if !errors.Is(err, restartErr) { + t.Errorf("expected restartErr, got %v", err) + } + }) + + t.Run("B3: factory error is propagated", func(t *testing.T) { + factoryErr := errors.New("factory error") + mock := &MockBuildxK8sInterface{} // RestartErr=nil so Restart succeeds + impl := newTestImpl(errorFactory(factoryErr)) + err := impl.executeDockerReBuild( + emptyCiCtx, + mock, + true, + "docker buildx build", + []string{}, + emptyMetadata, + []any{}, + 5*time.Second, + ) + if err == nil { + t.Fatal("expected error, got nil") + } + if !errors.Is(err, factoryErr) { + t.Errorf("expected factoryErr, got %v", err) + } + }) + + t.Run("B4: RegisterErr is propagated", func(t *testing.T) { + registerErr := errors.New("register fail") + mock := &MockBuildxK8sInterface{RegisterErr: registerErr} + impl := newTestImpl(mockFactory(mock)) + err := impl.executeDockerReBuild( + emptyCiCtx, + mock, + true, + "docker buildx build", + []string{}, + emptyMetadata, + []any{}, + 5*time.Second, + ) + if err == nil { + t.Fatal("expected error, got nil") + } + if !errors.Is(err, registerErr) { + t.Errorf("expected registerErr, got %v", err) + } + }) + + t.Run("B5: pod ready immediately → not BuilderPodDeletedError", func(t *testing.T) { + mock := &MockBuildxK8sInterface{WaitBlocks: false, WaitDelay: 0} + impl := newTestImpl(mockFactory(mock)) + err := impl.executeDockerReBuild( + emptyCiCtx, + mock, + true, + "docker buildx build .", + []string{}, + emptyMetadata, + []any{}, + 5*time.Second, + ) + // docker is not available in test env; error will be a docker exec error, NOT BuilderPodDeletedError + if errors.Is(err, BuilderPodDeletedError) { + t.Errorf("expected non-BuilderPodDeletedError, got BuilderPodDeletedError") + } + }) + + t.Run("B6: pod ready after 50ms → not BuilderPodDeletedError", func(t *testing.T) { + mock := &MockBuildxK8sInterface{WaitBlocks: false, WaitDelay: 50 * time.Millisecond} + impl := newTestImpl(mockFactory(mock)) + err := impl.executeDockerReBuild( + emptyCiCtx, + mock, + true, + "docker buildx build .", + []string{}, + emptyMetadata, + []any{}, + 5*time.Second, + ) + if errors.Is(err, BuilderPodDeletedError) { + t.Errorf("expected non-BuilderPodDeletedError, got BuilderPodDeletedError") + } + }) + + t.Run("B7: WaitBlocks=true with short timeout → BuilderPodDeletedError (wrapped in RetryableError)", func(t *testing.T) { + mock := &MockBuildxK8sInterface{WaitBlocks: true} + impl := newTestImpl(mockFactory(mock)) + err := impl.executeDockerReBuild( + emptyCiCtx, + mock, + true, + "docker buildx build .", + []string{}, + emptyMetadata, + []any{}, + 100*time.Millisecond, + ) + if err == nil { + t.Fatal("expected error, got nil") + } + // executeDockerReBuild wraps BuilderPodDeletedError in RetryableError + // which does not implement Unwrap, so we check via IsRetryableError and error message + if !retryFunc.IsRetryableError(err) { + t.Errorf("expected RetryableError wrapping BuilderPodDeletedError, got %T: %v", err, err) + } + if !strings.Contains(err.Error(), BuilderPodDeletedError.Error()) { + t.Errorf("expected error message to contain %q, got %q", BuilderPodDeletedError.Error(), err.Error()) + } + }) +} + +// --------------------------------------------------------------------------- +// Group C: waitForBuilderPods (package-level function) +// --------------------------------------------------------------------------- + +func TestWaitForBuilderPods(t *testing.T) { + t.Run("C1: pod ready immediately → nil", func(t *testing.T) { + mock := &MockBuildxK8sInterface{WaitBlocks: false, WaitDelay: 0} + ctx := context.Background() + err := waitForBuilderPods(ctx, mock, 5*time.Second) + if err != nil { + t.Errorf("expected nil, got %v", err) + } + }) + + t.Run("C2: pod ready after 50ms → nil", func(t *testing.T) { + mock := &MockBuildxK8sInterface{WaitBlocks: false, WaitDelay: 50 * time.Millisecond} + ctx := context.Background() + err := waitForBuilderPods(ctx, mock, 5*time.Second) + if err != nil { + t.Errorf("expected nil, got %v", err) + } + }) + + t.Run("C3: WaitBlocks with 100ms timeout → error with duration", func(t *testing.T) { + mock := &MockBuildxK8sInterface{WaitBlocks: true} + ctx := context.Background() + timeout := 100 * time.Millisecond + err := waitForBuilderPods(ctx, mock, timeout) + if err == nil { + t.Fatal("expected error, got nil") + } + errMsg := err.Error() + if !strings.Contains(errMsg, "did not reach Running state") { + t.Errorf("error %q should contain 'did not reach Running state'", errMsg) + } + if !strings.Contains(errMsg, "100ms") { + t.Errorf("error %q should contain '100ms'", errMsg) + } + }) + + t.Run("C4: pre-cancelled context → non-nil error", func(t *testing.T) { + mock := &MockBuildxK8sInterface{WaitBlocks: true} + ctx, cancel := context.WithCancel(context.Background()) + cancel() // cancel before calling + err := waitForBuilderPods(ctx, mock, 5*time.Second) + if err == nil { + t.Error("expected non-nil error for pre-cancelled context, got nil") + } + }) +} + +// --------------------------------------------------------------------------- +// Group F: CommonWorkflowRequest JSON field +// --------------------------------------------------------------------------- + +func TestCommonWorkflowRequestJSON(t *testing.T) { + t.Run("F1: JSON missing field → defaults to 0", func(t *testing.T) { + jsonStr := `{"workflowNamePrefix": "test"}` + var req CommonWorkflowRequest + if err := json.Unmarshal([]byte(jsonStr), &req); err != nil { + t.Fatalf("json.Unmarshal failed: %v", err) + } + if req.BuildxBuilderPodWaitDurationSecs != 0 { + t.Errorf("expected 0, got %d", req.BuildxBuilderPodWaitDurationSecs) + } + }) + + t.Run("F2: JSON includes field=300 → parsed correctly", func(t *testing.T) { + jsonStr := `{"buildxBuilderPodWaitDurationSecs": 300}` + var req CommonWorkflowRequest + if err := json.Unmarshal([]byte(jsonStr), &req); err != nil { + t.Fatalf("json.Unmarshal failed: %v", err) + } + if req.BuildxBuilderPodWaitDurationSecs != 300 { + t.Errorf("expected 300, got %d", req.BuildxBuilderPodWaitDurationSecs) + } + }) + + t.Run("F3: round-trip marshal/unmarshal preserves value", func(t *testing.T) { + orig := CommonWorkflowRequest{BuildxBuilderPodWaitDurationSecs: 180} + data, err := json.Marshal(orig) + if err != nil { + t.Fatalf("json.Marshal failed: %v", err) + } + var parsed CommonWorkflowRequest + if err := json.Unmarshal(data, &parsed); err != nil { + t.Fatalf("json.Unmarshal failed: %v", err) + } + if parsed.BuildxBuilderPodWaitDurationSecs != 180 { + t.Errorf("expected 180, got %d", parsed.BuildxBuilderPodWaitDurationSecs) + } + }) +} diff --git a/ci-runner/vendor/golang.org/x/time/rate/sometimes.go b/ci-runner/vendor/golang.org/x/time/rate/sometimes.go index 6ba99ddb6..9b8393269 100644 --- a/ci-runner/vendor/golang.org/x/time/rate/sometimes.go +++ b/ci-runner/vendor/golang.org/x/time/rate/sometimes.go @@ -61,7 +61,9 @@ func (s *Sometimes) Do(f func()) { (s.Every > 0 && s.count%s.Every == 0) || (s.Interval > 0 && time.Since(s.last) >= s.Interval) { f() - s.last = time.Now() + if s.Interval > 0 { + s.last = time.Now() + } } s.count++ } diff --git a/ci-runner/vendor/modules.txt b/ci-runner/vendor/modules.txt index 11a9d9188..f452e354e 100644 --- a/ci-runner/vendor/modules.txt +++ b/ci-runner/vendor/modules.txt @@ -298,7 +298,7 @@ github.com/cncf/xds/go/xds/type/v3 # github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc ## explicit github.com/davecgh/go-spew/spew -# github.com/devtron-labs/common-lib v0.19.1 => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072256-6c8429c6cc72 +# github.com/devtron-labs/common-lib v0.19.1 => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260227055702-7fe9d47354a0 ## explicit; go 1.24.0 github.com/devtron-labs/common-lib/blob-storage github.com/devtron-labs/common-lib/constants @@ -720,7 +720,7 @@ golang.org/x/crypto/pbkdf2 golang.org/x/crypto/pkcs12 golang.org/x/crypto/pkcs12/internal/rc2 golang.org/x/crypto/salsa20/salsa -# golang.org/x/net v0.41.0 +# golang.org/x/net v0.42.0 ## explicit; go 1.23.0 golang.org/x/net/http/httpguts golang.org/x/net/http/httpproxy @@ -763,7 +763,7 @@ golang.org/x/text/secure/bidirule golang.org/x/text/transform golang.org/x/text/unicode/bidi golang.org/x/text/unicode/norm -# golang.org/x/time v0.11.0 +# golang.org/x/time v0.12.0 ## explicit; go 1.23.0 golang.org/x/time/rate # google.golang.org/api v0.234.0 @@ -1199,4 +1199,4 @@ sigs.k8s.io/structured-merge-diff/v4/value ## explicit; go 1.22 sigs.k8s.io/yaml sigs.k8s.io/yaml/goyaml.v2 -# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072256-6c8429c6cc72 +# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260227055702-7fe9d47354a0 diff --git a/git-sensor/go.mod b/git-sensor/go.mod index cf4f55ebd..8a2e2d009 100644 --- a/git-sensor/go.mod +++ b/git-sensor/go.mod @@ -4,7 +4,7 @@ go 1.24.0 toolchain go1.24.3 -replace github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072256-6c8429c6cc72 +replace github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260227055702-7fe9d47354a0 require ( github.com/caarlos0/env v3.5.0+incompatible @@ -72,7 +72,7 @@ require ( github.com/xanzy/ssh-agent v0.3.3 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.40.0 // indirect - golang.org/x/net v0.41.0 // indirect + golang.org/x/net v0.42.0 // indirect golang.org/x/text v0.27.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20250519155744-55703ea1f237 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect diff --git a/git-sensor/go.sum b/git-sensor/go.sum index ca86277ce..7823a6980 100644 --- a/git-sensor/go.sum +++ b/git-sensor/go.sum @@ -26,8 +26,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072256-6c8429c6cc72 h1:L1XupZ+tdjzcMjtzncAszzTeDZKUm7h9HThDIFYkTz4= -github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072256-6c8429c6cc72/go.mod h1:CqHnvltrng2O40hNGVl56qcAhv7tiXK3SKx47LKyE/A= +github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260227055702-7fe9d47354a0 h1:KnmMU3qEy/QRtEJaUQNnXvCrintij+BYhOJtw+OjxYw= +github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260227055702-7fe9d47354a0/go.mod h1:d6awSGcXQc57s4PJlwcyACovJ4PgBmR9jZJ7h6CScUM= github.com/devtron-labs/protos v0.0.3-0.20250323220609-ecf8a0f7305e h1:U6UdYbW8a7xn5IzFPd8cywjVVPfutGJCudjePAfL/Hs= github.com/devtron-labs/protos v0.0.3-0.20250323220609-ecf8a0f7305e/go.mod h1:1TqULGlTey+VNhAu/ag7NJuUvByJemkqodsc9L5PHJk= github.com/docker/cli v28.1.1+incompatible h1:eyUemzeI45DY7eDPuwUcmDyDj1pM98oD5MdSpiItp8k= @@ -224,8 +224,8 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= -golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw= -golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA= +golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= +golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/git-sensor/vendor/modules.txt b/git-sensor/vendor/modules.txt index c7b6ccc42..a13e06273 100644 --- a/git-sensor/vendor/modules.txt +++ b/git-sensor/vendor/modules.txt @@ -66,7 +66,7 @@ github.com/cyphar/filepath-securejoin # github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc ## explicit github.com/davecgh/go-spew/spew -# github.com/devtron-labs/common-lib v0.0.0 => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072256-6c8429c6cc72 +# github.com/devtron-labs/common-lib v0.0.0 => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260227055702-7fe9d47354a0 ## explicit; go 1.24.0 github.com/devtron-labs/common-lib/constants github.com/devtron-labs/common-lib/fetchAllEnv @@ -328,7 +328,7 @@ golang.org/x/crypto/ssh golang.org/x/crypto/ssh/agent golang.org/x/crypto/ssh/internal/bcrypt_pbkdf golang.org/x/crypto/ssh/knownhosts -# golang.org/x/net v0.41.0 +# golang.org/x/net v0.42.0 ## explicit; go 1.23.0 golang.org/x/net/context golang.org/x/net/http/httpguts @@ -469,4 +469,4 @@ gopkg.in/yaml.v3 # mellium.im/sasl v0.3.2 ## explicit; go 1.20 mellium.im/sasl -# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072256-6c8429c6cc72 +# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260227055702-7fe9d47354a0 diff --git a/image-scanner/go.mod b/image-scanner/go.mod index 1a209958b..af2a2c196 100644 --- a/image-scanner/go.mod +++ b/image-scanner/go.mod @@ -56,7 +56,7 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.40.0 // indirect golang.org/x/mod v0.25.0 // indirect - golang.org/x/net v0.41.0 // indirect + golang.org/x/net v0.42.0 // indirect golang.org/x/sync v0.16.0 // indirect golang.org/x/sys v0.34.0 // indirect golang.org/x/text v0.27.0 // indirect @@ -69,4 +69,4 @@ require ( mellium.im/sasl v0.3.2 // indirect ) -replace github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072256-6c8429c6cc72 +replace github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260227055702-7fe9d47354a0 diff --git a/image-scanner/go.sum b/image-scanner/go.sum index 6c38f7479..33deb8c82 100644 --- a/image-scanner/go.sum +++ b/image-scanner/go.sum @@ -279,8 +279,8 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0= -github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072256-6c8429c6cc72 h1:L1XupZ+tdjzcMjtzncAszzTeDZKUm7h9HThDIFYkTz4= -github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072256-6c8429c6cc72/go.mod h1:CqHnvltrng2O40hNGVl56qcAhv7tiXK3SKx47LKyE/A= +github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260227055702-7fe9d47354a0 h1:KnmMU3qEy/QRtEJaUQNnXvCrintij+BYhOJtw+OjxYw= +github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260227055702-7fe9d47354a0/go.mod h1:d6awSGcXQc57s4PJlwcyACovJ4PgBmR9jZJ7h6CScUM= github.com/dgrijalva/jwt-go v0.0.0-20170104182250-a601269ab70c/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= @@ -1166,8 +1166,8 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= -golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw= -golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA= +golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= +golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= diff --git a/image-scanner/vendor/modules.txt b/image-scanner/vendor/modules.txt index d53c5c4c3..bd452d195 100644 --- a/image-scanner/vendor/modules.txt +++ b/image-scanner/vendor/modules.txt @@ -74,7 +74,7 @@ github.com/cespare/xxhash/v2 github.com/coreos/clair/api/v3/clairpb github.com/coreos/clair/database github.com/coreos/clair/ext/versionfmt -# github.com/devtron-labs/common-lib v0.19.0 => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072256-6c8429c6cc72 +# github.com/devtron-labs/common-lib v0.19.0 => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260227055702-7fe9d47354a0 ## explicit; go 1.24.0 github.com/devtron-labs/common-lib/async github.com/devtron-labs/common-lib/constants @@ -273,7 +273,7 @@ golang.org/x/mod/internal/lazyregexp golang.org/x/mod/modfile golang.org/x/mod/module golang.org/x/mod/semver -# golang.org/x/net v0.41.0 +# golang.org/x/net v0.42.0 ## explicit; go 1.23.0 golang.org/x/net/context golang.org/x/net/http/httpguts @@ -457,4 +457,4 @@ google.golang.org/protobuf/types/known/wrapperspb # mellium.im/sasl v0.3.2 ## explicit; go 1.20 mellium.im/sasl -# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072256-6c8429c6cc72 +# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260227055702-7fe9d47354a0 diff --git a/kubelink/go.mod b/kubelink/go.mod index 609e6f685..52f362a09 100644 --- a/kubelink/go.mod +++ b/kubelink/go.mod @@ -139,12 +139,12 @@ require ( go.yaml.in/yaml/v2 v2.4.2 // indirect go.yaml.in/yaml/v3 v3.0.3 // indirect golang.org/x/crypto v0.40.0 // indirect - golang.org/x/net v0.41.0 // indirect + golang.org/x/net v0.42.0 // indirect golang.org/x/oauth2 v0.30.0 // indirect golang.org/x/sys v0.34.0 // indirect golang.org/x/term v0.33.0 // indirect golang.org/x/text v0.27.0 // indirect - golang.org/x/time v0.11.0 // indirect + golang.org/x/time v0.12.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20250519155744-55703ea1f237 // indirect gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect @@ -157,7 +157,7 @@ require ( k8s.io/kube-aggregator v0.33.0 // indirect k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff // indirect k8s.io/kubectl v0.33.3 // indirect - k8s.io/kubernetes v1.33.1 // indirect + k8s.io/kubernetes v1.33.4 // indirect k8s.io/metrics v0.33.3 // indirect k8s.io/utils v0.0.0-20250502105355-0f33e8f1c979 // indirect mellium.im/sasl v0.3.2 // indirect @@ -168,4 +168,4 @@ require ( sigs.k8s.io/structured-merge-diff/v4 v4.7.0 // indirect ) -replace github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072256-6c8429c6cc72 +replace github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260227055702-7fe9d47354a0 diff --git a/kubelink/go.sum b/kubelink/go.sum index af9c97b0a..d20f6c2a9 100644 --- a/kubelink/go.sum +++ b/kubelink/go.sum @@ -46,8 +46,8 @@ github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UF github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chai2010/gettext-go v1.0.2 h1:1Lwwip6Q2QGsAdl/ZKPCwTe9fe0CjlUbqj5bFNSjIRk= github.com/chai2010/gettext-go v1.0.2/go.mod h1:y+wnP2cHYaVj19NZhYKAwEMH2CI1gNHeQQ+5AjwawxA= -github.com/containerd/containerd v1.7.29 h1:90fWABQsaN9mJhGkoVnuzEY+o1XDPbg9BTC9QTAHnuE= -github.com/containerd/containerd v1.7.29/go.mod h1:azUkWcOvHrWvaiUjSQH0fjzuHIwSPg1WL5PshGP4Szs= +github.com/containerd/containerd v1.7.27 h1:yFyEyojddO3MIGVER2xJLWoCIn+Up4GaHFquP7hsFII= +github.com/containerd/containerd v1.7.27/go.mod h1:xZmPnl75Vc+BLGt4MIfu6bp+fy03gdHAn9bz+FreFR0= github.com/containerd/errdefs v1.0.0 h1:tg5yIfIlQIrxYtu9ajqY42W3lpS19XqdxRQeEwYG8PI= github.com/containerd/errdefs v1.0.0/go.mod h1:+YBYIdtsnF4Iw6nWZhJcqGSg/dwvV7tyJ/kCkyJ2k+M= github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= @@ -65,8 +65,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072256-6c8429c6cc72 h1:L1XupZ+tdjzcMjtzncAszzTeDZKUm7h9HThDIFYkTz4= -github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072256-6c8429c6cc72/go.mod h1:CqHnvltrng2O40hNGVl56qcAhv7tiXK3SKx47LKyE/A= +github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260227055702-7fe9d47354a0 h1:KnmMU3qEy/QRtEJaUQNnXvCrintij+BYhOJtw+OjxYw= +github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260227055702-7fe9d47354a0/go.mod h1:d6awSGcXQc57s4PJlwcyACovJ4PgBmR9jZJ7h6CScUM= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/distribution/distribution/v3 v3.0.0 h1:q4R8wemdRQDClzoNNStftB2ZAfqOiN6UX90KJc4HjyM= @@ -420,8 +420,8 @@ golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91 golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/mod v0.26.0 h1:EGMPT//Ezu+ylkCijjPc+f4Aih7sZvaAr+O3EHBxvZg= -golang.org/x/mod v0.26.0/go.mod h1:/j6NAhSk8iQ723BGAUyoAcn7SlD7s15Dp9Nd/SfeaFQ= +golang.org/x/mod v0.25.0 h1:n7a+ZbQKQA/Ysbyb0/6IbB1H/X41mKgbhfv7AfG/44w= +golang.org/x/mod v0.25.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -567,8 +567,8 @@ k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff h1:/usPimJzUKKu+m+TE36gUy k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff/go.mod h1:5jIi+8yX4RIb8wk3XwBo5Pq2ccx4FP10ohkbSKCZoK8= k8s.io/kubectl v0.33.3 h1:r/phHvH1iU7gO/l7tTjQk2K01ER7/OAJi8uFHHyWSac= k8s.io/kubectl v0.33.3/go.mod h1:euj2bG56L6kUGOE/ckZbCoudPwuj4Kud7BR0GzyNiT0= -k8s.io/kubernetes v1.33.1 h1:86+VVY/f11taZdpEZrNciLw1MIQhu6BFXf/OMFn5EUg= -k8s.io/kubernetes v1.33.1/go.mod h1:2nWuPk0seE4+6sd0x60wQ6rYEXcV7SoeMbU0YbFm/5k= +k8s.io/kubernetes v1.33.4 h1:T1d5FLUYm3/KyUeV7YJhKTR980zHCHb7K2xhCSo3lE8= +k8s.io/kubernetes v1.33.4/go.mod h1:nrt8sldmckKz2fCZhgRX3SKfS2e+CzXATPv6ITNkU00= k8s.io/metrics v0.33.3 h1:9CcqBz15JZfISqwca33gdHS8I6XfsK1vA8WUdEnG70g= k8s.io/metrics v0.33.3/go.mod h1:Aw+cdg4AYHw0HvUY+lCyq40FOO84awrqvJRTw0cmXDs= k8s.io/utils v0.0.0-20250502105355-0f33e8f1c979 h1:jgJW5IePPXLGB8e/1wvd0Ich9QE97RvvF3a8J3fP/Lg= diff --git a/kubelink/vendor/github.com/containerd/containerd/archive/compression/compression.go b/kubelink/vendor/github.com/containerd/containerd/archive/compression/compression.go index 3c152f281..23ddfab1a 100644 --- a/kubelink/vendor/github.com/containerd/containerd/archive/compression/compression.go +++ b/kubelink/vendor/github.com/containerd/containerd/archive/compression/compression.go @@ -45,8 +45,6 @@ const ( Gzip // Zstd is zstd compression algorithm. Zstd - // Unknown is used when a plugin handles the algorithm. - Unknown ) const disablePigzEnv = "CONTAINERD_DISABLE_PIGZ" @@ -256,8 +254,6 @@ func (compression *Compression) Extension() string { return "gz" case Zstd: return "zst" - case Unknown: - return "unknown" } return "" } diff --git a/kubelink/vendor/modules.txt b/kubelink/vendor/modules.txt index 286d1f4f9..30889b78d 100644 --- a/kubelink/vendor/modules.txt +++ b/kubelink/vendor/modules.txt @@ -100,8 +100,8 @@ github.com/chai2010/gettext-go github.com/chai2010/gettext-go/mo github.com/chai2010/gettext-go/plural github.com/chai2010/gettext-go/po -# github.com/containerd/containerd v1.7.27 => github.com/containerd/containerd v1.7.29 -## explicit; go 1.23.0 +# github.com/containerd/containerd v1.7.27 +## explicit; go 1.21 github.com/containerd/containerd/archive/compression github.com/containerd/containerd/content github.com/containerd/containerd/errdefs @@ -125,7 +125,7 @@ github.com/cyphar/filepath-securejoin # github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc ## explicit github.com/davecgh/go-spew/spew -# github.com/devtron-labs/common-lib v0.0.0 => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072256-6c8429c6cc72 +# github.com/devtron-labs/common-lib v0.0.0 => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260227055702-7fe9d47354a0 ## explicit; go 1.24.0 github.com/devtron-labs/common-lib/async github.com/devtron-labs/common-lib/constants @@ -1247,7 +1247,7 @@ k8s.io/kubectl/pkg/util/podutils k8s.io/kubectl/pkg/util/templates k8s.io/kubectl/pkg/util/term k8s.io/kubectl/pkg/validation -# k8s.io/kubernetes v1.33.1 +# k8s.io/kubernetes v1.33.4 ## explicit; go 1.24.0 k8s.io/kubernetes/pkg/api/legacyscheme # k8s.io/metrics v0.33.3 @@ -1403,4 +1403,4 @@ sigs.k8s.io/structured-merge-diff/v4/value sigs.k8s.io/yaml sigs.k8s.io/yaml/goyaml.v2 sigs.k8s.io/yaml/goyaml.v3 -# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072256-6c8429c6cc72 +# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260227055702-7fe9d47354a0 diff --git a/kubewatch/go.mod b/kubewatch/go.mod index fc9801979..1b570b325 100644 --- a/kubewatch/go.mod +++ b/kubewatch/go.mod @@ -206,13 +206,13 @@ require ( go.yaml.in/yaml/v2 v2.4.2 // indirect go.yaml.in/yaml/v3 v3.0.3 // indirect golang.org/x/crypto v0.40.0 // indirect - golang.org/x/net v0.41.0 // indirect + golang.org/x/net v0.42.0 // indirect golang.org/x/oauth2 v0.30.0 // indirect golang.org/x/sync v0.16.0 // indirect golang.org/x/sys v0.34.0 // indirect golang.org/x/term v0.33.0 // indirect golang.org/x/text v0.27.0 // indirect - golang.org/x/time v0.11.0 // indirect + golang.org/x/time v0.12.0 // indirect google.golang.org/genproto v0.0.0-20250519155744-55703ea1f237 // indirect google.golang.org/grpc v1.72.2 // indirect gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect @@ -228,7 +228,7 @@ require ( k8s.io/kube-aggregator v0.33.0 // indirect k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff // indirect k8s.io/kubectl v0.33.3 // indirect - k8s.io/kubernetes v1.33.1 // indirect + k8s.io/kubernetes v1.33.4 // indirect k8s.io/metrics v0.33.3 // indirect oras.land/oras-go/v2 v2.6.0 // indirect sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect @@ -241,5 +241,5 @@ require ( replace ( github.com/cyphar/filepath-securejoin v0.4.1 => github.com/cyphar/filepath-securejoin v0.3.6 // indirect - github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072256-6c8429c6cc72 + github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260227055702-7fe9d47354a0 ) diff --git a/kubewatch/go.sum b/kubewatch/go.sum index 83360e45a..3c265922d 100644 --- a/kubewatch/go.sum +++ b/kubewatch/go.sum @@ -129,8 +129,8 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/denisenkom/go-mssqldb v0.12.3/go.mod h1:k0mtMFOnU+AihqFxPMiF05rtiDrorD1Vrm1KEz5hxDo= -github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072256-6c8429c6cc72 h1:L1XupZ+tdjzcMjtzncAszzTeDZKUm7h9HThDIFYkTz4= -github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072256-6c8429c6cc72/go.mod h1:CqHnvltrng2O40hNGVl56qcAhv7tiXK3SKx47LKyE/A= +github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260227055702-7fe9d47354a0 h1:KnmMU3qEy/QRtEJaUQNnXvCrintij+BYhOJtw+OjxYw= +github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260227055702-7fe9d47354a0/go.mod h1:d6awSGcXQc57s4PJlwcyACovJ4PgBmR9jZJ7h6CScUM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= @@ -803,8 +803,8 @@ golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= -golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw= -golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA= +golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= +golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -918,8 +918,8 @@ golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4= golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.11.0 h1:/bpjEDfN9tkoN/ryeYHnv5hcMlc8ncjMcM4XBk5NWV0= -golang.org/x/time v0.11.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg= +golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE= +golang.org/x/time v0.12.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181011042414-1f849cf54d09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1058,8 +1058,8 @@ k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff h1:/usPimJzUKKu+m+TE36gUy k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff/go.mod h1:5jIi+8yX4RIb8wk3XwBo5Pq2ccx4FP10ohkbSKCZoK8= k8s.io/kubectl v0.33.3 h1:r/phHvH1iU7gO/l7tTjQk2K01ER7/OAJi8uFHHyWSac= k8s.io/kubectl v0.33.3/go.mod h1:euj2bG56L6kUGOE/ckZbCoudPwuj4Kud7BR0GzyNiT0= -k8s.io/kubernetes v1.33.1 h1:86+VVY/f11taZdpEZrNciLw1MIQhu6BFXf/OMFn5EUg= -k8s.io/kubernetes v1.33.1/go.mod h1:2nWuPk0seE4+6sd0x60wQ6rYEXcV7SoeMbU0YbFm/5k= +k8s.io/kubernetes v1.33.4 h1:T1d5FLUYm3/KyUeV7YJhKTR980zHCHb7K2xhCSo3lE8= +k8s.io/kubernetes v1.33.4/go.mod h1:nrt8sldmckKz2fCZhgRX3SKfS2e+CzXATPv6ITNkU00= k8s.io/metrics v0.33.3 h1:9CcqBz15JZfISqwca33gdHS8I6XfsK1vA8WUdEnG70g= k8s.io/metrics v0.33.3/go.mod h1:Aw+cdg4AYHw0HvUY+lCyq40FOO84awrqvJRTw0cmXDs= k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew= diff --git a/kubewatch/vendor/github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1/repository_types.go b/kubewatch/vendor/github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1/repository_types.go index 33d50b513..047ae14b1 100644 --- a/kubewatch/vendor/github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1/repository_types.go +++ b/kubewatch/vendor/github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1/repository_types.go @@ -290,6 +290,7 @@ func (m *Repository) Sanitized() *Repository { Repo: m.Repo, Type: m.Type, Name: m.Name, + Username: m.Username, Insecure: m.IsInsecure(), EnableLFS: m.EnableLFS, EnableOCI: m.EnableOCI, diff --git a/kubewatch/vendor/github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1/types.go b/kubewatch/vendor/github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1/types.go index c1b1a5080..524f574f8 100644 --- a/kubewatch/vendor/github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1/types.go +++ b/kubewatch/vendor/github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1/types.go @@ -2099,32 +2099,6 @@ type Cluster struct { Annotations map[string]string `json:"annotations,omitempty" protobuf:"bytes,13,opt,name=annotations"` } -func (c *Cluster) Sanitized() *Cluster { - return &Cluster{ - ID: c.ID, - Server: c.Server, - Name: c.Name, - Project: c.Project, - Namespaces: c.Namespaces, - Shard: c.Shard, - Labels: c.Labels, - Annotations: c.Annotations, - ClusterResources: c.ClusterResources, - ConnectionState: c.ConnectionState, - ServerVersion: c.ServerVersion, - Info: c.Info, - RefreshRequestedAt: c.RefreshRequestedAt, - Config: ClusterConfig{ - AWSAuthConfig: c.Config.AWSAuthConfig, - ProxyUrl: c.Config.ProxyUrl, - DisableCompression: c.Config.DisableCompression, - TLSClientConfig: TLSClientConfig{ - Insecure: c.Config.Insecure, - }, - }, - } -} - // Equals returns true if two cluster objects are considered to be equal func (c *Cluster) Equals(other *Cluster) bool { if c.Server != other.Server { @@ -3060,14 +3034,6 @@ func (app *Application) SetPostDeleteFinalizer(stage ...string) { setFinalizer(&app.ObjectMeta, strings.Join(append([]string{PostDeleteFinalizerName}, stage...), "/"), true) } -func (app *Application) UnSetPostDeleteFinalizerAll() { - for _, finalizer := range app.Finalizers { - if strings.HasPrefix(finalizer, PostDeleteFinalizerName) { - setFinalizer(&app.ObjectMeta, finalizer, false) - } - } -} - func (app *Application) UnSetPostDeleteFinalizer(stage ...string) { setFinalizer(&app.ObjectMeta, strings.Join(append([]string{PostDeleteFinalizerName}, stage...), "/"), false) } diff --git a/kubewatch/vendor/github.com/argoproj/argo-cd/v2/util/env/env.go b/kubewatch/vendor/github.com/argoproj/argo-cd/v2/util/env/env.go index f4254c9e0..686ef8089 100644 --- a/kubewatch/vendor/github.com/argoproj/argo-cd/v2/util/env/env.go +++ b/kubewatch/vendor/github.com/argoproj/argo-cd/v2/util/env/env.go @@ -7,8 +7,6 @@ import ( "strings" "time" - timeutil "github.com/argoproj/pkg/time" - log "github.com/sirupsen/logrus" ) @@ -135,13 +133,8 @@ func ParseDurationFromEnv(env string, defaultValue, min, max time.Duration) time } dur, err := time.ParseDuration(str) if err != nil { - // provides backwards compatibility for durations defined in days, see: https://github.com/argoproj/argo-cd/issues/24740 - durPtr, err2 := timeutil.ParseDuration(str) - if err2 != nil { - log.Warnf("Could not parse '%s' as a duration from environment %s", str, env) - return defaultValue - } - dur = *durPtr + log.Warnf("Could not parse '%s' as a duration string from environment %s", str, env) + return defaultValue } if dur < min { diff --git a/kubewatch/vendor/github.com/argoproj/argo-cd/v2/util/git/ssh.go b/kubewatch/vendor/github.com/argoproj/argo-cd/v2/util/git/ssh.go index 36e4ab67a..a1cb337a8 100644 --- a/kubewatch/vendor/github.com/argoproj/argo-cd/v2/util/git/ssh.go +++ b/kubewatch/vendor/github.com/argoproj/argo-cd/v2/util/git/ssh.go @@ -1,14 +1,13 @@ package git import ( - "crypto/fips140" "fmt" gitssh "github.com/go-git/go-git/v5/plumbing/transport/ssh" "golang.org/x/crypto/ssh" ) -// SupportedSSHKeyExchangeAlgorithms is a list of all currently supported algorithms for SSH key exchange +// List of all currently supported algorithms for SSH key exchange // Unfortunately, crypto/ssh does not offer public constants or list for // this. var SupportedSSHKeyExchangeAlgorithms = []string{ @@ -22,15 +21,10 @@ var SupportedSSHKeyExchangeAlgorithms = []string{ "diffie-hellman-group14-sha1", } -// SupportedFIPSCompliantSSHKeyExchangeAlgorithms is a list of all currently supported algorithms for SSH key exchange -// that are FIPS compliant -var SupportedFIPSCompliantSSHKeyExchangeAlgorithms = []string{ - "ecdh-sha2-nistp256", - "ecdh-sha2-nistp384", - "ecdh-sha2-nistp521", - "diffie-hellman-group-exchange-sha256", - "diffie-hellman-group14-sha256", -} +// List of default key exchange algorithms to use. We use those that are +// available by default, we can become more opinionated later on (when +// we support configuration of algorithms to use). +var DefaultSSHKeyExchangeAlgorithms = SupportedSSHKeyExchangeAlgorithms // PublicKeysWithOptions is an auth method for go-git's SSH client that // inherits from PublicKeys, but provides the possibility to override @@ -57,17 +51,9 @@ func (a *PublicKeysWithOptions) ClientConfig() (*ssh.ClientConfig, error) { if len(a.KexAlgorithms) > 0 { kexAlgos = a.KexAlgorithms } else { - kexAlgos = getDefaultSSHKeyExchangeAlgorithms() + kexAlgos = DefaultSSHKeyExchangeAlgorithms } config := ssh.Config{KeyExchanges: kexAlgos} opts := &ssh.ClientConfig{Config: config, User: a.User, Auth: []ssh.AuthMethod{ssh.PublicKeys(a.Signer)}} return a.SetHostKeyCallback(opts) } - -// getDefaultSSHKeyExchangeAlgorithms returns the default key exchange algorithms to be used -func getDefaultSSHKeyExchangeAlgorithms() []string { - if fips140.Enabled() { - return SupportedFIPSCompliantSSHKeyExchangeAlgorithms - } - return SupportedSSHKeyExchangeAlgorithms -} diff --git a/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/Dockerfile b/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/Dockerfile index 3e3f0d230..0e3218b94 100644 --- a/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/Dockerfile +++ b/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/Dockerfile @@ -3,7 +3,7 @@ ARG GIT_COMMIT=unknown ARG GIT_TAG=unknown ARG GIT_TREE_STATE=unknown -FROM golang:1.24.4-alpine3.22 as builder +FROM golang:1.24-alpine3.21 as builder # libc-dev to build openapi-gen RUN apk update && apk add --no-cache \ @@ -80,27 +80,13 @@ RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache #################################################################################################### -FROM gcr.io/distroless/static as argoexec-base +FROM gcr.io/distroless/static as argoexec +COPY --from=argoexec-build /go/src/github.com/argoproj/argo-workflows/dist/argoexec /bin/ COPY --from=argoexec-build /etc/mime.types /etc/mime.types COPY hack/ssh_known_hosts /etc/ssh/ COPY hack/nsswitch.conf /etc/ -#################################################################################################### - -FROM argoexec-base as argoexec-nonroot - -USER 8737 - -COPY --chown=8737 --from=argoexec-build /go/src/github.com/argoproj/argo-workflows/dist/argoexec /bin/ - -ENTRYPOINT [ "argoexec" ] - -#################################################################################################### -FROM argoexec-base as argoexec - -COPY --from=argoexec-build /go/src/github.com/argoproj/argo-workflows/dist/argoexec /bin/ - ENTRYPOINT [ "argoexec" ] #################################################################################################### @@ -123,6 +109,8 @@ USER 8737 WORKDIR /home/argo +# Temporary workaround for https://github.com/grpc/grpc-go/issues/434 +ENV GRPC_ENFORCE_ALPN_ENABLED=false COPY hack/ssh_known_hosts /etc/ssh/ COPY hack/nsswitch.conf /etc/ COPY --from=argocli-build /go/src/github.com/argoproj/argo-workflows/dist/argo /bin/ diff --git a/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/Makefile b/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/Makefile index 3068ec4da..919511b58 100644 --- a/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/Makefile +++ b/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/Makefile @@ -245,33 +245,22 @@ else endif argoexec-image: -argoexec-nonroot-image: %-image: [ ! -e dist/$* ] || mv dist/$* . - # Special handling for argoexec-nonroot to create argoexec:VERSION-nonroot instead of argoexec-nonroot:VERSION - if [ "$*" = "argoexec-nonroot" ]; then \ - image_name="$(IMAGE_NAMESPACE)/argoexec:$(VERSION)-nonroot"; \ - else \ - image_name="$(IMAGE_NAMESPACE)/$*:$(VERSION)"; \ - fi; \ docker buildx build \ --platform $(TARGET_PLATFORM) \ --build-arg GIT_COMMIT=$(GIT_COMMIT) \ --build-arg GIT_TAG=$(GIT_TAG) \ --build-arg GIT_TREE_STATE=$(GIT_TREE_STATE) \ - -t $$image_name \ + -t $(IMAGE_NAMESPACE)/$*:$(VERSION) \ --target $* \ --load \ - .; \ - [ ! -e $* ] || mv $* dist/; \ - docker run --rm -t $$image_name version; \ - if [ $(K3D) = true ]; then \ - k3d image import -c $(K3D_CLUSTER_NAME) $$image_name; \ - fi; \ - if [ $(DOCKER_PUSH) = true ] && [ $(IMAGE_NAMESPACE) != argoproj ] ; then \ - docker push $$image_name; \ - fi + . + [ ! -e $* ] || mv $* dist/ + docker run --rm -t $(IMAGE_NAMESPACE)/$*:$(VERSION) version + if [ $(K3D) = true ]; then k3d image import -c $(K3D_CLUSTER_NAME) $(IMAGE_NAMESPACE)/$*:$(VERSION); fi + if [ $(DOCKER_PUSH) = true ] && [ $(IMAGE_NAMESPACE) != argoproj ] ; then docker push $(IMAGE_NAMESPACE)/$*:$(VERSION) ; fi .PHONY: codegen codegen: types swagger manifests $(GOPATH)/bin/mockery docs/fields.md docs/cli/argo.md diff --git a/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/USERS.md b/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/USERS.md index c78483b56..7ebc6b5ad 100644 --- a/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/USERS.md +++ b/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/USERS.md @@ -29,7 +29,6 @@ Currently, the following organizations are **officially** using Argo Workflows: 1. [Anova](https://www.anova.com/) 1. [Ant Group](https://www.antgroup.com/) 1. [AppDirect](https://www.appdirect.com/) -1. [Arcadia](https://www.arcadia.io) 1. [Arabesque](https://www.arabesque.com/) 1. [Argonaut](https://www.argonaut.dev/) 1. [ArthurAI](https://arthur.ai/) @@ -77,7 +76,6 @@ Currently, the following organizations are **officially** using Argo Workflows: 1. [DevSamurai](https://www.devsamurai.com/) 1. [Devtron Labs](https://github.com/devtron-labs/devtron) 1. [DLR](https://www.dlr.de/eoc/) -2. [DocNetwork](https://docnetwork.org/) 1. [DP Technology](https://www.dp.tech/) 1. [Dyno Therapeutics](https://dynotx.com) 1. [EBSCO Information Services](https://www.ebsco.com/) diff --git a/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/config/controller.go b/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/config/controller.go index cbe67b0bd..7e0e07302 100644 --- a/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/config/controller.go +++ b/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/config/controller.go @@ -13,7 +13,6 @@ import ( type Controller interface { Get(context.Context) (*Config, error) - GetNamespace() string GetName() string } @@ -63,10 +62,6 @@ func (cc *controller) Get(ctx context.Context) (*Config, error) { return config, parseConfigMap(cm, config) } -func (cc *controller) GetNamespace() string { - return cc.namespace -} - func (cc *controller) GetName() string { return cc.configMap } diff --git a/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/mkdocs.yml b/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/mkdocs.yml index 6069f3a09..d7653d9f9 100644 --- a/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/mkdocs.yml +++ b/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/mkdocs.yml @@ -33,7 +33,6 @@ markdown_extensions: - md_in_html - pymdownx.details - pymdownx.snippets - - pymdownx.tilde - pymdownx.superfences: custom_fences: # support mermaid diagrams per https://squidfunk.github.io/mkdocs-material/reference/diagrams/#configuration diff --git a/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/util/telemetry/instrument.go b/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/util/telemetry/instrument.go index f6604faca..ed12b7488 100644 --- a/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/util/telemetry/instrument.go +++ b/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/util/telemetry/instrument.go @@ -32,7 +32,8 @@ type instrumentType int const ( Float64ObservableGauge instrumentType = iota Float64Histogram - Float64ObservableCounter + Float64UpDownCounter + Float64ObservableUpDownCounter Int64ObservableGauge Int64UpDownCounter Int64Counter @@ -93,8 +94,15 @@ func (m *Metrics) CreateInstrument(instType instrumentType, name, desc, unit str ) instPtr = &inst err = insterr - case Float64ObservableCounter: - inst, insterr := (*m.otelMeter).Float64ObservableCounter(name, + case Float64UpDownCounter: + inst, insterr := (*m.otelMeter).Float64UpDownCounter(name, + metric.WithDescription(desc), + metric.WithUnit(unit), + ) + instPtr = &inst + err = insterr + case Float64ObservableUpDownCounter: + inst, insterr := (*m.otelMeter).Float64ObservableUpDownCounter(name, metric.WithDescription(desc), metric.WithUnit(unit), ) diff --git a/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/util/telemetry/operators.go b/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/util/telemetry/operators.go index 0041140b9..3e87b33f6 100644 --- a/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/util/telemetry/operators.go +++ b/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/util/telemetry/operators.go @@ -47,7 +47,7 @@ func (i *Instrument) Record(ctx context.Context, val float64, attribs InstAttrib func (i *Instrument) RegisterCallback(m *Metrics, f metric.Callback) error { switch inst := i.otel.(type) { - case *metric.Float64ObservableCounter: + case *metric.Float64ObservableUpDownCounter: _, err := (*m.otelMeter).RegisterCallback(f, *inst) return err case *metric.Float64ObservableGauge: @@ -74,7 +74,7 @@ func (i *Instrument) ObserveFloat(o metric.Observer, val float64, attribs InstAt switch inst := i.otel.(type) { case *metric.Float64ObservableGauge: o.ObserveFloat64(*inst, val, i.attributes(attribs)) - case *metric.Float64ObservableCounter: + case *metric.Float64ObservableUpDownCounter: o.ObserveFloat64(*inst, val, i.attributes(attribs)) default: log.Errorf("Metrics observeFloat() to invalid type %s (%t)", i.name, i.otel) diff --git a/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/util/template/expression_template.go b/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/util/template/expression_template.go index 43f1bb0c3..59ce6dd05 100644 --- a/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/util/template/expression_template.go +++ b/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/util/template/expression_template.go @@ -21,45 +21,33 @@ func init() { } } -var variablesToCheck = []string{ - "item", - "retries", - "lastRetry.exitCode", - "lastRetry.status", - "lastRetry.duration", - "lastRetry.message", - "workflow.status", - "workflow.failures", -} - -func anyVarNotInEnv(expression string, env map[string]interface{}) *string { - for _, variable := range variablesToCheck { - if hasVariableInExpression(expression, variable) && !hasVarInEnv(env, variable) { - return &variable - } - } - return nil -} - func expressionReplace(w io.Writer, expression string, env map[string]interface{}, allowUnresolved bool) (int, error) { // The template is JSON-marshaled. This JSON-unmarshals the expression to undo any character escapes. var unmarshalledExpression string err := json.Unmarshal([]byte(fmt.Sprintf(`"%s"`, expression)), &unmarshalledExpression) if err != nil && allowUnresolved { - log.WithError(err).Debug("unresolved is allowed") + log.WithError(err).Debug("unresolved is allowed ") return fmt.Fprintf(w, "{{%s%s}}", kindExpression, expression) } if err != nil { return 0, fmt.Errorf("failed to unmarshall JSON expression: %w", err) } - varNameNotInEnv := anyVarNotInEnv(unmarshalledExpression, env) - if varNameNotInEnv != nil && allowUnresolved { - // this is to make sure expressions don't get resolved to nil or an empty string when certain variables - // don't exist in the env during the "global" replacement. - // See https://github.com/argoproj/argo-workflows/issues/5388, https://github.com/argoproj/argo-workflows/issues/15008, - // https://github.com/argoproj/argo-workflows/issues/10393, https://github.com/expr-lang/expr/issues/330 - log.WithField("variable", *varNameNotInEnv).Debug("variable not in env but unresolved is allowed") + if _, ok := env["retries"]; !ok && hasRetries(unmarshalledExpression) && allowUnresolved { + // this is to make sure expressions like `sprig.int(retries)` don't get resolved to 0 when `retries` don't exist in the env + // See https://github.com/argoproj/argo-workflows/issues/5388 + log.WithError(err).Debug("Retries are present and unresolved is allowed") + return fmt.Fprintf(w, "{{%s%s}}", kindExpression, expression) + } + + // This is to make sure expressions which contains `workflow.status` and `work.failures` don't get resolved to nil + // when `workflow.status` and `workflow.failures` don't exist in the env. + // See https://github.com/argoproj/argo-workflows/issues/10393, https://github.com/expr-lang/expr/issues/330 + // This issue doesn't happen to other template parameters since `workflow.status` and `workflow.failures` only exist in the env + // when the exit handlers complete. + if ((hasWorkflowStatus(unmarshalledExpression) && !hasVarInEnv(env, "workflow.status")) || + (hasWorkflowFailures(unmarshalledExpression) && !hasVarInEnv(env, "workflow.failures"))) && + allowUnresolved { return fmt.Fprintf(w, "{{%s%s}}", kindExpression, expression) } @@ -112,55 +100,56 @@ func EnvMap(replaceMap map[string]string) map[string]interface{} { return envMap } -func searchTokens(haystack []lexer.Token, needle []lexer.Token) bool { - if len(needle) > len(haystack) { +// hasRetries checks if the variable `retries` exists in the expression template +func hasRetries(expression string) bool { + tokens, err := lexer.Lex(file.NewSource(expression)) + if err != nil { return false } - if len(needle) == 0 { - return true - } -outer: - for i := 0; i <= len(haystack)-len(needle); i++ { - for j := 0; j < len(needle); j++ { - if haystack[i+j].String() != needle[j].String() { - continue outer - } + for _, token := range tokens { + if token.Kind == lexer.Identifier && token.Value == "retries" { + return true } - return true } return false } -func filterEOF(toks []lexer.Token) []lexer.Token { - newToks := []lexer.Token{} - for _, tok := range toks { - if tok.Kind != lexer.EOF { - newToks = append(newToks, tok) +// hasWorkflowStatus checks if expression contains `workflow.status` +func hasWorkflowStatus(expression string) bool { + if !strings.Contains(expression, "workflow.status") { + return false + } + // Even if the expression contains `workflow.status`, it could be the case that it represents a string (`"workflow.status"`), + // not a variable, so we need to parse it and handle filter the string case. + tokens, err := lexer.Lex(file.NewSource(expression)) + if err != nil { + return false + } + for i := 0; i < len(tokens)-2; i++ { + if tokens[i].Value+tokens[i+1].Value+tokens[i+2].Value == "workflow.status" { + return true } } - return newToks + return false } -// hasVariableInExpression checks if an expression contains a variable. -// This function is somewhat cursed and I have attempted my best to -// remove this curse, but it still exists. -// The strings.Contains is needed because the lexer doesn't do -// any whitespace processing (workflow .status will be seen as workflow.status) -func hasVariableInExpression(expression, variable string) bool { - if !strings.Contains(expression, variable) { +// hasWorkflowFailures checks if expression contains `workflow.failures` +func hasWorkflowFailures(expression string) bool { + if !strings.Contains(expression, "workflow.failures") { return false } + // Even if the expression contains `workflow.failures`, it could be the case that it represents a string (`"workflow.failures"`), + // not a variable, so we need to parse it and handle filter the string case. tokens, err := lexer.Lex(file.NewSource(expression)) if err != nil { return false } - variableTokens, err := lexer.Lex(file.NewSource(variable)) - if err != nil { - return false + for i := 0; i < len(tokens)-2; i++ { + if tokens[i].Value+tokens[i+1].Value+tokens[i+2].Value == "workflow.failures" { + return true + } } - variableTokens = filterEOF(variableTokens) - - return searchTokens(tokens, variableTokens) + return false } // hasVarInEnv checks if a parameter is in env or not diff --git a/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/util/tls/tls.go b/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/util/tls/tls.go index b659530f4..6662908cc 100644 --- a/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/util/tls/tls.go +++ b/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/util/tls/tls.go @@ -125,7 +125,6 @@ func GenerateX509KeyPairTLSConfig(tlsMinVersion uint16) (*tls.Config, error) { Certificates: []tls.Certificate{*cer}, MinVersion: uint16(tlsMinVersion), InsecureSkipVerify: true, - NextProtos: []string{"h2"}, }, nil } @@ -148,6 +147,5 @@ func GetServerTLSConfigFromSecret(ctx context.Context, kubectlConfig kubernetes. return &tls.Config{ Certificates: []tls.Certificate{cert}, MinVersion: uint16(tlsMinVersion), - NextProtos: []string{"h2"}, }, nil } diff --git a/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/util/unstructured/unstructured.go b/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/util/unstructured/unstructured.go index 5884c3e85..698bff037 100644 --- a/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/util/unstructured/unstructured.go +++ b/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/util/unstructured/unstructured.go @@ -14,8 +14,6 @@ import ( "k8s.io/client-go/tools/cache" ) -const workflowPaginationLimit = 500 - // NewUnstructuredInformer constructs a new informer for Unstructured type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. @@ -34,29 +32,7 @@ func NewFilteredUnstructuredInformer(resource schema.GroupVersionResource, clien if tweakListRequestListOptions != nil { tweakListRequestListOptions(&options) } - var allWorkflows []unstructured.Unstructured - continueTok := "" - options.Limit = workflowPaginationLimit - for { - options.Continue = continueTok - unList, err := client.Resource(resource).Namespace(namespace).List(ctx, options) - if err != nil { - return nil, err - } - allWorkflows = append(allWorkflows, unList.Items...) - - if unList.GetContinue() == "" { - break - } - continueTok = unList.GetContinue() - } - return &unstructured.UnstructuredList{ - Object: map[string]interface{}{ - "apiVersion": "v1", - "kind": "List", - }, - Items: allWorkflows, - }, nil + return client.Resource(resource).Namespace(namespace).List(ctx, options) }, WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { if tweakWatchRequestListOptions != nil { diff --git a/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/workflow/common/util.go b/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/workflow/common/util.go index 063227d2c..b7ffbe291 100644 --- a/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/workflow/common/util.go +++ b/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/workflow/common/util.go @@ -255,6 +255,7 @@ func SubstituteParams(tmpl *wfv1.Template, globalParams, localParams Parameters) return nil, errors.InternalWrapError(err) } // Now replace the rest of substitutions (the ones that can be made) in the template + replaceMap = make(map[string]string) for _, inParam := range globalReplacedTmpl.Inputs.Parameters { if inParam.Value == nil && inParam.ValueFrom == nil { return nil, errors.InternalErrorf("inputs.parameters.%s had no value", inParam.Name) diff --git a/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/workflow/metrics/metrics_custom.go b/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/workflow/metrics/metrics_custom.go index aa9cb14db..65e5df156 100644 --- a/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/workflow/metrics/metrics_custom.go +++ b/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/workflow/metrics/metrics_custom.go @@ -27,7 +27,6 @@ type customMetricValue struct { lastUpdated time.Time labels []*wfv1.MetricLabel key string - completed bool } type customMetricUserData struct { @@ -139,7 +138,7 @@ func (m *Metrics) matchExistingMetric(metricSpec *wfv1.Prometheus) (*telemetry.I if wantedType != wfv1.MetricTypeGauge && !metricSpec.IsRealtime() { return nil, fmt.Errorf("Found existing gauge for custom metric %s of type %s", metricSpec.Name, wantedType) } - case *metric.Float64ObservableCounter: + case *metric.Float64ObservableUpDownCounter: if wantedType != wfv1.MetricTypeCounter { return nil, fmt.Errorf("Found existing counter for custom metric %s of type %s", metricSpec.Name, wantedType) } @@ -257,7 +256,7 @@ func (m *Metrics) createCustomMetric(metricSpec *wfv1.Prometheus) error { case metricType == wfv1.MetricTypeHistogram: return m.CreateInstrument(telemetry.Float64Histogram, metricSpec.Name, metricSpec.Help, "{item}", telemetry.WithDefaultBuckets(metricSpec.Histogram.GetBuckets())) case metricType == wfv1.MetricTypeCounter: - err := m.CreateInstrument(telemetry.Float64ObservableCounter, metricSpec.Name, metricSpec.Help, "{item}") + err := m.CreateInstrument(telemetry.Float64ObservableUpDownCounter, metricSpec.Name, metricSpec.Help, "{item}") if err != nil { return err } @@ -288,12 +287,7 @@ func (m *Metrics) runCustomGC(ttl time.Duration) { ud.mutex.Lock() for key, value := range ud.values { if time.Since(value.lastUpdated) > ttl { - switch { - case value.rtValueFunc != nil && value.completed: - delete(ud.values, key) - case value.rtValueFunc == nil: - delete(ud.values, key) - } + delete(ud.values, key) } } ud.mutex.Unlock() @@ -317,42 +311,20 @@ func (m *Metrics) customMetricsGC(ctx context.Context, ttl time.Duration) { } } -type operation int - -const ( - Complete operation = iota - Delete -) - -func (m *Metrics) handleRealtimeMetricsForWfUID(key string, op operation) { +func (m *Metrics) StopRealtimeMetricsForWfUID(key string) { m.realtimeMutex.Lock() defer m.realtimeMutex.Unlock() if _, exists := m.realtimeWorkflows[key]; !exists { return } + realtimeMetrics := m.realtimeWorkflows[key] for _, metric := range realtimeMetrics { ud := customUserData(metric.inst, true) ud.mutex.Lock() - switch op { - case Complete: - if value, ok := ud.values[metric.key]; ok && value != nil { - value.completed = true - } - case Delete: - delete(ud.values, metric.key) - } + delete(ud.values, metric.key) ud.mutex.Unlock() } - if op == Delete { - delete(m.realtimeWorkflows, key) - } -} - -func (m *Metrics) CompleteRealtimeMetricsForWfUID(key string) { - m.handleRealtimeMetricsForWfUID(key, Complete) -} -func (m *Metrics) DeleteRealtimeMetricsForWfUID(key string) { - m.handleRealtimeMetricsForWfUID(key, Delete) + delete(m.realtimeWorkflows, key) } diff --git a/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/workflow/util/merge.go b/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/workflow/util/merge.go index 24442bddb..c6a022696 100644 --- a/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/workflow/util/merge.go +++ b/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/workflow/util/merge.go @@ -16,20 +16,11 @@ func MergeTo(patch, target *wfv1.Workflow) error { return nil } - // Temporarily remove hooks and labelsFrom as they don't merge patchHooks := patch.Spec.Hooks + // Temporarily remove hooks as they don't merge patch.Spec.Hooks = nil - var patchLabelsFrom map[string]wfv1.LabelValueFrom - if patch.Spec.WorkflowMetadata != nil { - patchLabelsFrom = patch.Spec.WorkflowMetadata.LabelsFrom - patch.Spec.WorkflowMetadata.LabelsFrom = nil - } - patchWfBytes, err := json.Marshal(patch) patch.Spec.Hooks = patchHooks - if len(patchLabelsFrom) != 0 { - patch.Spec.WorkflowMetadata.LabelsFrom = patchLabelsFrom - } if err != nil { return err } @@ -61,16 +52,6 @@ func MergeTo(patch, target *wfv1.Workflow) error { target.Spec.Hooks[name] = hook } } - - if len(patchLabelsFrom) != 0 && target.Spec.WorkflowMetadata.LabelsFrom == nil { - target.Spec.WorkflowMetadata.LabelsFrom = make(map[string]wfv1.LabelValueFrom) - } - for key, val := range patchLabelsFrom { - // If the patch labelFrom doesn't exist in target - if _, ok := target.Spec.WorkflowMetadata.LabelsFrom[key]; !ok { - target.Spec.WorkflowMetadata.LabelsFrom[key] = val - } - } return nil } diff --git a/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/workflow/validate/validate.go b/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/workflow/validate/validate.go index a8d86ea86..5310c1c9c 100644 --- a/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/workflow/validate/validate.go +++ b/kubewatch/vendor/github.com/argoproj/argo-workflows/v3/workflow/validate/validate.go @@ -274,38 +274,6 @@ func ValidateWorkflow(wftmplGetter templateresolution.WorkflowTemplateNamespaced } if tmplHolder != nil { ctx.globalParams[common.GlobalVarWorkflowFailures] = placeholderGenerator.NextPlaceholder() - - // Check if any template has parametrized global artifacts, if so enable global artifact resolution for exit handlers - hasParametrizedGlobalArtifacts := false - for _, tmpl := range wf.Spec.Templates { - for _, art := range tmpl.Outputs.Artifacts { - if art.GlobalName != "" && isParameter(art.GlobalName) { - hasParametrizedGlobalArtifacts = true - break - } - } - if hasParametrizedGlobalArtifacts { - break - } - } - if hasWorkflowTemplateRef && !hasParametrizedGlobalArtifacts { - // Also check the referenced workflow template - for _, tmpl := range wfSpecHolder.GetWorkflowSpec().Templates { - for _, art := range tmpl.Outputs.Artifacts { - if art.GlobalName != "" && isParameter(art.GlobalName) { - hasParametrizedGlobalArtifacts = true - break - } - } - if hasParametrizedGlobalArtifacts { - break - } - } - } - if hasParametrizedGlobalArtifacts { - ctx.globalParams[anyWorkflowOutputArtifactMagicValue] = "true" - } - _, err = ctx.validateTemplateHolder(tmplHolder, tmplCtx, &wf.Spec.Arguments, opts.WorkflowTemplateValidation) if err != nil { return err @@ -602,10 +570,6 @@ func (ctx *templateValidationCtx) validateTemplateHolder(tmplHolder wfv1.Templat tmplCtx, resolvedTmpl, _, err := tmplCtx.ResolveTemplate(tmplHolder) if err != nil { if argoerr, ok := err.(errors.ArgoError); ok && argoerr.Code() == errors.CodeNotFound { - if tmplRef != nil && strings.Contains(tmplRef.Template, "placeholder") { - // placeholder indicate this is a dynamic template, skip validation - return nil, nil - } if tmplRef != nil { return nil, errors.Errorf(errors.CodeBadRequest, "template reference %s.%s not found", tmplRef.Name, tmplRef.Template) } diff --git a/kubewatch/vendor/github.com/argoproj/pkg/exec/exec.go b/kubewatch/vendor/github.com/argoproj/pkg/exec/exec.go index ddae6b29a..a8f4a6bd4 100644 --- a/kubewatch/vendor/github.com/argoproj/pkg/exec/exec.go +++ b/kubewatch/vendor/github.com/argoproj/pkg/exec/exec.go @@ -2,7 +2,6 @@ package exec import ( "bytes" - "errors" "fmt" "os" "os/exec" @@ -11,6 +10,7 @@ import ( "syscall" "time" + "github.com/pkg/errors" log "github.com/sirupsen/logrus" "github.com/argoproj/pkg/rand" @@ -183,7 +183,7 @@ type WaitPIDOpts struct { // WaitPID waits for a non-child process id to exit func WaitPID(pid int, opts ...WaitPIDOpts) error { if runtime.GOOS != "linux" { - return fmt.Errorf("platform '%s' unsupported", runtime.GOOS) + return errors.Errorf("Platform '%s' unsupported", runtime.GOOS) } var timeout time.Duration pollInterval := time.Second @@ -211,7 +211,7 @@ func WaitPID(pid int, opts ...WaitPIDOpts) error { if os.IsNotExist(err) { return nil } - return err + return errors.WithStack(err) } case <-timoutCh: return ErrWaitPIDTimeout diff --git a/kubewatch/vendor/github.com/argoproj/pkg/file/file.go b/kubewatch/vendor/github.com/argoproj/pkg/file/file.go index 46276533d..b35c7ed0a 100644 --- a/kubewatch/vendor/github.com/argoproj/pkg/file/file.go +++ b/kubewatch/vendor/github.com/argoproj/pkg/file/file.go @@ -2,18 +2,20 @@ package file import ( "os" + + "github.com/pkg/errors" ) // IsDirectory returns whether or not the given file is a directory func IsDirectory(path string) (bool, error) { fileOrDir, err := os.Open(path) if err != nil { - return false, err + return false, errors.WithStack(err) } defer func() { _ = fileOrDir.Close() }() stat, err := fileOrDir.Stat() if err != nil { - return false, err + return false, errors.WithStack(err) } return stat.IsDir(), nil } diff --git a/kubewatch/vendor/github.com/argoproj/pkg/time/time.go b/kubewatch/vendor/github.com/argoproj/pkg/time/time.go deleted file mode 100644 index 8d9b1e1ae..000000000 --- a/kubewatch/vendor/github.com/argoproj/pkg/time/time.go +++ /dev/null @@ -1,46 +0,0 @@ -package time - -import ( - "fmt" - "log" - "regexp" - "strconv" - "time" -) - -var durationRegex = regexp.MustCompile(`^(\d+)([smhd])$`) - -// ParseDuration parses a duration string and returns the time.Duration -func ParseDuration(duration string) (*time.Duration, error) { - matches := durationRegex.FindStringSubmatch(duration) - if len(matches) != 3 { - return nil, fmt.Errorf("Invalid since format '%s'. Expected format (e.g. 3h)\n", duration) - } - amount, err := strconv.ParseInt(matches[1], 10, 64) - if err != nil { - log.Fatal(err) - } - var unit time.Duration - switch matches[2] { - case "s": - unit = time.Second - case "m": - unit = time.Minute - case "h": - unit = time.Hour - case "d": - unit = time.Hour * 24 - } - dur := unit * time.Duration(amount) - return &dur, nil -} - -// ParseSince parses a duration string and returns a time.Time in history relative to current time -func ParseSince(duration string) (*time.Time, error) { - dur, err := ParseDuration(duration) - if err != nil { - return nil, err - } - since := time.Now().UTC().Add(-*dur) - return &since, nil -} diff --git a/kubewatch/vendor/github.com/expr-lang/expr/README.md b/kubewatch/vendor/github.com/expr-lang/expr/README.md index a7ded479c..c0778a84d 100644 --- a/kubewatch/vendor/github.com/expr-lang/expr/README.md +++ b/kubewatch/vendor/github.com/expr-lang/expr/README.md @@ -149,9 +149,8 @@ func main() { * [GoDaddy](https://godaddy.com) employs Expr for the customization of its GoDaddy Pro product. * [ByteDance](https://bytedance.com) incorporates Expr into its internal business rule engine. * [Aviasales](https://aviasales.ru) utilizes Expr as a business rule engine for its flight search engine. -* [Alibaba](https://alibaba.com) uses Expr in a web framework for building recommendation services. -* [Argo](https://argoproj.github.io) integrates Expr into Argo Rollouts and Argo Workflows for Kubernetes. * [Wish.com](https://www.wish.com) employs Expr in its decision-making rule engine for the Wish Assistant. +* [Argo](https://argoproj.github.io) integrates Expr into Argo Rollouts and Argo Workflows for Kubernetes. * [OpenTelemetry](https://opentelemetry.io) integrates Expr into the OpenTelemetry Collector. * [Philips Labs](https://github.com/philips-labs/tabia) employs Expr in Tabia, a tool designed to collect insights on their code bases. * [CrowdSec](https://crowdsec.net) incorporates Expr into its security automation tool. @@ -172,7 +171,6 @@ func main() { * [FastSchema](https://github.com/fastschema/fastschema) - A BaaS leveraging Expr for its customizable and dynamic Access Control system. * [WunderGraph Cosmo](https://github.com/wundergraph/cosmo) - GraphQL Federeration Router uses Expr to customize Middleware behaviour * [SOLO](https://solo.one) uses Expr interally to allow dynamic code execution with custom defined functions. -* [Naoma.AI](https://www.naoma.ai) uses Expr as a part of its call scoring engine. [Add your company too](https://github.com/expr-lang/expr/edit/master/README.md) diff --git a/kubewatch/vendor/github.com/expr-lang/expr/SECURITY.md b/kubewatch/vendor/github.com/expr-lang/expr/SECURITY.md index e18771f5d..8d692a398 100644 --- a/kubewatch/vendor/github.com/expr-lang/expr/SECURITY.md +++ b/kubewatch/vendor/github.com/expr-lang/expr/SECURITY.md @@ -11,8 +11,11 @@ unless this is not possible or feasible with a reasonable effort. | Version | Supported | |---------|--------------------| -| 1.x | :white_check_mark: | -| 0.x | :x: | +| 1.16 | :white_check_mark: | +| 1.15 | :white_check_mark: | +| 1.14 | :white_check_mark: | +| 1.13 | :white_check_mark: | +| < 1.13 | :x: | ## Reporting a Vulnerability diff --git a/kubewatch/vendor/github.com/expr-lang/expr/ast/node.go b/kubewatch/vendor/github.com/expr-lang/expr/ast/node.go index f17fd7e52..02923ac52 100644 --- a/kubewatch/vendor/github.com/expr-lang/expr/ast/node.go +++ b/kubewatch/vendor/github.com/expr-lang/expr/ast/node.go @@ -15,7 +15,7 @@ var ( type Node interface { Location() file.Location SetLocation(file.Location) - Nature() *nature.Nature + Nature() nature.Nature SetNature(nature.Nature) Type() reflect.Type SetType(reflect.Type) @@ -47,8 +47,8 @@ func (n *base) SetLocation(loc file.Location) { } // Nature returns the nature of the node. -func (n *base) Nature() *nature.Nature { - return &n.nature +func (n *base) Nature() nature.Nature { + return n.nature } // SetNature sets the nature of the node. @@ -66,7 +66,7 @@ func (n *base) Type() reflect.Type { // SetType sets the type of the node. func (n *base) SetType(t reflect.Type) { - n.nature = nature.FromType(t) + n.nature.Type = t } // NilNode represents nil. @@ -200,13 +200,12 @@ type PointerNode struct { Name string // Name of the pointer. Like "index" in "#index". } -// ConditionalNode represents a ternary operator or if/else operator. +// ConditionalNode represents a ternary operator. type ConditionalNode struct { base - Ternary bool // Is it ternary or if/else operator? - Cond Node // Condition - Exp1 Node // Expression 1 - Exp2 Node // Expression 2 + Cond Node // Condition of the ternary operator. Like "foo" in "foo ? bar : baz". + Exp1 Node // Expression 1 of the ternary operator. Like "bar" in "foo ? bar : baz". + Exp2 Node // Expression 2 of the ternary operator. Like "baz" in "foo ? bar : baz". } // VariableDeclaratorNode represents a variable declaration. diff --git a/kubewatch/vendor/github.com/expr-lang/expr/ast/print.go b/kubewatch/vendor/github.com/expr-lang/expr/ast/print.go index 527a5b99b..e4e45f0fa 100644 --- a/kubewatch/vendor/github.com/expr-lang/expr/ast/print.go +++ b/kubewatch/vendor/github.com/expr-lang/expr/ast/print.go @@ -207,16 +207,6 @@ func (n *SequenceNode) String() string { } func (n *ConditionalNode) String() string { - if !n.Ternary { - cond := n.Cond.String() - exp1 := n.Exp1.String() - if c2, ok := n.Exp2.(*ConditionalNode); ok && !c2.Ternary { - return fmt.Sprintf("if %s { %s } else %s", cond, exp1, c2.String()) - } - exp2 := n.Exp2.String() - return fmt.Sprintf("if %s { %s } else { %s }", cond, exp1, exp2) - } - var cond, exp1, exp2 string if _, ok := n.Cond.(*ConditionalNode); ok { cond = fmt.Sprintf("(%s)", n.Cond.String()) diff --git a/kubewatch/vendor/github.com/expr-lang/expr/builtin/builtin.go b/kubewatch/vendor/github.com/expr-lang/expr/builtin/builtin.go index 4fe356fbf..c23daf468 100644 --- a/kubewatch/vendor/github.com/expr-lang/expr/builtin/builtin.go +++ b/kubewatch/vendor/github.com/expr-lang/expr/builtin/builtin.go @@ -3,7 +3,6 @@ package builtin import ( "encoding/base64" "encoding/json" - "errors" "fmt" "reflect" "sort" @@ -17,10 +16,6 @@ import ( var ( Index map[string]int Names []string - - // MaxDepth limits the recursion depth for nested structures. - MaxDepth = 10000 - ErrorMaxDepth = errors.New("recursion depth exceeded") ) func init() { @@ -382,7 +377,7 @@ var Builtins = []*Function{ { Name: "max", Func: func(args ...any) (any, error) { - return minMax("max", runtime.Less, 0, args...) + return minMax("max", runtime.Less, args...) }, Validate: func(args []reflect.Type) (reflect.Type, error) { return validateAggregateFunc("max", args) @@ -391,7 +386,7 @@ var Builtins = []*Function{ { Name: "min", Func: func(args ...any) (any, error) { - return minMax("min", runtime.More, 0, args...) + return minMax("min", runtime.More, args...) }, Validate: func(args []reflect.Type) (reflect.Type, error) { return validateAggregateFunc("min", args) @@ -400,7 +395,7 @@ var Builtins = []*Function{ { Name: "mean", Func: func(args ...any) (any, error) { - count, sum, err := mean(0, args...) + count, sum, err := mean(args...) if err != nil { return nil, err } @@ -416,7 +411,7 @@ var Builtins = []*Function{ { Name: "median", Func: func(args ...any) (any, error) { - values, err := median(0, args...) + values, err := median(args...) if err != nil { return nil, err } @@ -945,10 +940,7 @@ var Builtins = []*Function{ if v.Kind() != reflect.Array && v.Kind() != reflect.Slice { return nil, size, fmt.Errorf("cannot flatten %s", v.Kind()) } - ret, err := flatten(v, 0) - if err != nil { - return nil, 0, err - } + ret := flatten(v) size = uint(len(ret)) return ret, size, nil }, diff --git a/kubewatch/vendor/github.com/expr-lang/expr/builtin/lib.go b/kubewatch/vendor/github.com/expr-lang/expr/builtin/lib.go index 07a029b2f..5a70a6b91 100644 --- a/kubewatch/vendor/github.com/expr-lang/expr/builtin/lib.go +++ b/kubewatch/vendor/github.com/expr-lang/expr/builtin/lib.go @@ -253,10 +253,7 @@ func String(arg any) any { return fmt.Sprintf("%v", arg) } -func minMax(name string, fn func(any, any) bool, depth int, args ...any) (any, error) { - if depth > MaxDepth { - return nil, ErrorMaxDepth - } +func minMax(name string, fn func(any, any) bool, args ...any) (any, error) { var val any for _, arg := range args { rv := reflect.ValueOf(arg) @@ -264,7 +261,7 @@ func minMax(name string, fn func(any, any) bool, depth int, args ...any) (any, e case reflect.Array, reflect.Slice: size := rv.Len() for i := 0; i < size; i++ { - elemVal, err := minMax(name, fn, depth+1, rv.Index(i).Interface()) + elemVal, err := minMax(name, fn, rv.Index(i).Interface()) if err != nil { return nil, err } @@ -297,10 +294,7 @@ func minMax(name string, fn func(any, any) bool, depth int, args ...any) (any, e return val, nil } -func mean(depth int, args ...any) (int, float64, error) { - if depth > MaxDepth { - return 0, 0, ErrorMaxDepth - } +func mean(args ...any) (int, float64, error) { var total float64 var count int @@ -310,7 +304,7 @@ func mean(depth int, args ...any) (int, float64, error) { case reflect.Array, reflect.Slice: size := rv.Len() for i := 0; i < size; i++ { - elemCount, elemSum, err := mean(depth+1, rv.Index(i).Interface()) + elemCount, elemSum, err := mean(rv.Index(i).Interface()) if err != nil { return 0, 0, err } @@ -333,10 +327,7 @@ func mean(depth int, args ...any) (int, float64, error) { return count, total, nil } -func median(depth int, args ...any) ([]float64, error) { - if depth > MaxDepth { - return nil, ErrorMaxDepth - } +func median(args ...any) ([]float64, error) { var values []float64 for _, arg := range args { @@ -345,7 +336,7 @@ func median(depth int, args ...any) ([]float64, error) { case reflect.Array, reflect.Slice: size := rv.Len() for i := 0; i < size; i++ { - elems, err := median(depth+1, rv.Index(i).Interface()) + elems, err := median(rv.Index(i).Interface()) if err != nil { return nil, err } @@ -364,24 +355,18 @@ func median(depth int, args ...any) ([]float64, error) { return values, nil } -func flatten(arg reflect.Value, depth int) ([]any, error) { - if depth > MaxDepth { - return nil, ErrorMaxDepth - } +func flatten(arg reflect.Value) []any { ret := []any{} for i := 0; i < arg.Len(); i++ { v := deref.Value(arg.Index(i)) if v.Kind() == reflect.Array || v.Kind() == reflect.Slice { - x, err := flatten(v, depth+1) - if err != nil { - return nil, err - } + x := flatten(v) ret = append(ret, x...) } else { ret = append(ret, v.Interface()) } } - return ret, nil + return ret } func get(params ...any) (out any, err error) { @@ -389,10 +374,6 @@ func get(params ...any) (out any, err error) { i := params[1] v := reflect.ValueOf(from) - if from == nil { - return nil, nil - } - if v.Kind() == reflect.Invalid { panic(fmt.Sprintf("cannot fetch %v from %T", i, from)) } @@ -436,14 +417,10 @@ func get(params ...any) (out any, err error) { fieldName := i.(string) value := v.FieldByNameFunc(func(name string) bool { field, _ := v.Type().FieldByName(name) - switch field.Tag.Get("expr") { - case "-": - return false - case fieldName: + if field.Tag.Get("expr") == fieldName { return true - default: - return name == fieldName } + return name == fieldName }) if value.IsValid() { return value.Interface(), nil diff --git a/kubewatch/vendor/github.com/expr-lang/expr/checker/checker.go b/kubewatch/vendor/github.com/expr-lang/expr/checker/checker.go index 0ed0d1e3b..f49234137 100644 --- a/kubewatch/vendor/github.com/expr-lang/expr/checker/checker.go +++ b/kubewatch/vendor/github.com/expr-lang/expr/checker/checker.go @@ -4,7 +4,6 @@ import ( "fmt" "reflect" "regexp" - "time" "github.com/expr-lang/expr/ast" "github.com/expr-lang/expr/builtin" @@ -14,90 +13,17 @@ import ( "github.com/expr-lang/expr/parser" ) -var ( - anyType = reflect.TypeOf(new(any)).Elem() - boolType = reflect.TypeOf(true) - intType = reflect.TypeOf(0) - floatType = reflect.TypeOf(float64(0)) - stringType = reflect.TypeOf("") - arrayType = reflect.TypeOf([]any{}) - mapType = reflect.TypeOf(map[string]any{}) - timeType = reflect.TypeOf(time.Time{}) - durationType = reflect.TypeOf(time.Duration(0)) - - anyTypeSlice = []reflect.Type{anyType} -) - -// ParseCheck parses input expression and checks its types. Also, it applies -// all provided patchers. In case of error, it returns error with a tree. -func ParseCheck(input string, config *conf.Config) (*parser.Tree, error) { - tree, err := parser.ParseWithConfig(input, config) - if err != nil { - return tree, err - } - - _, err = new(Checker).PatchAndCheck(tree, config) - if err != nil { - return tree, err - } - - return tree, nil -} - -// Check calls Check on a disposable Checker. -func Check(tree *parser.Tree, config *conf.Config) (reflect.Type, error) { - return new(Checker).Check(tree, config) -} - -type Checker struct { - config *conf.Config - predicateScopes []predicateScope - varScopes []varScope - err *file.Error - needsReset bool -} - -type predicateScope struct { - collection Nature - vars []varScope -} - -type varScope struct { - name string - nature Nature -} - -// PatchAndCheck applies all patchers and checks the tree. -func (v *Checker) PatchAndCheck(tree *parser.Tree, config *conf.Config) (reflect.Type, error) { - v.reset(config) - if len(config.Visitors) > 0 { - // Run all patchers that dont support being run repeatedly first - v.runVisitors(tree, false) - - // Run patchers that require multiple passes next (currently only Operator patching) - v.runVisitors(tree, true) - } - return v.Check(tree, config) -} - -// Check checks types of the expression tree. It returns type of the expression -// and error if any. If config is nil, then default configuration will be used. -func (v *Checker) Check(tree *parser.Tree, config *conf.Config) (reflect.Type, error) { - v.reset(config) - return v.check(tree) -} - // Run visitors in a given config over the given tree // runRepeatable controls whether to filter for only vistors that require multiple passes or not -func (v *Checker) runVisitors(tree *parser.Tree, runRepeatable bool) { +func runVisitors(tree *parser.Tree, config *conf.Config, runRepeatable bool) { for { more := false - for _, visitor := range v.config.Visitors { + for _, v := range config.Visitors { // We need to perform types check, because some visitors may rely on // types information available in the tree. - _, _ = v.Check(tree, v.config) + _, _ = Check(tree, config) - r, repeatable := visitor.(interface { + r, repeatable := v.(interface { Reset() ShouldRepeat() bool }) @@ -105,12 +31,12 @@ func (v *Checker) runVisitors(tree *parser.Tree, runRepeatable bool) { if repeatable { if runRepeatable { r.Reset() - ast.Walk(&tree.Node, visitor) + ast.Walk(&tree.Node, v) more = more || r.ShouldRepeat() } } else { if !runRepeatable { - ast.Walk(&tree.Node, visitor) + ast.Walk(&tree.Node, v) } } } @@ -121,7 +47,38 @@ func (v *Checker) runVisitors(tree *parser.Tree, runRepeatable bool) { } } -func (v *Checker) check(tree *parser.Tree) (reflect.Type, error) { +// ParseCheck parses input expression and checks its types. Also, it applies +// all provided patchers. In case of error, it returns error with a tree. +func ParseCheck(input string, config *conf.Config) (*parser.Tree, error) { + tree, err := parser.ParseWithConfig(input, config) + if err != nil { + return tree, err + } + + if len(config.Visitors) > 0 { + // Run all patchers that dont support being run repeatedly first + runVisitors(tree, config, false) + + // Run patchers that require multiple passes next (currently only Operator patching) + runVisitors(tree, config, true) + } + _, err = Check(tree, config) + if err != nil { + return tree, err + } + + return tree, nil +} + +// Check checks types of the expression tree. It returns type of the expression +// and error if any. If config is nil, then default configuration will be used. +func Check(tree *parser.Tree, config *conf.Config) (reflect.Type, error) { + if config == nil { + config = conf.New(nil) + } + + v := &checker{config: config} + nt := v.visit(tree.Node) // To keep compatibility with previous versions, we should return any, if nature is unknown. @@ -136,19 +93,19 @@ func (v *Checker) check(tree *parser.Tree) (reflect.Type, error) { if v.config.Expect != reflect.Invalid { if v.config.ExpectAny { - if nt.IsUnknown(&v.config.NtCache) { + if isUnknown(nt) { return t, nil } } switch v.config.Expect { case reflect.Int, reflect.Int64, reflect.Float64: - if !nt.IsNumber() { - return nil, fmt.Errorf("expected %v, but got %s", v.config.Expect, nt.String()) + if !isNumber(nt) { + return nil, fmt.Errorf("expected %v, but got %v", v.config.Expect, nt) } default: - if nt.Kind != v.config.Expect { - return nil, fmt.Errorf("expected %v, but got %s", v.config.Expect, nt.String()) + if nt.Kind() != v.config.Expect { + return nil, fmt.Errorf("expected %v, but got %s", v.config.Expect, nt) } } } @@ -156,76 +113,81 @@ func (v *Checker) check(tree *parser.Tree) (reflect.Type, error) { return t, nil } -func (v *Checker) reset(config *conf.Config) { - if v.needsReset { - clearSlice(v.predicateScopes) - clearSlice(v.varScopes) - v.predicateScopes = v.predicateScopes[:0] - v.varScopes = v.varScopes[:0] - v.err = nil - } - v.needsReset = true +type checker struct { + config *conf.Config + predicateScopes []predicateScope + varScopes []varScope + err *file.Error +} - if config == nil { - config = conf.New(nil) - } - v.config = config +type predicateScope struct { + collection Nature + vars map[string]Nature } -func clearSlice[S ~[]E, E any](s S) { - var zero E - for i := range s { - s[i] = zero - } +type varScope struct { + name string + nature Nature } -func (v *Checker) visit(node ast.Node) Nature { +type info struct { + method bool + fn *builtin.Function + + // elem is element type of array or map. + // Arrays created with type []any, but + // we would like to detect expressions + // like `42 in ["a"]` as invalid. + elem reflect.Type +} + +func (v *checker) visit(node ast.Node) Nature { var nt Nature switch n := node.(type) { case *ast.NilNode: - nt = v.config.NtCache.NatureOf(nil) + nt = v.NilNode(n) case *ast.IdentifierNode: - nt = v.identifierNode(n) + nt = v.IdentifierNode(n) case *ast.IntegerNode: - nt = v.config.NtCache.FromType(intType) + nt = v.IntegerNode(n) case *ast.FloatNode: - nt = v.config.NtCache.FromType(floatType) + nt = v.FloatNode(n) case *ast.BoolNode: - nt = v.config.NtCache.FromType(boolType) + nt = v.BoolNode(n) case *ast.StringNode: - nt = v.config.NtCache.FromType(stringType) + nt = v.StringNode(n) case *ast.ConstantNode: - nt = v.config.NtCache.FromType(reflect.TypeOf(n.Value)) + nt = v.ConstantNode(n) case *ast.UnaryNode: - nt = v.unaryNode(n) + nt = v.UnaryNode(n) case *ast.BinaryNode: - nt = v.binaryNode(n) + nt = v.BinaryNode(n) case *ast.ChainNode: - nt = v.chainNode(n) + nt = v.ChainNode(n) case *ast.MemberNode: - nt = v.memberNode(n) + nt = v.MemberNode(n) case *ast.SliceNode: - nt = v.sliceNode(n) + nt = v.SliceNode(n) case *ast.CallNode: - nt = v.callNode(n) + nt = v.CallNode(n) case *ast.BuiltinNode: - nt = v.builtinNode(n) + nt = v.BuiltinNode(n) case *ast.PredicateNode: - nt = v.predicateNode(n) + nt = v.PredicateNode(n) case *ast.PointerNode: - nt = v.pointerNode(n) + nt = v.PointerNode(n) case *ast.VariableDeclaratorNode: - nt = v.variableDeclaratorNode(n) + nt = v.VariableDeclaratorNode(n) case *ast.SequenceNode: - nt = v.sequenceNode(n) + nt = v.SequenceNode(n) case *ast.ConditionalNode: - nt = v.conditionalNode(n) + nt = v.ConditionalNode(n) case *ast.ArrayNode: - nt = v.arrayNode(n) + nt = v.ArrayNode(n) case *ast.MapNode: - nt = v.mapNode(n) + nt = v.MapNode(n) case *ast.PairNode: - nt = v.pairNode(n) + nt = v.PairNode(n) default: panic(fmt.Sprintf("undefined node type (%T)", node)) } @@ -233,226 +195,236 @@ func (v *Checker) visit(node ast.Node) Nature { return nt } -func (v *Checker) error(node ast.Node, format string, args ...any) Nature { +func (v *checker) error(node ast.Node, format string, args ...any) Nature { if v.err == nil { // show first error v.err = &file.Error{ Location: node.Location(), Message: fmt.Sprintf(format, args...), } } - return Nature{} + return unknown } -func (v *Checker) identifierNode(node *ast.IdentifierNode) Nature { - for i := len(v.varScopes) - 1; i >= 0; i-- { - if v.varScopes[i].name == node.Value { - return v.varScopes[i].nature - } +func (v *checker) NilNode(*ast.NilNode) Nature { + return nilNature +} + +func (v *checker) IdentifierNode(node *ast.IdentifierNode) Nature { + if variable, ok := v.lookupVariable(node.Value); ok { + return variable.nature } if node.Value == "$env" { - return Nature{} + return unknown } return v.ident(node, node.Value, v.config.Strict, true) } // ident method returns type of environment variable, builtin or function. -func (v *Checker) ident(node ast.Node, name string, strict, builtins bool) Nature { - if nt, ok := v.config.Env.Get(&v.config.NtCache, name); ok { +func (v *checker) ident(node ast.Node, name string, strict, builtins bool) Nature { + if nt, ok := v.config.Env.Get(name); ok { return nt } if builtins { if fn, ok := v.config.Functions[name]; ok { - nt := v.config.NtCache.FromType(fn.Type()) - if nt.TypeData == nil { - nt.TypeData = new(TypeData) - } - nt.TypeData.Func = fn - return nt + return Nature{Type: fn.Type(), Func: fn} } if fn, ok := v.config.Builtins[name]; ok { - nt := v.config.NtCache.FromType(fn.Type()) - if nt.TypeData == nil { - nt.TypeData = new(TypeData) - } - nt.TypeData.Func = fn - return nt + return Nature{Type: fn.Type(), Func: fn} } } if v.config.Strict && strict { - return v.error(node, "unknown name %s", name) + return v.error(node, "unknown name %v", name) } - return Nature{} + return unknown +} + +func (v *checker) IntegerNode(*ast.IntegerNode) Nature { + return integerNature } -func (v *Checker) unaryNode(node *ast.UnaryNode) Nature { +func (v *checker) FloatNode(*ast.FloatNode) Nature { + return floatNature +} + +func (v *checker) BoolNode(*ast.BoolNode) Nature { + return boolNature +} + +func (v *checker) StringNode(*ast.StringNode) Nature { + return stringNature +} + +func (v *checker) ConstantNode(node *ast.ConstantNode) Nature { + return Nature{Type: reflect.TypeOf(node.Value)} +} + +func (v *checker) UnaryNode(node *ast.UnaryNode) Nature { nt := v.visit(node.Node) - nt = nt.Deref(&v.config.NtCache) + nt = nt.Deref() switch node.Operator { case "!", "not": - if nt.IsBool() { - return v.config.NtCache.FromType(boolType) + if isBool(nt) { + return boolNature } - if nt.IsUnknown(&v.config.NtCache) { - return v.config.NtCache.FromType(boolType) + if isUnknown(nt) { + return boolNature } case "+", "-": - if nt.IsNumber() { + if isNumber(nt) { return nt } - if nt.IsUnknown(&v.config.NtCache) { - return Nature{} + if isUnknown(nt) { + return unknown } default: - return v.error(node, "unknown operator (%s)", node.Operator) + return v.error(node, "unknown operator (%v)", node.Operator) } - return v.error(node, `invalid operation: %s (mismatched type %s)`, node.Operator, nt.String()) + return v.error(node, `invalid operation: %v (mismatched type %s)`, node.Operator, nt) } -func (v *Checker) binaryNode(node *ast.BinaryNode) Nature { +func (v *checker) BinaryNode(node *ast.BinaryNode) Nature { l := v.visit(node.Left) r := v.visit(node.Right) - l = l.Deref(&v.config.NtCache) - r = r.Deref(&v.config.NtCache) + l = l.Deref() + r = r.Deref() switch node.Operator { case "==", "!=": - if l.ComparableTo(&v.config.NtCache, r) { - return v.config.NtCache.FromType(boolType) + if isComparable(l, r) { + return boolNature } case "or", "||", "and", "&&": - if l.IsBool() && r.IsBool() { - return v.config.NtCache.FromType(boolType) + if isBool(l) && isBool(r) { + return boolNature } - if l.MaybeCompatible(&v.config.NtCache, r, BoolCheck) { - return v.config.NtCache.FromType(boolType) + if or(l, r, isBool) { + return boolNature } case "<", ">", ">=", "<=": - if l.IsNumber() && r.IsNumber() { - return v.config.NtCache.FromType(boolType) + if isNumber(l) && isNumber(r) { + return boolNature } - if l.IsString() && r.IsString() { - return v.config.NtCache.FromType(boolType) + if isString(l) && isString(r) { + return boolNature } - if l.IsTime() && r.IsTime() { - return v.config.NtCache.FromType(boolType) + if isTime(l) && isTime(r) { + return boolNature } - if l.IsDuration() && r.IsDuration() { - return v.config.NtCache.FromType(boolType) + if isDuration(l) && isDuration(r) { + return boolNature } - if l.MaybeCompatible(&v.config.NtCache, r, NumberCheck, StringCheck, TimeCheck, DurationCheck) { - return v.config.NtCache.FromType(boolType) + if or(l, r, isNumber, isString, isTime, isDuration) { + return boolNature } case "-": - if l.IsNumber() && r.IsNumber() { - return l.PromoteNumericNature(&v.config.NtCache, r) + if isNumber(l) && isNumber(r) { + return combined(l, r) } - if l.IsTime() && r.IsTime() { - return v.config.NtCache.FromType(durationType) + if isTime(l) && isTime(r) { + return durationNature } - if l.IsTime() && r.IsDuration() { - return v.config.NtCache.FromType(timeType) + if isTime(l) && isDuration(r) { + return timeNature } - if l.IsDuration() && r.IsDuration() { - return v.config.NtCache.FromType(durationType) + if isDuration(l) && isDuration(r) { + return durationNature } - if l.MaybeCompatible(&v.config.NtCache, r, NumberCheck, TimeCheck, DurationCheck) { - return Nature{} + if or(l, r, isNumber, isTime, isDuration) { + return unknown } case "*": - if l.IsNumber() && r.IsNumber() { - return l.PromoteNumericNature(&v.config.NtCache, r) + if isNumber(l) && isNumber(r) { + return combined(l, r) } - if l.IsNumber() && r.IsDuration() { - return v.config.NtCache.FromType(durationType) + if isNumber(l) && isDuration(r) { + return durationNature } - if l.IsDuration() && r.IsNumber() { - return v.config.NtCache.FromType(durationType) + if isDuration(l) && isNumber(r) { + return durationNature } - if l.IsDuration() && r.IsDuration() { - return v.config.NtCache.FromType(durationType) + if isDuration(l) && isDuration(r) { + return durationNature } - if l.MaybeCompatible(&v.config.NtCache, r, NumberCheck, DurationCheck) { - return Nature{} + if or(l, r, isNumber, isDuration) { + return unknown } case "/": - if l.IsNumber() && r.IsNumber() { - return v.config.NtCache.FromType(floatType) + if isNumber(l) && isNumber(r) { + return floatNature } - if l.MaybeCompatible(&v.config.NtCache, r, NumberCheck) { - return v.config.NtCache.FromType(floatType) + if or(l, r, isNumber) { + return floatNature } case "**", "^": - if l.IsNumber() && r.IsNumber() { - return v.config.NtCache.FromType(floatType) + if isNumber(l) && isNumber(r) { + return floatNature } - if l.MaybeCompatible(&v.config.NtCache, r, NumberCheck) { - return v.config.NtCache.FromType(floatType) + if or(l, r, isNumber) { + return floatNature } case "%": - if l.IsInteger && r.IsInteger { - return v.config.NtCache.FromType(intType) + if isInteger(l) && isInteger(r) { + return integerNature } - if l.MaybeCompatible(&v.config.NtCache, r, IntegerCheck) { - return v.config.NtCache.FromType(intType) + if or(l, r, isInteger) { + return integerNature } case "+": - if l.IsNumber() && r.IsNumber() { - return l.PromoteNumericNature(&v.config.NtCache, r) + if isNumber(l) && isNumber(r) { + return combined(l, r) } - if l.IsString() && r.IsString() { - return v.config.NtCache.FromType(stringType) + if isString(l) && isString(r) { + return stringNature } - if l.IsTime() && r.IsDuration() { - return v.config.NtCache.FromType(timeType) + if isTime(l) && isDuration(r) { + return timeNature } - if l.IsDuration() && r.IsTime() { - return v.config.NtCache.FromType(timeType) + if isDuration(l) && isTime(r) { + return timeNature } - if l.IsDuration() && r.IsDuration() { - return v.config.NtCache.FromType(durationType) + if isDuration(l) && isDuration(r) { + return durationNature } - if l.MaybeCompatible(&v.config.NtCache, r, NumberCheck, StringCheck, TimeCheck, DurationCheck) { - return Nature{} + if or(l, r, isNumber, isString, isTime, isDuration) { + return unknown } case "in": - if (l.IsString() || l.IsUnknown(&v.config.NtCache)) && r.IsStruct() { - return v.config.NtCache.FromType(boolType) + if (isString(l) || isUnknown(l)) && isStruct(r) { + return boolNature } - if r.IsMap() { - rKey := r.Key(&v.config.NtCache) - if !l.IsUnknown(&v.config.NtCache) && !l.AssignableTo(rKey) { - return v.error(node, "cannot use %s as type %s in map key", l.String(), rKey.String()) + if isMap(r) { + if !isUnknown(l) && !l.AssignableTo(r.Key()) { + return v.error(node, "cannot use %v as type %v in map key", l, r.Key()) } - return v.config.NtCache.FromType(boolType) + return boolNature } - if r.IsArray() { - rElem := r.Elem(&v.config.NtCache) - if !l.ComparableTo(&v.config.NtCache, rElem) { - return v.error(node, "cannot use %s as type %s in array", l.String(), rElem.String()) + if isArray(r) { + if !isComparable(l, r.Elem()) { + return v.error(node, "cannot use %v as type %v in array", l, r.Elem()) } - return v.config.NtCache.FromType(boolType) + return boolNature } - if l.IsUnknown(&v.config.NtCache) && r.IsAnyOf(StringCheck, ArrayCheck, MapCheck) { - return v.config.NtCache.FromType(boolType) + if isUnknown(l) && anyOf(r, isString, isArray, isMap) { + return boolNature } - if r.IsUnknown(&v.config.NtCache) { - return v.config.NtCache.FromType(boolType) + if isUnknown(r) { + return boolNature } case "matches": @@ -462,54 +434,57 @@ func (v *Checker) binaryNode(node *ast.BinaryNode) Nature { return v.error(node, err.Error()) } } - if (l.IsString() || l.IsByteSlice()) && r.IsString() { - return v.config.NtCache.FromType(boolType) + if isString(l) && isString(r) { + return boolNature } - if l.MaybeCompatible(&v.config.NtCache, r, StringCheck) { - return v.config.NtCache.FromType(boolType) + if or(l, r, isString) { + return boolNature } case "contains", "startsWith", "endsWith": - if l.IsString() && r.IsString() { - return v.config.NtCache.FromType(boolType) + if isString(l) && isString(r) { + return boolNature } - if l.MaybeCompatible(&v.config.NtCache, r, StringCheck) { - return v.config.NtCache.FromType(boolType) + if or(l, r, isString) { + return boolNature } case "..": - if l.IsInteger && r.IsInteger || l.MaybeCompatible(&v.config.NtCache, r, IntegerCheck) { - return ArrayFromType(&v.config.NtCache, intType) + if isInteger(l) && isInteger(r) { + return arrayOf(integerNature) + } + if or(l, r, isInteger) { + return arrayOf(integerNature) } case "??": - if l.Nil && !r.Nil { + if isNil(l) && !isNil(r) { return r } - if !l.Nil && r.Nil { + if !isNil(l) && isNil(r) { return l } - if l.Nil && r.Nil { - return v.config.NtCache.NatureOf(nil) + if isNil(l) && isNil(r) { + return nilNature } if r.AssignableTo(l) { return l } - return Nature{} + return unknown default: - return v.error(node, "unknown operator (%s)", node.Operator) + return v.error(node, "unknown operator (%v)", node.Operator) } - return v.error(node, `invalid operation: %s (mismatched types %s and %s)`, node.Operator, l.String(), r.String()) + return v.error(node, `invalid operation: %v (mismatched types %v and %v)`, node.Operator, l, r) } -func (v *Checker) chainNode(node *ast.ChainNode) Nature { +func (v *checker) ChainNode(node *ast.ChainNode) Nature { return v.visit(node.Node) } -func (v *Checker) memberNode(node *ast.MemberNode) Nature { +func (v *checker) MemberNode(node *ast.MemberNode) Nature { // $env variable if an, ok := node.Node.(*ast.IdentifierNode); ok && an.Value == "$env" { if name, ok := node.Property.(*ast.StringNode); ok { @@ -523,68 +498,60 @@ func (v *Checker) memberNode(node *ast.MemberNode) Nature { } return v.ident(node, name.Value, strict, false /* no builtins and no functions */) } - return Nature{} + return unknown } base := v.visit(node.Node) prop := v.visit(node.Property) - if base.IsUnknown(&v.config.NtCache) { - return Nature{} + if isUnknown(base) { + return unknown } if name, ok := node.Property.(*ast.StringNode); ok { - if base.Nil { - return v.error(node, "type nil has no field %s", name.Value) + if isNil(base) { + return v.error(node, "type nil has no field %v", name.Value) } // First, check methods defined on base type itself, // independent of which type it is. Without dereferencing. - if m, ok := base.MethodByName(&v.config.NtCache, name.Value); ok { + if m, ok := base.MethodByName(name.Value); ok { return m } } - base = base.Deref(&v.config.NtCache) + base = base.Deref() - switch base.Kind { + switch base.Kind() { case reflect.Map: - // If the map key is a pointer, we should not dereference the property. - if !prop.AssignableTo(base.Key(&v.config.NtCache)) { - propDeref := prop.Deref(&v.config.NtCache) - if propDeref.AssignableTo(base.Key(&v.config.NtCache)) { - prop = propDeref - } - } - if !prop.AssignableTo(base.Key(&v.config.NtCache)) && !prop.IsUnknown(&v.config.NtCache) { - return v.error(node.Property, "cannot use %s to get an element from %s", prop.String(), base.String()) + if !prop.AssignableTo(base.Key()) && !isUnknown(prop) { + return v.error(node.Property, "cannot use %v to get an element from %v", prop, base) } - if prop, ok := node.Property.(*ast.StringNode); ok && base.TypeData != nil { + if prop, ok := node.Property.(*ast.StringNode); ok { if field, ok := base.Fields[prop.Value]; ok { return field } else if base.Strict { - return v.error(node.Property, "unknown field %s", prop.Value) + return v.error(node.Property, "unknown field %v", prop.Value) } } - return base.Elem(&v.config.NtCache) + return base.Elem() case reflect.Array, reflect.Slice: - prop = prop.Deref(&v.config.NtCache) - if !prop.IsInteger && !prop.IsUnknown(&v.config.NtCache) { - return v.error(node.Property, "array elements can only be selected using an integer (got %s)", prop.String()) + if !isInteger(prop) && !isUnknown(prop) { + return v.error(node.Property, "array elements can only be selected using an integer (got %v)", prop) } - return base.Elem(&v.config.NtCache) + return base.Elem() case reflect.Struct: if name, ok := node.Property.(*ast.StringNode); ok { propertyName := name.Value - if field, ok := base.FieldByName(&v.config.NtCache, propertyName); ok { - return v.config.NtCache.FromType(field.Type) + if field, ok := base.FieldByName(propertyName); ok { + return Nature{Type: field.Type} } if node.Method { - return v.error(node, "type %v has no method %v", base.String(), propertyName) + return v.error(node, "type %v has no method %v", base, propertyName) } - return v.error(node, "type %v has no field %v", base.String(), propertyName) + return v.error(node, "type %v has no field %v", base, propertyName) } } @@ -592,47 +559,47 @@ func (v *Checker) memberNode(node *ast.MemberNode) Nature { if name, ok := node.Property.(*ast.StringNode); ok { if node.Method { - return v.error(node, "type %v has no method %v", base.String(), name.Value) + return v.error(node, "type %v has no method %v", base, name.Value) } - return v.error(node, "type %v has no field %v", base.String(), name.Value) + return v.error(node, "type %v has no field %v", base, name.Value) } - return v.error(node, "type %v[%v] is undefined", base.String(), prop.String()) + return v.error(node, "type %v[%v] is undefined", base, prop) } -func (v *Checker) sliceNode(node *ast.SliceNode) Nature { +func (v *checker) SliceNode(node *ast.SliceNode) Nature { nt := v.visit(node.Node) - if nt.IsUnknown(&v.config.NtCache) { - return Nature{} + if isUnknown(nt) { + return unknown } - switch nt.Kind { + switch nt.Kind() { case reflect.String, reflect.Array, reflect.Slice: // ok default: - return v.error(node, "cannot slice %s", nt.String()) + return v.error(node, "cannot slice %s", nt) } if node.From != nil { from := v.visit(node.From) - from = from.Deref(&v.config.NtCache) - if !from.IsInteger && !from.IsUnknown(&v.config.NtCache) { - return v.error(node.From, "non-integer slice index %v", from.String()) + if !isInteger(from) && !isUnknown(from) { + return v.error(node.From, "non-integer slice index %v", from) } } if node.To != nil { to := v.visit(node.To) - to = to.Deref(&v.config.NtCache) - if !to.IsInteger && !to.IsUnknown(&v.config.NtCache) { - return v.error(node.To, "non-integer slice index %v", to.String()) + if !isInteger(to) && !isUnknown(to) { + return v.error(node.To, "non-integer slice index %v", to) } } return nt } -func (v *Checker) callNode(node *ast.CallNode) Nature { +func (v *checker) CallNode(node *ast.CallNode) Nature { + nt := v.functionReturnType(node) + // Check if type was set on node (for example, by patcher) // and use node type instead of function return type. // @@ -644,17 +611,18 @@ func (v *Checker) callNode(node *ast.CallNode) Nature { // fix `errCall()` to return proper type, so on second // checker pass we should replace anyType on method node // with new correct function return type. - if typ := node.Type(); typ != nil && typ != anyType { - return *node.Nature() + if node.Type() != nil && node.Type() != anyType { + return node.Nature() } + return nt +} + +func (v *checker) functionReturnType(node *ast.CallNode) Nature { nt := v.visit(node.Callee) - if nt.IsUnknown(&v.config.NtCache) { - return Nature{} - } - if nt.TypeData != nil && nt.TypeData.Func != nil { - return v.checkFunction(nt.TypeData.Func, node, node.Arguments) + if nt.Func != nil { + return v.checkFunction(nt.Func, node, node.Arguments) } fnName := "function" @@ -667,126 +635,122 @@ func (v *Checker) callNode(node *ast.CallNode) Nature { } } - if nt.Nil { + if isUnknown(nt) { + return unknown + } + + if isNil(nt) { return v.error(node, "%v is nil; cannot call nil as function", fnName) } - if nt.Kind == reflect.Func { + switch nt.Kind() { + case reflect.Func: outType, err := v.checkArguments(fnName, nt, node.Arguments, node) if err != nil { if v.err == nil { v.err = err } - return Nature{} + return unknown } return outType } - return v.error(node, "%s is not callable", nt.String()) + return v.error(node, "%s is not callable", nt) } -func (v *Checker) builtinNode(node *ast.BuiltinNode) Nature { +func (v *checker) BuiltinNode(node *ast.BuiltinNode) Nature { switch node.Name { case "all", "none", "any", "one": - collection := v.visit(node.Arguments[0]) - collection = collection.Deref(&v.config.NtCache) - if !collection.IsArray() && !collection.IsUnknown(&v.config.NtCache) { - return v.error(node.Arguments[0], "builtin %v takes only array (got %v)", node.Name, collection.String()) + collection := v.visit(node.Arguments[0]).Deref() + if !isArray(collection) && !isUnknown(collection) { + return v.error(node.Arguments[0], "builtin %v takes only array (got %v)", node.Name, collection) } v.begin(collection) predicate := v.visit(node.Arguments[1]) v.end() - if predicate.IsFunc() && + if isFunc(predicate) && predicate.NumOut() == 1 && - predicate.NumIn() == 1 && predicate.IsFirstArgUnknown(&v.config.NtCache) { + predicate.NumIn() == 1 && isUnknown(predicate.In(0)) { - predicateOut := predicate.Out(&v.config.NtCache, 0) - if !predicateOut.IsBool() && !predicateOut.IsUnknown(&v.config.NtCache) { - return v.error(node.Arguments[1], "predicate should return boolean (got %s)", predicateOut.String()) + if !isBool(predicate.Out(0)) && !isUnknown(predicate.Out(0)) { + return v.error(node.Arguments[1], "predicate should return boolean (got %v)", predicate.Out(0).String()) } - return v.config.NtCache.FromType(boolType) + return boolNature } return v.error(node.Arguments[1], "predicate should has one input and one output param") case "filter": - collection := v.visit(node.Arguments[0]) - collection = collection.Deref(&v.config.NtCache) - if !collection.IsArray() && !collection.IsUnknown(&v.config.NtCache) { - return v.error(node.Arguments[0], "builtin %v takes only array (got %v)", node.Name, collection.String()) + collection := v.visit(node.Arguments[0]).Deref() + if !isArray(collection) && !isUnknown(collection) { + return v.error(node.Arguments[0], "builtin %v takes only array (got %v)", node.Name, collection) } v.begin(collection) predicate := v.visit(node.Arguments[1]) v.end() - if predicate.IsFunc() && + if isFunc(predicate) && predicate.NumOut() == 1 && - predicate.NumIn() == 1 && predicate.IsFirstArgUnknown(&v.config.NtCache) { + predicate.NumIn() == 1 && isUnknown(predicate.In(0)) { - predicateOut := predicate.Out(&v.config.NtCache, 0) - if !predicateOut.IsBool() && !predicateOut.IsUnknown(&v.config.NtCache) { - return v.error(node.Arguments[1], "predicate should return boolean (got %s)", predicateOut.String()) + if !isBool(predicate.Out(0)) && !isUnknown(predicate.Out(0)) { + return v.error(node.Arguments[1], "predicate should return boolean (got %v)", predicate.Out(0).String()) } - if collection.IsUnknown(&v.config.NtCache) { - return v.config.NtCache.FromType(arrayType) + if isUnknown(collection) { + return arrayNature } - collection = collection.Elem(&v.config.NtCache) - return collection.MakeArrayOf(&v.config.NtCache) + return arrayOf(collection.Elem()) } return v.error(node.Arguments[1], "predicate should has one input and one output param") case "map": - collection := v.visit(node.Arguments[0]) - collection = collection.Deref(&v.config.NtCache) - if !collection.IsArray() && !collection.IsUnknown(&v.config.NtCache) { - return v.error(node.Arguments[0], "builtin %v takes only array (got %v)", node.Name, collection.String()) + collection := v.visit(node.Arguments[0]).Deref() + if !isArray(collection) && !isUnknown(collection) { + return v.error(node.Arguments[0], "builtin %v takes only array (got %v)", node.Name, collection) } - v.begin(collection, varScope{"index", v.config.NtCache.FromType(intType)}) + v.begin(collection, scopeVar{"index", integerNature}) predicate := v.visit(node.Arguments[1]) v.end() - if predicate.IsFunc() && + if isFunc(predicate) && predicate.NumOut() == 1 && - predicate.NumIn() == 1 && predicate.IsFirstArgUnknown(&v.config.NtCache) { + predicate.NumIn() == 1 && isUnknown(predicate.In(0)) { - return predicate.Ref.MakeArrayOf(&v.config.NtCache) + return arrayOf(*predicate.PredicateOut) } return v.error(node.Arguments[1], "predicate should has one input and one output param") case "count": - collection := v.visit(node.Arguments[0]) - collection = collection.Deref(&v.config.NtCache) - if !collection.IsArray() && !collection.IsUnknown(&v.config.NtCache) { - return v.error(node.Arguments[0], "builtin %v takes only array (got %v)", node.Name, collection.String()) + collection := v.visit(node.Arguments[0]).Deref() + if !isArray(collection) && !isUnknown(collection) { + return v.error(node.Arguments[0], "builtin %v takes only array (got %v)", node.Name, collection) } if len(node.Arguments) == 1 { - return v.config.NtCache.FromType(intType) + return integerNature } v.begin(collection) predicate := v.visit(node.Arguments[1]) v.end() - if predicate.IsFunc() && + if isFunc(predicate) && predicate.NumOut() == 1 && - predicate.NumIn() == 1 && predicate.IsFirstArgUnknown(&v.config.NtCache) { - predicateOut := predicate.Out(&v.config.NtCache, 0) - if !predicateOut.IsBool() && !predicateOut.IsUnknown(&v.config.NtCache) { - return v.error(node.Arguments[1], "predicate should return boolean (got %s)", predicateOut.String()) + predicate.NumIn() == 1 && isUnknown(predicate.In(0)) { + if !isBool(predicate.Out(0)) && !isUnknown(predicate.Out(0)) { + return v.error(node.Arguments[1], "predicate should return boolean (got %v)", predicate.Out(0).String()) } - return v.config.NtCache.FromType(intType) + return integerNature } return v.error(node.Arguments[1], "predicate should has one input and one output param") case "sum": - collection := v.visit(node.Arguments[0]) - collection = collection.Deref(&v.config.NtCache) - if !collection.IsArray() && !collection.IsUnknown(&v.config.NtCache) { - return v.error(node.Arguments[0], "builtin %v takes only array (got %v)", node.Name, collection.String()) + collection := v.visit(node.Arguments[0]).Deref() + if !isArray(collection) && !isUnknown(collection) { + return v.error(node.Arguments[0], "builtin %v takes only array (got %v)", node.Name, collection) } if len(node.Arguments) == 2 { @@ -794,95 +758,86 @@ func (v *Checker) builtinNode(node *ast.BuiltinNode) Nature { predicate := v.visit(node.Arguments[1]) v.end() - if predicate.IsFunc() && + if isFunc(predicate) && predicate.NumOut() == 1 && - predicate.NumIn() == 1 && predicate.IsFirstArgUnknown(&v.config.NtCache) { - return predicate.Out(&v.config.NtCache, 0) + predicate.NumIn() == 1 && isUnknown(predicate.In(0)) { + return predicate.Out(0) } } else { - if collection.IsUnknown(&v.config.NtCache) { - return Nature{} + if isUnknown(collection) { + return unknown } - return collection.Elem(&v.config.NtCache) + return collection.Elem() } case "find", "findLast": - collection := v.visit(node.Arguments[0]) - collection = collection.Deref(&v.config.NtCache) - if !collection.IsArray() && !collection.IsUnknown(&v.config.NtCache) { - return v.error(node.Arguments[0], "builtin %v takes only array (got %v)", node.Name, collection.String()) + collection := v.visit(node.Arguments[0]).Deref() + if !isArray(collection) && !isUnknown(collection) { + return v.error(node.Arguments[0], "builtin %v takes only array (got %v)", node.Name, collection) } v.begin(collection) predicate := v.visit(node.Arguments[1]) v.end() - if predicate.IsFunc() && + if isFunc(predicate) && predicate.NumOut() == 1 && - predicate.NumIn() == 1 && predicate.IsFirstArgUnknown(&v.config.NtCache) { + predicate.NumIn() == 1 && isUnknown(predicate.In(0)) { - predicateOut := predicate.Out(&v.config.NtCache, 0) - if !predicateOut.IsBool() && !predicateOut.IsUnknown(&v.config.NtCache) { - return v.error(node.Arguments[1], "predicate should return boolean (got %s)", predicateOut.String()) + if !isBool(predicate.Out(0)) && !isUnknown(predicate.Out(0)) { + return v.error(node.Arguments[1], "predicate should return boolean (got %v)", predicate.Out(0).String()) } - if collection.IsUnknown(&v.config.NtCache) { - return Nature{} + if isUnknown(collection) { + return unknown } - return collection.Elem(&v.config.NtCache) + return collection.Elem() } return v.error(node.Arguments[1], "predicate should has one input and one output param") case "findIndex", "findLastIndex": - collection := v.visit(node.Arguments[0]) - collection = collection.Deref(&v.config.NtCache) - if !collection.IsArray() && !collection.IsUnknown(&v.config.NtCache) { - return v.error(node.Arguments[0], "builtin %v takes only array (got %v)", node.Name, collection.String()) + collection := v.visit(node.Arguments[0]).Deref() + if !isArray(collection) && !isUnknown(collection) { + return v.error(node.Arguments[0], "builtin %v takes only array (got %v)", node.Name, collection) } v.begin(collection) predicate := v.visit(node.Arguments[1]) v.end() - if predicate.IsFunc() && + if isFunc(predicate) && predicate.NumOut() == 1 && - predicate.NumIn() == 1 && predicate.IsFirstArgUnknown(&v.config.NtCache) { + predicate.NumIn() == 1 && isUnknown(predicate.In(0)) { - predicateOut := predicate.Out(&v.config.NtCache, 0) - if !predicateOut.IsBool() && !predicateOut.IsUnknown(&v.config.NtCache) { - return v.error(node.Arguments[1], "predicate should return boolean (got %s)", predicateOut.String()) + if !isBool(predicate.Out(0)) && !isUnknown(predicate.Out(0)) { + return v.error(node.Arguments[1], "predicate should return boolean (got %v)", predicate.Out(0).String()) } - return v.config.NtCache.FromType(intType) + return integerNature } return v.error(node.Arguments[1], "predicate should has one input and one output param") case "groupBy": - collection := v.visit(node.Arguments[0]) - collection = collection.Deref(&v.config.NtCache) - if !collection.IsArray() && !collection.IsUnknown(&v.config.NtCache) { - return v.error(node.Arguments[0], "builtin %v takes only array (got %v)", node.Name, collection.String()) + collection := v.visit(node.Arguments[0]).Deref() + if !isArray(collection) && !isUnknown(collection) { + return v.error(node.Arguments[0], "builtin %v takes only array (got %v)", node.Name, collection) } v.begin(collection) predicate := v.visit(node.Arguments[1]) v.end() - if predicate.IsFunc() && + if isFunc(predicate) && predicate.NumOut() == 1 && - predicate.NumIn() == 1 && predicate.IsFirstArgUnknown(&v.config.NtCache) { + predicate.NumIn() == 1 && isUnknown(predicate.In(0)) { - collection = collection.Elem(&v.config.NtCache) - collection = collection.MakeArrayOf(&v.config.NtCache) - nt := v.config.NtCache.NatureOf(map[any][]any{}) - nt.Ref = &collection - return nt + groups := arrayOf(collection.Elem()) + return Nature{Type: reflect.TypeOf(map[any][]any{}), ArrayOf: &groups} } return v.error(node.Arguments[1], "predicate should has one input and one output param") case "sortBy": - collection := v.visit(node.Arguments[0]) - collection = collection.Deref(&v.config.NtCache) - if !collection.IsArray() && !collection.IsUnknown(&v.config.NtCache) { - return v.error(node.Arguments[0], "builtin %v takes only array (got %v)", node.Name, collection.String()) + collection := v.visit(node.Arguments[0]).Deref() + if !isArray(collection) && !isUnknown(collection) { + return v.error(node.Arguments[0], "builtin %v takes only array (got %v)", node.Name, collection) } v.begin(collection) @@ -893,22 +848,21 @@ func (v *Checker) builtinNode(node *ast.BuiltinNode) Nature { _ = v.visit(node.Arguments[2]) } - if predicate.IsFunc() && + if isFunc(predicate) && predicate.NumOut() == 1 && - predicate.NumIn() == 1 && predicate.IsFirstArgUnknown(&v.config.NtCache) { + predicate.NumIn() == 1 && isUnknown(predicate.In(0)) { return collection } return v.error(node.Arguments[1], "predicate should has one input and one output param") case "reduce": - collection := v.visit(node.Arguments[0]) - collection = collection.Deref(&v.config.NtCache) - if !collection.IsArray() && !collection.IsUnknown(&v.config.NtCache) { - return v.error(node.Arguments[0], "builtin %v takes only array (got %v)", node.Name, collection.String()) + collection := v.visit(node.Arguments[0]).Deref() + if !isArray(collection) && !isUnknown(collection) { + return v.error(node.Arguments[0], "builtin %v takes only array (got %v)", node.Name, collection) } - v.begin(collection, varScope{"index", v.config.NtCache.FromType(intType)}, varScope{"acc", Nature{}}) + v.begin(collection, scopeVar{"index", integerNature}, scopeVar{"acc", unknown}) predicate := v.visit(node.Arguments[1]) v.end() @@ -916,8 +870,8 @@ func (v *Checker) builtinNode(node *ast.BuiltinNode) Nature { _ = v.visit(node.Arguments[2]) } - if predicate.IsFunc() && predicate.NumOut() == 1 { - return *predicate.Ref + if isFunc(predicate) && predicate.NumOut() == 1 { + return *predicate.PredicateOut } return v.error(node.Arguments[1], "predicate should has two input and one output param") @@ -934,60 +888,65 @@ func (v *Checker) builtinNode(node *ast.BuiltinNode) Nature { return v.error(node, "unknown builtin %v", node.Name) } -func (v *Checker) begin(collectionNature Nature, vars ...varScope) { - v.predicateScopes = append(v.predicateScopes, predicateScope{ - collection: collectionNature, - vars: vars, - }) +type scopeVar struct { + varName string + varNature Nature +} + +func (v *checker) begin(collectionNature Nature, vars ...scopeVar) { + scope := predicateScope{collection: collectionNature, vars: make(map[string]Nature)} + for _, v := range vars { + scope.vars[v.varName] = v.varNature + } + v.predicateScopes = append(v.predicateScopes, scope) } -func (v *Checker) end() { +func (v *checker) end() { v.predicateScopes = v.predicateScopes[:len(v.predicateScopes)-1] } -func (v *Checker) checkBuiltinGet(node *ast.BuiltinNode) Nature { +func (v *checker) checkBuiltinGet(node *ast.BuiltinNode) Nature { if len(node.Arguments) != 2 { return v.error(node, "invalid number of arguments (expected 2, got %d)", len(node.Arguments)) } base := v.visit(node.Arguments[0]) prop := v.visit(node.Arguments[1]) - prop = prop.Deref(&v.config.NtCache) if id, ok := node.Arguments[0].(*ast.IdentifierNode); ok && id.Value == "$env" { if s, ok := node.Arguments[1].(*ast.StringNode); ok { - if nt, ok := v.config.Env.Get(&v.config.NtCache, s.Value); ok { + if nt, ok := v.config.Env.Get(s.Value); ok { return nt } } - return Nature{} + return unknown } - if base.IsUnknown(&v.config.NtCache) { - return Nature{} + if isUnknown(base) { + return unknown } - switch base.Kind { + switch base.Kind() { case reflect.Slice, reflect.Array: - if !prop.IsInteger && !prop.IsUnknown(&v.config.NtCache) { - return v.error(node.Arguments[1], "non-integer slice index %s", prop.String()) + if !isInteger(prop) && !isUnknown(prop) { + return v.error(node.Arguments[1], "non-integer slice index %s", prop) } - return base.Elem(&v.config.NtCache) + return base.Elem() case reflect.Map: - if !prop.AssignableTo(base.Key(&v.config.NtCache)) && !prop.IsUnknown(&v.config.NtCache) { - return v.error(node.Arguments[1], "cannot use %s to get an element from %s", prop.String(), base.String()) + if !prop.AssignableTo(base.Key()) && !isUnknown(prop) { + return v.error(node.Arguments[1], "cannot use %s to get an element from %s", prop, base) } - return base.Elem(&v.config.NtCache) + return base.Elem() } - return v.error(node.Arguments[0], "type %v does not support indexing", base.String()) + return v.error(node.Arguments[0], "type %v does not support indexing", base) } -func (v *Checker) checkFunction(f *builtin.Function, node ast.Node, arguments []ast.Node) Nature { +func (v *checker) checkFunction(f *builtin.Function, node ast.Node, arguments []ast.Node) Nature { if f.Validate != nil { args := make([]reflect.Type, len(arguments)) for i, arg := range arguments { argNature := v.visit(arg) - if argNature.IsUnknown(&v.config.NtCache) { + if isUnknown(argNature) { args[i] = anyType } else { args[i] = argNature.Type @@ -997,21 +956,21 @@ func (v *Checker) checkFunction(f *builtin.Function, node ast.Node, arguments [] if err != nil { return v.error(node, "%v", err) } - return v.config.NtCache.FromType(t) + return Nature{Type: t} } else if len(f.Types) == 0 { - nt, err := v.checkArguments(f.Name, v.config.NtCache.FromType(f.Type()), arguments, node) + nt, err := v.checkArguments(f.Name, Nature{Type: f.Type()}, arguments, node) if err != nil { if v.err == nil { v.err = err } - return Nature{} + return unknown } // No type was specified, so we assume the function returns any. return nt } var lastErr *file.Error for _, t := range f.Types { - outNature, err := v.checkArguments(f.Name, v.config.NtCache.FromType(t), arguments, node) + outNature, err := v.checkArguments(f.Name, Nature{Type: t}, arguments, node) if err != nil { lastErr = err continue @@ -1030,31 +989,30 @@ func (v *Checker) checkFunction(f *builtin.Function, node ast.Node, arguments [] if v.err == nil { v.err = lastErr } - return Nature{} + return unknown } return v.error(node, "no matching overload for %v", f.Name) } -func (v *Checker) checkArguments( +func (v *checker) checkArguments( name string, fn Nature, arguments []ast.Node, node ast.Node, ) (Nature, *file.Error) { - if fn.IsUnknown(&v.config.NtCache) { - return Nature{}, nil + if isUnknown(fn) { + return unknown, nil } - numOut := fn.NumOut() - if numOut == 0 { - return Nature{}, &file.Error{ + if fn.NumOut() == 0 { + return unknown, &file.Error{ Location: node.Location(), Message: fmt.Sprintf("func %v doesn't return value", name), } } - if numOut > 2 { - return Nature{}, &file.Error{ + if numOut := fn.NumOut(); numOut > 2 { + return unknown, &file.Error{ Location: node.Location(), Message: fmt.Sprintf("func %v returns more then two values", name), } @@ -1073,8 +1031,7 @@ func (v *Checker) checkArguments( } var err *file.Error - isVariadic := fn.IsVariadic() - if isVariadic { + if fn.IsVariadic() { if len(arguments) < fnNumIn-1 { err = &file.Error{ Location: node.Location(), @@ -1102,38 +1059,38 @@ func (v *Checker) checkArguments( for _, arg := range arguments { _ = v.visit(arg) } - return fn.Out(&v.config.NtCache, 0), err + return fn.Out(0), err } for i, arg := range arguments { argNature := v.visit(arg) var in Nature - if isVariadic && i >= fnNumIn-1 { + if fn.IsVariadic() && i >= fnNumIn-1 { // For variadic arguments fn(xs ...int), go replaces type of xs (int) with ([]int). // As we compare arguments one by one, we need underling type. - in = fn.InElem(&v.config.NtCache, fnNumIn-1) + in = fn.In(fn.NumIn() - 1).Elem() } else { - in = fn.In(&v.config.NtCache, i+fnInOffset) + in = fn.In(i + fnInOffset) } - if in.IsFloat && argNature.IsInteger { + if isFloat(in) && isInteger(argNature) { traverseAndReplaceIntegerNodesWithFloatNodes(&arguments[i], in) continue } - if in.IsInteger && argNature.IsInteger && argNature.Kind != in.Kind { + if isInteger(in) && isInteger(argNature) && argNature.Kind() != in.Kind() { traverseAndReplaceIntegerNodesWithIntegerNodes(&arguments[i], in) continue } - if argNature.Nil { - if in.Kind == reflect.Ptr || in.Kind == reflect.Interface { + if isNil(argNature) { + if in.Kind() == reflect.Ptr || in.Kind() == reflect.Interface { continue } - return Nature{}, &file.Error{ + return unknown, &file.Error{ Location: arg.Location(), - Message: fmt.Sprintf("cannot use nil as argument (type %s) to call %v", in.String(), name), + Message: fmt.Sprintf("cannot use nil as argument (type %s) to call %v", in, name), } } @@ -1145,20 +1102,17 @@ func (v *Checker) checkArguments( // We also need to check if dereference arg type is assignable to the function input type. // For example, func(int) and argument *int. In this case we will add OpDeref to the argument, // so we can call the function with *int argument. - if !assignable && argNature.IsPointer() { - nt := argNature.Deref(&v.config.NtCache) - assignable = nt.AssignableTo(in) - } + assignable = assignable || argNature.Deref().AssignableTo(in) - if !assignable && !argNature.IsUnknown(&v.config.NtCache) { - return Nature{}, &file.Error{ + if !assignable && !isUnknown(argNature) { + return unknown, &file.Error{ Location: arg.Location(), - Message: fmt.Sprintf("cannot use %s as argument (type %s) to call %v ", argNature.String(), in.String(), name), + Message: fmt.Sprintf("cannot use %s as argument (type %s) to call %v ", argNature, in, name), } } } - return fn.Out(&v.config.NtCache, 0), nil + return fn.Out(0), nil } func traverseAndReplaceIntegerNodesWithFloatNodes(node *ast.Node, newNature Nature) { @@ -1198,46 +1152,45 @@ func traverseAndReplaceIntegerNodesWithIntegerNodes(node *ast.Node, newNature Na } } -func (v *Checker) predicateNode(node *ast.PredicateNode) Nature { +func (v *checker) PredicateNode(node *ast.PredicateNode) Nature { nt := v.visit(node.Node) var out []reflect.Type - if nt.IsUnknown(&v.config.NtCache) { + if isUnknown(nt) { out = append(out, anyType) - } else if !nt.Nil { + } else if !isNil(nt) { out = append(out, nt.Type) } - n := v.config.NtCache.FromType(reflect.FuncOf(anyTypeSlice, out, false)) - n.Ref = &nt - return n + return Nature{ + Type: reflect.FuncOf([]reflect.Type{anyType}, out, false), + PredicateOut: &nt, + } } -func (v *Checker) pointerNode(node *ast.PointerNode) Nature { +func (v *checker) PointerNode(node *ast.PointerNode) Nature { if len(v.predicateScopes) == 0 { return v.error(node, "cannot use pointer accessor outside predicate") } scope := v.predicateScopes[len(v.predicateScopes)-1] if node.Name == "" { - if scope.collection.IsUnknown(&v.config.NtCache) { - return Nature{} + if isUnknown(scope.collection) { + return unknown } - switch scope.collection.Kind { + switch scope.collection.Kind() { case reflect.Array, reflect.Slice: - return scope.collection.Elem(&v.config.NtCache) + return scope.collection.Elem() } return v.error(node, "cannot use %v as array", scope) } if scope.vars != nil { - for i := range scope.vars { - if node.Name == scope.vars[i].name { - return scope.vars[i].nature - } + if t, ok := scope.vars[node.Name]; ok { + return t } } return v.error(node, "unknown pointer #%v", node.Name) } -func (v *Checker) variableDeclaratorNode(node *ast.VariableDeclaratorNode) Nature { - if _, ok := v.config.Env.Get(&v.config.NtCache, node.Name); ok { +func (v *checker) VariableDeclaratorNode(node *ast.VariableDeclaratorNode) Nature { + if _, ok := v.config.Env.Get(node.Name); ok { return v.error(node, "cannot redeclare %v", node.Name) } if _, ok := v.config.Functions[node.Name]; ok { @@ -1246,10 +1199,8 @@ func (v *Checker) variableDeclaratorNode(node *ast.VariableDeclaratorNode) Natur if _, ok := v.config.Builtins[node.Name]; ok { return v.error(node, "cannot redeclare builtin %v", node.Name) } - for i := len(v.varScopes) - 1; i >= 0; i-- { - if v.varScopes[i].name == node.Name { - return v.error(node, "cannot redeclare variable %v", node.Name) - } + if _, ok := v.lookupVariable(node.Name); ok { + return v.error(node, "cannot redeclare variable %v", node.Name) } varNature := v.visit(node.Value) v.varScopes = append(v.varScopes, varScope{node.Name, varNature}) @@ -1258,7 +1209,7 @@ func (v *Checker) variableDeclaratorNode(node *ast.VariableDeclaratorNode) Natur return exprNature } -func (v *Checker) sequenceNode(node *ast.SequenceNode) Nature { +func (v *checker) SequenceNode(node *ast.SequenceNode) Nature { if len(node.Nodes) == 0 { return v.error(node, "empty sequence expression") } @@ -1269,65 +1220,66 @@ func (v *Checker) sequenceNode(node *ast.SequenceNode) Nature { return last } -func (v *Checker) conditionalNode(node *ast.ConditionalNode) Nature { +func (v *checker) lookupVariable(name string) (varScope, bool) { + for i := len(v.varScopes) - 1; i >= 0; i-- { + if v.varScopes[i].name == name { + return v.varScopes[i], true + } + } + return varScope{}, false +} + +func (v *checker) ConditionalNode(node *ast.ConditionalNode) Nature { c := v.visit(node.Cond) - c = c.Deref(&v.config.NtCache) - if !c.IsBool() && !c.IsUnknown(&v.config.NtCache) { - return v.error(node.Cond, "non-bool expression (type %v) used as condition", c.String()) + if !isBool(c) && !isUnknown(c) { + return v.error(node.Cond, "non-bool expression (type %v) used as condition", c) } t1 := v.visit(node.Exp1) t2 := v.visit(node.Exp2) - if t1.Nil && !t2.Nil { + if isNil(t1) && !isNil(t2) { return t2 } - if !t1.Nil && t2.Nil { + if !isNil(t1) && isNil(t2) { return t1 } - if t1.Nil && t2.Nil { - return v.config.NtCache.NatureOf(nil) + if isNil(t1) && isNil(t2) { + return nilNature } if t1.AssignableTo(t2) { - if t1.IsArray() && t2.IsArray() { - e1 := t1.Elem(&v.config.NtCache) - e2 := t2.Elem(&v.config.NtCache) - if !e1.AssignableTo(e2) || !e2.AssignableTo(e1) { - return v.config.NtCache.FromType(arrayType) - } - } return t1 } - return Nature{} + return unknown } -func (v *Checker) arrayNode(node *ast.ArrayNode) Nature { +func (v *checker) ArrayNode(node *ast.ArrayNode) Nature { var prev Nature allElementsAreSameType := true for i, node := range node.Nodes { curr := v.visit(node) if i > 0 { - if curr.Kind != prev.Kind { + if curr.Kind() != prev.Kind() { allElementsAreSameType = false } } prev = curr } if allElementsAreSameType { - return prev.MakeArrayOf(&v.config.NtCache) + return arrayOf(prev) } - return v.config.NtCache.FromType(arrayType) + return arrayNature } -func (v *Checker) mapNode(node *ast.MapNode) Nature { +func (v *checker) MapNode(node *ast.MapNode) Nature { for _, pair := range node.Pairs { v.visit(pair) } - return v.config.NtCache.FromType(mapType) + return mapNature } -func (v *Checker) pairNode(node *ast.PairNode) Nature { +func (v *checker) PairNode(node *ast.PairNode) Nature { v.visit(node.Key) v.visit(node.Value) - return v.config.NtCache.NatureOf(nil) + return nilNature } diff --git a/kubewatch/vendor/github.com/expr-lang/expr/checker/info.go b/kubewatch/vendor/github.com/expr-lang/expr/checker/info.go index 57202e958..f1cc92ebe 100644 --- a/kubewatch/vendor/github.com/expr-lang/expr/checker/info.go +++ b/kubewatch/vendor/github.com/expr-lang/expr/checker/info.go @@ -8,18 +8,22 @@ import ( "github.com/expr-lang/expr/vm" ) -func FieldIndex(c *Cache, env Nature, node ast.Node) (bool, []int, string) { +func FieldIndex(env Nature, node ast.Node) (bool, []int, string) { switch n := node.(type) { case *ast.IdentifierNode: - if idx, ok := env.FieldIndex(c, n.Value); ok { - return true, idx, n.Value + if env.Kind() == reflect.Struct { + if field, ok := env.Get(n.Value); ok && len(field.FieldIndex) > 0 { + return true, field.FieldIndex, n.Value + } } case *ast.MemberNode: - base := n.Node.Nature().Deref(c) - if base.Kind == reflect.Struct { + base := n.Node.Nature() + base = base.Deref() + if base.Kind() == reflect.Struct { if prop, ok := n.Property.(*ast.StringNode); ok { - if idx, ok := base.FieldIndex(c, prop.Value); ok { - return true, idx, prop.Value + name := prop.Value + if field, ok := base.FieldByName(name); ok { + return true, field.FieldIndex, name } } } @@ -27,11 +31,11 @@ func FieldIndex(c *Cache, env Nature, node ast.Node) (bool, []int, string) { return false, nil, "" } -func MethodIndex(c *Cache, env Nature, node ast.Node) (bool, int, string) { +func MethodIndex(env Nature, node ast.Node) (bool, int, string) { switch n := node.(type) { case *ast.IdentifierNode: - if env.Kind == reflect.Struct { - if m, ok := env.Get(c, n.Value); ok && m.TypeData != nil { + if env.Kind() == reflect.Struct { + if m, ok := env.Get(n.Value); ok { return m.Method, m.MethodIndex, n.Value } } @@ -117,7 +121,7 @@ func IsFastFunc(fn reflect.Type, method bool) bool { fn.NumOut() == 1 && fn.Out(0).Kind() == reflect.Interface { rest := fn.In(fn.NumIn() - 1) // function has only one param for functions and two for methods - if rest != nil && rest.Kind() == reflect.Slice && rest.Elem().Kind() == reflect.Interface { + if kind(rest) == reflect.Slice && rest.Elem().Kind() == reflect.Interface { return true } } diff --git a/kubewatch/vendor/github.com/expr-lang/expr/checker/nature/nature.go b/kubewatch/vendor/github.com/expr-lang/expr/checker/nature/nature.go index c96f28c43..993c9fcf8 100644 --- a/kubewatch/vendor/github.com/expr-lang/expr/checker/nature/nature.go +++ b/kubewatch/vendor/github.com/expr-lang/expr/checker/nature/nature.go @@ -1,458 +1,247 @@ package nature import ( - "fmt" "reflect" - "time" "github.com/expr-lang/expr/builtin" "github.com/expr-lang/expr/internal/deref" ) var ( - intType = reflect.TypeOf(0) - floatType = reflect.TypeOf(float64(0)) - arrayType = reflect.TypeOf([]any{}) - byteSliceType = reflect.TypeOf([]byte{}) - timeType = reflect.TypeOf(time.Time{}) - durationType = reflect.TypeOf(time.Duration(0)) - - builtinInt = map[reflect.Type]struct{}{ - reflect.TypeOf(int(0)): {}, - reflect.TypeOf(int8(0)): {}, - reflect.TypeOf(int16(0)): {}, - reflect.TypeOf(int32(0)): {}, - reflect.TypeOf(int64(0)): {}, - reflect.TypeOf(uintptr(0)): {}, - reflect.TypeOf(uint(0)): {}, - reflect.TypeOf(uint8(0)): {}, - reflect.TypeOf(uint16(0)): {}, - reflect.TypeOf(uint32(0)): {}, - reflect.TypeOf(uint64(0)): {}, - } - builtinFloat = map[reflect.Type]struct{}{ - reflect.TypeOf(float32(0)): {}, - reflect.TypeOf(float64(0)): {}, - } -) - -type NatureCheck int - -const ( - _ NatureCheck = iota - BoolCheck - StringCheck - IntegerCheck - NumberCheck - MapCheck - ArrayCheck - TimeCheck - DurationCheck + unknown = Nature{} ) type Nature struct { - // The order of the fields matter, check alignment before making changes. - - Type reflect.Type // Type of the value. If nil, then value is unknown. - Kind reflect.Kind // Kind of the value. - - *TypeData - - // Ref is a reference used for multiple, disjoint purposes. When the Nature - // is for a: - // - Predicate: then Ref is the nature of the Out of the predicate. - // - Array-like types: then Ref is the Elem nature of array type (usually Type is []any, but ArrayOf can be any nature). - Ref *Nature - - Nil bool // If value is nil. - Strict bool // If map is types.StrictMap. - Method bool // If value retrieved from method. Usually used to determine amount of in arguments. - IsInteger bool // If it's a builtin integer or unsigned integer type. - IsFloat bool // If it's a builtin float type. -} - -type TypeData struct { - methodset *methodset // optional to avoid the map in *Cache - - *structData - - // map-only data + Type reflect.Type // Type of the value. If nil, then value is unknown. + Func *builtin.Function // Used to pass function type from callee to CallNode. + ArrayOf *Nature // Elem nature of array type (usually Type is []any, but ArrayOf can be any nature). + PredicateOut *Nature // Out nature of predicate. Fields map[string]Nature // Fields of map type. DefaultMapValue *Nature // Default value of map type. - - // callable-only data - Func *builtin.Function // Used to pass function type from callee to CallNode. + Strict bool // If map is types.StrictMap. + Nil bool // If value is nil. + Method bool // If value retrieved from method. Usually used to determine amount of in arguments. MethodIndex int // Index of method in type. - inElem, outZero *Nature - numIn, numOut int - - isVariadic bool - isVariadicSet bool - numInSet bool - numOutSet bool + FieldIndex []int // Index of field in type. } -// Cache is a shared cache of type information. It is only used in the stages -// where type information becomes relevant, so packages like ast, parser, types, -// and lexer do not need to use the cache because they don't need any service -// from the Nature type, they only describe. However, when receiving a Nature -// from one of those packages, the cache must be set immediately. -type Cache struct { - methods map[reflect.Type]*methodset - structs map[reflect.Type]Nature +func (n Nature) IsAny() bool { + return n.Kind() == reflect.Interface && n.NumMethods() == 0 } -// NatureOf returns a Nature describing "i". If "i" is nil then it returns a -// Nature describing the value "nil". -func (c *Cache) NatureOf(i any) Nature { - // reflect.TypeOf(nil) returns nil, but in FromType we want to differentiate - // what nil means for us - if i == nil { - return Nature{Nil: true} +func (n Nature) IsUnknown() bool { + switch { + case n.Type == nil && !n.Nil: + return true + case n.IsAny(): + return true } - return c.FromType(reflect.TypeOf(i)) -} - -// FromType returns a Nature describing a value of type "t". If "t" is nil then -// it returns a Nature describing an unknown value. -func (c *Cache) FromType(t reflect.Type) Nature { - if t == nil { - return Nature{} - } - var td *TypeData - var isInteger, isFloat bool - k := t.Kind() - switch k { - case reflect.Struct: - // c can be nil when we call the package function FromType, which uses a - // nil *Cache to call this method. - if c != nil { - return c.getStruct(t) - } - fallthrough - case reflect.Func: - td = new(TypeData) - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, - reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - _, isInteger = builtinInt[t] - case reflect.Float32, reflect.Float64: - _, isFloat = builtinFloat[t] - } - return Nature{ - Type: t, - Kind: k, - TypeData: td, - IsInteger: isInteger, - IsFloat: isFloat, - } -} - -func (c *Cache) getStruct(t reflect.Type) Nature { - if c.structs == nil { - c.structs = map[reflect.Type]Nature{} - } else if nt, ok := c.structs[t]; ok { - return nt - } - nt := Nature{ - Type: t, - Kind: reflect.Struct, - TypeData: &TypeData{ - structData: &structData{ - rType: t, - numField: t.NumField(), - anonIdx: -1, // do not lookup embedded fields yet - }, - }, - } - c.structs[t] = nt - return nt + return false } -func (c *Cache) getMethodset(t reflect.Type, k reflect.Kind) *methodset { - if t == nil || c == nil { - return nil - } - if c.methods == nil { - c.methods = map[reflect.Type]*methodset{ - t: nil, - } - } else if s, ok := c.methods[t]; ok { - return s - } - numMethod := t.NumMethod() - if numMethod < 1 { - c.methods[t] = nil // negative cache - return nil - } - s := &methodset{ - rType: t, - kind: k, - numMethod: numMethod, +func (n Nature) String() string { + if n.Type != nil { + return n.Type.String() } - c.methods[t] = s - return s -} - -// NatureOf calls NatureOf on a nil *Cache. See the comment on Cache. -func NatureOf(i any) Nature { - var c *Cache - return c.NatureOf(i) -} - -// FromType calls FromType on a nil *Cache. See the comment on Cache. -func FromType(t reflect.Type) Nature { - var c *Cache - return c.FromType(t) -} - -func ArrayFromType(c *Cache, t reflect.Type) Nature { - elem := c.FromType(t) - nt := c.FromType(arrayType) - nt.Ref = &elem - return nt -} - -func (n *Nature) IsAny(c *Cache) bool { - return n.Type != nil && n.Kind == reflect.Interface && n.NumMethods(c) == 0 -} - -func (n *Nature) IsUnknown(c *Cache) bool { - return n.Type == nil && !n.Nil || n.IsAny(c) + return "unknown" } -func (n *Nature) String() string { +func (n Nature) Deref() Nature { if n.Type != nil { - return n.Type.String() + n.Type = deref.Type(n.Type) } - return "unknown" + return n } -func (n *Nature) Deref(c *Cache) Nature { - t, _, changed := deref.TypeKind(n.Type, n.Kind) - if !changed { - return *n +func (n Nature) Kind() reflect.Kind { + if n.Type != nil { + return n.Type.Kind() } - return c.FromType(t) + return reflect.Invalid } -func (n *Nature) Key(c *Cache) Nature { - if n.Kind == reflect.Map { - return c.FromType(n.Type.Key()) +func (n Nature) Key() Nature { + if n.Kind() == reflect.Map { + return Nature{Type: n.Type.Key()} } - return Nature{} + return unknown } -func (n *Nature) Elem(c *Cache) Nature { - switch n.Kind { +func (n Nature) Elem() Nature { + switch n.Kind() { case reflect.Ptr: - return c.FromType(n.Type.Elem()) + return Nature{Type: n.Type.Elem()} case reflect.Map: - if n.TypeData != nil && n.DefaultMapValue != nil { + if n.DefaultMapValue != nil { return *n.DefaultMapValue } - return c.FromType(n.Type.Elem()) - case reflect.Slice, reflect.Array: - if n.Ref != nil { - return *n.Ref + return Nature{Type: n.Type.Elem()} + case reflect.Array, reflect.Slice: + if n.ArrayOf != nil { + return *n.ArrayOf } - return c.FromType(n.Type.Elem()) + return Nature{Type: n.Type.Elem()} } - return Nature{} + return unknown } -func (n *Nature) AssignableTo(nt Nature) bool { +func (n Nature) AssignableTo(nt Nature) bool { if n.Nil { - switch nt.Kind { - case reflect.Pointer, reflect.Interface, reflect.Chan, reflect.Func, - reflect.Map, reflect.Slice: - // nil can be assigned to these kinds + // Untyped nil is assignable to any interface, but implements only the empty interface. + if nt.IsAny() { return true } } - if n.Type == nil || nt.Type == nil || - n.Kind != nt.Kind && nt.Kind != reflect.Interface { + if n.Type == nil || nt.Type == nil { return false } return n.Type.AssignableTo(nt.Type) } -func (n *Nature) getMethodset(c *Cache) *methodset { - if n.TypeData != nil && n.TypeData.methodset != nil { - return n.TypeData.methodset - } - s := c.getMethodset(n.Type, n.Kind) - if n.TypeData != nil { - n.TypeData.methodset = s // cache locally if possible +func (n Nature) NumMethods() int { + if n.Type == nil { + return 0 } - return s + return n.Type.NumMethod() } -func (n *Nature) NumMethods(c *Cache) int { - if s := n.getMethodset(c); s != nil { - return s.numMethod +func (n Nature) MethodByName(name string) (Nature, bool) { + if n.Type == nil { + return unknown, false } - return 0 -} - -func (n *Nature) MethodByName(c *Cache, name string) (Nature, bool) { - if s := n.getMethodset(c); s != nil { - if m := s.method(c, name); m != nil { - return m.nature, true - } + method, ok := n.Type.MethodByName(name) + if !ok { + return unknown, false } - return Nature{}, false -} -func (n *Nature) NumIn() int { - if n.numInSet { - return n.numIn - } - n.numInSet = true - n.numIn = n.Type.NumIn() - return n.numIn -} + if n.Type.Kind() == reflect.Interface { + // In case of interface type method will not have a receiver, + // and to prevent checker decreasing numbers of in arguments + // return method type as not method (second argument is false). -func (n *Nature) InElem(c *Cache, i int) Nature { - if n.inElem == nil { - n2 := c.FromType(n.Type.In(i)) - n2 = n2.Elem(c) - n.inElem = &n2 + // Also, we can not use m.Index here, because it will be + // different indexes for different types which implement + // the same interface. + return Nature{Type: method.Type}, true + } else { + return Nature{ + Type: method.Type, + Method: true, + MethodIndex: method.Index, + }, true } - return *n.inElem } -func (n *Nature) In(c *Cache, i int) Nature { - return c.FromType(n.Type.In(i)) +func (n Nature) NumIn() int { + if n.Type == nil { + return 0 + } + return n.Type.NumIn() } -func (n *Nature) IsFirstArgUnknown(c *Cache) bool { - if n.Type != nil { - n2 := c.FromType(n.Type.In(0)) - return n2.IsUnknown(c) +func (n Nature) In(i int) Nature { + if n.Type == nil { + return unknown } - return false + return Nature{Type: n.Type.In(i)} } -func (n *Nature) NumOut() int { - if n.numOutSet { - return n.numOut +func (n Nature) NumOut() int { + if n.Type == nil { + return 0 } - n.numOutSet = true - n.numOut = n.Type.NumOut() - return n.numOut + return n.Type.NumOut() } -func (n *Nature) Out(c *Cache, i int) Nature { - if i != 0 { - return n.out(c, i) - } - if n.outZero != nil { - return *n.outZero +func (n Nature) Out(i int) Nature { + if n.Type == nil { + return unknown } - nt := n.out(c, 0) - n.outZero = &nt - return nt + return Nature{Type: n.Type.Out(i)} } -func (n *Nature) out(c *Cache, i int) Nature { +func (n Nature) IsVariadic() bool { if n.Type == nil { - return Nature{} + return false } - return c.FromType(n.Type.Out(i)) + return n.Type.IsVariadic() } -func (n *Nature) IsVariadic() bool { - if n.isVariadicSet { - return n.isVariadic +func (n Nature) FieldByName(name string) (Nature, bool) { + if n.Type == nil { + return unknown, false } - n.isVariadicSet = true - n.isVariadic = n.Type.IsVariadic() - return n.isVariadic + field, ok := fetchField(n.Type, name) + return Nature{Type: field.Type, FieldIndex: field.Index}, ok } -func (n *Nature) FieldByName(c *Cache, name string) (Nature, bool) { - if n.Kind != reflect.Struct { - return Nature{}, false - } - var sd *structData - if n.TypeData != nil && n.structData != nil { - sd = n.structData - } else { - sd = c.getStruct(n.Type).structData - } - if sf := sd.structField(c, nil, name); sf != nil { - return sf.Nature, true +func (n Nature) PkgPath() string { + if n.Type == nil { + return "" } - return Nature{}, false + return n.Type.PkgPath() } -func (n *Nature) IsFastMap() bool { - return n.Type != nil && - n.Type.Kind() == reflect.Map && +func (n Nature) IsFastMap() bool { + if n.Type == nil { + return false + } + if n.Type.Kind() == reflect.Map && n.Type.Key().Kind() == reflect.String && - n.Type.Elem().Kind() == reflect.Interface + n.Type.Elem().Kind() == reflect.Interface { + return true + } + return false } -func (n *Nature) Get(c *Cache, name string) (Nature, bool) { - if n.Kind == reflect.Map && n.TypeData != nil { - f, ok := n.Fields[name] - return f, ok +func (n Nature) Get(name string) (Nature, bool) { + if n.Type == nil { + return unknown, false } - return n.getSlow(c, name) -} -func (n *Nature) getSlow(c *Cache, name string) (Nature, bool) { - if nt, ok := n.MethodByName(c, name); ok { - return nt, true + if m, ok := n.MethodByName(name); ok { + return m, true } - t, k, changed := deref.TypeKind(n.Type, n.Kind) - if k == reflect.Struct { - var sd *structData - if changed { - sd = c.getStruct(t).structData - } else { - sd = n.structData + + t := deref.Type(n.Type) + + switch t.Kind() { + case reflect.Struct: + if f, ok := fetchField(t, name); ok { + return Nature{ + Type: f.Type, + FieldIndex: f.Index, + }, true } - if sf := sd.structField(c, nil, name); sf != nil { - return sf.Nature, true + case reflect.Map: + if f, ok := n.Fields[name]; ok { + return f, true } } - return Nature{}, false -} - -func (n *Nature) FieldIndex(c *Cache, name string) ([]int, bool) { - if n.Kind != reflect.Struct { - return nil, false - } - if sf := n.structField(c, nil, name); sf != nil { - return sf.Index, true - } - return nil, false + return unknown, false } -func (n *Nature) All(c *Cache) map[string]Nature { +func (n Nature) All() map[string]Nature { table := make(map[string]Nature) if n.Type == nil { return table } - for i := 0; i < n.NumMethods(c); i++ { + for i := 0; i < n.Type.NumMethod(); i++ { method := n.Type.Method(i) - nt := c.FromType(method.Type) - if nt.TypeData == nil { - nt.TypeData = new(TypeData) + table[method.Name] = Nature{ + Type: method.Type, + Method: true, + MethodIndex: method.Index, } - nt.Method = true - nt.MethodIndex = method.Index - table[method.Name] = nt } t := deref.Type(n.Type) switch t.Kind() { case reflect.Struct: - for name, nt := range StructFields(c, t) { + for name, nt := range StructFields(t) { if _, ok := table[name]; ok { continue } @@ -460,120 +249,13 @@ func (n *Nature) All(c *Cache) map[string]Nature { } case reflect.Map: - if n.TypeData != nil { - for key, nt := range n.Fields { - if _, ok := table[key]; ok { - continue - } - table[key] = nt + for key, nt := range n.Fields { + if _, ok := table[key]; ok { + continue } + table[key] = nt } } return table } - -func (n *Nature) IsNumber() bool { - return n.IsInteger || n.IsFloat -} - -func (n *Nature) PromoteNumericNature(c *Cache, rhs Nature) Nature { - if n.IsUnknown(c) || rhs.IsUnknown(c) { - return Nature{} - } - if n.IsFloat || rhs.IsFloat { - return c.FromType(floatType) - } - return c.FromType(intType) -} - -func (n *Nature) IsTime() bool { - return n.Type == timeType -} - -func (n *Nature) IsDuration() bool { - return n.Type == durationType -} - -func (n *Nature) IsBool() bool { - return n.Kind == reflect.Bool -} - -func (n *Nature) IsString() bool { - return n.Kind == reflect.String -} - -func (n *Nature) IsByteSlice() bool { - return n.Type == byteSliceType -} - -func (n *Nature) IsArray() bool { - return n.Kind == reflect.Slice || n.Kind == reflect.Array -} - -func (n *Nature) IsMap() bool { - return n.Kind == reflect.Map -} - -func (n *Nature) IsStruct() bool { - return n.Kind == reflect.Struct -} - -func (n *Nature) IsFunc() bool { - return n.Kind == reflect.Func -} - -func (n *Nature) IsPointer() bool { - return n.Kind == reflect.Ptr -} - -func (n *Nature) IsAnyOf(cs ...NatureCheck) bool { - var result bool - for i := 0; i < len(cs) && !result; i++ { - switch cs[i] { - case BoolCheck: - result = n.IsBool() - case StringCheck: - result = n.IsString() - case IntegerCheck: - result = n.IsInteger - case NumberCheck: - result = n.IsNumber() - case MapCheck: - result = n.IsMap() - case ArrayCheck: - result = n.IsArray() - case TimeCheck: - result = n.IsTime() - case DurationCheck: - result = n.IsDuration() - default: - panic(fmt.Sprintf("unknown check value %d", cs[i])) - } - } - return result -} - -func (n *Nature) ComparableTo(c *Cache, rhs Nature) bool { - return n.IsUnknown(c) || rhs.IsUnknown(c) || - n.Nil || rhs.Nil || - n.IsNumber() && rhs.IsNumber() || - n.IsDuration() && rhs.IsDuration() || - n.IsTime() && rhs.IsTime() || - n.IsArray() && rhs.IsArray() || - n.AssignableTo(rhs) -} - -func (n *Nature) MaybeCompatible(c *Cache, rhs Nature, cs ...NatureCheck) bool { - nIsUnknown := n.IsUnknown(c) - rshIsUnknown := rhs.IsUnknown(c) - return nIsUnknown && rshIsUnknown || - nIsUnknown && rhs.IsAnyOf(cs...) || - rshIsUnknown && n.IsAnyOf(cs...) -} - -func (n *Nature) MakeArrayOf(c *Cache) Nature { - nt := c.FromType(arrayType) - nt.Ref = n - return nt -} diff --git a/kubewatch/vendor/github.com/expr-lang/expr/checker/nature/utils.go b/kubewatch/vendor/github.com/expr-lang/expr/checker/nature/utils.go index 2af946002..c242f91a6 100644 --- a/kubewatch/vendor/github.com/expr-lang/expr/checker/nature/utils.go +++ b/kubewatch/vendor/github.com/expr-lang/expr/checker/nature/utils.go @@ -6,228 +6,71 @@ import ( "github.com/expr-lang/expr/internal/deref" ) -func fieldName(fieldName string, tag reflect.StructTag) (string, bool) { - switch taggedName := tag.Get("expr"); taggedName { - case "-": - return "", false - case "": - return fieldName, true - default: - return taggedName, true +func fieldName(field reflect.StructField) string { + if taggedName := field.Tag.Get("expr"); taggedName != "" { + return taggedName } + return field.Name } -type structData struct { - rType reflect.Type - fields map[string]*structField - numField, ownIdx, anonIdx int - - curParent, curChild *structData - curChildIndex []int -} - -type structField struct { - Nature - Index []int -} - -func (s *structData) finished() bool { - return s.ownIdx >= s.numField && // no own fields left to visit - s.anonIdx >= s.numField && // no embedded fields to visit - s.curChild == nil // no child in process of visiting -} - -func (s *structData) structField(c *Cache, parentEmbed *structData, name string) *structField { - if s.fields == nil { - if s.numField > 0 { - s.fields = make(map[string]*structField, s.numField) - } - } else if f := s.fields[name]; f != nil { - return f - } - if s.finished() { - return nil - } - - // Lookup own fields first. - for ; s.ownIdx < s.numField; s.ownIdx++ { - field := s.rType.Field(s.ownIdx) - if field.Anonymous && s.anonIdx < 0 { - // start iterating anon fields on the first instead of zero - s.anonIdx = s.ownIdx - } - if !field.IsExported() { - continue - } - fName, ok := fieldName(field.Name, field.Tag) - if !ok || fName == "" { - // name can still be empty for a type created at runtime with - // reflect - continue - } - nt := c.FromType(field.Type) - sf := &structField{ - Nature: nt, - Index: field.Index, - } - s.fields[fName] = sf - if parentEmbed != nil { - parentEmbed.trySet(fName, sf) - } - if fName == name { - return sf +func fetchField(t reflect.Type, name string) (reflect.StructField, bool) { + // First check all structs fields. + for i := 0; i < t.NumField(); i++ { + field := t.Field(i) + // Search all fields, even embedded structs. + if fieldName(field) == name { + return field, true } } - if s.curChild != nil { - sf := s.findInEmbedded(c, parentEmbed, s.curChild, s.curChildIndex, name) - if sf != nil { - return sf + // Second check fields of embedded structs. + for i := 0; i < t.NumField(); i++ { + anon := t.Field(i) + if anon.Anonymous { + anonType := anon.Type + if anonType.Kind() == reflect.Pointer { + anonType = anonType.Elem() + } + if field, ok := fetchField(anonType, name); ok { + field.Index = append(anon.Index, field.Index...) + return field, true + } } } - // Lookup embedded fields through anon own fields - for ; s.anonIdx >= 0 && s.anonIdx < s.numField; s.anonIdx++ { - field := s.rType.Field(s.anonIdx) - // we do enter embedded non-exported types because they could contain - // exported fields - if !field.Anonymous { - continue - } - t, k, _ := deref.TypeKind(field.Type, field.Type.Kind()) - if k != reflect.Struct { - continue - } - - childEmbed := c.getStruct(t).structData - sf := s.findInEmbedded(c, parentEmbed, childEmbed, field.Index, name) - if sf != nil { - return sf - } - } - - return nil + return reflect.StructField{}, false } -func (s *structData) findInEmbedded( - c *Cache, - parentEmbed, childEmbed *structData, - childIndex []int, - name string, -) *structField { - // Set current parent/child data. This allows trySet to handle child fields - // and add them to our struct and to the parent as well if needed - s.curParent = parentEmbed - s.curChild = childEmbed - s.curChildIndex = childIndex - defer func() { - // Ensure to cleanup references - s.curParent = nil - if childEmbed.finished() { - // If the child can still have more fields to explore then keep it - // referened to look it up again if we need to - s.curChild = nil - s.curChildIndex = nil - } - }() - - // See if the child has already cached its fields. This is still important - // to check even if it's the s.unfinishedEmbedded because it may have - // explored new fields since the last time we visited it - for name, sf := range childEmbed.fields { - s.trySet(name, sf) - } - - // Recheck if we have what we needed from the above sync - if sf := s.fields[name]; sf != nil { - return sf - } - - // Try finding in the child again in case it hasn't finished - if !childEmbed.finished() { - if childEmbed.structField(c, s, name) != nil { - return s.fields[name] - } - } - - return nil -} - -func (s *structData) trySet(name string, sf *structField) { - if _, ok := s.fields[name]; ok { - return - } - sf = &structField{ - Nature: sf.Nature, - Index: append(s.curChildIndex, sf.Index...), - } - s.fields[name] = sf - if s.curParent != nil { - s.curParent.trySet(name, sf) - } -} - -func StructFields(c *Cache, t reflect.Type) map[string]Nature { +func StructFields(t reflect.Type) map[string]Nature { table := make(map[string]Nature) + + t = deref.Type(t) if t == nil { return table } - t, k, _ := deref.TypeKind(t, t.Kind()) - if k == reflect.Struct { - // lookup for a field with an empty name, which will cause to never find a - // match, meaning everything will have been cached. - sd := c.getStruct(t).structData - sd.structField(c, nil, "") - for name, sf := range sd.fields { - table[name] = sf.Nature - } - } - return table -} -type methodset struct { - rType reflect.Type - kind reflect.Kind - methods map[string]*method - numMethod, idx int -} + switch t.Kind() { + case reflect.Struct: + for i := 0; i < t.NumField(); i++ { + f := t.Field(i) -type method struct { - reflect.Method - nature Nature -} + if f.Anonymous { + for name, typ := range StructFields(f.Type) { + if _, ok := table[name]; ok { + continue + } + typ.FieldIndex = append(f.Index, typ.FieldIndex...) + table[name] = typ + } + } -func (s *methodset) method(c *Cache, name string) *method { - if s.methods == nil { - s.methods = make(map[string]*method, s.numMethod) - } else if m := s.methods[name]; m != nil { - return m - } - for ; s.idx < s.numMethod; s.idx++ { - rm := s.rType.Method(s.idx) - if !rm.IsExported() { - continue - } - nt := c.FromType(rm.Type) - if s.rType.Kind() != reflect.Interface { - nt.Method = true - nt.MethodIndex = rm.Index - // In case of interface type method will not have a receiver, - // and to prevent checker decreasing numbers of in arguments - // return method type as not method (second argument is false). + table[fieldName(f)] = Nature{ + Type: f.Type, + FieldIndex: f.Index, + } - // Also, we can not use m.Index here, because it will be - // different indexes for different types which implement - // the same interface. - } - m := &method{ - Method: rm, - nature: nt, - } - s.methods[rm.Name] = m - if rm.Name == name { - return m } } - return nil + + return table } diff --git a/kubewatch/vendor/github.com/expr-lang/expr/checker/types.go b/kubewatch/vendor/github.com/expr-lang/expr/checker/types.go new file mode 100644 index 000000000..09896de5d --- /dev/null +++ b/kubewatch/vendor/github.com/expr-lang/expr/checker/types.go @@ -0,0 +1,190 @@ +package checker + +import ( + "reflect" + "time" + + . "github.com/expr-lang/expr/checker/nature" +) + +var ( + unknown = Nature{} + nilNature = Nature{Nil: true} + boolNature = Nature{Type: reflect.TypeOf(true)} + integerNature = Nature{Type: reflect.TypeOf(0)} + floatNature = Nature{Type: reflect.TypeOf(float64(0))} + stringNature = Nature{Type: reflect.TypeOf("")} + arrayNature = Nature{Type: reflect.TypeOf([]any{})} + mapNature = Nature{Type: reflect.TypeOf(map[string]any{})} + timeNature = Nature{Type: reflect.TypeOf(time.Time{})} + durationNature = Nature{Type: reflect.TypeOf(time.Duration(0))} +) + +var ( + anyType = reflect.TypeOf(new(any)).Elem() + timeType = reflect.TypeOf(time.Time{}) + durationType = reflect.TypeOf(time.Duration(0)) + arrayType = reflect.TypeOf([]any{}) +) + +func arrayOf(nt Nature) Nature { + return Nature{ + Type: arrayType, + ArrayOf: &nt, + } +} + +func isNil(nt Nature) bool { + return nt.Nil +} + +func combined(l, r Nature) Nature { + if isUnknown(l) || isUnknown(r) { + return unknown + } + if isFloat(l) || isFloat(r) { + return floatNature + } + return integerNature +} + +func anyOf(nt Nature, fns ...func(Nature) bool) bool { + for _, fn := range fns { + if fn(nt) { + return true + } + } + return false +} + +func or(l, r Nature, fns ...func(Nature) bool) bool { + if isUnknown(l) && isUnknown(r) { + return true + } + if isUnknown(l) && anyOf(r, fns...) { + return true + } + if isUnknown(r) && anyOf(l, fns...) { + return true + } + return false +} + +func isUnknown(nt Nature) bool { + return nt.IsUnknown() +} + +func isInteger(nt Nature) bool { + switch nt.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + fallthrough + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + return nt.PkgPath() == "" + } + return false +} + +func isFloat(nt Nature) bool { + switch nt.Kind() { + case reflect.Float32, reflect.Float64: + return nt.PkgPath() == "" + } + return false +} + +func isNumber(nt Nature) bool { + return isInteger(nt) || isFloat(nt) +} + +func isTime(nt Nature) bool { + switch nt.Type { + case timeType: + return true + } + return false +} + +func isDuration(nt Nature) bool { + switch nt.Type { + case durationType: + return true + } + return false +} + +func isBool(nt Nature) bool { + switch nt.Kind() { + case reflect.Bool: + return true + } + return false +} + +func isString(nt Nature) bool { + switch nt.Kind() { + case reflect.String: + return true + } + return false +} + +func isArray(nt Nature) bool { + switch nt.Kind() { + case reflect.Slice, reflect.Array: + return true + } + return false +} + +func isMap(nt Nature) bool { + switch nt.Kind() { + case reflect.Map: + return true + } + return false +} + +func isStruct(nt Nature) bool { + switch nt.Kind() { + case reflect.Struct: + return true + } + return false +} + +func isFunc(nt Nature) bool { + switch nt.Kind() { + case reflect.Func: + return true + } + return false +} + +func kind(t reflect.Type) reflect.Kind { + if t == nil { + return reflect.Invalid + } + return t.Kind() +} + +func isComparable(l, r Nature) bool { + if isUnknown(l) || isUnknown(r) { + return true + } + if isNil(l) || isNil(r) { + return true + } + if isNumber(l) && isNumber(r) { + return true + } + if isDuration(l) && isDuration(r) { + return true + } + if isTime(l) && isTime(r) { + return true + } + if isArray(l) && isArray(r) { + return true + } + return l.AssignableTo(r) +} diff --git a/kubewatch/vendor/github.com/expr-lang/expr/compiler/compiler.go b/kubewatch/vendor/github.com/expr-lang/expr/compiler/compiler.go index 5de89f54c..90e54e54b 100644 --- a/kubewatch/vendor/github.com/expr-lang/expr/compiler/compiler.go +++ b/kubewatch/vendor/github.com/expr-lang/expr/compiler/compiler.go @@ -5,7 +5,6 @@ import ( "math" "reflect" "regexp" - "runtime/debug" "github.com/expr-lang/expr/ast" "github.com/expr-lang/expr/builtin" @@ -25,7 +24,7 @@ const ( func Compile(tree *parser.Tree, config *conf.Config) (program *Program, err error) { defer func() { if r := recover(); r != nil { - err = fmt.Errorf("%v\n%s", r, debug.Stack()) + err = fmt.Errorf("%v", r) } }() @@ -37,12 +36,6 @@ func Compile(tree *parser.Tree, config *conf.Config) (program *Program, err erro debugInfo: make(map[string]string), } - if config != nil { - c.ntCache = &c.config.NtCache - } else { - c.ntCache = new(Cache) - } - c.compile(tree.Node) if c.config != nil { @@ -53,8 +46,6 @@ func Compile(tree *parser.Tree, config *conf.Config) (program *Program, err erro c.emit(OpCast, 1) case reflect.Float64: c.emit(OpCast, 2) - case reflect.Bool: - c.emit(OpCast, 3) } if c.config.Optimize { c.optimize() @@ -83,7 +74,6 @@ func Compile(tree *parser.Tree, config *conf.Config) (program *Program, err erro type compiler struct { config *conf.Config - ntCache *Cache locations []file.Location bytecode []Opcode variables int @@ -312,12 +302,12 @@ func (c *compiler) IdentifierNode(node *ast.IdentifierNode) { if env.IsFastMap() { c.emit(OpLoadFast, c.addConstant(node.Value)) - } else if ok, index, name := checker.FieldIndex(c.ntCache, env, node); ok { + } else if ok, index, name := checker.FieldIndex(env, node); ok { c.emit(OpLoadField, c.addConstant(&runtime.Field{ Index: index, Path: []string{name}, })) - } else if ok, index, name := checker.MethodIndex(c.ntCache, env, node); ok { + } else if ok, index, name := checker.MethodIndex(env, node); ok { c.emit(OpLoadMethod, c.addConstant(&runtime.Method{ Name: name, Index: index, @@ -448,14 +438,6 @@ func (c *compiler) BinaryNode(node *ast.BinaryNode) { c.emit(OpNot) case "or", "||": - if c.config != nil && !c.config.ShortCircuit { - c.compile(node.Left) - c.derefInNeeded(node.Left) - c.compile(node.Right) - c.derefInNeeded(node.Right) - c.emit(OpOr) - break - } c.compile(node.Left) c.derefInNeeded(node.Left) end := c.emit(OpJumpIfTrue, placeholder) @@ -465,14 +447,6 @@ func (c *compiler) BinaryNode(node *ast.BinaryNode) { c.patchJump(end) case "and", "&&": - if c.config != nil && !c.config.ShortCircuit { - c.compile(node.Left) - c.derefInNeeded(node.Left) - c.compile(node.Right) - c.derefInNeeded(node.Right) - c.emit(OpAnd) - break - } c.compile(node.Left) c.derefInNeeded(node.Left) end := c.emit(OpJumpIfFalse, placeholder) @@ -679,7 +653,7 @@ func (c *compiler) MemberNode(node *ast.MemberNode) { env = c.config.Env } - if ok, index, name := checker.MethodIndex(c.ntCache, env, node); ok { + if ok, index, name := checker.MethodIndex(env, node); ok { c.compile(node.Node) c.emit(OpMethod, c.addConstant(&runtime.Method{ Name: name, @@ -690,14 +664,14 @@ func (c *compiler) MemberNode(node *ast.MemberNode) { op := OpFetch base := node.Node - ok, index, nodeName := checker.FieldIndex(c.ntCache, env, node) + ok, index, nodeName := checker.FieldIndex(env, node) path := []string{nodeName} if ok { op = OpFetchField for !node.Optional { if ident, isIdent := base.(*ast.IdentifierNode); isIdent { - if ok, identIndex, name := checker.FieldIndex(c.ntCache, env, ident); ok { + if ok, identIndex, name := checker.FieldIndex(env, ident); ok { index = append(identIndex, index...) path = append([]string{name}, path...) c.emitLocation(ident.Location(), OpLoadField, c.addConstant( @@ -708,7 +682,7 @@ func (c *compiler) MemberNode(node *ast.MemberNode) { } if member, isMember := base.(*ast.MemberNode); isMember { - if ok, memberIndex, name := checker.FieldIndex(c.ntCache, env, member); ok { + if ok, memberIndex, name := checker.FieldIndex(env, member); ok { index = append(memberIndex, index...) path = append([]string{name}, path...) node = member @@ -732,18 +706,6 @@ func (c *compiler) MemberNode(node *ast.MemberNode) { if op == OpFetch { c.compile(node.Property) - deref := true - // If the map key is a pointer, we should not dereference the property. - if node.Node.Type() != nil && node.Node.Type().Kind() == reflect.Map { - keyType := node.Node.Type().Key() - propType := node.Property.Type() - if propType != nil && propType.AssignableTo(keyType) { - deref = false - } - } - if deref { - c.derefInNeeded(node.Property) - } c.emit(OpFetch) } else { c.emitLocation(node.Location(), op, c.addConstant( @@ -756,13 +718,11 @@ func (c *compiler) SliceNode(node *ast.SliceNode) { c.compile(node.Node) if node.To != nil { c.compile(node.To) - c.derefInNeeded(node.To) } else { c.emit(OpLen) } if node.From != nil { c.compile(node.From) - c.derefInNeeded(node.From) } else { c.emitPush(0) } @@ -783,7 +743,7 @@ func (c *compiler) CallNode(node *ast.CallNode) { } } case *ast.IdentifierNode: - if t, ok := c.config.Env.MethodByName(c.ntCache, callee.Value); ok && t.Method { + if t, ok := c.config.Env.MethodByName(callee.Value); ok && t.Method { fnInOffset = 1 fnNumIn-- } @@ -816,16 +776,12 @@ func (c *compiler) CallNode(node *ast.CallNode) { } c.compile(node.Callee) - if c.config != nil { - isMethod, _, _ := checker.MethodIndex(c.ntCache, c.config.Env, node.Callee) - if index, ok := checker.TypedFuncIndex(node.Callee.Type(), isMethod); ok { - c.emit(OpCallTyped, index) - return - } else if checker.IsFastFunc(node.Callee.Type(), isMethod) { - c.emit(OpCallFast, len(node.Arguments)) - } else { - c.emit(OpCall, len(node.Arguments)) - } + isMethod, _, _ := checker.MethodIndex(c.config.Env, node.Callee) + if index, ok := checker.TypedFuncIndex(node.Callee.Type(), isMethod); ok { + c.emit(OpCallTyped, index) + return + } else if checker.IsFastFunc(node.Callee.Type(), isMethod) { + c.emit(OpCallFast, len(node.Arguments)) } else { c.emit(OpCall, len(node.Arguments)) } @@ -1120,7 +1076,7 @@ func (c *compiler) BuiltinNode(node *ast.BuiltinNode) { for i, arg := range node.Arguments { c.compile(arg) argType := arg.Type() - if argType.Kind() == reflect.Ptr || arg.Nature().IsUnknown(c.ntCache) { + if argType.Kind() == reflect.Ptr || arg.Nature().IsUnknown() { if f.Deref == nil { // By default, builtins expect arguments to be dereferenced. c.emit(OpDeref) @@ -1135,9 +1091,7 @@ func (c *compiler) BuiltinNode(node *ast.BuiltinNode) { if f.Fast != nil { c.emit(OpCallBuiltin1, id) } else if f.Safe != nil { - id := c.addConstant(f.Safe) - c.emit(OpPush, id) - c.debugInfo[fmt.Sprintf("const_%d", id)] = node.Name + c.emit(OpPush, c.addConstant(f.Safe)) c.emit(OpCallSafe, len(node.Arguments)) } else if f.Func != nil { c.emitFunction(f, len(node.Arguments)) @@ -1243,7 +1197,6 @@ func (c *compiler) lookupVariable(name string) (int, bool) { func (c *compiler) ConditionalNode(node *ast.ConditionalNode) { c.compile(node.Cond) - c.derefInNeeded(node.Cond) otherwise := c.emit(OpJumpIfFalse, placeholder) c.emit(OpPop) diff --git a/kubewatch/vendor/github.com/expr-lang/expr/conf/config.go b/kubewatch/vendor/github.com/expr-lang/expr/conf/config.go index f7c95d203..d629958e5 100644 --- a/kubewatch/vendor/github.com/expr-lang/expr/conf/config.go +++ b/kubewatch/vendor/github.com/expr-lang/expr/conf/config.go @@ -10,12 +10,12 @@ import ( "github.com/expr-lang/expr/vm/runtime" ) -var ( - // DefaultMemoryBudget represents default maximum allowed memory usage by the vm.VM. +const ( + // DefaultMemoryBudget represents an upper limit of memory usage DefaultMemoryBudget uint = 1e6 - // DefaultMaxNodes represents default maximum allowed AST nodes by the compiler. - DefaultMaxNodes uint = 1e4 + // DefaultMaxNodes represents an upper limit of AST nodes + DefaultMaxNodes uint = 10000 ) type FunctionsTable map[string]*builtin.Function @@ -27,28 +27,22 @@ type Config struct { ExpectAny bool Optimize bool Strict bool - ShortCircuit bool Profile bool MaxNodes uint + MemoryBudget uint ConstFns map[string]reflect.Value Visitors []ast.Visitor Functions FunctionsTable Builtins FunctionsTable Disabled map[string]bool // disabled builtins - NtCache nature.Cache - // DisableIfOperator disables the built-in `if ... { } else { }` operator syntax - // so that users can use a custom function named `if(...)` without conflicts. - // When enabled, the lexer treats `if`/`else` as identifiers and the parser - // will not parse `if` statements. - DisableIfOperator bool } // CreateNew creates new config with default values. func CreateNew() *Config { c := &Config{ Optimize: true, - ShortCircuit: true, MaxNodes: DefaultMaxNodes, + MemoryBudget: DefaultMemoryBudget, ConstFns: make(map[string]reflect.Value), Functions: make(map[string]*builtin.Function), Builtins: make(map[string]*builtin.Function), @@ -69,7 +63,7 @@ func New(env any) *Config { func (c *Config) WithEnv(env any) { c.EnvObject = env - c.Env = EnvWithCache(&c.NtCache, env) + c.Env = Env(env) c.Strict = c.Env.Strict } @@ -100,7 +94,7 @@ func (c *Config) IsOverridden(name string) bool { if _, ok := c.Functions[name]; ok { return true } - if _, ok := c.Env.Get(&c.NtCache, name); ok { + if _, ok := c.Env.Get(name); ok { return true } return false diff --git a/kubewatch/vendor/github.com/expr-lang/expr/conf/env.go b/kubewatch/vendor/github.com/expr-lang/expr/conf/env.go index 0acd44570..8b13df1e1 100644 --- a/kubewatch/vendor/github.com/expr-lang/expr/conf/env.go +++ b/kubewatch/vendor/github.com/expr-lang/expr/conf/env.go @@ -9,42 +9,35 @@ import ( "github.com/expr-lang/expr/types" ) -// Env returns the Nature of the given environment. -// -// Deprecated: use EnvWithCache instead. func Env(env any) Nature { - return EnvWithCache(new(Cache), env) -} - -func EnvWithCache(c *Cache, env any) Nature { if env == nil { - n := c.NatureOf(map[string]any{}) - n.Strict = true - return n + return Nature{ + Type: reflect.TypeOf(map[string]any{}), + Strict: true, + } } switch env := env.(type) { case types.Map: - nt := env.Nature() - return nt + return env.Nature() } v := reflect.ValueOf(env) - t := v.Type() + d := deref.Value(v) - switch deref.Value(v).Kind() { + switch d.Kind() { case reflect.Struct: - n := c.FromType(t) - n.Strict = true - return n + return Nature{ + Type: v.Type(), + Strict: true, + } case reflect.Map: - n := c.FromType(v.Type()) - if n.TypeData == nil { - n.TypeData = new(TypeData) + n := Nature{ + Type: v.Type(), + Fields: make(map[string]Nature, v.Len()), + Strict: true, } - n.Strict = true - n.Fields = make(map[string]Nature, v.Len()) for _, key := range v.MapKeys() { elem := v.MapIndex(key) @@ -56,15 +49,14 @@ func EnvWithCache(c *Cache, env any) Nature { switch face := face.(type) { case types.Map: - nt := face.Nature() - n.Fields[key.String()] = nt + n.Fields[key.String()] = face.Nature() default: if face == nil { - n.Fields[key.String()] = c.NatureOf(nil) + n.Fields[key.String()] = Nature{Nil: true} continue } - n.Fields[key.String()] = c.NatureOf(face) + n.Fields[key.String()] = Nature{Type: reflect.TypeOf(face)} } } diff --git a/kubewatch/vendor/github.com/expr-lang/expr/expr.go b/kubewatch/vendor/github.com/expr-lang/expr/expr.go index 280605e67..5e60791e1 100644 --- a/kubewatch/vendor/github.com/expr-lang/expr/expr.go +++ b/kubewatch/vendor/github.com/expr-lang/expr/expr.go @@ -13,7 +13,6 @@ import ( "github.com/expr-lang/expr/conf" "github.com/expr-lang/expr/file" "github.com/expr-lang/expr/optimizer" - "github.com/expr-lang/expr/parser" "github.com/expr-lang/expr/patcher" "github.com/expr-lang/expr/vm" ) @@ -48,7 +47,6 @@ func Operator(operator string, fn ...string) Option { Overloads: fn, Env: &c.Env, Functions: c.Functions, - NtCache: &c.NtCache, } c.Visitors = append(c.Visitors, p) } @@ -109,14 +107,6 @@ func AsFloat64() Option { } } -// DisableIfOperator disables the `if ... else ...` operator syntax so a custom -// function named `if(...)` can be used without conflicts. -func DisableIfOperator() Option { - return func(c *conf.Config) { - c.DisableIfOperator = true - } -} - // WarnOnAny tells the compiler to warn if expression return any type. func WarnOnAny() Option { return func(c *conf.Config) { @@ -134,13 +124,6 @@ func Optimize(b bool) Option { } } -// DisableShortCircuit turns short circuit off. -func DisableShortCircuit() Option { - return func(c *conf.Config) { - c.ShortCircuit = false - } -} - // Patch adds visitor to list of visitors what will be applied before compiling AST to bytecode. func Patch(visitor ast.Visitor) Option { return func(c *conf.Config) { @@ -211,15 +194,6 @@ func Timezone(name string) Option { }) } -// MaxNodes sets the maximum number of nodes allowed in the expression. -// By default, the maximum number of nodes is conf.DefaultMaxNodes. -// If MaxNodes is set to 0, the node budget check is disabled. -func MaxNodes(n uint) Option { - return func(c *conf.Config) { - c.MaxNodes = n - } -} - // Compile parses and compiles given input expression to bytecode program. func Compile(input string, ops ...Option) (*vm.Program, error) { config := conf.CreateNew() @@ -266,12 +240,7 @@ func Eval(input string, env any) (any, error) { return nil, fmt.Errorf("misused expr.Eval: second argument (env) should be passed without expr.Env") } - tree, err := parser.Parse(input) - if err != nil { - return nil, err - } - - program, err := compiler.Compile(tree, nil) + program, err := Compile(input) if err != nil { return nil, err } diff --git a/kubewatch/vendor/github.com/expr-lang/expr/file/error.go b/kubewatch/vendor/github.com/expr-lang/expr/file/error.go index c398ed59c..8ff85dfa5 100644 --- a/kubewatch/vendor/github.com/expr-lang/expr/file/error.go +++ b/kubewatch/vendor/github.com/expr-lang/expr/file/error.go @@ -3,6 +3,7 @@ package file import ( "fmt" "strings" + "unicode/utf8" ) type Error struct { @@ -18,48 +19,43 @@ func (e *Error) Error() string { return e.format() } -var tabReplacer = strings.NewReplacer("\t", " ") - func (e *Error) Bind(source Source) *Error { - src := source.String() - - var runeCount, lineStart int e.Line = 1 - e.Column = 0 - for i, r := range src { - if runeCount == e.From { + for i, r := range source { + if i == e.From { break } if r == '\n' { - lineStart = i + 1 e.Line++ e.Column = 0 } else { e.Column++ } - runeCount++ - } - - lineEnd := lineStart + strings.IndexByte(src[lineStart:], '\n') - if lineEnd < lineStart { - lineEnd = len(src) - } - if lineStart == lineEnd { - return e } + if snippet, found := source.Snippet(e.Line); found { + snippet := strings.Replace(snippet, "\t", " ", -1) + srcLine := "\n | " + snippet + var bytes = []byte(snippet) + var indLine = "\n | " + for i := 0; i < e.Column && len(bytes) > 0; i++ { + _, sz := utf8.DecodeRune(bytes) + bytes = bytes[sz:] + if sz > 1 { + goto noind + } else { + indLine += "." + } + } + if _, sz := utf8.DecodeRune(bytes); sz > 1 { + goto noind + } else { + indLine += "^" + } + srcLine += indLine - const prefix = "\n | " - line := src[lineStart:lineEnd] - snippet := new(strings.Builder) - snippet.Grow(2*len(prefix) + len(line) + e.Column + 1) - snippet.WriteString(prefix) - tabReplacer.WriteString(snippet, line) - snippet.WriteString(prefix) - for i := 0; i < e.Column; i++ { - snippet.WriteByte('.') + noind: + e.Snippet = srcLine } - snippet.WriteByte('^') - e.Snippet = snippet.String() return e } diff --git a/kubewatch/vendor/github.com/expr-lang/expr/file/source.go b/kubewatch/vendor/github.com/expr-lang/expr/file/source.go index b11bb5f9d..8e2b2d154 100644 --- a/kubewatch/vendor/github.com/expr-lang/expr/file/source.go +++ b/kubewatch/vendor/github.com/expr-lang/expr/file/source.go @@ -1,36 +1,48 @@ package file -import "strings" +import ( + "strings" + "unicode/utf8" +) -type Source struct { - raw string -} +type Source []rune func NewSource(contents string) Source { - return Source{ - raw: contents, - } + return []rune(contents) } func (s Source) String() string { - return s.raw + return string(s) } func (s Source) Snippet(line int) (string, bool) { - if s.raw == "" { + if s == nil { return "", false } - var start int - for i := 1; i < line; i++ { - pos := strings.IndexByte(s.raw[start:], '\n') - if pos < 0 { - return "", false - } - start += pos + 1 + lines := strings.Split(string(s), "\n") + lineOffsets := make([]int, len(lines)) + var offset int + for i, line := range lines { + offset = offset + utf8.RuneCountInString(line) + 1 + lineOffsets[i] = offset + } + charStart, found := getLineOffset(lineOffsets, line) + if !found || len(s) == 0 { + return "", false } - end := start + strings.IndexByte(s.raw[start:], '\n') - if end < start { - end = len(s.raw) + charEnd, found := getLineOffset(lineOffsets, line+1) + if found { + return string(s[charStart : charEnd-1]), true + } + return string(s[charStart:]), true +} + +func getLineOffset(lineOffsets []int, line int) (int, bool) { + if line == 1 { + return 0, true + } else if line > 1 && line <= len(lineOffsets) { + offset := lineOffsets[line-2] + return offset, true } - return s.raw[start:end], true + return -1, false } diff --git a/kubewatch/vendor/github.com/expr-lang/expr/internal/deref/deref.go b/kubewatch/vendor/github.com/expr-lang/expr/internal/deref/deref.go index 4ad7877f8..da3e28ce6 100644 --- a/kubewatch/vendor/github.com/expr-lang/expr/internal/deref/deref.go +++ b/kubewatch/vendor/github.com/expr-lang/expr/internal/deref/deref.go @@ -45,12 +45,3 @@ func Value(v reflect.Value) reflect.Value { } return v } - -func TypeKind(t reflect.Type, k reflect.Kind) (_ reflect.Type, _ reflect.Kind, changed bool) { - for k == reflect.Pointer { - changed = true - t = t.Elem() - k = t.Kind() - } - return t, k, changed -} diff --git a/kubewatch/vendor/github.com/expr-lang/expr/internal/ring/ring.go b/kubewatch/vendor/github.com/expr-lang/expr/internal/ring/ring.go deleted file mode 100644 index cc9e727b0..000000000 --- a/kubewatch/vendor/github.com/expr-lang/expr/internal/ring/ring.go +++ /dev/null @@ -1,85 +0,0 @@ -package ring - -// Ring is a very simple ring buffer implementation that uses a slice. The -// internal slice will only grow, never shrink. When it grows, it grows in -// chunks of "chunkSize" (given as argument in the [New] function). Pointer and -// reference types can be safely used because memory is cleared. -type Ring[T any] struct { - data []T - back, len, chunkSize int -} - -func New[T any](chunkSize int) *Ring[T] { - if chunkSize < 1 { - panic("chunkSize must be greater than zero") - } - return &Ring[T]{ - chunkSize: chunkSize, - } -} - -func (r *Ring[T]) Len() int { - return r.len -} - -func (r *Ring[T]) Cap() int { - return len(r.data) -} - -func (r *Ring[T]) Reset() { - var zero T - for i := range r.data { - r.data[i] = zero // clear mem, optimized by the compiler, in Go 1.21 the "clear" builtin can be used - } - r.back = 0 - r.len = 0 -} - -// Nth returns the n-th oldest value (zero-based) in the ring without making -// any change. -func (r *Ring[T]) Nth(n int) (v T, ok bool) { - if n < 0 || n >= r.len || len(r.data) == 0 { - return v, false - } - n = (n + r.back) % len(r.data) - return r.data[n], true -} - -// Dequeue returns the oldest value. -func (r *Ring[T]) Dequeue() (v T, ok bool) { - if r.len == 0 { - return v, false - } - v, r.data[r.back] = r.data[r.back], v // retrieve and clear mem - r.len-- - r.back = (r.back + 1) % len(r.data) - return v, true -} - -// Enqueue adds an item to the ring. -func (r *Ring[T]) Enqueue(v T) { - if r.len == len(r.data) { - r.grow() - } - writePos := (r.back + r.len) % len(r.data) - r.data[writePos] = v - r.len++ -} - -func (r *Ring[T]) grow() { - s := make([]T, len(r.data)+r.chunkSize) - if r.len > 0 { - chunk1 := r.back + r.len - if chunk1 > len(r.data) { - chunk1 = len(r.data) - } - copied := copy(s, r.data[r.back:chunk1]) - - if copied < r.len { // wrapped slice - chunk2 := r.len - copied - copy(s[copied:], r.data[:chunk2]) - } - } - r.back = 0 - r.data = s -} diff --git a/kubewatch/vendor/github.com/expr-lang/expr/optimizer/fold.go b/kubewatch/vendor/github.com/expr-lang/expr/optimizer/fold.go index 2e5498fa5..bb40eab93 100644 --- a/kubewatch/vendor/github.com/expr-lang/expr/optimizer/fold.go +++ b/kubewatch/vendor/github.com/expr-lang/expr/optimizer/fold.go @@ -296,12 +296,10 @@ func (fold *fold) Visit(node *Node) { Name: "filter", Arguments: []Node{ base.Arguments[0], - &PredicateNode{ - Node: &BinaryNode{ - Operator: "&&", - Left: base.Arguments[1].(*PredicateNode).Node, - Right: n.Arguments[1].(*PredicateNode).Node, - }, + &BinaryNode{ + Operator: "&&", + Left: base.Arguments[1].(*PredicateNode).Node, + Right: n.Arguments[1].(*PredicateNode).Node, }, }, }) diff --git a/kubewatch/vendor/github.com/expr-lang/expr/parser/lexer/lexer.go b/kubewatch/vendor/github.com/expr-lang/expr/parser/lexer/lexer.go index 0e75942d0..e6b06c09d 100644 --- a/kubewatch/vendor/github.com/expr-lang/expr/parser/lexer/lexer.go +++ b/kubewatch/vendor/github.com/expr-lang/expr/parser/lexer/lexer.go @@ -2,174 +2,152 @@ package lexer import ( "fmt" - "io" "strings" - "unicode/utf8" "github.com/expr-lang/expr/file" - "github.com/expr-lang/expr/internal/ring" ) -const ringChunkSize = 10 - -// Lex will buffer and return the tokens of a disposable *[Lexer]. func Lex(source file.Source) ([]Token, error) { - tokens := make([]Token, 0, ringChunkSize) - l := New() - l.Reset(source) - for { - t, err := l.Next() - switch err { - case nil: - tokens = append(tokens, t) - case io.EOF: - return tokens, nil - default: - return nil, err - } + l := &lexer{ + source: source, + tokens: make([]Token, 0), + start: 0, + end: 0, } -} + l.commit() -// New returns a reusable lexer. -func New() *Lexer { - return &Lexer{ - tokens: ring.New[Token](ringChunkSize), + for state := root; state != nil; { + state = state(l) } -} -type Lexer struct { - state stateFn - source file.Source - tokens *ring.Ring[Token] - err *file.Error - start, end struct { - byte, rune int + if l.err != nil { + return nil, l.err.Bind(source) } - eof bool - // When true, keywords `if`/`else` are not treated as operators and - // will be emitted as identifiers instead (for compatibility with custom if()). - DisableIfOperator bool -} -func (l *Lexer) Reset(source file.Source) { - l.source = source - l.tokens.Reset() - l.state = root + return l.tokens, nil } -func (l *Lexer) Next() (Token, error) { - for l.state != nil && l.err == nil && l.tokens.Len() == 0 { - l.state = l.state(l) - } - if l.err != nil { - return Token{}, l.err.Bind(l.source) - } - if t, ok := l.tokens.Dequeue(); ok { - return t, nil - } - return Token{}, io.EOF +type lexer struct { + source file.Source + tokens []Token + start, end int + err *file.Error } const eof rune = -1 -func (l *Lexer) commit() { +func (l *lexer) commit() { l.start = l.end } -func (l *Lexer) next() rune { - if l.end.byte >= len(l.source.String()) { - l.eof = true +func (l *lexer) next() rune { + if l.end >= len(l.source) { + l.end++ return eof } - r, sz := utf8.DecodeRuneInString(l.source.String()[l.end.byte:]) - l.end.rune++ - l.end.byte += sz + r := l.source[l.end] + l.end++ return r } -func (l *Lexer) peek() rune { - if l.end.byte < len(l.source.String()) { - r, _ := utf8.DecodeRuneInString(l.source.String()[l.end.byte:]) - return r - } - return eof +func (l *lexer) peek() rune { + r := l.next() + l.backup() + return r } -func (l *Lexer) backup() { - if l.eof { - l.eof = false - } else if l.end.rune > 0 { - _, sz := utf8.DecodeLastRuneInString(l.source.String()[:l.end.byte]) - l.end.byte -= sz - l.end.rune-- - } +func (l *lexer) backup() { + l.end-- } -func (l *Lexer) emit(t Kind) { +func (l *lexer) emit(t Kind) { l.emitValue(t, l.word()) } -func (l *Lexer) emitValue(t Kind, value string) { - l.tokens.Enqueue(Token{ - Location: file.Location{From: l.start.rune, To: l.end.rune}, +func (l *lexer) emitValue(t Kind, value string) { + l.tokens = append(l.tokens, Token{ + Location: file.Location{From: l.start, To: l.end}, Kind: t, Value: value, }) l.commit() } -func (l *Lexer) emitEOF() { - from := l.end.rune - 1 +func (l *lexer) emitEOF() { + from := l.end - 2 if from < 0 { from = 0 } - to := l.end.rune - 0 + to := l.end - 1 if to < 0 { to = 0 } - l.tokens.Enqueue(Token{ + l.tokens = append(l.tokens, Token{ Location: file.Location{From: from, To: to}, Kind: EOF, }) l.commit() } -func (l *Lexer) skip() { +func (l *lexer) skip() { l.commit() } -func (l *Lexer) word() string { - return l.source.String()[l.start.byte:l.end.byte] +func (l *lexer) word() string { + // TODO: boundary check is NOT needed here, but for some reason CI fuzz tests are failing. + if l.start > len(l.source) || l.end > len(l.source) { + return "__invalid__" + } + return string(l.source[l.start:l.end]) } -func (l *Lexer) accept(valid string) bool { - if strings.ContainsRune(valid, l.peek()) { - l.next() +func (l *lexer) accept(valid string) bool { + if strings.ContainsRune(valid, l.next()) { return true } + l.backup() return false } -func (l *Lexer) acceptRun(valid string) { - for l.accept(valid) { +func (l *lexer) acceptRun(valid string) { + for strings.ContainsRune(valid, l.next()) { } + l.backup() } -func (l *Lexer) skipSpaces() { - l.acceptRun(" ") +func (l *lexer) skipSpaces() { + r := l.peek() + for ; r == ' '; r = l.peek() { + l.next() + } l.skip() } -func (l *Lexer) error(format string, args ...any) stateFn { - if l.err == nil { // show first error - end := l.end.rune - if l.eof { - end++ +func (l *lexer) acceptWord(word string) bool { + pos := l.end + + l.skipSpaces() + + for _, ch := range word { + if l.next() != ch { + l.end = pos + return false } + } + if r := l.peek(); r != ' ' && r != eof { + l.end = pos + return false + } + + return true +} + +func (l *lexer) error(format string, args ...any) stateFn { + if l.err == nil { // show first error l.err = &file.Error{ Location: file.Location{ - From: end - 1, - To: end, + From: l.end - 1, + To: l.end, }, Message: fmt.Sprintf(format, args...), } @@ -189,7 +167,7 @@ func digitVal(ch rune) int { func lower(ch rune) rune { return ('a' - 'A') | ch } // returns lower-case ch iff ch is ASCII letter -func (l *Lexer) scanDigits(ch rune, base, n int) rune { +func (l *lexer) scanDigits(ch rune, base, n int) rune { for n > 0 && digitVal(ch) < base { ch = l.next() n-- @@ -200,7 +178,7 @@ func (l *Lexer) scanDigits(ch rune, base, n int) rune { return ch } -func (l *Lexer) scanEscape(quote rune) rune { +func (l *lexer) scanEscape(quote rune) rune { ch := l.next() // read character after '/' switch ch { case 'a', 'b', 'f', 'n', 'r', 't', 'v', '\\', quote: @@ -211,37 +189,6 @@ func (l *Lexer) scanEscape(quote rune) rune { case 'x': ch = l.scanDigits(l.next(), 16, 2) case 'u': - // Support variable-length form: \u{XXXXXX} - if l.peek() == '{' { - // consume '{' - l.next() - // read 1-6 hex digits - digits := 0 - for { - p := l.peek() - if p == '}' { - break - } - if digitVal(p) >= 16 { - l.error("invalid char escape") - return eof - } - if digits >= 6 { - l.error("invalid char escape") - return eof - } - l.next() - digits++ - } - if l.peek() != '}' || digits == 0 { - l.error("invalid char escape") - return eof - } - // consume '}' and continue - l.next() - ch = l.next() - break - } ch = l.scanDigits(l.next(), 16, 4) case 'U': ch = l.scanDigits(l.next(), 16, 8) @@ -251,7 +198,7 @@ func (l *Lexer) scanEscape(quote rune) rune { return ch } -func (l *Lexer) scanString(quote rune) (n int) { +func (l *lexer) scanString(quote rune) (n int) { ch := l.next() // read character after quote for ch != quote { if ch == '\n' || ch == eof { @@ -268,48 +215,16 @@ func (l *Lexer) scanString(quote rune) (n int) { return } -func (l *Lexer) scanRawString(quote rune) (n int) { - var escapedQuotes int -loop: - for { - ch := l.next() - for ch == quote && l.peek() == quote { - // skip current and next char which are the quote escape sequence - l.next() - ch = l.next() - escapedQuotes++ - } - switch ch { - case quote: - break loop - case eof: +func (l *lexer) scanRawString(quote rune) (n int) { + ch := l.next() // read character after back tick + for ch != quote { + if ch == eof { l.error("literal not terminated") return } + ch = l.next() n++ } - str := l.source.String()[l.start.byte+1 : l.end.byte-1] - - // handle simple case where no quoted backtick was found, then no allocation - // is needed for the new string - if escapedQuotes == 0 { - l.emitValue(String, str) - return - } - - var b strings.Builder - var skipped bool - b.Grow(len(str) - escapedQuotes) - for _, r := range str { - if r == quote { - if !skipped { - skipped = true - continue - } - skipped = false - } - b.WriteRune(r) - } - l.emitValue(String, b.String()) + l.emitValue(String, string(l.source[l.start+1:l.end-1])) return } diff --git a/kubewatch/vendor/github.com/expr-lang/expr/parser/lexer/state.go b/kubewatch/vendor/github.com/expr-lang/expr/parser/lexer/state.go index 91857eade..c694a2ca0 100644 --- a/kubewatch/vendor/github.com/expr-lang/expr/parser/lexer/state.go +++ b/kubewatch/vendor/github.com/expr-lang/expr/parser/lexer/state.go @@ -6,9 +6,9 @@ import ( "github.com/expr-lang/expr/parser/utils" ) -type stateFn func(*Lexer) stateFn +type stateFn func(*lexer) stateFn -func root(l *Lexer) stateFn { +func root(l *lexer) stateFn { switch r := l.next(); { case r == eof: l.emitEOF() @@ -61,7 +61,7 @@ func root(l *Lexer) stateFn { return root } -func number(l *Lexer) stateFn { +func number(l *lexer) stateFn { if !l.scanNumber() { return l.error("bad number syntax: %q", l.word()) } @@ -69,7 +69,7 @@ func number(l *Lexer) stateFn { return root } -func (l *Lexer) scanNumber() bool { +func (l *lexer) scanNumber() bool { digits := "0123456789_" // Is it hex? if l.accept("0") { @@ -107,7 +107,7 @@ func (l *Lexer) scanNumber() bool { return true } -func dot(l *Lexer) stateFn { +func dot(l *lexer) stateFn { l.next() if l.accept("0123456789") { l.backup() @@ -118,7 +118,7 @@ func dot(l *Lexer) stateFn { return root } -func identifier(l *Lexer) stateFn { +func identifier(l *lexer) stateFn { loop: for { switch r := l.next(); { @@ -129,14 +129,8 @@ loop: switch l.word() { case "not": return not - case "in", "or", "and", "matches", "contains", "startsWith", "endsWith", "let": + case "in", "or", "and", "matches", "contains", "startsWith", "endsWith", "let", "if", "else": l.emit(Operator) - case "if", "else": - if !l.DisableIfOperator { - l.emit(Operator) - } else { - l.emit(Identifier) - } default: l.emit(Identifier) } @@ -146,7 +140,7 @@ loop: return root } -func not(l *Lexer) stateFn { +func not(l *lexer) stateFn { l.emit(Operator) l.skipSpaces() @@ -173,13 +167,13 @@ func not(l *Lexer) stateFn { return root } -func questionMark(l *Lexer) stateFn { +func questionMark(l *lexer) stateFn { l.accept(".?") l.emit(Operator) return root } -func slash(l *Lexer) stateFn { +func slash(l *lexer) stateFn { if l.accept("/") { return singleLineComment } @@ -190,7 +184,7 @@ func slash(l *Lexer) stateFn { return root } -func singleLineComment(l *Lexer) stateFn { +func singleLineComment(l *lexer) stateFn { for { r := l.next() if r == eof || r == '\n' { @@ -201,7 +195,7 @@ func singleLineComment(l *Lexer) stateFn { return root } -func multiLineComment(l *Lexer) stateFn { +func multiLineComment(l *lexer) stateFn { for { r := l.next() if r == eof { @@ -215,7 +209,7 @@ func multiLineComment(l *Lexer) stateFn { return root } -func pointer(l *Lexer) stateFn { +func pointer(l *lexer) stateFn { l.accept("#") l.emit(Operator) for { diff --git a/kubewatch/vendor/github.com/expr-lang/expr/parser/lexer/token.go b/kubewatch/vendor/github.com/expr-lang/expr/parser/lexer/token.go index c809c690e..459fa6905 100644 --- a/kubewatch/vendor/github.com/expr-lang/expr/parser/lexer/token.go +++ b/kubewatch/vendor/github.com/expr-lang/expr/parser/lexer/token.go @@ -31,13 +31,17 @@ func (t Token) String() string { } func (t Token) Is(kind Kind, values ...string) bool { - if kind != t.Kind { - return false + if len(values) == 0 { + return kind == t.Kind } + for _, v := range values { if v == t.Value { - return true + goto found } } - return len(values) == 0 + return false + +found: + return kind == t.Kind } diff --git a/kubewatch/vendor/github.com/expr-lang/expr/parser/lexer/utils.go b/kubewatch/vendor/github.com/expr-lang/expr/parser/lexer/utils.go index 6aa088ae3..5c9e6b59d 100644 --- a/kubewatch/vendor/github.com/expr-lang/expr/parser/lexer/utils.go +++ b/kubewatch/vendor/github.com/expr-lang/expr/parser/lexer/utils.go @@ -36,8 +36,7 @@ func unescape(value string) (string, error) { if size >= math.MaxInt { return "", fmt.Errorf("too large string") } - buf := new(strings.Builder) - buf.Grow(int(size)) + buf := make([]byte, 0, size) for len(value) > 0 { c, multibyte, rest, err := unescapeChar(value) if err != nil { @@ -45,13 +44,13 @@ func unescape(value string) (string, error) { } value = rest if c < utf8.RuneSelf || !multibyte { - buf.WriteByte(byte(c)) + buf = append(buf, byte(c)) } else { n := utf8.EncodeRune(runeTmp[:], c) - buf.Write(runeTmp[:n]) + buf = append(buf, runeTmp[:n]...) } } - return buf.String(), nil + return string(buf), nil } // unescapeChar takes a string input and returns the following info: @@ -111,41 +110,6 @@ func unescapeChar(s string) (value rune, multibyte bool, tail string, err error) // 4. Unicode escape sequences, reproduced from `strconv/quote.go` case 'x', 'X', 'u', 'U': - // Support Go/Rust-style variable-length form: \u{XXXXXX} - if c == 'u' && len(s) > 0 && s[0] == '{' { - // consume '{' - s = s[1:] - var v rune - digits := 0 - for len(s) > 0 && s[0] != '}' { - x, ok := unhex(s[0]) - if !ok { - err = fmt.Errorf("unable to unescape string") - return - } - if digits >= 6 { // at most 6 hex digits - err = fmt.Errorf("unable to unescape string") - return - } - v = v<<4 | x - s = s[1:] - digits++ - } - // require closing '}' and at least 1 digit - if len(s) == 0 || s[0] != '}' || digits == 0 { - err = fmt.Errorf("unable to unescape string") - return - } - // consume '}' - s = s[1:] - if v > utf8.MaxRune { - err = fmt.Errorf("unable to unescape string") - return - } - value = v - multibyte = true - break - } n := 0 switch c { case 'x', 'X': diff --git a/kubewatch/vendor/github.com/expr-lang/expr/parser/parser.go b/kubewatch/vendor/github.com/expr-lang/expr/parser/parser.go index 9ccf47830..5ba16d2a2 100644 --- a/kubewatch/vendor/github.com/expr-lang/expr/parser/parser.go +++ b/kubewatch/vendor/github.com/expr-lang/expr/parser/parser.go @@ -1,9 +1,7 @@ package parser import ( - "errors" "fmt" - "io" "math" "strconv" "strings" @@ -46,66 +44,18 @@ var predicates = map[string]struct { "reduce": {[]arg{expr, predicate, expr | optional}}, } -// Parser is a reusable parser. The zero value is ready for use. -type Parser struct { - lexer *Lexer - current, stashed Token - hasStash bool - err *file.Error - config *conf.Config - depth int // predicate call depth - nodeCount uint // tracks number of AST nodes created +type parser struct { + tokens []Token + current Token + pos int + err *file.Error + config *conf.Config + depth int // predicate call depth + nodeCount uint // tracks number of AST nodes created } -func (p *Parser) Parse(input string, config *conf.Config) (*Tree, error) { - if p.lexer == nil { - p.lexer = New() - } - p.config = config - // propagate config flags to lexer - if p.lexer != nil { - if config != nil { - p.lexer.DisableIfOperator = config.DisableIfOperator - } else { - p.lexer.DisableIfOperator = false - } - } - source := file.NewSource(input) - p.lexer.Reset(source) - p.next() - node := p.parseSequenceExpression() - - if !p.current.Is(EOF) { - p.error("unexpected token %v", p.current) - } - - tree := &Tree{ - Node: node, - Source: source, - } - err := p.err - - // cleanup non-reusable pointer values and reset state - p.err = nil - p.config = nil - p.lexer.Reset(file.Source{}) - - if err != nil { - return tree, err.Bind(source) - } - - return tree, nil -} - -func (p *Parser) checkNodeLimit() error { +func (p *parser) checkNodeLimit() error { p.nodeCount++ - if p.config == nil { - if p.nodeCount > conf.DefaultMaxNodes { - p.error("compilation failed: expression exceeds maximum allowed nodes") - return nil - } - return nil - } if p.config.MaxNodes > 0 && p.nodeCount > p.config.MaxNodes { p.error("compilation failed: expression exceeds maximum allowed nodes") return nil @@ -113,7 +63,7 @@ func (p *Parser) checkNodeLimit() error { return nil } -func (p *Parser) createNode(n Node, loc file.Location) Node { +func (p *parser) createNode(n Node, loc file.Location) Node { if err := p.checkNodeLimit(); err != nil { return nil } @@ -124,7 +74,7 @@ func (p *Parser) createNode(n Node, loc file.Location) Node { return n } -func (p *Parser) createMemberNode(n *MemberNode, loc file.Location) *MemberNode { +func (p *parser) createMemberNode(n *MemberNode, loc file.Location) *MemberNode { if err := p.checkNodeLimit(); err != nil { return nil } @@ -141,18 +91,48 @@ type Tree struct { } func Parse(input string) (*Tree, error) { - return ParseWithConfig(input, nil) + return ParseWithConfig(input, &conf.Config{ + Disabled: map[string]bool{}, + }) } func ParseWithConfig(input string, config *conf.Config) (*Tree, error) { - return new(Parser).Parse(input, config) + source := file.NewSource(input) + + tokens, err := Lex(source) + if err != nil { + return nil, err + } + + p := &parser{ + tokens: tokens, + current: tokens[0], + config: config, + } + + node := p.parseSequenceExpression() + + if !p.current.Is(EOF) { + p.error("unexpected token %v", p.current) + } + + tree := &Tree{ + Node: node, + Source: source, + } + + if p.err != nil { + return tree, p.err.Bind(source) + } + + return tree, nil } -func (p *Parser) error(format string, args ...any) { +func (p *parser) error(format string, args ...any) { p.errorAt(p.current, format, args...) } -func (p *Parser) errorAt(token Token, format string, args ...any) { +func (p *parser) errorAt(token Token, format string, args ...any) { if p.err == nil { // show first error p.err = &file.Error{ Location: token.Location, @@ -161,32 +141,16 @@ func (p *Parser) errorAt(token Token, format string, args ...any) { } } -func (p *Parser) next() { - if p.hasStash { - p.current = p.stashed - p.hasStash = false - return - } - - token, err := p.lexer.Next() - var e *file.Error - switch { - case err == nil: - p.current = token - case errors.Is(err, io.EOF): +func (p *parser) next() { + p.pos++ + if p.pos >= len(p.tokens) { p.error("unexpected end of expression") - case errors.As(err, &e): - p.err = e - default: - p.err = &file.Error{ - Location: p.current.Location, - Message: "unknown lexing error", - Prev: err, - } + return } + p.current = p.tokens[p.pos] } -func (p *Parser) expect(kind Kind, values ...string) { +func (p *parser) expect(kind Kind, values ...string) { if p.current.Is(kind, values...) { p.next() return @@ -196,7 +160,7 @@ func (p *Parser) expect(kind Kind, values ...string) { // parse functions -func (p *Parser) parseSequenceExpression() Node { +func (p *parser) parseSequenceExpression() Node { nodes := []Node{p.parseExpression(0)} for p.current.Is(Operator, ";") && p.err == nil { @@ -217,7 +181,7 @@ func (p *Parser) parseSequenceExpression() Node { }, nodes[0].Location()) } -func (p *Parser) parseExpression(precedence int) Node { +func (p *parser) parseExpression(precedence int) Node { if p.err != nil { return nil } @@ -226,7 +190,7 @@ func (p *Parser) parseExpression(precedence int) Node { return p.parseVariableDeclaration() } - if precedence == 0 && (p.config == nil || !p.config.DisableIfOperator) && p.current.Is(Operator, "if") { + if precedence == 0 && p.current.Is(Operator, "if") { return p.parseConditionalIf() } @@ -240,16 +204,15 @@ func (p *Parser) parseExpression(precedence int) Node { // Handle "not *" operator, like "not in" or "not contains". if negate { - tokenBackup := p.current + currentPos := p.pos p.next() if operator.AllowedNegateSuffix(p.current.Value) { if op, ok := operator.Binary[p.current.Value]; ok && op.Precedence >= precedence { notToken = p.current opToken = p.current } else { - p.hasStash = true - p.stashed = p.current - p.current = tokenBackup + p.pos = currentPos + p.current = opToken break } } else { @@ -320,7 +283,7 @@ func (p *Parser) parseExpression(precedence int) Node { return nodeLeft } -func (p *Parser) parseVariableDeclaration() Node { +func (p *parser) parseVariableDeclaration() Node { p.expect(Operator, "let") variableName := p.current p.expect(Identifier) @@ -335,25 +298,16 @@ func (p *Parser) parseVariableDeclaration() Node { }, variableName.Location) } -func (p *Parser) parseConditionalIf() Node { +func (p *parser) parseConditionalIf() Node { p.next() - if p.err != nil { - return nil - } nodeCondition := p.parseExpression(0) p.expect(Bracket, "{") expr1 := p.parseSequenceExpression() p.expect(Bracket, "}") p.expect(Operator, "else") - - var expr2 Node - if p.current.Is(Operator, "if") { - expr2 = p.parseConditionalIf() - } else { - p.expect(Bracket, "{") - expr2 = p.parseSequenceExpression() - p.expect(Bracket, "}") - } + p.expect(Bracket, "{") + expr2 := p.parseSequenceExpression() + p.expect(Bracket, "}") return &ConditionalNode{ Cond: nodeCondition, @@ -363,26 +317,25 @@ func (p *Parser) parseConditionalIf() Node { } -func (p *Parser) parseConditional(node Node) Node { +func (p *parser) parseConditional(node Node) Node { var expr1, expr2 Node for p.current.Is(Operator, "?") && p.err == nil { p.next() if !p.current.Is(Operator, ":") { - expr1 = p.parseExpression(0) + expr1 = p.parseSequenceExpression() p.expect(Operator, ":") - expr2 = p.parseExpression(0) + expr2 = p.parseSequenceExpression() } else { p.next() expr1 = node - expr2 = p.parseExpression(0) + expr2 = p.parseSequenceExpression() } node = p.createNode(&ConditionalNode{ - Ternary: true, - Cond: node, - Exp1: expr1, - Exp2: expr2, + Cond: node, + Exp1: expr1, + Exp2: expr2, }, p.current.Location) if node == nil { return nil @@ -391,7 +344,7 @@ func (p *Parser) parseConditional(node Node) Node { return node } -func (p *Parser) parsePrimary() Node { +func (p *parser) parsePrimary() Node { token := p.current if token.Is(Operator) { @@ -444,7 +397,7 @@ func (p *Parser) parsePrimary() Node { return p.parseSecondary() } -func (p *Parser) parseSecondary() Node { +func (p *parser) parseSecondary() Node { var node Node token := p.current @@ -543,7 +496,7 @@ func (p *Parser) parseSecondary() Node { return p.parsePostfixExpression(node) } -func (p *Parser) toIntegerNode(number int64) Node { +func (p *parser) toIntegerNode(number int64) Node { if number > math.MaxInt { p.error("integer literal is too large") return nil @@ -551,7 +504,7 @@ func (p *Parser) toIntegerNode(number int64) Node { return p.createNode(&IntegerNode{Value: int(number)}, p.current.Location) } -func (p *Parser) toFloatNode(number float64) Node { +func (p *parser) toFloatNode(number float64) Node { if number > math.MaxFloat64 { p.error("float literal is too large") return nil @@ -559,19 +512,13 @@ func (p *Parser) toFloatNode(number float64) Node { return p.createNode(&FloatNode{Value: number}, p.current.Location) } -func (p *Parser) parseCall(token Token, arguments []Node, checkOverrides bool) Node { +func (p *parser) parseCall(token Token, arguments []Node, checkOverrides bool) Node { var node Node - isOverridden := false - if p.config != nil { - isOverridden = p.config.IsOverridden(token.Value) - } + isOverridden := p.config.IsOverridden(token.Value) isOverridden = isOverridden && checkOverrides - if _, ok := predicates[token.Value]; ok && p.config != nil && p.config.Disabled[token.Value] && !isOverridden { - // Disabled predicate without replacement - fail immediately - p.error("unknown name %s", token.Value) - } else if b, ok := predicates[token.Value]; ok && !isOverridden { + if b, ok := predicates[token.Value]; ok && !isOverridden { p.expect(Bracket, "(") // In case of the pipe operator, the first argument is the left-hand side @@ -615,10 +562,7 @@ func (p *Parser) parseCall(token Token, arguments []Node, checkOverrides bool) N if node == nil { return nil } - } else if _, ok := builtin.Index[token.Value]; ok && p.config != nil && p.config.Disabled[token.Value] && !isOverridden { - // Disabled builtin without replacement - fail immediately - p.error("unknown name %s", token.Value) - } else if _, ok := builtin.Index[token.Value]; ok && (p.config == nil || !p.config.Disabled[token.Value]) && !isOverridden { + } else if _, ok := builtin.Index[token.Value]; ok && !p.config.Disabled[token.Value] && !isOverridden { node = p.createNode(&BuiltinNode{ Name: token.Value, Arguments: p.parseArguments(arguments), @@ -643,7 +587,7 @@ func (p *Parser) parseCall(token Token, arguments []Node, checkOverrides bool) N return node } -func (p *Parser) parseArguments(arguments []Node) []Node { +func (p *parser) parseArguments(arguments []Node) []Node { // If pipe operator is used, the first argument is the left-hand side // of the operator, so we do not parse it as an argument inside brackets. offset := len(arguments) @@ -664,7 +608,7 @@ func (p *Parser) parseArguments(arguments []Node) []Node { return arguments } -func (p *Parser) parsePredicate() Node { +func (p *parser) parsePredicate() Node { startToken := p.current withBrackets := false if p.current.Is(Bracket, "{") { @@ -696,7 +640,7 @@ func (p *Parser) parsePredicate() Node { return predicateNode } -func (p *Parser) parseArrayExpression(token Token) Node { +func (p *parser) parseArrayExpression(token Token) Node { nodes := make([]Node, 0) p.expect(Bracket, "[") @@ -720,7 +664,7 @@ end: return node } -func (p *Parser) parseMapExpression(token Token) Node { +func (p *parser) parseMapExpression(token Token) Node { p.expect(Bracket, "{") nodes := make([]Node, 0) @@ -773,7 +717,7 @@ end: return node } -func (p *Parser) parsePostfixExpression(node Node) Node { +func (p *parser) parsePostfixExpression(node Node) Node { postfixToken := p.current for (postfixToken.Is(Operator) || postfixToken.Is(Bracket)) && p.err == nil { optional := postfixToken.Value == "?." @@ -903,7 +847,7 @@ func (p *Parser) parsePostfixExpression(node Node) Node { } return node } -func (p *Parser) parseComparison(left Node, token Token, precedence int) Node { +func (p *parser) parseComparison(left Node, token Token, precedence int) Node { var rootNode Node for { comparator := p.parseExpression(precedence + 1) diff --git a/kubewatch/vendor/github.com/expr-lang/expr/patcher/operator_override.go b/kubewatch/vendor/github.com/expr-lang/expr/patcher/operator_override.go index cf4287c24..308cbdba3 100644 --- a/kubewatch/vendor/github.com/expr-lang/expr/patcher/operator_override.go +++ b/kubewatch/vendor/github.com/expr-lang/expr/patcher/operator_override.go @@ -16,7 +16,6 @@ type OperatorOverloading struct { Env *nature.Nature // Env type. Functions conf.FunctionsTable // Env functions. applied bool // Flag to indicate if any changes were made to the tree. - NtCache *nature.Cache } func (p *OperatorOverloading) Visit(node *ast.Node) { @@ -63,7 +62,7 @@ func (p *OperatorOverloading) FindSuitableOperatorOverload(l, r reflect.Type) (r func (p *OperatorOverloading) findSuitableOperatorOverloadInTypes(l, r reflect.Type) (reflect.Type, string, bool) { for _, fn := range p.Overloads { - fnType, ok := p.Env.Get(p.NtCache, fn) + fnType, ok := p.Env.Get(fn) if !ok { continue } @@ -110,7 +109,7 @@ func checkTypeSuits(t reflect.Type, l reflect.Type, r reflect.Type, firstInIndex func (p *OperatorOverloading) Check() { for _, fn := range p.Overloads { - fnType, foundType := p.Env.Get(p.NtCache, fn) + fnType, foundType := p.Env.Get(fn) fnFunc, foundFunc := p.Functions[fn] if !foundFunc && (!foundType || fnType.Type.Kind() != reflect.Func) { panic(fmt.Errorf("function %s for %s operator does not exist in the environment", fn, p.Operator)) diff --git a/kubewatch/vendor/github.com/expr-lang/expr/types/types.go b/kubewatch/vendor/github.com/expr-lang/expr/types/types.go index 33257c500..bb1cbe5fa 100644 --- a/kubewatch/vendor/github.com/expr-lang/expr/types/types.go +++ b/kubewatch/vendor/github.com/expr-lang/expr/types/types.go @@ -44,7 +44,7 @@ func TypeOf(v any) Type { type anyType struct{} func (anyType) Nature() Nature { - return FromType(nil) + return Nature{Type: nil} } func (anyType) Equal(t Type) bool { @@ -58,7 +58,7 @@ func (anyType) String() string { type nilType struct{} func (nilType) Nature() Nature { - return NatureOf(nil) + return Nature{Nil: true} } func (nilType) Equal(t Type) bool { @@ -77,7 +77,7 @@ type rtype struct { } func (r rtype) Nature() Nature { - return FromType(r.t) + return Nature{Type: r.t} } func (r rtype) Equal(t Type) bool { @@ -100,12 +100,11 @@ type Map map[string]Type const Extra = "[[__extra_keys__]]" func (m Map) Nature() Nature { - nt := NatureOf(map[string]any{}) - if nt.TypeData == nil { - nt.TypeData = new(TypeData) + nt := Nature{ + Type: reflect.TypeOf(map[string]any{}), + Fields: make(map[string]Nature, len(m)), + Strict: true, } - nt.Fields = make(map[string]Nature, len(m)) - nt.Strict = true for k, v := range m { if k == Extra { nt.Strict = false @@ -156,13 +155,11 @@ type array struct { func (a array) Nature() Nature { of := a.of.Nature() - nt := NatureOf([]any{}) - if nt.TypeData == nil { - nt.TypeData = new(TypeData) + return Nature{ + Type: reflect.TypeOf([]any{}), + Fields: make(map[string]Nature, 1), + ArrayOf: &of, } - nt.Fields = make(map[string]Nature, 1) - nt.Ref = &of - return nt } func (a array) Equal(t Type) bool { diff --git a/kubewatch/vendor/github.com/expr-lang/expr/vm/opcodes.go b/kubewatch/vendor/github.com/expr-lang/expr/vm/opcodes.go index 5fca0fa29..84d751d6b 100644 --- a/kubewatch/vendor/github.com/expr-lang/expr/vm/opcodes.go +++ b/kubewatch/vendor/github.com/expr-lang/expr/vm/opcodes.go @@ -84,7 +84,5 @@ const ( OpProfileStart OpProfileEnd OpBegin - OpAnd - OpOr OpEnd // This opcode must be at the end of this list. ) diff --git a/kubewatch/vendor/github.com/expr-lang/expr/vm/program.go b/kubewatch/vendor/github.com/expr-lang/expr/vm/program.go index 7eb96bd3d..15ce26f5b 100644 --- a/kubewatch/vendor/github.com/expr-lang/expr/vm/program.go +++ b/kubewatch/vendor/github.com/expr-lang/expr/vm/program.go @@ -112,9 +112,6 @@ func (program *Program) DisassembleWriter(w io.Writer) { } else { c = "out of range" } - if name, ok := program.debugInfo[fmt.Sprintf("const_%d", arg)]; ok { - c = name - } if r, ok := c.(*regexp.Regexp); ok { c = r.String() } @@ -375,12 +372,6 @@ func (program *Program) DisassembleWriter(w io.Writer) { case OpBegin: code("OpBegin") - case OpAnd: - code("OpAnd") - - case OpOr: - code("OpOr") - case OpEnd: code("OpEnd") diff --git a/kubewatch/vendor/github.com/expr-lang/expr/vm/runtime/runtime.go b/kubewatch/vendor/github.com/expr-lang/expr/vm/runtime/runtime.go index d24c6af03..cd48a280d 100644 --- a/kubewatch/vendor/github.com/expr-lang/expr/vm/runtime/runtime.go +++ b/kubewatch/vendor/github.com/expr-lang/expr/vm/runtime/runtime.go @@ -6,18 +6,10 @@ import ( "fmt" "math" "reflect" - "sync" "github.com/expr-lang/expr/internal/deref" ) -var fieldCache sync.Map - -type fieldCacheKey struct { - t reflect.Type - f string -} - func Fetch(from, i any) any { v := reflect.ValueOf(from) if v.Kind() == reflect.Invalid { @@ -71,31 +63,15 @@ func Fetch(from, i any) any { case reflect.Struct: fieldName := i.(string) - t := v.Type() - key := fieldCacheKey{ - t: t, - f: fieldName, - } - if cv, ok := fieldCache.Load(key); ok { - return v.FieldByIndex(cv.([]int)).Interface() - } - field, ok := t.FieldByNameFunc(func(name string) bool { - field, _ := t.FieldByName(name) - switch field.Tag.Get("expr") { - case "-": - return false - case fieldName: + value := v.FieldByNameFunc(func(name string) bool { + field, _ := v.Type().FieldByName(name) + if field.Tag.Get("expr") == fieldName { return true - default: - return name == fieldName } + return name == fieldName }) - if ok { - value := v.FieldByIndex(field.Index) - if value.IsValid() { - fieldCache.Store(key, field.Index) - return value.Interface() - } + if value.IsValid() { + return value.Interface() } } panic(fmt.Sprintf("cannot fetch %v from %T", i, from)) @@ -186,11 +162,6 @@ func Slice(array, from, to any) any { if a > b { a = b } - if v.Kind() == reflect.Array && !v.CanAddr() { - newValue := reflect.New(v.Type()).Elem() - newValue.Set(v) - v = newValue - } value := v.Slice(a, b) if value.IsValid() { return value.Interface() @@ -242,11 +213,7 @@ func In(needle any, array any) bool { if !n.IsValid() || n.Kind() != reflect.String { panic(fmt.Sprintf("cannot use %T as field name of %T", needle, array)) } - field, ok := v.Type().FieldByName(n.String()) - if !ok || !field.IsExported() || field.Tag.Get("expr") == "-" { - return false - } - value := v.FieldByIndex(field.Index) + value := v.FieldByName(n.String()) if value.IsValid() { return true } @@ -413,18 +380,6 @@ func ToFloat64(a any) float64 { } } -func ToBool(a any) bool { - if a == nil { - return false - } - switch x := a.(type) { - case bool: - return x - default: - panic(fmt.Sprintf("invalid operation: bool(%T)", x)) - } -} - func IsNil(v any) bool { if v == nil { return true diff --git a/kubewatch/vendor/github.com/expr-lang/expr/vm/vm.go b/kubewatch/vendor/github.com/expr-lang/expr/vm/vm.go index 3c7a2b3f7..de13cade1 100644 --- a/kubewatch/vendor/github.com/expr-lang/expr/vm/vm.go +++ b/kubewatch/vendor/github.com/expr-lang/expr/vm/vm.go @@ -17,8 +17,6 @@ import ( "github.com/expr-lang/expr/vm/runtime" ) -const maxFnArgsBuf = 256 - func Run(program *Program, env any) (any, error) { if program == nil { return nil, fmt.Errorf("program is nil") @@ -69,24 +67,21 @@ func (vm *VM) Run(program *Program, env any) (_ any, err error) { if vm.Stack == nil { vm.Stack = make([]any, 0, 2) } else { - clearSlice(vm.Stack) vm.Stack = vm.Stack[0:0] } if vm.Scopes != nil { - clearSlice(vm.Scopes) vm.Scopes = vm.Scopes[0:0] } if len(vm.Variables) < program.variables { vm.Variables = make([]any, program.variables) } + if vm.MemoryBudget == 0 { vm.MemoryBudget = conf.DefaultMemoryBudget } vm.memory = 0 vm.ip = 0 - var fnArgsBuf []any - for vm.ip < len(program.Bytecode) { if debug && vm.debug { <-vm.step @@ -180,47 +175,29 @@ func (vm *VM) Run(program *Program, env any) (_ any, err error) { vm.push(a.(string) == b.(string)) case OpJump: - if arg < 0 { - panic("negative jump offset is invalid") - } vm.ip += arg case OpJumpIfTrue: - if arg < 0 { - panic("negative jump offset is invalid") - } if vm.current().(bool) { vm.ip += arg } case OpJumpIfFalse: - if arg < 0 { - panic("negative jump offset is invalid") - } if !vm.current().(bool) { vm.ip += arg } case OpJumpIfNil: - if arg < 0 { - panic("negative jump offset is invalid") - } if runtime.IsNil(vm.current()) { vm.ip += arg } case OpJumpIfNotNil: - if arg < 0 { - panic("negative jump offset is invalid") - } if !runtime.IsNil(vm.current()) { vm.ip += arg } case OpJumpIfEnd: - if arg < 0 { - panic("negative jump offset is invalid") - } scope := vm.scope() if scope.Index >= scope.Len { vm.ip += arg @@ -303,13 +280,7 @@ func (vm *VM) Run(program *Program, env any) (_ any, err error) { vm.push(false) break } - var match bool - var err error - if s, ok := a.(string); ok { - match, err = regexp.MatchString(b.(string), s) - } else { - match, err = regexp.Match(b.(string), a.([]byte)) - } + match, err := regexp.MatchString(b.(string), a.(string)) if err != nil { panic(err) } @@ -322,11 +293,7 @@ func (vm *VM) Run(program *Program, env any) (_ any, err error) { break } r := program.Constants[arg].(*regexp.Regexp) - if s, ok := a.(string); ok { - vm.push(r.MatchString(s)) - } else { - vm.push(r.Match(a.([]byte))) - } + vm.push(r.MatchString(a.(string))) case OpContains: b := vm.pop() @@ -362,29 +329,13 @@ func (vm *VM) Run(program *Program, env any) (_ any, err error) { vm.push(runtime.Slice(node, from, to)) case OpCall: - v := vm.pop() - if v == nil { - panic("invalid operation: cannot call nil") - } - fn := reflect.ValueOf(v) - if fn.Kind() != reflect.Func { - panic(fmt.Sprintf("invalid operation: cannot call non-function of type %T", v)) - } - fnType := fn.Type() + fn := reflect.ValueOf(vm.pop()) size := arg in := make([]reflect.Value, size) - isVariadic := fnType.IsVariadic() - numIn := fnType.NumIn() for i := int(size) - 1; i >= 0; i-- { param := vm.pop() if param == nil { - var inType reflect.Type - if isVariadic && i >= numIn-1 { - inType = fnType.In(numIn - 1).Elem() - } else { - inType = fnType.In(i) - } - in[i] = reflect.Zero(inType) + in[i] = reflect.Zero(fn.Type().In(i)) } else { in[i] = reflect.ValueOf(param) } @@ -403,27 +354,27 @@ func (vm *VM) Run(program *Program, env any) (_ any, err error) { vm.push(out) case OpCall1: - var args []any - args, fnArgsBuf = vm.getArgsForFunc(fnArgsBuf, program, 1) - out, err := program.functions[arg](args...) + a := vm.pop() + out, err := program.functions[arg](a) if err != nil { panic(err) } vm.push(out) case OpCall2: - var args []any - args, fnArgsBuf = vm.getArgsForFunc(fnArgsBuf, program, 2) - out, err := program.functions[arg](args...) + b := vm.pop() + a := vm.pop() + out, err := program.functions[arg](a, b) if err != nil { panic(err) } vm.push(out) case OpCall3: - var args []any - args, fnArgsBuf = vm.getArgsForFunc(fnArgsBuf, program, 3) - out, err := program.functions[arg](args...) + c := vm.pop() + b := vm.pop() + a := vm.pop() + out, err := program.functions[arg](a, b, c) if err != nil { panic(err) } @@ -431,9 +382,12 @@ func (vm *VM) Run(program *Program, env any) (_ any, err error) { case OpCallN: fn := vm.pop().(Function) - var args []any - args, fnArgsBuf = vm.getArgsForFunc(fnArgsBuf, program, arg) - out, err := fn(args...) + size := arg + in := make([]any, size) + for i := int(size) - 1; i >= 0; i-- { + in[i] = vm.pop() + } + out, err := fn(in...) if err != nil { panic(err) } @@ -441,15 +395,21 @@ func (vm *VM) Run(program *Program, env any) (_ any, err error) { case OpCallFast: fn := vm.pop().(func(...any) any) - var args []any - args, fnArgsBuf = vm.getArgsForFunc(fnArgsBuf, program, arg) - vm.push(fn(args...)) + size := arg + in := make([]any, size) + for i := int(size) - 1; i >= 0; i-- { + in[i] = vm.pop() + } + vm.push(fn(in...)) case OpCallSafe: fn := vm.pop().(SafeFunction) - var args []any - args, fnArgsBuf = vm.getArgsForFunc(fnArgsBuf, program, arg) - out, mem, err := fn(args...) + size := arg + in := make([]any, size) + for i := int(size) - 1; i >= 0; i-- { + in[i] = vm.pop() + } + out, mem, err := fn(in...) if err != nil { panic(err) } @@ -493,8 +453,6 @@ func (vm *VM) Run(program *Program, env any) (_ any, err error) { vm.push(runtime.ToInt64(vm.pop())) case 2: vm.push(runtime.ToFloat64(vm.pop())) - case 3: - vm.push(runtime.ToBool(vm.pop())) } case OpDeref: @@ -601,16 +559,6 @@ func (vm *VM) Run(program *Program, env any) (_ any, err error) { Len: array.Len(), }) - case OpAnd: - a := vm.pop() - b := vm.pop() - vm.push(a.(bool) && b.(bool)) - - case OpOr: - a := vm.pop() - b := vm.pop() - vm.push(a.(bool) || b.(bool)) - case OpEnd: vm.Scopes = vm.Scopes[:len(vm.Scopes)-1] @@ -640,16 +588,10 @@ func (vm *VM) push(value any) { } func (vm *VM) current() any { - if len(vm.Stack) == 0 { - panic("stack underflow") - } return vm.Stack[len(vm.Stack)-1] } func (vm *VM) pop() any { - if len(vm.Stack) == 0 { - panic("stack underflow") - } value := vm.Stack[len(vm.Stack)-1] vm.Stack = vm.Stack[:len(vm.Stack)-1] return value @@ -666,64 +608,6 @@ func (vm *VM) scope() *Scope { return vm.Scopes[len(vm.Scopes)-1] } -// getArgsForFunc lazily initializes the buffer the first time it is called for -// a given program (thus, it also needs "program" to run). It will -// take "needed" elements from the buffer and populate them with vm.pop() in -// reverse order. Because the estimation can fall short, this function can -// occasionally make a new allocation. -func (vm *VM) getArgsForFunc(argsBuf []any, program *Program, needed int) (args []any, argsBufOut []any) { - if needed == 0 || program == nil { - return nil, argsBuf - } - - // Step 1: fix estimations and preallocate - if argsBuf == nil { - estimatedFnArgsCount := estimateFnArgsCount(program) - if estimatedFnArgsCount > maxFnArgsBuf { - // put a practical limit to avoid excessive preallocation - estimatedFnArgsCount = maxFnArgsBuf - } - if estimatedFnArgsCount < needed { - // in the case that the first call is for example OpCallN with a large - // number of arguments, then make sure we will be able to serve them at - // least. - estimatedFnArgsCount = needed - } - - // in the case that we are preparing the arguments for the first - // function call of the program, then argsBuf will be nil, so we - // initialize it. We delay this initial allocation here because a - // program could have many function calls but exit earlier than the - // first call, so in that case we avoid allocating unnecessarily - argsBuf = make([]any, estimatedFnArgsCount) - } - - // Step 2: get the final slice that will be returned - var buf []any - if len(argsBuf) >= needed { - // in this case, we are successfully using the single preallocation. We - // use the full slice expression [low : high : max] because in that way - // a function that receives this slice as variadic arguments will not be - // able to make modifications to contiguous elements with append(). If - // they call append on their variadic arguments they will make a new - // allocation. - buf = (argsBuf)[:needed:needed] - argsBuf = (argsBuf)[needed:] // advance the buffer - } else { - // if we have been making calls to something like OpCallN with many more - // arguments than what we estimated, then we will need to allocate - // separately - buf = make([]any, needed) - } - - // Step 3: populate the final slice bulk copying from the stack. This is the - // exact order and copy() is a highly optimized operation - copy(buf, vm.Stack[len(vm.Stack)-needed:]) - vm.Stack = vm.Stack[:len(vm.Stack)-needed] - - return buf, argsBuf -} - func (vm *VM) Step() { vm.step <- struct{}{} } @@ -731,37 +615,3 @@ func (vm *VM) Step() { func (vm *VM) Position() chan int { return vm.curr } - -func clearSlice[S ~[]E, E any](s S) { - var zero E - for i := range s { - s[i] = zero // clear mem, optimized by the compiler, in Go 1.21 the "clear" builtin can be used - } -} - -// estimateFnArgsCount inspects a *Program and estimates how many function -// arguments will be required to run it. -func estimateFnArgsCount(program *Program) int { - // Implementation note: a program will not necessarily go through all - // operations, but this is just an estimation - var count int - for _, op := range program.Bytecode { - if int(op) < len(opArgLenEstimation) { - count += opArgLenEstimation[op] - } - } - return count -} - -var opArgLenEstimation = [...]int{ - OpCall1: 1, - OpCall2: 2, - OpCall3: 3, - // we don't know exactly but we know at least 4, so be conservative as this - // is only an optimization and we also want to avoid excessive preallocation - OpCallN: 4, - // here we don't know either, but we can guess it could be common to receive - // up to 3 arguments in a function - OpCallFast: 3, - OpCallSafe: 3, -} diff --git a/kubewatch/vendor/golang.org/x/crypto/argon2/argon2.go b/kubewatch/vendor/golang.org/x/crypto/argon2/argon2.go index 2b65ec91a..29f0a2de4 100644 --- a/kubewatch/vendor/golang.org/x/crypto/argon2/argon2.go +++ b/kubewatch/vendor/golang.org/x/crypto/argon2/argon2.go @@ -6,7 +6,7 @@ // Argon2 was selected as the winner of the Password Hashing Competition and can // be used to derive cryptographic keys from passwords. // -// For a detailed specification of Argon2 see [argon2-specs.pdf]. +// For a detailed specification of Argon2 see [1]. // // If you aren't sure which function you need, use Argon2id (IDKey) and // the parameter recommendations for your scenario. @@ -17,7 +17,7 @@ // It uses data-independent memory access, which is preferred for password // hashing and password-based key derivation. Argon2i requires more passes over // memory than Argon2id to protect from trade-off attacks. The recommended -// parameters (taken from [RFC 9106 Section 7.3]) for non-interactive operations are time=3 and to +// parameters (taken from [2]) for non-interactive operations are time=3 and to // use the maximum available memory. // // # Argon2id @@ -27,11 +27,11 @@ // half of the first iteration over the memory and data-dependent memory access // for the rest. Argon2id is side-channel resistant and provides better brute- // force cost savings due to time-memory tradeoffs than Argon2i. The recommended -// parameters for non-interactive operations (taken from [RFC 9106 Section 7.3]) are time=1 and to +// parameters for non-interactive operations (taken from [2]) are time=1 and to // use the maximum available memory. // -// [argon2-specs.pdf]: https://github.com/P-H-C/phc-winner-argon2/blob/master/argon2-specs.pdf -// [RFC 9106 Section 7.3]: https://www.rfc-editor.org/rfc/rfc9106.html#section-7.3 +// [1] https://github.com/P-H-C/phc-winner-argon2/blob/master/argon2-specs.pdf +// [2] https://tools.ietf.org/html/draft-irtf-cfrg-argon2-03#section-9.3 package argon2 import ( @@ -59,7 +59,7 @@ const ( // // key := argon2.Key([]byte("some password"), salt, 3, 32*1024, 4, 32) // -// [RFC 9106 Section 7.3] recommends time=3, and memory=32*1024 as a sensible number. +// The draft RFC recommends[2] time=3, and memory=32*1024 is a sensible number. // If using that amount of memory (32 MB) is not possible in some contexts then // the time parameter can be increased to compensate. // @@ -69,8 +69,6 @@ const ( // adjusted to the number of available CPUs. The cost parameters should be // increased as memory latency and CPU parallelism increases. Remember to get a // good random salt. -// -// [RFC 9106 Section 7.3]: https://www.rfc-editor.org/rfc/rfc9106.html#section-7.3 func Key(password, salt []byte, time, memory uint32, threads uint8, keyLen uint32) []byte { return deriveKey(argon2i, password, salt, nil, nil, time, memory, threads, keyLen) } @@ -85,7 +83,7 @@ func Key(password, salt []byte, time, memory uint32, threads uint8, keyLen uint3 // // key := argon2.IDKey([]byte("some password"), salt, 1, 64*1024, 4, 32) // -// [RFC 9106 Section 7.3] recommends time=1, and memory=64*1024 as a sensible number. +// The draft RFC recommends[2] time=1, and memory=64*1024 is a sensible number. // If using that amount of memory (64 MB) is not possible in some contexts then // the time parameter can be increased to compensate. // @@ -95,8 +93,6 @@ func Key(password, salt []byte, time, memory uint32, threads uint8, keyLen uint3 // adjusted to the numbers of available CPUs. The cost parameters should be // increased as memory latency and CPU parallelism increases. Remember to get a // good random salt. -// -// [RFC 9106 Section 7.3]: https://www.rfc-editor.org/rfc/rfc9106.html#section-7.3 func IDKey(password, salt []byte, time, memory uint32, threads uint8, keyLen uint32) []byte { return deriveKey(argon2id, password, salt, nil, nil, time, memory, threads, keyLen) } diff --git a/kubewatch/vendor/golang.org/x/crypto/chacha20/chacha_arm64.s b/kubewatch/vendor/golang.org/x/crypto/chacha20/chacha_arm64.s index 769af387e..7dd2638e8 100644 --- a/kubewatch/vendor/golang.org/x/crypto/chacha20/chacha_arm64.s +++ b/kubewatch/vendor/golang.org/x/crypto/chacha20/chacha_arm64.s @@ -29,7 +29,7 @@ loop: MOVD $NUM_ROUNDS, R21 VLD1 (R11), [V30.S4, V31.S4] - // load constants + // load contants // VLD4R (R10), [V0.S4, V1.S4, V2.S4, V3.S4] WORD $0x4D60E940 diff --git a/kubewatch/vendor/golang.org/x/crypto/curve25519/curve25519.go b/kubewatch/vendor/golang.org/x/crypto/curve25519/curve25519.go index 048faef3a..21ca3b2ee 100644 --- a/kubewatch/vendor/golang.org/x/crypto/curve25519/curve25519.go +++ b/kubewatch/vendor/golang.org/x/crypto/curve25519/curve25519.go @@ -3,14 +3,11 @@ // license that can be found in the LICENSE file. // Package curve25519 provides an implementation of the X25519 function, which -// performs scalar multiplication on the elliptic curve known as Curve25519 -// according to [RFC 7748]. +// performs scalar multiplication on the elliptic curve known as Curve25519. +// See RFC 7748. // -// The curve25519 package is a wrapper for the X25519 implementation in the -// crypto/ecdh package. It is [frozen] and is not accepting new features. -// -// [RFC 7748]: https://datatracker.ietf.org/doc/html/rfc7748 -// [frozen]: https://go.dev/wiki/Frozen +// This package is a wrapper for the X25519 implementation +// in the crypto/ecdh package. package curve25519 import "crypto/ecdh" @@ -39,7 +36,7 @@ func ScalarBaseMult(dst, scalar *[32]byte) { curve := ecdh.X25519() priv, err := curve.NewPrivateKey(scalar[:]) if err != nil { - panic("curve25519: " + err.Error()) + panic("curve25519: internal error: scalarBaseMult was not 32 bytes") } copy(dst[:], priv.PublicKey().Bytes()) } diff --git a/kubewatch/vendor/golang.org/x/crypto/salsa20/salsa/hsalsa20.go b/kubewatch/vendor/golang.org/x/crypto/salsa20/salsa/hsalsa20.go index 75df77406..3685b3445 100644 --- a/kubewatch/vendor/golang.org/x/crypto/salsa20/salsa/hsalsa20.go +++ b/kubewatch/vendor/golang.org/x/crypto/salsa20/salsa/hsalsa20.go @@ -3,10 +3,6 @@ // license that can be found in the LICENSE file. // Package salsa provides low-level access to functions in the Salsa family. -// -// Deprecated: this package exposes unsafe low-level operations. New applications -// should consider using the AEAD construction in golang.org/x/crypto/chacha20poly1305 -// instead. Existing users should migrate to golang.org/x/crypto/salsa20. package salsa import "math/bits" diff --git a/kubewatch/vendor/golang.org/x/crypto/sha3/doc.go b/kubewatch/vendor/golang.org/x/crypto/sha3/doc.go new file mode 100644 index 000000000..bbf391fe6 --- /dev/null +++ b/kubewatch/vendor/golang.org/x/crypto/sha3/doc.go @@ -0,0 +1,66 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package sha3 implements the SHA-3 fixed-output-length hash functions and +// the SHAKE variable-output-length hash functions defined by FIPS-202. +// +// All types in this package also implement [encoding.BinaryMarshaler], +// [encoding.BinaryAppender] and [encoding.BinaryUnmarshaler] to marshal and +// unmarshal the internal state of the hash. +// +// Both types of hash function use the "sponge" construction and the Keccak +// permutation. For a detailed specification see http://keccak.noekeon.org/ +// +// # Guidance +// +// If you aren't sure what function you need, use SHAKE256 with at least 64 +// bytes of output. The SHAKE instances are faster than the SHA3 instances; +// the latter have to allocate memory to conform to the hash.Hash interface. +// +// If you need a secret-key MAC (message authentication code), prepend the +// secret key to the input, hash with SHAKE256 and read at least 32 bytes of +// output. +// +// # Security strengths +// +// The SHA3-x (x equals 224, 256, 384, or 512) functions have a security +// strength against preimage attacks of x bits. Since they only produce "x" +// bits of output, their collision-resistance is only "x/2" bits. +// +// The SHAKE-256 and -128 functions have a generic security strength of 256 and +// 128 bits against all attacks, provided that at least 2x bits of their output +// is used. Requesting more than 64 or 32 bytes of output, respectively, does +// not increase the collision-resistance of the SHAKE functions. +// +// # The sponge construction +// +// A sponge builds a pseudo-random function from a public pseudo-random +// permutation, by applying the permutation to a state of "rate + capacity" +// bytes, but hiding "capacity" of the bytes. +// +// A sponge starts out with a zero state. To hash an input using a sponge, up +// to "rate" bytes of the input are XORed into the sponge's state. The sponge +// is then "full" and the permutation is applied to "empty" it. This process is +// repeated until all the input has been "absorbed". The input is then padded. +// The digest is "squeezed" from the sponge in the same way, except that output +// is copied out instead of input being XORed in. +// +// A sponge is parameterized by its generic security strength, which is equal +// to half its capacity; capacity + rate is equal to the permutation's width. +// Since the KeccakF-1600 permutation is 1600 bits (200 bytes) wide, this means +// that the security strength of a sponge instance is equal to (1600 - bitrate) / 2. +// +// # Recommendations +// +// The SHAKE functions are recommended for most new uses. They can produce +// output of arbitrary length. SHAKE256, with an output length of at least +// 64 bytes, provides 256-bit security against all attacks. The Keccak team +// recommends it for most applications upgrading from SHA2-512. (NIST chose a +// much stronger, but much slower, sponge instance for SHA3-512.) +// +// The SHA-3 functions are "drop-in" replacements for the SHA-2 functions. +// They produce output of the same length, with the same security strengths +// against all attacks. This means, in particular, that SHA3-256 only has +// 128-bit collision resistance, because its output length is 32 bytes. +package sha3 diff --git a/kubewatch/vendor/golang.org/x/crypto/sha3/hashes.go b/kubewatch/vendor/golang.org/x/crypto/sha3/hashes.go index a51269d91..31fffbe04 100644 --- a/kubewatch/vendor/golang.org/x/crypto/sha3/hashes.go +++ b/kubewatch/vendor/golang.org/x/crypto/sha3/hashes.go @@ -2,94 +2,127 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Package sha3 implements the SHA-3 hash algorithms and the SHAKE extendable -// output functions defined in FIPS 202. -// -// Most of this package is a wrapper around the crypto/sha3 package in the -// standard library. The only exception is the legacy Keccak hash functions. package sha3 +// This file provides functions for creating instances of the SHA-3 +// and SHAKE hash functions, as well as utility functions for hashing +// bytes. + import ( - "crypto/sha3" + "crypto" "hash" ) // New224 creates a new SHA3-224 hash. // Its generic security strength is 224 bits against preimage attacks, // and 112 bits against collision attacks. -// -// It is a wrapper for the [sha3.New224] function in the standard library. -// -//go:fix inline func New224() hash.Hash { - return sha3.New224() + return new224() } // New256 creates a new SHA3-256 hash. // Its generic security strength is 256 bits against preimage attacks, // and 128 bits against collision attacks. -// -// It is a wrapper for the [sha3.New256] function in the standard library. -// -//go:fix inline func New256() hash.Hash { - return sha3.New256() + return new256() } // New384 creates a new SHA3-384 hash. // Its generic security strength is 384 bits against preimage attacks, // and 192 bits against collision attacks. -// -// It is a wrapper for the [sha3.New384] function in the standard library. -// -//go:fix inline func New384() hash.Hash { - return sha3.New384() + return new384() } // New512 creates a new SHA3-512 hash. // Its generic security strength is 512 bits against preimage attacks, // and 256 bits against collision attacks. -// -// It is a wrapper for the [sha3.New512] function in the standard library. -// -//go:fix inline func New512() hash.Hash { - return sha3.New512() + return new512() } -// Sum224 returns the SHA3-224 digest of the data. +func init() { + crypto.RegisterHash(crypto.SHA3_224, New224) + crypto.RegisterHash(crypto.SHA3_256, New256) + crypto.RegisterHash(crypto.SHA3_384, New384) + crypto.RegisterHash(crypto.SHA3_512, New512) +} + +const ( + dsbyteSHA3 = 0b00000110 + dsbyteKeccak = 0b00000001 + dsbyteShake = 0b00011111 + dsbyteCShake = 0b00000100 + + // rateK[c] is the rate in bytes for Keccak[c] where c is the capacity in + // bits. Given the sponge size is 1600 bits, the rate is 1600 - c bits. + rateK256 = (1600 - 256) / 8 + rateK448 = (1600 - 448) / 8 + rateK512 = (1600 - 512) / 8 + rateK768 = (1600 - 768) / 8 + rateK1024 = (1600 - 1024) / 8 +) + +func new224Generic() *state { + return &state{rate: rateK448, outputLen: 28, dsbyte: dsbyteSHA3} +} + +func new256Generic() *state { + return &state{rate: rateK512, outputLen: 32, dsbyte: dsbyteSHA3} +} + +func new384Generic() *state { + return &state{rate: rateK768, outputLen: 48, dsbyte: dsbyteSHA3} +} + +func new512Generic() *state { + return &state{rate: rateK1024, outputLen: 64, dsbyte: dsbyteSHA3} +} + +// NewLegacyKeccak256 creates a new Keccak-256 hash. // -// It is a wrapper for the [sha3.Sum224] function in the standard library. +// Only use this function if you require compatibility with an existing cryptosystem +// that uses non-standard padding. All other users should use New256 instead. +func NewLegacyKeccak256() hash.Hash { + return &state{rate: rateK512, outputLen: 32, dsbyte: dsbyteKeccak} +} + +// NewLegacyKeccak512 creates a new Keccak-512 hash. // -//go:fix inline -func Sum224(data []byte) [28]byte { - return sha3.Sum224(data) +// Only use this function if you require compatibility with an existing cryptosystem +// that uses non-standard padding. All other users should use New512 instead. +func NewLegacyKeccak512() hash.Hash { + return &state{rate: rateK1024, outputLen: 64, dsbyte: dsbyteKeccak} +} + +// Sum224 returns the SHA3-224 digest of the data. +func Sum224(data []byte) (digest [28]byte) { + h := New224() + h.Write(data) + h.Sum(digest[:0]) + return } // Sum256 returns the SHA3-256 digest of the data. -// -// It is a wrapper for the [sha3.Sum256] function in the standard library. -// -//go:fix inline -func Sum256(data []byte) [32]byte { - return sha3.Sum256(data) +func Sum256(data []byte) (digest [32]byte) { + h := New256() + h.Write(data) + h.Sum(digest[:0]) + return } // Sum384 returns the SHA3-384 digest of the data. -// -// It is a wrapper for the [sha3.Sum384] function in the standard library. -// -//go:fix inline -func Sum384(data []byte) [48]byte { - return sha3.Sum384(data) +func Sum384(data []byte) (digest [48]byte) { + h := New384() + h.Write(data) + h.Sum(digest[:0]) + return } // Sum512 returns the SHA3-512 digest of the data. -// -// It is a wrapper for the [sha3.Sum512] function in the standard library. -// -//go:fix inline -func Sum512(data []byte) [64]byte { - return sha3.Sum512(data) +func Sum512(data []byte) (digest [64]byte) { + h := New512() + h.Write(data) + h.Sum(digest[:0]) + return } diff --git a/kubewatch/vendor/golang.org/x/crypto/sha3/hashes_noasm.go b/kubewatch/vendor/golang.org/x/crypto/sha3/hashes_noasm.go new file mode 100644 index 000000000..9d85fb621 --- /dev/null +++ b/kubewatch/vendor/golang.org/x/crypto/sha3/hashes_noasm.go @@ -0,0 +1,23 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !gc || purego || !s390x + +package sha3 + +func new224() *state { + return new224Generic() +} + +func new256() *state { + return new256Generic() +} + +func new384() *state { + return new384Generic() +} + +func new512() *state { + return new512Generic() +} diff --git a/kubewatch/vendor/golang.org/x/crypto/sha3/legacy_keccakf.go b/kubewatch/vendor/golang.org/x/crypto/sha3/keccakf.go similarity index 98% rename from kubewatch/vendor/golang.org/x/crypto/sha3/legacy_keccakf.go rename to kubewatch/vendor/golang.org/x/crypto/sha3/keccakf.go index 101588c16..ce48b1dd3 100644 --- a/kubewatch/vendor/golang.org/x/crypto/sha3/legacy_keccakf.go +++ b/kubewatch/vendor/golang.org/x/crypto/sha3/keccakf.go @@ -2,11 +2,9 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -package sha3 +//go:build !amd64 || purego || !gc -// This implementation is only used for NewLegacyKeccak256 and -// NewLegacyKeccak512, which are not implemented by crypto/sha3. -// All other functions in this package are wrappers around crypto/sha3. +package sha3 import "math/bits" diff --git a/kubewatch/vendor/golang.org/x/crypto/sha3/keccakf_amd64.go b/kubewatch/vendor/golang.org/x/crypto/sha3/keccakf_amd64.go new file mode 100644 index 000000000..b908696be --- /dev/null +++ b/kubewatch/vendor/golang.org/x/crypto/sha3/keccakf_amd64.go @@ -0,0 +1,13 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build amd64 && !purego && gc + +package sha3 + +// This function is implemented in keccakf_amd64.s. + +//go:noescape + +func keccakF1600(a *[25]uint64) diff --git a/kubewatch/vendor/golang.org/x/crypto/sha3/keccakf_amd64.s b/kubewatch/vendor/golang.org/x/crypto/sha3/keccakf_amd64.s new file mode 100644 index 000000000..99e2f16e9 --- /dev/null +++ b/kubewatch/vendor/golang.org/x/crypto/sha3/keccakf_amd64.s @@ -0,0 +1,5419 @@ +// Code generated by command: go run keccakf_amd64_asm.go -out ../keccakf_amd64.s -pkg sha3. DO NOT EDIT. + +//go:build amd64 && !purego && gc + +// func keccakF1600(a *[25]uint64) +TEXT ·keccakF1600(SB), $200-8 + MOVQ a+0(FP), DI + + // Convert the user state into an internal state + NOTQ 8(DI) + NOTQ 16(DI) + NOTQ 64(DI) + NOTQ 96(DI) + NOTQ 136(DI) + NOTQ 160(DI) + + // Execute the KeccakF permutation + MOVQ (DI), SI + MOVQ 8(DI), BP + MOVQ 32(DI), R15 + XORQ 40(DI), SI + XORQ 48(DI), BP + XORQ 72(DI), R15 + XORQ 80(DI), SI + XORQ 88(DI), BP + XORQ 112(DI), R15 + XORQ 120(DI), SI + XORQ 128(DI), BP + XORQ 152(DI), R15 + XORQ 160(DI), SI + XORQ 168(DI), BP + MOVQ 176(DI), DX + MOVQ 184(DI), R8 + XORQ 192(DI), R15 + + // Prepare round + MOVQ BP, BX + ROLQ $0x01, BX + MOVQ 16(DI), R12 + XORQ 56(DI), DX + XORQ R15, BX + XORQ 96(DI), R12 + XORQ 136(DI), DX + XORQ DX, R12 + MOVQ R12, CX + ROLQ $0x01, CX + MOVQ 24(DI), R13 + XORQ 64(DI), R8 + XORQ SI, CX + XORQ 104(DI), R13 + XORQ 144(DI), R8 + XORQ R8, R13 + MOVQ R13, DX + ROLQ $0x01, DX + MOVQ R15, R8 + XORQ BP, DX + ROLQ $0x01, R8 + MOVQ SI, R9 + XORQ R12, R8 + ROLQ $0x01, R9 + + // Result b + MOVQ (DI), R10 + MOVQ 48(DI), R11 + XORQ R13, R9 + MOVQ 96(DI), R12 + MOVQ 144(DI), R13 + MOVQ 192(DI), R14 + XORQ CX, R11 + ROLQ $0x2c, R11 + XORQ DX, R12 + XORQ BX, R10 + ROLQ $0x2b, R12 + MOVQ R11, SI + MOVQ $0x0000000000000001, AX + ORQ R12, SI + XORQ R10, AX + XORQ AX, SI + MOVQ SI, (SP) + XORQ R9, R14 + ROLQ $0x0e, R14 + MOVQ R10, R15 + ANDQ R11, R15 + XORQ R14, R15 + MOVQ R15, 32(SP) + XORQ R8, R13 + ROLQ $0x15, R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 16(SP) + NOTQ R12 + ORQ R10, R14 + ORQ R13, R12 + XORQ R13, R14 + XORQ R11, R12 + MOVQ R14, 24(SP) + MOVQ R12, 8(SP) + MOVQ R12, BP + + // Result g + MOVQ 72(DI), R11 + XORQ R9, R11 + MOVQ 80(DI), R12 + ROLQ $0x14, R11 + XORQ BX, R12 + ROLQ $0x03, R12 + MOVQ 24(DI), R10 + MOVQ R11, AX + ORQ R12, AX + XORQ R8, R10 + MOVQ 128(DI), R13 + MOVQ 176(DI), R14 + ROLQ $0x1c, R10 + XORQ R10, AX + MOVQ AX, 40(SP) + XORQ AX, SI + XORQ CX, R13 + ROLQ $0x2d, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 48(SP) + XORQ AX, BP + XORQ DX, R14 + ROLQ $0x3d, R14 + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 64(SP) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 72(SP) + NOTQ R14 + XORQ R10, R15 + ORQ R14, R13 + XORQ R12, R13 + MOVQ R13, 56(SP) + + // Result k + MOVQ 8(DI), R10 + MOVQ 56(DI), R11 + MOVQ 104(DI), R12 + MOVQ 152(DI), R13 + MOVQ 160(DI), R14 + XORQ DX, R11 + ROLQ $0x06, R11 + XORQ R8, R12 + ROLQ $0x19, R12 + MOVQ R11, AX + ORQ R12, AX + XORQ CX, R10 + ROLQ $0x01, R10 + XORQ R10, AX + MOVQ AX, 80(SP) + XORQ AX, SI + XORQ R9, R13 + ROLQ $0x08, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 88(SP) + XORQ AX, BP + XORQ BX, R14 + ROLQ $0x12, R14 + NOTQ R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 96(SP) + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 104(SP) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 112(SP) + XORQ R10, R15 + + // Result m + MOVQ 40(DI), R11 + XORQ BX, R11 + MOVQ 88(DI), R12 + ROLQ $0x24, R11 + XORQ CX, R12 + MOVQ 32(DI), R10 + ROLQ $0x0a, R12 + MOVQ R11, AX + MOVQ 136(DI), R13 + ANDQ R12, AX + XORQ R9, R10 + MOVQ 184(DI), R14 + ROLQ $0x1b, R10 + XORQ R10, AX + MOVQ AX, 120(SP) + XORQ AX, SI + XORQ DX, R13 + ROLQ $0x0f, R13 + MOVQ R12, AX + ORQ R13, AX + XORQ R11, AX + MOVQ AX, 128(SP) + XORQ AX, BP + XORQ R8, R14 + ROLQ $0x38, R14 + NOTQ R13 + MOVQ R13, AX + ORQ R14, AX + XORQ R12, AX + MOVQ AX, 136(SP) + ORQ R10, R11 + XORQ R14, R11 + MOVQ R11, 152(SP) + ANDQ R10, R14 + XORQ R13, R14 + MOVQ R14, 144(SP) + XORQ R11, R15 + + // Result s + MOVQ 16(DI), R10 + MOVQ 64(DI), R11 + MOVQ 112(DI), R12 + XORQ DX, R10 + MOVQ 120(DI), R13 + ROLQ $0x3e, R10 + XORQ R8, R11 + MOVQ 168(DI), R14 + ROLQ $0x37, R11 + XORQ R9, R12 + MOVQ R10, R9 + XORQ CX, R14 + ROLQ $0x02, R14 + ANDQ R11, R9 + XORQ R14, R9 + MOVQ R9, 192(SP) + ROLQ $0x27, R12 + XORQ R9, R15 + NOTQ R11 + XORQ BX, R13 + MOVQ R11, BX + ANDQ R12, BX + XORQ R10, BX + MOVQ BX, 160(SP) + XORQ BX, SI + ROLQ $0x29, R13 + MOVQ R12, CX + ORQ R13, CX + XORQ R11, CX + MOVQ CX, 168(SP) + XORQ CX, BP + MOVQ R13, DX + MOVQ R14, R8 + ANDQ R14, DX + ORQ R10, R8 + XORQ R12, DX + XORQ R13, R8 + MOVQ DX, 176(SP) + MOVQ R8, 184(SP) + + // Prepare round + MOVQ BP, BX + ROLQ $0x01, BX + MOVQ 16(SP), R12 + XORQ 56(SP), DX + XORQ R15, BX + XORQ 96(SP), R12 + XORQ 136(SP), DX + XORQ DX, R12 + MOVQ R12, CX + ROLQ $0x01, CX + MOVQ 24(SP), R13 + XORQ 64(SP), R8 + XORQ SI, CX + XORQ 104(SP), R13 + XORQ 144(SP), R8 + XORQ R8, R13 + MOVQ R13, DX + ROLQ $0x01, DX + MOVQ R15, R8 + XORQ BP, DX + ROLQ $0x01, R8 + MOVQ SI, R9 + XORQ R12, R8 + ROLQ $0x01, R9 + + // Result b + MOVQ (SP), R10 + MOVQ 48(SP), R11 + XORQ R13, R9 + MOVQ 96(SP), R12 + MOVQ 144(SP), R13 + MOVQ 192(SP), R14 + XORQ CX, R11 + ROLQ $0x2c, R11 + XORQ DX, R12 + XORQ BX, R10 + ROLQ $0x2b, R12 + MOVQ R11, SI + MOVQ $0x0000000000008082, AX + ORQ R12, SI + XORQ R10, AX + XORQ AX, SI + MOVQ SI, (DI) + XORQ R9, R14 + ROLQ $0x0e, R14 + MOVQ R10, R15 + ANDQ R11, R15 + XORQ R14, R15 + MOVQ R15, 32(DI) + XORQ R8, R13 + ROLQ $0x15, R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 16(DI) + NOTQ R12 + ORQ R10, R14 + ORQ R13, R12 + XORQ R13, R14 + XORQ R11, R12 + MOVQ R14, 24(DI) + MOVQ R12, 8(DI) + MOVQ R12, BP + + // Result g + MOVQ 72(SP), R11 + XORQ R9, R11 + MOVQ 80(SP), R12 + ROLQ $0x14, R11 + XORQ BX, R12 + ROLQ $0x03, R12 + MOVQ 24(SP), R10 + MOVQ R11, AX + ORQ R12, AX + XORQ R8, R10 + MOVQ 128(SP), R13 + MOVQ 176(SP), R14 + ROLQ $0x1c, R10 + XORQ R10, AX + MOVQ AX, 40(DI) + XORQ AX, SI + XORQ CX, R13 + ROLQ $0x2d, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 48(DI) + XORQ AX, BP + XORQ DX, R14 + ROLQ $0x3d, R14 + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 64(DI) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 72(DI) + NOTQ R14 + XORQ R10, R15 + ORQ R14, R13 + XORQ R12, R13 + MOVQ R13, 56(DI) + + // Result k + MOVQ 8(SP), R10 + MOVQ 56(SP), R11 + MOVQ 104(SP), R12 + MOVQ 152(SP), R13 + MOVQ 160(SP), R14 + XORQ DX, R11 + ROLQ $0x06, R11 + XORQ R8, R12 + ROLQ $0x19, R12 + MOVQ R11, AX + ORQ R12, AX + XORQ CX, R10 + ROLQ $0x01, R10 + XORQ R10, AX + MOVQ AX, 80(DI) + XORQ AX, SI + XORQ R9, R13 + ROLQ $0x08, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 88(DI) + XORQ AX, BP + XORQ BX, R14 + ROLQ $0x12, R14 + NOTQ R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 96(DI) + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 104(DI) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 112(DI) + XORQ R10, R15 + + // Result m + MOVQ 40(SP), R11 + XORQ BX, R11 + MOVQ 88(SP), R12 + ROLQ $0x24, R11 + XORQ CX, R12 + MOVQ 32(SP), R10 + ROLQ $0x0a, R12 + MOVQ R11, AX + MOVQ 136(SP), R13 + ANDQ R12, AX + XORQ R9, R10 + MOVQ 184(SP), R14 + ROLQ $0x1b, R10 + XORQ R10, AX + MOVQ AX, 120(DI) + XORQ AX, SI + XORQ DX, R13 + ROLQ $0x0f, R13 + MOVQ R12, AX + ORQ R13, AX + XORQ R11, AX + MOVQ AX, 128(DI) + XORQ AX, BP + XORQ R8, R14 + ROLQ $0x38, R14 + NOTQ R13 + MOVQ R13, AX + ORQ R14, AX + XORQ R12, AX + MOVQ AX, 136(DI) + ORQ R10, R11 + XORQ R14, R11 + MOVQ R11, 152(DI) + ANDQ R10, R14 + XORQ R13, R14 + MOVQ R14, 144(DI) + XORQ R11, R15 + + // Result s + MOVQ 16(SP), R10 + MOVQ 64(SP), R11 + MOVQ 112(SP), R12 + XORQ DX, R10 + MOVQ 120(SP), R13 + ROLQ $0x3e, R10 + XORQ R8, R11 + MOVQ 168(SP), R14 + ROLQ $0x37, R11 + XORQ R9, R12 + MOVQ R10, R9 + XORQ CX, R14 + ROLQ $0x02, R14 + ANDQ R11, R9 + XORQ R14, R9 + MOVQ R9, 192(DI) + ROLQ $0x27, R12 + XORQ R9, R15 + NOTQ R11 + XORQ BX, R13 + MOVQ R11, BX + ANDQ R12, BX + XORQ R10, BX + MOVQ BX, 160(DI) + XORQ BX, SI + ROLQ $0x29, R13 + MOVQ R12, CX + ORQ R13, CX + XORQ R11, CX + MOVQ CX, 168(DI) + XORQ CX, BP + MOVQ R13, DX + MOVQ R14, R8 + ANDQ R14, DX + ORQ R10, R8 + XORQ R12, DX + XORQ R13, R8 + MOVQ DX, 176(DI) + MOVQ R8, 184(DI) + + // Prepare round + MOVQ BP, BX + ROLQ $0x01, BX + MOVQ 16(DI), R12 + XORQ 56(DI), DX + XORQ R15, BX + XORQ 96(DI), R12 + XORQ 136(DI), DX + XORQ DX, R12 + MOVQ R12, CX + ROLQ $0x01, CX + MOVQ 24(DI), R13 + XORQ 64(DI), R8 + XORQ SI, CX + XORQ 104(DI), R13 + XORQ 144(DI), R8 + XORQ R8, R13 + MOVQ R13, DX + ROLQ $0x01, DX + MOVQ R15, R8 + XORQ BP, DX + ROLQ $0x01, R8 + MOVQ SI, R9 + XORQ R12, R8 + ROLQ $0x01, R9 + + // Result b + MOVQ (DI), R10 + MOVQ 48(DI), R11 + XORQ R13, R9 + MOVQ 96(DI), R12 + MOVQ 144(DI), R13 + MOVQ 192(DI), R14 + XORQ CX, R11 + ROLQ $0x2c, R11 + XORQ DX, R12 + XORQ BX, R10 + ROLQ $0x2b, R12 + MOVQ R11, SI + MOVQ $0x800000000000808a, AX + ORQ R12, SI + XORQ R10, AX + XORQ AX, SI + MOVQ SI, (SP) + XORQ R9, R14 + ROLQ $0x0e, R14 + MOVQ R10, R15 + ANDQ R11, R15 + XORQ R14, R15 + MOVQ R15, 32(SP) + XORQ R8, R13 + ROLQ $0x15, R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 16(SP) + NOTQ R12 + ORQ R10, R14 + ORQ R13, R12 + XORQ R13, R14 + XORQ R11, R12 + MOVQ R14, 24(SP) + MOVQ R12, 8(SP) + MOVQ R12, BP + + // Result g + MOVQ 72(DI), R11 + XORQ R9, R11 + MOVQ 80(DI), R12 + ROLQ $0x14, R11 + XORQ BX, R12 + ROLQ $0x03, R12 + MOVQ 24(DI), R10 + MOVQ R11, AX + ORQ R12, AX + XORQ R8, R10 + MOVQ 128(DI), R13 + MOVQ 176(DI), R14 + ROLQ $0x1c, R10 + XORQ R10, AX + MOVQ AX, 40(SP) + XORQ AX, SI + XORQ CX, R13 + ROLQ $0x2d, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 48(SP) + XORQ AX, BP + XORQ DX, R14 + ROLQ $0x3d, R14 + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 64(SP) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 72(SP) + NOTQ R14 + XORQ R10, R15 + ORQ R14, R13 + XORQ R12, R13 + MOVQ R13, 56(SP) + + // Result k + MOVQ 8(DI), R10 + MOVQ 56(DI), R11 + MOVQ 104(DI), R12 + MOVQ 152(DI), R13 + MOVQ 160(DI), R14 + XORQ DX, R11 + ROLQ $0x06, R11 + XORQ R8, R12 + ROLQ $0x19, R12 + MOVQ R11, AX + ORQ R12, AX + XORQ CX, R10 + ROLQ $0x01, R10 + XORQ R10, AX + MOVQ AX, 80(SP) + XORQ AX, SI + XORQ R9, R13 + ROLQ $0x08, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 88(SP) + XORQ AX, BP + XORQ BX, R14 + ROLQ $0x12, R14 + NOTQ R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 96(SP) + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 104(SP) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 112(SP) + XORQ R10, R15 + + // Result m + MOVQ 40(DI), R11 + XORQ BX, R11 + MOVQ 88(DI), R12 + ROLQ $0x24, R11 + XORQ CX, R12 + MOVQ 32(DI), R10 + ROLQ $0x0a, R12 + MOVQ R11, AX + MOVQ 136(DI), R13 + ANDQ R12, AX + XORQ R9, R10 + MOVQ 184(DI), R14 + ROLQ $0x1b, R10 + XORQ R10, AX + MOVQ AX, 120(SP) + XORQ AX, SI + XORQ DX, R13 + ROLQ $0x0f, R13 + MOVQ R12, AX + ORQ R13, AX + XORQ R11, AX + MOVQ AX, 128(SP) + XORQ AX, BP + XORQ R8, R14 + ROLQ $0x38, R14 + NOTQ R13 + MOVQ R13, AX + ORQ R14, AX + XORQ R12, AX + MOVQ AX, 136(SP) + ORQ R10, R11 + XORQ R14, R11 + MOVQ R11, 152(SP) + ANDQ R10, R14 + XORQ R13, R14 + MOVQ R14, 144(SP) + XORQ R11, R15 + + // Result s + MOVQ 16(DI), R10 + MOVQ 64(DI), R11 + MOVQ 112(DI), R12 + XORQ DX, R10 + MOVQ 120(DI), R13 + ROLQ $0x3e, R10 + XORQ R8, R11 + MOVQ 168(DI), R14 + ROLQ $0x37, R11 + XORQ R9, R12 + MOVQ R10, R9 + XORQ CX, R14 + ROLQ $0x02, R14 + ANDQ R11, R9 + XORQ R14, R9 + MOVQ R9, 192(SP) + ROLQ $0x27, R12 + XORQ R9, R15 + NOTQ R11 + XORQ BX, R13 + MOVQ R11, BX + ANDQ R12, BX + XORQ R10, BX + MOVQ BX, 160(SP) + XORQ BX, SI + ROLQ $0x29, R13 + MOVQ R12, CX + ORQ R13, CX + XORQ R11, CX + MOVQ CX, 168(SP) + XORQ CX, BP + MOVQ R13, DX + MOVQ R14, R8 + ANDQ R14, DX + ORQ R10, R8 + XORQ R12, DX + XORQ R13, R8 + MOVQ DX, 176(SP) + MOVQ R8, 184(SP) + + // Prepare round + MOVQ BP, BX + ROLQ $0x01, BX + MOVQ 16(SP), R12 + XORQ 56(SP), DX + XORQ R15, BX + XORQ 96(SP), R12 + XORQ 136(SP), DX + XORQ DX, R12 + MOVQ R12, CX + ROLQ $0x01, CX + MOVQ 24(SP), R13 + XORQ 64(SP), R8 + XORQ SI, CX + XORQ 104(SP), R13 + XORQ 144(SP), R8 + XORQ R8, R13 + MOVQ R13, DX + ROLQ $0x01, DX + MOVQ R15, R8 + XORQ BP, DX + ROLQ $0x01, R8 + MOVQ SI, R9 + XORQ R12, R8 + ROLQ $0x01, R9 + + // Result b + MOVQ (SP), R10 + MOVQ 48(SP), R11 + XORQ R13, R9 + MOVQ 96(SP), R12 + MOVQ 144(SP), R13 + MOVQ 192(SP), R14 + XORQ CX, R11 + ROLQ $0x2c, R11 + XORQ DX, R12 + XORQ BX, R10 + ROLQ $0x2b, R12 + MOVQ R11, SI + MOVQ $0x8000000080008000, AX + ORQ R12, SI + XORQ R10, AX + XORQ AX, SI + MOVQ SI, (DI) + XORQ R9, R14 + ROLQ $0x0e, R14 + MOVQ R10, R15 + ANDQ R11, R15 + XORQ R14, R15 + MOVQ R15, 32(DI) + XORQ R8, R13 + ROLQ $0x15, R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 16(DI) + NOTQ R12 + ORQ R10, R14 + ORQ R13, R12 + XORQ R13, R14 + XORQ R11, R12 + MOVQ R14, 24(DI) + MOVQ R12, 8(DI) + MOVQ R12, BP + + // Result g + MOVQ 72(SP), R11 + XORQ R9, R11 + MOVQ 80(SP), R12 + ROLQ $0x14, R11 + XORQ BX, R12 + ROLQ $0x03, R12 + MOVQ 24(SP), R10 + MOVQ R11, AX + ORQ R12, AX + XORQ R8, R10 + MOVQ 128(SP), R13 + MOVQ 176(SP), R14 + ROLQ $0x1c, R10 + XORQ R10, AX + MOVQ AX, 40(DI) + XORQ AX, SI + XORQ CX, R13 + ROLQ $0x2d, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 48(DI) + XORQ AX, BP + XORQ DX, R14 + ROLQ $0x3d, R14 + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 64(DI) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 72(DI) + NOTQ R14 + XORQ R10, R15 + ORQ R14, R13 + XORQ R12, R13 + MOVQ R13, 56(DI) + + // Result k + MOVQ 8(SP), R10 + MOVQ 56(SP), R11 + MOVQ 104(SP), R12 + MOVQ 152(SP), R13 + MOVQ 160(SP), R14 + XORQ DX, R11 + ROLQ $0x06, R11 + XORQ R8, R12 + ROLQ $0x19, R12 + MOVQ R11, AX + ORQ R12, AX + XORQ CX, R10 + ROLQ $0x01, R10 + XORQ R10, AX + MOVQ AX, 80(DI) + XORQ AX, SI + XORQ R9, R13 + ROLQ $0x08, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 88(DI) + XORQ AX, BP + XORQ BX, R14 + ROLQ $0x12, R14 + NOTQ R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 96(DI) + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 104(DI) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 112(DI) + XORQ R10, R15 + + // Result m + MOVQ 40(SP), R11 + XORQ BX, R11 + MOVQ 88(SP), R12 + ROLQ $0x24, R11 + XORQ CX, R12 + MOVQ 32(SP), R10 + ROLQ $0x0a, R12 + MOVQ R11, AX + MOVQ 136(SP), R13 + ANDQ R12, AX + XORQ R9, R10 + MOVQ 184(SP), R14 + ROLQ $0x1b, R10 + XORQ R10, AX + MOVQ AX, 120(DI) + XORQ AX, SI + XORQ DX, R13 + ROLQ $0x0f, R13 + MOVQ R12, AX + ORQ R13, AX + XORQ R11, AX + MOVQ AX, 128(DI) + XORQ AX, BP + XORQ R8, R14 + ROLQ $0x38, R14 + NOTQ R13 + MOVQ R13, AX + ORQ R14, AX + XORQ R12, AX + MOVQ AX, 136(DI) + ORQ R10, R11 + XORQ R14, R11 + MOVQ R11, 152(DI) + ANDQ R10, R14 + XORQ R13, R14 + MOVQ R14, 144(DI) + XORQ R11, R15 + + // Result s + MOVQ 16(SP), R10 + MOVQ 64(SP), R11 + MOVQ 112(SP), R12 + XORQ DX, R10 + MOVQ 120(SP), R13 + ROLQ $0x3e, R10 + XORQ R8, R11 + MOVQ 168(SP), R14 + ROLQ $0x37, R11 + XORQ R9, R12 + MOVQ R10, R9 + XORQ CX, R14 + ROLQ $0x02, R14 + ANDQ R11, R9 + XORQ R14, R9 + MOVQ R9, 192(DI) + ROLQ $0x27, R12 + XORQ R9, R15 + NOTQ R11 + XORQ BX, R13 + MOVQ R11, BX + ANDQ R12, BX + XORQ R10, BX + MOVQ BX, 160(DI) + XORQ BX, SI + ROLQ $0x29, R13 + MOVQ R12, CX + ORQ R13, CX + XORQ R11, CX + MOVQ CX, 168(DI) + XORQ CX, BP + MOVQ R13, DX + MOVQ R14, R8 + ANDQ R14, DX + ORQ R10, R8 + XORQ R12, DX + XORQ R13, R8 + MOVQ DX, 176(DI) + MOVQ R8, 184(DI) + + // Prepare round + MOVQ BP, BX + ROLQ $0x01, BX + MOVQ 16(DI), R12 + XORQ 56(DI), DX + XORQ R15, BX + XORQ 96(DI), R12 + XORQ 136(DI), DX + XORQ DX, R12 + MOVQ R12, CX + ROLQ $0x01, CX + MOVQ 24(DI), R13 + XORQ 64(DI), R8 + XORQ SI, CX + XORQ 104(DI), R13 + XORQ 144(DI), R8 + XORQ R8, R13 + MOVQ R13, DX + ROLQ $0x01, DX + MOVQ R15, R8 + XORQ BP, DX + ROLQ $0x01, R8 + MOVQ SI, R9 + XORQ R12, R8 + ROLQ $0x01, R9 + + // Result b + MOVQ (DI), R10 + MOVQ 48(DI), R11 + XORQ R13, R9 + MOVQ 96(DI), R12 + MOVQ 144(DI), R13 + MOVQ 192(DI), R14 + XORQ CX, R11 + ROLQ $0x2c, R11 + XORQ DX, R12 + XORQ BX, R10 + ROLQ $0x2b, R12 + MOVQ R11, SI + MOVQ $0x000000000000808b, AX + ORQ R12, SI + XORQ R10, AX + XORQ AX, SI + MOVQ SI, (SP) + XORQ R9, R14 + ROLQ $0x0e, R14 + MOVQ R10, R15 + ANDQ R11, R15 + XORQ R14, R15 + MOVQ R15, 32(SP) + XORQ R8, R13 + ROLQ $0x15, R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 16(SP) + NOTQ R12 + ORQ R10, R14 + ORQ R13, R12 + XORQ R13, R14 + XORQ R11, R12 + MOVQ R14, 24(SP) + MOVQ R12, 8(SP) + MOVQ R12, BP + + // Result g + MOVQ 72(DI), R11 + XORQ R9, R11 + MOVQ 80(DI), R12 + ROLQ $0x14, R11 + XORQ BX, R12 + ROLQ $0x03, R12 + MOVQ 24(DI), R10 + MOVQ R11, AX + ORQ R12, AX + XORQ R8, R10 + MOVQ 128(DI), R13 + MOVQ 176(DI), R14 + ROLQ $0x1c, R10 + XORQ R10, AX + MOVQ AX, 40(SP) + XORQ AX, SI + XORQ CX, R13 + ROLQ $0x2d, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 48(SP) + XORQ AX, BP + XORQ DX, R14 + ROLQ $0x3d, R14 + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 64(SP) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 72(SP) + NOTQ R14 + XORQ R10, R15 + ORQ R14, R13 + XORQ R12, R13 + MOVQ R13, 56(SP) + + // Result k + MOVQ 8(DI), R10 + MOVQ 56(DI), R11 + MOVQ 104(DI), R12 + MOVQ 152(DI), R13 + MOVQ 160(DI), R14 + XORQ DX, R11 + ROLQ $0x06, R11 + XORQ R8, R12 + ROLQ $0x19, R12 + MOVQ R11, AX + ORQ R12, AX + XORQ CX, R10 + ROLQ $0x01, R10 + XORQ R10, AX + MOVQ AX, 80(SP) + XORQ AX, SI + XORQ R9, R13 + ROLQ $0x08, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 88(SP) + XORQ AX, BP + XORQ BX, R14 + ROLQ $0x12, R14 + NOTQ R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 96(SP) + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 104(SP) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 112(SP) + XORQ R10, R15 + + // Result m + MOVQ 40(DI), R11 + XORQ BX, R11 + MOVQ 88(DI), R12 + ROLQ $0x24, R11 + XORQ CX, R12 + MOVQ 32(DI), R10 + ROLQ $0x0a, R12 + MOVQ R11, AX + MOVQ 136(DI), R13 + ANDQ R12, AX + XORQ R9, R10 + MOVQ 184(DI), R14 + ROLQ $0x1b, R10 + XORQ R10, AX + MOVQ AX, 120(SP) + XORQ AX, SI + XORQ DX, R13 + ROLQ $0x0f, R13 + MOVQ R12, AX + ORQ R13, AX + XORQ R11, AX + MOVQ AX, 128(SP) + XORQ AX, BP + XORQ R8, R14 + ROLQ $0x38, R14 + NOTQ R13 + MOVQ R13, AX + ORQ R14, AX + XORQ R12, AX + MOVQ AX, 136(SP) + ORQ R10, R11 + XORQ R14, R11 + MOVQ R11, 152(SP) + ANDQ R10, R14 + XORQ R13, R14 + MOVQ R14, 144(SP) + XORQ R11, R15 + + // Result s + MOVQ 16(DI), R10 + MOVQ 64(DI), R11 + MOVQ 112(DI), R12 + XORQ DX, R10 + MOVQ 120(DI), R13 + ROLQ $0x3e, R10 + XORQ R8, R11 + MOVQ 168(DI), R14 + ROLQ $0x37, R11 + XORQ R9, R12 + MOVQ R10, R9 + XORQ CX, R14 + ROLQ $0x02, R14 + ANDQ R11, R9 + XORQ R14, R9 + MOVQ R9, 192(SP) + ROLQ $0x27, R12 + XORQ R9, R15 + NOTQ R11 + XORQ BX, R13 + MOVQ R11, BX + ANDQ R12, BX + XORQ R10, BX + MOVQ BX, 160(SP) + XORQ BX, SI + ROLQ $0x29, R13 + MOVQ R12, CX + ORQ R13, CX + XORQ R11, CX + MOVQ CX, 168(SP) + XORQ CX, BP + MOVQ R13, DX + MOVQ R14, R8 + ANDQ R14, DX + ORQ R10, R8 + XORQ R12, DX + XORQ R13, R8 + MOVQ DX, 176(SP) + MOVQ R8, 184(SP) + + // Prepare round + MOVQ BP, BX + ROLQ $0x01, BX + MOVQ 16(SP), R12 + XORQ 56(SP), DX + XORQ R15, BX + XORQ 96(SP), R12 + XORQ 136(SP), DX + XORQ DX, R12 + MOVQ R12, CX + ROLQ $0x01, CX + MOVQ 24(SP), R13 + XORQ 64(SP), R8 + XORQ SI, CX + XORQ 104(SP), R13 + XORQ 144(SP), R8 + XORQ R8, R13 + MOVQ R13, DX + ROLQ $0x01, DX + MOVQ R15, R8 + XORQ BP, DX + ROLQ $0x01, R8 + MOVQ SI, R9 + XORQ R12, R8 + ROLQ $0x01, R9 + + // Result b + MOVQ (SP), R10 + MOVQ 48(SP), R11 + XORQ R13, R9 + MOVQ 96(SP), R12 + MOVQ 144(SP), R13 + MOVQ 192(SP), R14 + XORQ CX, R11 + ROLQ $0x2c, R11 + XORQ DX, R12 + XORQ BX, R10 + ROLQ $0x2b, R12 + MOVQ R11, SI + MOVQ $0x0000000080000001, AX + ORQ R12, SI + XORQ R10, AX + XORQ AX, SI + MOVQ SI, (DI) + XORQ R9, R14 + ROLQ $0x0e, R14 + MOVQ R10, R15 + ANDQ R11, R15 + XORQ R14, R15 + MOVQ R15, 32(DI) + XORQ R8, R13 + ROLQ $0x15, R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 16(DI) + NOTQ R12 + ORQ R10, R14 + ORQ R13, R12 + XORQ R13, R14 + XORQ R11, R12 + MOVQ R14, 24(DI) + MOVQ R12, 8(DI) + MOVQ R12, BP + + // Result g + MOVQ 72(SP), R11 + XORQ R9, R11 + MOVQ 80(SP), R12 + ROLQ $0x14, R11 + XORQ BX, R12 + ROLQ $0x03, R12 + MOVQ 24(SP), R10 + MOVQ R11, AX + ORQ R12, AX + XORQ R8, R10 + MOVQ 128(SP), R13 + MOVQ 176(SP), R14 + ROLQ $0x1c, R10 + XORQ R10, AX + MOVQ AX, 40(DI) + XORQ AX, SI + XORQ CX, R13 + ROLQ $0x2d, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 48(DI) + XORQ AX, BP + XORQ DX, R14 + ROLQ $0x3d, R14 + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 64(DI) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 72(DI) + NOTQ R14 + XORQ R10, R15 + ORQ R14, R13 + XORQ R12, R13 + MOVQ R13, 56(DI) + + // Result k + MOVQ 8(SP), R10 + MOVQ 56(SP), R11 + MOVQ 104(SP), R12 + MOVQ 152(SP), R13 + MOVQ 160(SP), R14 + XORQ DX, R11 + ROLQ $0x06, R11 + XORQ R8, R12 + ROLQ $0x19, R12 + MOVQ R11, AX + ORQ R12, AX + XORQ CX, R10 + ROLQ $0x01, R10 + XORQ R10, AX + MOVQ AX, 80(DI) + XORQ AX, SI + XORQ R9, R13 + ROLQ $0x08, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 88(DI) + XORQ AX, BP + XORQ BX, R14 + ROLQ $0x12, R14 + NOTQ R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 96(DI) + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 104(DI) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 112(DI) + XORQ R10, R15 + + // Result m + MOVQ 40(SP), R11 + XORQ BX, R11 + MOVQ 88(SP), R12 + ROLQ $0x24, R11 + XORQ CX, R12 + MOVQ 32(SP), R10 + ROLQ $0x0a, R12 + MOVQ R11, AX + MOVQ 136(SP), R13 + ANDQ R12, AX + XORQ R9, R10 + MOVQ 184(SP), R14 + ROLQ $0x1b, R10 + XORQ R10, AX + MOVQ AX, 120(DI) + XORQ AX, SI + XORQ DX, R13 + ROLQ $0x0f, R13 + MOVQ R12, AX + ORQ R13, AX + XORQ R11, AX + MOVQ AX, 128(DI) + XORQ AX, BP + XORQ R8, R14 + ROLQ $0x38, R14 + NOTQ R13 + MOVQ R13, AX + ORQ R14, AX + XORQ R12, AX + MOVQ AX, 136(DI) + ORQ R10, R11 + XORQ R14, R11 + MOVQ R11, 152(DI) + ANDQ R10, R14 + XORQ R13, R14 + MOVQ R14, 144(DI) + XORQ R11, R15 + + // Result s + MOVQ 16(SP), R10 + MOVQ 64(SP), R11 + MOVQ 112(SP), R12 + XORQ DX, R10 + MOVQ 120(SP), R13 + ROLQ $0x3e, R10 + XORQ R8, R11 + MOVQ 168(SP), R14 + ROLQ $0x37, R11 + XORQ R9, R12 + MOVQ R10, R9 + XORQ CX, R14 + ROLQ $0x02, R14 + ANDQ R11, R9 + XORQ R14, R9 + MOVQ R9, 192(DI) + ROLQ $0x27, R12 + XORQ R9, R15 + NOTQ R11 + XORQ BX, R13 + MOVQ R11, BX + ANDQ R12, BX + XORQ R10, BX + MOVQ BX, 160(DI) + XORQ BX, SI + ROLQ $0x29, R13 + MOVQ R12, CX + ORQ R13, CX + XORQ R11, CX + MOVQ CX, 168(DI) + XORQ CX, BP + MOVQ R13, DX + MOVQ R14, R8 + ANDQ R14, DX + ORQ R10, R8 + XORQ R12, DX + XORQ R13, R8 + MOVQ DX, 176(DI) + MOVQ R8, 184(DI) + + // Prepare round + MOVQ BP, BX + ROLQ $0x01, BX + MOVQ 16(DI), R12 + XORQ 56(DI), DX + XORQ R15, BX + XORQ 96(DI), R12 + XORQ 136(DI), DX + XORQ DX, R12 + MOVQ R12, CX + ROLQ $0x01, CX + MOVQ 24(DI), R13 + XORQ 64(DI), R8 + XORQ SI, CX + XORQ 104(DI), R13 + XORQ 144(DI), R8 + XORQ R8, R13 + MOVQ R13, DX + ROLQ $0x01, DX + MOVQ R15, R8 + XORQ BP, DX + ROLQ $0x01, R8 + MOVQ SI, R9 + XORQ R12, R8 + ROLQ $0x01, R9 + + // Result b + MOVQ (DI), R10 + MOVQ 48(DI), R11 + XORQ R13, R9 + MOVQ 96(DI), R12 + MOVQ 144(DI), R13 + MOVQ 192(DI), R14 + XORQ CX, R11 + ROLQ $0x2c, R11 + XORQ DX, R12 + XORQ BX, R10 + ROLQ $0x2b, R12 + MOVQ R11, SI + MOVQ $0x8000000080008081, AX + ORQ R12, SI + XORQ R10, AX + XORQ AX, SI + MOVQ SI, (SP) + XORQ R9, R14 + ROLQ $0x0e, R14 + MOVQ R10, R15 + ANDQ R11, R15 + XORQ R14, R15 + MOVQ R15, 32(SP) + XORQ R8, R13 + ROLQ $0x15, R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 16(SP) + NOTQ R12 + ORQ R10, R14 + ORQ R13, R12 + XORQ R13, R14 + XORQ R11, R12 + MOVQ R14, 24(SP) + MOVQ R12, 8(SP) + MOVQ R12, BP + + // Result g + MOVQ 72(DI), R11 + XORQ R9, R11 + MOVQ 80(DI), R12 + ROLQ $0x14, R11 + XORQ BX, R12 + ROLQ $0x03, R12 + MOVQ 24(DI), R10 + MOVQ R11, AX + ORQ R12, AX + XORQ R8, R10 + MOVQ 128(DI), R13 + MOVQ 176(DI), R14 + ROLQ $0x1c, R10 + XORQ R10, AX + MOVQ AX, 40(SP) + XORQ AX, SI + XORQ CX, R13 + ROLQ $0x2d, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 48(SP) + XORQ AX, BP + XORQ DX, R14 + ROLQ $0x3d, R14 + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 64(SP) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 72(SP) + NOTQ R14 + XORQ R10, R15 + ORQ R14, R13 + XORQ R12, R13 + MOVQ R13, 56(SP) + + // Result k + MOVQ 8(DI), R10 + MOVQ 56(DI), R11 + MOVQ 104(DI), R12 + MOVQ 152(DI), R13 + MOVQ 160(DI), R14 + XORQ DX, R11 + ROLQ $0x06, R11 + XORQ R8, R12 + ROLQ $0x19, R12 + MOVQ R11, AX + ORQ R12, AX + XORQ CX, R10 + ROLQ $0x01, R10 + XORQ R10, AX + MOVQ AX, 80(SP) + XORQ AX, SI + XORQ R9, R13 + ROLQ $0x08, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 88(SP) + XORQ AX, BP + XORQ BX, R14 + ROLQ $0x12, R14 + NOTQ R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 96(SP) + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 104(SP) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 112(SP) + XORQ R10, R15 + + // Result m + MOVQ 40(DI), R11 + XORQ BX, R11 + MOVQ 88(DI), R12 + ROLQ $0x24, R11 + XORQ CX, R12 + MOVQ 32(DI), R10 + ROLQ $0x0a, R12 + MOVQ R11, AX + MOVQ 136(DI), R13 + ANDQ R12, AX + XORQ R9, R10 + MOVQ 184(DI), R14 + ROLQ $0x1b, R10 + XORQ R10, AX + MOVQ AX, 120(SP) + XORQ AX, SI + XORQ DX, R13 + ROLQ $0x0f, R13 + MOVQ R12, AX + ORQ R13, AX + XORQ R11, AX + MOVQ AX, 128(SP) + XORQ AX, BP + XORQ R8, R14 + ROLQ $0x38, R14 + NOTQ R13 + MOVQ R13, AX + ORQ R14, AX + XORQ R12, AX + MOVQ AX, 136(SP) + ORQ R10, R11 + XORQ R14, R11 + MOVQ R11, 152(SP) + ANDQ R10, R14 + XORQ R13, R14 + MOVQ R14, 144(SP) + XORQ R11, R15 + + // Result s + MOVQ 16(DI), R10 + MOVQ 64(DI), R11 + MOVQ 112(DI), R12 + XORQ DX, R10 + MOVQ 120(DI), R13 + ROLQ $0x3e, R10 + XORQ R8, R11 + MOVQ 168(DI), R14 + ROLQ $0x37, R11 + XORQ R9, R12 + MOVQ R10, R9 + XORQ CX, R14 + ROLQ $0x02, R14 + ANDQ R11, R9 + XORQ R14, R9 + MOVQ R9, 192(SP) + ROLQ $0x27, R12 + XORQ R9, R15 + NOTQ R11 + XORQ BX, R13 + MOVQ R11, BX + ANDQ R12, BX + XORQ R10, BX + MOVQ BX, 160(SP) + XORQ BX, SI + ROLQ $0x29, R13 + MOVQ R12, CX + ORQ R13, CX + XORQ R11, CX + MOVQ CX, 168(SP) + XORQ CX, BP + MOVQ R13, DX + MOVQ R14, R8 + ANDQ R14, DX + ORQ R10, R8 + XORQ R12, DX + XORQ R13, R8 + MOVQ DX, 176(SP) + MOVQ R8, 184(SP) + + // Prepare round + MOVQ BP, BX + ROLQ $0x01, BX + MOVQ 16(SP), R12 + XORQ 56(SP), DX + XORQ R15, BX + XORQ 96(SP), R12 + XORQ 136(SP), DX + XORQ DX, R12 + MOVQ R12, CX + ROLQ $0x01, CX + MOVQ 24(SP), R13 + XORQ 64(SP), R8 + XORQ SI, CX + XORQ 104(SP), R13 + XORQ 144(SP), R8 + XORQ R8, R13 + MOVQ R13, DX + ROLQ $0x01, DX + MOVQ R15, R8 + XORQ BP, DX + ROLQ $0x01, R8 + MOVQ SI, R9 + XORQ R12, R8 + ROLQ $0x01, R9 + + // Result b + MOVQ (SP), R10 + MOVQ 48(SP), R11 + XORQ R13, R9 + MOVQ 96(SP), R12 + MOVQ 144(SP), R13 + MOVQ 192(SP), R14 + XORQ CX, R11 + ROLQ $0x2c, R11 + XORQ DX, R12 + XORQ BX, R10 + ROLQ $0x2b, R12 + MOVQ R11, SI + MOVQ $0x8000000000008009, AX + ORQ R12, SI + XORQ R10, AX + XORQ AX, SI + MOVQ SI, (DI) + XORQ R9, R14 + ROLQ $0x0e, R14 + MOVQ R10, R15 + ANDQ R11, R15 + XORQ R14, R15 + MOVQ R15, 32(DI) + XORQ R8, R13 + ROLQ $0x15, R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 16(DI) + NOTQ R12 + ORQ R10, R14 + ORQ R13, R12 + XORQ R13, R14 + XORQ R11, R12 + MOVQ R14, 24(DI) + MOVQ R12, 8(DI) + MOVQ R12, BP + + // Result g + MOVQ 72(SP), R11 + XORQ R9, R11 + MOVQ 80(SP), R12 + ROLQ $0x14, R11 + XORQ BX, R12 + ROLQ $0x03, R12 + MOVQ 24(SP), R10 + MOVQ R11, AX + ORQ R12, AX + XORQ R8, R10 + MOVQ 128(SP), R13 + MOVQ 176(SP), R14 + ROLQ $0x1c, R10 + XORQ R10, AX + MOVQ AX, 40(DI) + XORQ AX, SI + XORQ CX, R13 + ROLQ $0x2d, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 48(DI) + XORQ AX, BP + XORQ DX, R14 + ROLQ $0x3d, R14 + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 64(DI) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 72(DI) + NOTQ R14 + XORQ R10, R15 + ORQ R14, R13 + XORQ R12, R13 + MOVQ R13, 56(DI) + + // Result k + MOVQ 8(SP), R10 + MOVQ 56(SP), R11 + MOVQ 104(SP), R12 + MOVQ 152(SP), R13 + MOVQ 160(SP), R14 + XORQ DX, R11 + ROLQ $0x06, R11 + XORQ R8, R12 + ROLQ $0x19, R12 + MOVQ R11, AX + ORQ R12, AX + XORQ CX, R10 + ROLQ $0x01, R10 + XORQ R10, AX + MOVQ AX, 80(DI) + XORQ AX, SI + XORQ R9, R13 + ROLQ $0x08, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 88(DI) + XORQ AX, BP + XORQ BX, R14 + ROLQ $0x12, R14 + NOTQ R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 96(DI) + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 104(DI) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 112(DI) + XORQ R10, R15 + + // Result m + MOVQ 40(SP), R11 + XORQ BX, R11 + MOVQ 88(SP), R12 + ROLQ $0x24, R11 + XORQ CX, R12 + MOVQ 32(SP), R10 + ROLQ $0x0a, R12 + MOVQ R11, AX + MOVQ 136(SP), R13 + ANDQ R12, AX + XORQ R9, R10 + MOVQ 184(SP), R14 + ROLQ $0x1b, R10 + XORQ R10, AX + MOVQ AX, 120(DI) + XORQ AX, SI + XORQ DX, R13 + ROLQ $0x0f, R13 + MOVQ R12, AX + ORQ R13, AX + XORQ R11, AX + MOVQ AX, 128(DI) + XORQ AX, BP + XORQ R8, R14 + ROLQ $0x38, R14 + NOTQ R13 + MOVQ R13, AX + ORQ R14, AX + XORQ R12, AX + MOVQ AX, 136(DI) + ORQ R10, R11 + XORQ R14, R11 + MOVQ R11, 152(DI) + ANDQ R10, R14 + XORQ R13, R14 + MOVQ R14, 144(DI) + XORQ R11, R15 + + // Result s + MOVQ 16(SP), R10 + MOVQ 64(SP), R11 + MOVQ 112(SP), R12 + XORQ DX, R10 + MOVQ 120(SP), R13 + ROLQ $0x3e, R10 + XORQ R8, R11 + MOVQ 168(SP), R14 + ROLQ $0x37, R11 + XORQ R9, R12 + MOVQ R10, R9 + XORQ CX, R14 + ROLQ $0x02, R14 + ANDQ R11, R9 + XORQ R14, R9 + MOVQ R9, 192(DI) + ROLQ $0x27, R12 + XORQ R9, R15 + NOTQ R11 + XORQ BX, R13 + MOVQ R11, BX + ANDQ R12, BX + XORQ R10, BX + MOVQ BX, 160(DI) + XORQ BX, SI + ROLQ $0x29, R13 + MOVQ R12, CX + ORQ R13, CX + XORQ R11, CX + MOVQ CX, 168(DI) + XORQ CX, BP + MOVQ R13, DX + MOVQ R14, R8 + ANDQ R14, DX + ORQ R10, R8 + XORQ R12, DX + XORQ R13, R8 + MOVQ DX, 176(DI) + MOVQ R8, 184(DI) + + // Prepare round + MOVQ BP, BX + ROLQ $0x01, BX + MOVQ 16(DI), R12 + XORQ 56(DI), DX + XORQ R15, BX + XORQ 96(DI), R12 + XORQ 136(DI), DX + XORQ DX, R12 + MOVQ R12, CX + ROLQ $0x01, CX + MOVQ 24(DI), R13 + XORQ 64(DI), R8 + XORQ SI, CX + XORQ 104(DI), R13 + XORQ 144(DI), R8 + XORQ R8, R13 + MOVQ R13, DX + ROLQ $0x01, DX + MOVQ R15, R8 + XORQ BP, DX + ROLQ $0x01, R8 + MOVQ SI, R9 + XORQ R12, R8 + ROLQ $0x01, R9 + + // Result b + MOVQ (DI), R10 + MOVQ 48(DI), R11 + XORQ R13, R9 + MOVQ 96(DI), R12 + MOVQ 144(DI), R13 + MOVQ 192(DI), R14 + XORQ CX, R11 + ROLQ $0x2c, R11 + XORQ DX, R12 + XORQ BX, R10 + ROLQ $0x2b, R12 + MOVQ R11, SI + MOVQ $0x000000000000008a, AX + ORQ R12, SI + XORQ R10, AX + XORQ AX, SI + MOVQ SI, (SP) + XORQ R9, R14 + ROLQ $0x0e, R14 + MOVQ R10, R15 + ANDQ R11, R15 + XORQ R14, R15 + MOVQ R15, 32(SP) + XORQ R8, R13 + ROLQ $0x15, R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 16(SP) + NOTQ R12 + ORQ R10, R14 + ORQ R13, R12 + XORQ R13, R14 + XORQ R11, R12 + MOVQ R14, 24(SP) + MOVQ R12, 8(SP) + MOVQ R12, BP + + // Result g + MOVQ 72(DI), R11 + XORQ R9, R11 + MOVQ 80(DI), R12 + ROLQ $0x14, R11 + XORQ BX, R12 + ROLQ $0x03, R12 + MOVQ 24(DI), R10 + MOVQ R11, AX + ORQ R12, AX + XORQ R8, R10 + MOVQ 128(DI), R13 + MOVQ 176(DI), R14 + ROLQ $0x1c, R10 + XORQ R10, AX + MOVQ AX, 40(SP) + XORQ AX, SI + XORQ CX, R13 + ROLQ $0x2d, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 48(SP) + XORQ AX, BP + XORQ DX, R14 + ROLQ $0x3d, R14 + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 64(SP) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 72(SP) + NOTQ R14 + XORQ R10, R15 + ORQ R14, R13 + XORQ R12, R13 + MOVQ R13, 56(SP) + + // Result k + MOVQ 8(DI), R10 + MOVQ 56(DI), R11 + MOVQ 104(DI), R12 + MOVQ 152(DI), R13 + MOVQ 160(DI), R14 + XORQ DX, R11 + ROLQ $0x06, R11 + XORQ R8, R12 + ROLQ $0x19, R12 + MOVQ R11, AX + ORQ R12, AX + XORQ CX, R10 + ROLQ $0x01, R10 + XORQ R10, AX + MOVQ AX, 80(SP) + XORQ AX, SI + XORQ R9, R13 + ROLQ $0x08, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 88(SP) + XORQ AX, BP + XORQ BX, R14 + ROLQ $0x12, R14 + NOTQ R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 96(SP) + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 104(SP) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 112(SP) + XORQ R10, R15 + + // Result m + MOVQ 40(DI), R11 + XORQ BX, R11 + MOVQ 88(DI), R12 + ROLQ $0x24, R11 + XORQ CX, R12 + MOVQ 32(DI), R10 + ROLQ $0x0a, R12 + MOVQ R11, AX + MOVQ 136(DI), R13 + ANDQ R12, AX + XORQ R9, R10 + MOVQ 184(DI), R14 + ROLQ $0x1b, R10 + XORQ R10, AX + MOVQ AX, 120(SP) + XORQ AX, SI + XORQ DX, R13 + ROLQ $0x0f, R13 + MOVQ R12, AX + ORQ R13, AX + XORQ R11, AX + MOVQ AX, 128(SP) + XORQ AX, BP + XORQ R8, R14 + ROLQ $0x38, R14 + NOTQ R13 + MOVQ R13, AX + ORQ R14, AX + XORQ R12, AX + MOVQ AX, 136(SP) + ORQ R10, R11 + XORQ R14, R11 + MOVQ R11, 152(SP) + ANDQ R10, R14 + XORQ R13, R14 + MOVQ R14, 144(SP) + XORQ R11, R15 + + // Result s + MOVQ 16(DI), R10 + MOVQ 64(DI), R11 + MOVQ 112(DI), R12 + XORQ DX, R10 + MOVQ 120(DI), R13 + ROLQ $0x3e, R10 + XORQ R8, R11 + MOVQ 168(DI), R14 + ROLQ $0x37, R11 + XORQ R9, R12 + MOVQ R10, R9 + XORQ CX, R14 + ROLQ $0x02, R14 + ANDQ R11, R9 + XORQ R14, R9 + MOVQ R9, 192(SP) + ROLQ $0x27, R12 + XORQ R9, R15 + NOTQ R11 + XORQ BX, R13 + MOVQ R11, BX + ANDQ R12, BX + XORQ R10, BX + MOVQ BX, 160(SP) + XORQ BX, SI + ROLQ $0x29, R13 + MOVQ R12, CX + ORQ R13, CX + XORQ R11, CX + MOVQ CX, 168(SP) + XORQ CX, BP + MOVQ R13, DX + MOVQ R14, R8 + ANDQ R14, DX + ORQ R10, R8 + XORQ R12, DX + XORQ R13, R8 + MOVQ DX, 176(SP) + MOVQ R8, 184(SP) + + // Prepare round + MOVQ BP, BX + ROLQ $0x01, BX + MOVQ 16(SP), R12 + XORQ 56(SP), DX + XORQ R15, BX + XORQ 96(SP), R12 + XORQ 136(SP), DX + XORQ DX, R12 + MOVQ R12, CX + ROLQ $0x01, CX + MOVQ 24(SP), R13 + XORQ 64(SP), R8 + XORQ SI, CX + XORQ 104(SP), R13 + XORQ 144(SP), R8 + XORQ R8, R13 + MOVQ R13, DX + ROLQ $0x01, DX + MOVQ R15, R8 + XORQ BP, DX + ROLQ $0x01, R8 + MOVQ SI, R9 + XORQ R12, R8 + ROLQ $0x01, R9 + + // Result b + MOVQ (SP), R10 + MOVQ 48(SP), R11 + XORQ R13, R9 + MOVQ 96(SP), R12 + MOVQ 144(SP), R13 + MOVQ 192(SP), R14 + XORQ CX, R11 + ROLQ $0x2c, R11 + XORQ DX, R12 + XORQ BX, R10 + ROLQ $0x2b, R12 + MOVQ R11, SI + MOVQ $0x0000000000000088, AX + ORQ R12, SI + XORQ R10, AX + XORQ AX, SI + MOVQ SI, (DI) + XORQ R9, R14 + ROLQ $0x0e, R14 + MOVQ R10, R15 + ANDQ R11, R15 + XORQ R14, R15 + MOVQ R15, 32(DI) + XORQ R8, R13 + ROLQ $0x15, R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 16(DI) + NOTQ R12 + ORQ R10, R14 + ORQ R13, R12 + XORQ R13, R14 + XORQ R11, R12 + MOVQ R14, 24(DI) + MOVQ R12, 8(DI) + MOVQ R12, BP + + // Result g + MOVQ 72(SP), R11 + XORQ R9, R11 + MOVQ 80(SP), R12 + ROLQ $0x14, R11 + XORQ BX, R12 + ROLQ $0x03, R12 + MOVQ 24(SP), R10 + MOVQ R11, AX + ORQ R12, AX + XORQ R8, R10 + MOVQ 128(SP), R13 + MOVQ 176(SP), R14 + ROLQ $0x1c, R10 + XORQ R10, AX + MOVQ AX, 40(DI) + XORQ AX, SI + XORQ CX, R13 + ROLQ $0x2d, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 48(DI) + XORQ AX, BP + XORQ DX, R14 + ROLQ $0x3d, R14 + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 64(DI) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 72(DI) + NOTQ R14 + XORQ R10, R15 + ORQ R14, R13 + XORQ R12, R13 + MOVQ R13, 56(DI) + + // Result k + MOVQ 8(SP), R10 + MOVQ 56(SP), R11 + MOVQ 104(SP), R12 + MOVQ 152(SP), R13 + MOVQ 160(SP), R14 + XORQ DX, R11 + ROLQ $0x06, R11 + XORQ R8, R12 + ROLQ $0x19, R12 + MOVQ R11, AX + ORQ R12, AX + XORQ CX, R10 + ROLQ $0x01, R10 + XORQ R10, AX + MOVQ AX, 80(DI) + XORQ AX, SI + XORQ R9, R13 + ROLQ $0x08, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 88(DI) + XORQ AX, BP + XORQ BX, R14 + ROLQ $0x12, R14 + NOTQ R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 96(DI) + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 104(DI) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 112(DI) + XORQ R10, R15 + + // Result m + MOVQ 40(SP), R11 + XORQ BX, R11 + MOVQ 88(SP), R12 + ROLQ $0x24, R11 + XORQ CX, R12 + MOVQ 32(SP), R10 + ROLQ $0x0a, R12 + MOVQ R11, AX + MOVQ 136(SP), R13 + ANDQ R12, AX + XORQ R9, R10 + MOVQ 184(SP), R14 + ROLQ $0x1b, R10 + XORQ R10, AX + MOVQ AX, 120(DI) + XORQ AX, SI + XORQ DX, R13 + ROLQ $0x0f, R13 + MOVQ R12, AX + ORQ R13, AX + XORQ R11, AX + MOVQ AX, 128(DI) + XORQ AX, BP + XORQ R8, R14 + ROLQ $0x38, R14 + NOTQ R13 + MOVQ R13, AX + ORQ R14, AX + XORQ R12, AX + MOVQ AX, 136(DI) + ORQ R10, R11 + XORQ R14, R11 + MOVQ R11, 152(DI) + ANDQ R10, R14 + XORQ R13, R14 + MOVQ R14, 144(DI) + XORQ R11, R15 + + // Result s + MOVQ 16(SP), R10 + MOVQ 64(SP), R11 + MOVQ 112(SP), R12 + XORQ DX, R10 + MOVQ 120(SP), R13 + ROLQ $0x3e, R10 + XORQ R8, R11 + MOVQ 168(SP), R14 + ROLQ $0x37, R11 + XORQ R9, R12 + MOVQ R10, R9 + XORQ CX, R14 + ROLQ $0x02, R14 + ANDQ R11, R9 + XORQ R14, R9 + MOVQ R9, 192(DI) + ROLQ $0x27, R12 + XORQ R9, R15 + NOTQ R11 + XORQ BX, R13 + MOVQ R11, BX + ANDQ R12, BX + XORQ R10, BX + MOVQ BX, 160(DI) + XORQ BX, SI + ROLQ $0x29, R13 + MOVQ R12, CX + ORQ R13, CX + XORQ R11, CX + MOVQ CX, 168(DI) + XORQ CX, BP + MOVQ R13, DX + MOVQ R14, R8 + ANDQ R14, DX + ORQ R10, R8 + XORQ R12, DX + XORQ R13, R8 + MOVQ DX, 176(DI) + MOVQ R8, 184(DI) + + // Prepare round + MOVQ BP, BX + ROLQ $0x01, BX + MOVQ 16(DI), R12 + XORQ 56(DI), DX + XORQ R15, BX + XORQ 96(DI), R12 + XORQ 136(DI), DX + XORQ DX, R12 + MOVQ R12, CX + ROLQ $0x01, CX + MOVQ 24(DI), R13 + XORQ 64(DI), R8 + XORQ SI, CX + XORQ 104(DI), R13 + XORQ 144(DI), R8 + XORQ R8, R13 + MOVQ R13, DX + ROLQ $0x01, DX + MOVQ R15, R8 + XORQ BP, DX + ROLQ $0x01, R8 + MOVQ SI, R9 + XORQ R12, R8 + ROLQ $0x01, R9 + + // Result b + MOVQ (DI), R10 + MOVQ 48(DI), R11 + XORQ R13, R9 + MOVQ 96(DI), R12 + MOVQ 144(DI), R13 + MOVQ 192(DI), R14 + XORQ CX, R11 + ROLQ $0x2c, R11 + XORQ DX, R12 + XORQ BX, R10 + ROLQ $0x2b, R12 + MOVQ R11, SI + MOVQ $0x0000000080008009, AX + ORQ R12, SI + XORQ R10, AX + XORQ AX, SI + MOVQ SI, (SP) + XORQ R9, R14 + ROLQ $0x0e, R14 + MOVQ R10, R15 + ANDQ R11, R15 + XORQ R14, R15 + MOVQ R15, 32(SP) + XORQ R8, R13 + ROLQ $0x15, R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 16(SP) + NOTQ R12 + ORQ R10, R14 + ORQ R13, R12 + XORQ R13, R14 + XORQ R11, R12 + MOVQ R14, 24(SP) + MOVQ R12, 8(SP) + MOVQ R12, BP + + // Result g + MOVQ 72(DI), R11 + XORQ R9, R11 + MOVQ 80(DI), R12 + ROLQ $0x14, R11 + XORQ BX, R12 + ROLQ $0x03, R12 + MOVQ 24(DI), R10 + MOVQ R11, AX + ORQ R12, AX + XORQ R8, R10 + MOVQ 128(DI), R13 + MOVQ 176(DI), R14 + ROLQ $0x1c, R10 + XORQ R10, AX + MOVQ AX, 40(SP) + XORQ AX, SI + XORQ CX, R13 + ROLQ $0x2d, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 48(SP) + XORQ AX, BP + XORQ DX, R14 + ROLQ $0x3d, R14 + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 64(SP) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 72(SP) + NOTQ R14 + XORQ R10, R15 + ORQ R14, R13 + XORQ R12, R13 + MOVQ R13, 56(SP) + + // Result k + MOVQ 8(DI), R10 + MOVQ 56(DI), R11 + MOVQ 104(DI), R12 + MOVQ 152(DI), R13 + MOVQ 160(DI), R14 + XORQ DX, R11 + ROLQ $0x06, R11 + XORQ R8, R12 + ROLQ $0x19, R12 + MOVQ R11, AX + ORQ R12, AX + XORQ CX, R10 + ROLQ $0x01, R10 + XORQ R10, AX + MOVQ AX, 80(SP) + XORQ AX, SI + XORQ R9, R13 + ROLQ $0x08, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 88(SP) + XORQ AX, BP + XORQ BX, R14 + ROLQ $0x12, R14 + NOTQ R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 96(SP) + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 104(SP) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 112(SP) + XORQ R10, R15 + + // Result m + MOVQ 40(DI), R11 + XORQ BX, R11 + MOVQ 88(DI), R12 + ROLQ $0x24, R11 + XORQ CX, R12 + MOVQ 32(DI), R10 + ROLQ $0x0a, R12 + MOVQ R11, AX + MOVQ 136(DI), R13 + ANDQ R12, AX + XORQ R9, R10 + MOVQ 184(DI), R14 + ROLQ $0x1b, R10 + XORQ R10, AX + MOVQ AX, 120(SP) + XORQ AX, SI + XORQ DX, R13 + ROLQ $0x0f, R13 + MOVQ R12, AX + ORQ R13, AX + XORQ R11, AX + MOVQ AX, 128(SP) + XORQ AX, BP + XORQ R8, R14 + ROLQ $0x38, R14 + NOTQ R13 + MOVQ R13, AX + ORQ R14, AX + XORQ R12, AX + MOVQ AX, 136(SP) + ORQ R10, R11 + XORQ R14, R11 + MOVQ R11, 152(SP) + ANDQ R10, R14 + XORQ R13, R14 + MOVQ R14, 144(SP) + XORQ R11, R15 + + // Result s + MOVQ 16(DI), R10 + MOVQ 64(DI), R11 + MOVQ 112(DI), R12 + XORQ DX, R10 + MOVQ 120(DI), R13 + ROLQ $0x3e, R10 + XORQ R8, R11 + MOVQ 168(DI), R14 + ROLQ $0x37, R11 + XORQ R9, R12 + MOVQ R10, R9 + XORQ CX, R14 + ROLQ $0x02, R14 + ANDQ R11, R9 + XORQ R14, R9 + MOVQ R9, 192(SP) + ROLQ $0x27, R12 + XORQ R9, R15 + NOTQ R11 + XORQ BX, R13 + MOVQ R11, BX + ANDQ R12, BX + XORQ R10, BX + MOVQ BX, 160(SP) + XORQ BX, SI + ROLQ $0x29, R13 + MOVQ R12, CX + ORQ R13, CX + XORQ R11, CX + MOVQ CX, 168(SP) + XORQ CX, BP + MOVQ R13, DX + MOVQ R14, R8 + ANDQ R14, DX + ORQ R10, R8 + XORQ R12, DX + XORQ R13, R8 + MOVQ DX, 176(SP) + MOVQ R8, 184(SP) + + // Prepare round + MOVQ BP, BX + ROLQ $0x01, BX + MOVQ 16(SP), R12 + XORQ 56(SP), DX + XORQ R15, BX + XORQ 96(SP), R12 + XORQ 136(SP), DX + XORQ DX, R12 + MOVQ R12, CX + ROLQ $0x01, CX + MOVQ 24(SP), R13 + XORQ 64(SP), R8 + XORQ SI, CX + XORQ 104(SP), R13 + XORQ 144(SP), R8 + XORQ R8, R13 + MOVQ R13, DX + ROLQ $0x01, DX + MOVQ R15, R8 + XORQ BP, DX + ROLQ $0x01, R8 + MOVQ SI, R9 + XORQ R12, R8 + ROLQ $0x01, R9 + + // Result b + MOVQ (SP), R10 + MOVQ 48(SP), R11 + XORQ R13, R9 + MOVQ 96(SP), R12 + MOVQ 144(SP), R13 + MOVQ 192(SP), R14 + XORQ CX, R11 + ROLQ $0x2c, R11 + XORQ DX, R12 + XORQ BX, R10 + ROLQ $0x2b, R12 + MOVQ R11, SI + MOVQ $0x000000008000000a, AX + ORQ R12, SI + XORQ R10, AX + XORQ AX, SI + MOVQ SI, (DI) + XORQ R9, R14 + ROLQ $0x0e, R14 + MOVQ R10, R15 + ANDQ R11, R15 + XORQ R14, R15 + MOVQ R15, 32(DI) + XORQ R8, R13 + ROLQ $0x15, R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 16(DI) + NOTQ R12 + ORQ R10, R14 + ORQ R13, R12 + XORQ R13, R14 + XORQ R11, R12 + MOVQ R14, 24(DI) + MOVQ R12, 8(DI) + MOVQ R12, BP + + // Result g + MOVQ 72(SP), R11 + XORQ R9, R11 + MOVQ 80(SP), R12 + ROLQ $0x14, R11 + XORQ BX, R12 + ROLQ $0x03, R12 + MOVQ 24(SP), R10 + MOVQ R11, AX + ORQ R12, AX + XORQ R8, R10 + MOVQ 128(SP), R13 + MOVQ 176(SP), R14 + ROLQ $0x1c, R10 + XORQ R10, AX + MOVQ AX, 40(DI) + XORQ AX, SI + XORQ CX, R13 + ROLQ $0x2d, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 48(DI) + XORQ AX, BP + XORQ DX, R14 + ROLQ $0x3d, R14 + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 64(DI) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 72(DI) + NOTQ R14 + XORQ R10, R15 + ORQ R14, R13 + XORQ R12, R13 + MOVQ R13, 56(DI) + + // Result k + MOVQ 8(SP), R10 + MOVQ 56(SP), R11 + MOVQ 104(SP), R12 + MOVQ 152(SP), R13 + MOVQ 160(SP), R14 + XORQ DX, R11 + ROLQ $0x06, R11 + XORQ R8, R12 + ROLQ $0x19, R12 + MOVQ R11, AX + ORQ R12, AX + XORQ CX, R10 + ROLQ $0x01, R10 + XORQ R10, AX + MOVQ AX, 80(DI) + XORQ AX, SI + XORQ R9, R13 + ROLQ $0x08, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 88(DI) + XORQ AX, BP + XORQ BX, R14 + ROLQ $0x12, R14 + NOTQ R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 96(DI) + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 104(DI) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 112(DI) + XORQ R10, R15 + + // Result m + MOVQ 40(SP), R11 + XORQ BX, R11 + MOVQ 88(SP), R12 + ROLQ $0x24, R11 + XORQ CX, R12 + MOVQ 32(SP), R10 + ROLQ $0x0a, R12 + MOVQ R11, AX + MOVQ 136(SP), R13 + ANDQ R12, AX + XORQ R9, R10 + MOVQ 184(SP), R14 + ROLQ $0x1b, R10 + XORQ R10, AX + MOVQ AX, 120(DI) + XORQ AX, SI + XORQ DX, R13 + ROLQ $0x0f, R13 + MOVQ R12, AX + ORQ R13, AX + XORQ R11, AX + MOVQ AX, 128(DI) + XORQ AX, BP + XORQ R8, R14 + ROLQ $0x38, R14 + NOTQ R13 + MOVQ R13, AX + ORQ R14, AX + XORQ R12, AX + MOVQ AX, 136(DI) + ORQ R10, R11 + XORQ R14, R11 + MOVQ R11, 152(DI) + ANDQ R10, R14 + XORQ R13, R14 + MOVQ R14, 144(DI) + XORQ R11, R15 + + // Result s + MOVQ 16(SP), R10 + MOVQ 64(SP), R11 + MOVQ 112(SP), R12 + XORQ DX, R10 + MOVQ 120(SP), R13 + ROLQ $0x3e, R10 + XORQ R8, R11 + MOVQ 168(SP), R14 + ROLQ $0x37, R11 + XORQ R9, R12 + MOVQ R10, R9 + XORQ CX, R14 + ROLQ $0x02, R14 + ANDQ R11, R9 + XORQ R14, R9 + MOVQ R9, 192(DI) + ROLQ $0x27, R12 + XORQ R9, R15 + NOTQ R11 + XORQ BX, R13 + MOVQ R11, BX + ANDQ R12, BX + XORQ R10, BX + MOVQ BX, 160(DI) + XORQ BX, SI + ROLQ $0x29, R13 + MOVQ R12, CX + ORQ R13, CX + XORQ R11, CX + MOVQ CX, 168(DI) + XORQ CX, BP + MOVQ R13, DX + MOVQ R14, R8 + ANDQ R14, DX + ORQ R10, R8 + XORQ R12, DX + XORQ R13, R8 + MOVQ DX, 176(DI) + MOVQ R8, 184(DI) + + // Prepare round + MOVQ BP, BX + ROLQ $0x01, BX + MOVQ 16(DI), R12 + XORQ 56(DI), DX + XORQ R15, BX + XORQ 96(DI), R12 + XORQ 136(DI), DX + XORQ DX, R12 + MOVQ R12, CX + ROLQ $0x01, CX + MOVQ 24(DI), R13 + XORQ 64(DI), R8 + XORQ SI, CX + XORQ 104(DI), R13 + XORQ 144(DI), R8 + XORQ R8, R13 + MOVQ R13, DX + ROLQ $0x01, DX + MOVQ R15, R8 + XORQ BP, DX + ROLQ $0x01, R8 + MOVQ SI, R9 + XORQ R12, R8 + ROLQ $0x01, R9 + + // Result b + MOVQ (DI), R10 + MOVQ 48(DI), R11 + XORQ R13, R9 + MOVQ 96(DI), R12 + MOVQ 144(DI), R13 + MOVQ 192(DI), R14 + XORQ CX, R11 + ROLQ $0x2c, R11 + XORQ DX, R12 + XORQ BX, R10 + ROLQ $0x2b, R12 + MOVQ R11, SI + MOVQ $0x000000008000808b, AX + ORQ R12, SI + XORQ R10, AX + XORQ AX, SI + MOVQ SI, (SP) + XORQ R9, R14 + ROLQ $0x0e, R14 + MOVQ R10, R15 + ANDQ R11, R15 + XORQ R14, R15 + MOVQ R15, 32(SP) + XORQ R8, R13 + ROLQ $0x15, R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 16(SP) + NOTQ R12 + ORQ R10, R14 + ORQ R13, R12 + XORQ R13, R14 + XORQ R11, R12 + MOVQ R14, 24(SP) + MOVQ R12, 8(SP) + MOVQ R12, BP + + // Result g + MOVQ 72(DI), R11 + XORQ R9, R11 + MOVQ 80(DI), R12 + ROLQ $0x14, R11 + XORQ BX, R12 + ROLQ $0x03, R12 + MOVQ 24(DI), R10 + MOVQ R11, AX + ORQ R12, AX + XORQ R8, R10 + MOVQ 128(DI), R13 + MOVQ 176(DI), R14 + ROLQ $0x1c, R10 + XORQ R10, AX + MOVQ AX, 40(SP) + XORQ AX, SI + XORQ CX, R13 + ROLQ $0x2d, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 48(SP) + XORQ AX, BP + XORQ DX, R14 + ROLQ $0x3d, R14 + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 64(SP) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 72(SP) + NOTQ R14 + XORQ R10, R15 + ORQ R14, R13 + XORQ R12, R13 + MOVQ R13, 56(SP) + + // Result k + MOVQ 8(DI), R10 + MOVQ 56(DI), R11 + MOVQ 104(DI), R12 + MOVQ 152(DI), R13 + MOVQ 160(DI), R14 + XORQ DX, R11 + ROLQ $0x06, R11 + XORQ R8, R12 + ROLQ $0x19, R12 + MOVQ R11, AX + ORQ R12, AX + XORQ CX, R10 + ROLQ $0x01, R10 + XORQ R10, AX + MOVQ AX, 80(SP) + XORQ AX, SI + XORQ R9, R13 + ROLQ $0x08, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 88(SP) + XORQ AX, BP + XORQ BX, R14 + ROLQ $0x12, R14 + NOTQ R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 96(SP) + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 104(SP) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 112(SP) + XORQ R10, R15 + + // Result m + MOVQ 40(DI), R11 + XORQ BX, R11 + MOVQ 88(DI), R12 + ROLQ $0x24, R11 + XORQ CX, R12 + MOVQ 32(DI), R10 + ROLQ $0x0a, R12 + MOVQ R11, AX + MOVQ 136(DI), R13 + ANDQ R12, AX + XORQ R9, R10 + MOVQ 184(DI), R14 + ROLQ $0x1b, R10 + XORQ R10, AX + MOVQ AX, 120(SP) + XORQ AX, SI + XORQ DX, R13 + ROLQ $0x0f, R13 + MOVQ R12, AX + ORQ R13, AX + XORQ R11, AX + MOVQ AX, 128(SP) + XORQ AX, BP + XORQ R8, R14 + ROLQ $0x38, R14 + NOTQ R13 + MOVQ R13, AX + ORQ R14, AX + XORQ R12, AX + MOVQ AX, 136(SP) + ORQ R10, R11 + XORQ R14, R11 + MOVQ R11, 152(SP) + ANDQ R10, R14 + XORQ R13, R14 + MOVQ R14, 144(SP) + XORQ R11, R15 + + // Result s + MOVQ 16(DI), R10 + MOVQ 64(DI), R11 + MOVQ 112(DI), R12 + XORQ DX, R10 + MOVQ 120(DI), R13 + ROLQ $0x3e, R10 + XORQ R8, R11 + MOVQ 168(DI), R14 + ROLQ $0x37, R11 + XORQ R9, R12 + MOVQ R10, R9 + XORQ CX, R14 + ROLQ $0x02, R14 + ANDQ R11, R9 + XORQ R14, R9 + MOVQ R9, 192(SP) + ROLQ $0x27, R12 + XORQ R9, R15 + NOTQ R11 + XORQ BX, R13 + MOVQ R11, BX + ANDQ R12, BX + XORQ R10, BX + MOVQ BX, 160(SP) + XORQ BX, SI + ROLQ $0x29, R13 + MOVQ R12, CX + ORQ R13, CX + XORQ R11, CX + MOVQ CX, 168(SP) + XORQ CX, BP + MOVQ R13, DX + MOVQ R14, R8 + ANDQ R14, DX + ORQ R10, R8 + XORQ R12, DX + XORQ R13, R8 + MOVQ DX, 176(SP) + MOVQ R8, 184(SP) + + // Prepare round + MOVQ BP, BX + ROLQ $0x01, BX + MOVQ 16(SP), R12 + XORQ 56(SP), DX + XORQ R15, BX + XORQ 96(SP), R12 + XORQ 136(SP), DX + XORQ DX, R12 + MOVQ R12, CX + ROLQ $0x01, CX + MOVQ 24(SP), R13 + XORQ 64(SP), R8 + XORQ SI, CX + XORQ 104(SP), R13 + XORQ 144(SP), R8 + XORQ R8, R13 + MOVQ R13, DX + ROLQ $0x01, DX + MOVQ R15, R8 + XORQ BP, DX + ROLQ $0x01, R8 + MOVQ SI, R9 + XORQ R12, R8 + ROLQ $0x01, R9 + + // Result b + MOVQ (SP), R10 + MOVQ 48(SP), R11 + XORQ R13, R9 + MOVQ 96(SP), R12 + MOVQ 144(SP), R13 + MOVQ 192(SP), R14 + XORQ CX, R11 + ROLQ $0x2c, R11 + XORQ DX, R12 + XORQ BX, R10 + ROLQ $0x2b, R12 + MOVQ R11, SI + MOVQ $0x800000000000008b, AX + ORQ R12, SI + XORQ R10, AX + XORQ AX, SI + MOVQ SI, (DI) + XORQ R9, R14 + ROLQ $0x0e, R14 + MOVQ R10, R15 + ANDQ R11, R15 + XORQ R14, R15 + MOVQ R15, 32(DI) + XORQ R8, R13 + ROLQ $0x15, R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 16(DI) + NOTQ R12 + ORQ R10, R14 + ORQ R13, R12 + XORQ R13, R14 + XORQ R11, R12 + MOVQ R14, 24(DI) + MOVQ R12, 8(DI) + MOVQ R12, BP + + // Result g + MOVQ 72(SP), R11 + XORQ R9, R11 + MOVQ 80(SP), R12 + ROLQ $0x14, R11 + XORQ BX, R12 + ROLQ $0x03, R12 + MOVQ 24(SP), R10 + MOVQ R11, AX + ORQ R12, AX + XORQ R8, R10 + MOVQ 128(SP), R13 + MOVQ 176(SP), R14 + ROLQ $0x1c, R10 + XORQ R10, AX + MOVQ AX, 40(DI) + XORQ AX, SI + XORQ CX, R13 + ROLQ $0x2d, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 48(DI) + XORQ AX, BP + XORQ DX, R14 + ROLQ $0x3d, R14 + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 64(DI) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 72(DI) + NOTQ R14 + XORQ R10, R15 + ORQ R14, R13 + XORQ R12, R13 + MOVQ R13, 56(DI) + + // Result k + MOVQ 8(SP), R10 + MOVQ 56(SP), R11 + MOVQ 104(SP), R12 + MOVQ 152(SP), R13 + MOVQ 160(SP), R14 + XORQ DX, R11 + ROLQ $0x06, R11 + XORQ R8, R12 + ROLQ $0x19, R12 + MOVQ R11, AX + ORQ R12, AX + XORQ CX, R10 + ROLQ $0x01, R10 + XORQ R10, AX + MOVQ AX, 80(DI) + XORQ AX, SI + XORQ R9, R13 + ROLQ $0x08, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 88(DI) + XORQ AX, BP + XORQ BX, R14 + ROLQ $0x12, R14 + NOTQ R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 96(DI) + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 104(DI) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 112(DI) + XORQ R10, R15 + + // Result m + MOVQ 40(SP), R11 + XORQ BX, R11 + MOVQ 88(SP), R12 + ROLQ $0x24, R11 + XORQ CX, R12 + MOVQ 32(SP), R10 + ROLQ $0x0a, R12 + MOVQ R11, AX + MOVQ 136(SP), R13 + ANDQ R12, AX + XORQ R9, R10 + MOVQ 184(SP), R14 + ROLQ $0x1b, R10 + XORQ R10, AX + MOVQ AX, 120(DI) + XORQ AX, SI + XORQ DX, R13 + ROLQ $0x0f, R13 + MOVQ R12, AX + ORQ R13, AX + XORQ R11, AX + MOVQ AX, 128(DI) + XORQ AX, BP + XORQ R8, R14 + ROLQ $0x38, R14 + NOTQ R13 + MOVQ R13, AX + ORQ R14, AX + XORQ R12, AX + MOVQ AX, 136(DI) + ORQ R10, R11 + XORQ R14, R11 + MOVQ R11, 152(DI) + ANDQ R10, R14 + XORQ R13, R14 + MOVQ R14, 144(DI) + XORQ R11, R15 + + // Result s + MOVQ 16(SP), R10 + MOVQ 64(SP), R11 + MOVQ 112(SP), R12 + XORQ DX, R10 + MOVQ 120(SP), R13 + ROLQ $0x3e, R10 + XORQ R8, R11 + MOVQ 168(SP), R14 + ROLQ $0x37, R11 + XORQ R9, R12 + MOVQ R10, R9 + XORQ CX, R14 + ROLQ $0x02, R14 + ANDQ R11, R9 + XORQ R14, R9 + MOVQ R9, 192(DI) + ROLQ $0x27, R12 + XORQ R9, R15 + NOTQ R11 + XORQ BX, R13 + MOVQ R11, BX + ANDQ R12, BX + XORQ R10, BX + MOVQ BX, 160(DI) + XORQ BX, SI + ROLQ $0x29, R13 + MOVQ R12, CX + ORQ R13, CX + XORQ R11, CX + MOVQ CX, 168(DI) + XORQ CX, BP + MOVQ R13, DX + MOVQ R14, R8 + ANDQ R14, DX + ORQ R10, R8 + XORQ R12, DX + XORQ R13, R8 + MOVQ DX, 176(DI) + MOVQ R8, 184(DI) + + // Prepare round + MOVQ BP, BX + ROLQ $0x01, BX + MOVQ 16(DI), R12 + XORQ 56(DI), DX + XORQ R15, BX + XORQ 96(DI), R12 + XORQ 136(DI), DX + XORQ DX, R12 + MOVQ R12, CX + ROLQ $0x01, CX + MOVQ 24(DI), R13 + XORQ 64(DI), R8 + XORQ SI, CX + XORQ 104(DI), R13 + XORQ 144(DI), R8 + XORQ R8, R13 + MOVQ R13, DX + ROLQ $0x01, DX + MOVQ R15, R8 + XORQ BP, DX + ROLQ $0x01, R8 + MOVQ SI, R9 + XORQ R12, R8 + ROLQ $0x01, R9 + + // Result b + MOVQ (DI), R10 + MOVQ 48(DI), R11 + XORQ R13, R9 + MOVQ 96(DI), R12 + MOVQ 144(DI), R13 + MOVQ 192(DI), R14 + XORQ CX, R11 + ROLQ $0x2c, R11 + XORQ DX, R12 + XORQ BX, R10 + ROLQ $0x2b, R12 + MOVQ R11, SI + MOVQ $0x8000000000008089, AX + ORQ R12, SI + XORQ R10, AX + XORQ AX, SI + MOVQ SI, (SP) + XORQ R9, R14 + ROLQ $0x0e, R14 + MOVQ R10, R15 + ANDQ R11, R15 + XORQ R14, R15 + MOVQ R15, 32(SP) + XORQ R8, R13 + ROLQ $0x15, R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 16(SP) + NOTQ R12 + ORQ R10, R14 + ORQ R13, R12 + XORQ R13, R14 + XORQ R11, R12 + MOVQ R14, 24(SP) + MOVQ R12, 8(SP) + MOVQ R12, BP + + // Result g + MOVQ 72(DI), R11 + XORQ R9, R11 + MOVQ 80(DI), R12 + ROLQ $0x14, R11 + XORQ BX, R12 + ROLQ $0x03, R12 + MOVQ 24(DI), R10 + MOVQ R11, AX + ORQ R12, AX + XORQ R8, R10 + MOVQ 128(DI), R13 + MOVQ 176(DI), R14 + ROLQ $0x1c, R10 + XORQ R10, AX + MOVQ AX, 40(SP) + XORQ AX, SI + XORQ CX, R13 + ROLQ $0x2d, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 48(SP) + XORQ AX, BP + XORQ DX, R14 + ROLQ $0x3d, R14 + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 64(SP) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 72(SP) + NOTQ R14 + XORQ R10, R15 + ORQ R14, R13 + XORQ R12, R13 + MOVQ R13, 56(SP) + + // Result k + MOVQ 8(DI), R10 + MOVQ 56(DI), R11 + MOVQ 104(DI), R12 + MOVQ 152(DI), R13 + MOVQ 160(DI), R14 + XORQ DX, R11 + ROLQ $0x06, R11 + XORQ R8, R12 + ROLQ $0x19, R12 + MOVQ R11, AX + ORQ R12, AX + XORQ CX, R10 + ROLQ $0x01, R10 + XORQ R10, AX + MOVQ AX, 80(SP) + XORQ AX, SI + XORQ R9, R13 + ROLQ $0x08, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 88(SP) + XORQ AX, BP + XORQ BX, R14 + ROLQ $0x12, R14 + NOTQ R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 96(SP) + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 104(SP) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 112(SP) + XORQ R10, R15 + + // Result m + MOVQ 40(DI), R11 + XORQ BX, R11 + MOVQ 88(DI), R12 + ROLQ $0x24, R11 + XORQ CX, R12 + MOVQ 32(DI), R10 + ROLQ $0x0a, R12 + MOVQ R11, AX + MOVQ 136(DI), R13 + ANDQ R12, AX + XORQ R9, R10 + MOVQ 184(DI), R14 + ROLQ $0x1b, R10 + XORQ R10, AX + MOVQ AX, 120(SP) + XORQ AX, SI + XORQ DX, R13 + ROLQ $0x0f, R13 + MOVQ R12, AX + ORQ R13, AX + XORQ R11, AX + MOVQ AX, 128(SP) + XORQ AX, BP + XORQ R8, R14 + ROLQ $0x38, R14 + NOTQ R13 + MOVQ R13, AX + ORQ R14, AX + XORQ R12, AX + MOVQ AX, 136(SP) + ORQ R10, R11 + XORQ R14, R11 + MOVQ R11, 152(SP) + ANDQ R10, R14 + XORQ R13, R14 + MOVQ R14, 144(SP) + XORQ R11, R15 + + // Result s + MOVQ 16(DI), R10 + MOVQ 64(DI), R11 + MOVQ 112(DI), R12 + XORQ DX, R10 + MOVQ 120(DI), R13 + ROLQ $0x3e, R10 + XORQ R8, R11 + MOVQ 168(DI), R14 + ROLQ $0x37, R11 + XORQ R9, R12 + MOVQ R10, R9 + XORQ CX, R14 + ROLQ $0x02, R14 + ANDQ R11, R9 + XORQ R14, R9 + MOVQ R9, 192(SP) + ROLQ $0x27, R12 + XORQ R9, R15 + NOTQ R11 + XORQ BX, R13 + MOVQ R11, BX + ANDQ R12, BX + XORQ R10, BX + MOVQ BX, 160(SP) + XORQ BX, SI + ROLQ $0x29, R13 + MOVQ R12, CX + ORQ R13, CX + XORQ R11, CX + MOVQ CX, 168(SP) + XORQ CX, BP + MOVQ R13, DX + MOVQ R14, R8 + ANDQ R14, DX + ORQ R10, R8 + XORQ R12, DX + XORQ R13, R8 + MOVQ DX, 176(SP) + MOVQ R8, 184(SP) + + // Prepare round + MOVQ BP, BX + ROLQ $0x01, BX + MOVQ 16(SP), R12 + XORQ 56(SP), DX + XORQ R15, BX + XORQ 96(SP), R12 + XORQ 136(SP), DX + XORQ DX, R12 + MOVQ R12, CX + ROLQ $0x01, CX + MOVQ 24(SP), R13 + XORQ 64(SP), R8 + XORQ SI, CX + XORQ 104(SP), R13 + XORQ 144(SP), R8 + XORQ R8, R13 + MOVQ R13, DX + ROLQ $0x01, DX + MOVQ R15, R8 + XORQ BP, DX + ROLQ $0x01, R8 + MOVQ SI, R9 + XORQ R12, R8 + ROLQ $0x01, R9 + + // Result b + MOVQ (SP), R10 + MOVQ 48(SP), R11 + XORQ R13, R9 + MOVQ 96(SP), R12 + MOVQ 144(SP), R13 + MOVQ 192(SP), R14 + XORQ CX, R11 + ROLQ $0x2c, R11 + XORQ DX, R12 + XORQ BX, R10 + ROLQ $0x2b, R12 + MOVQ R11, SI + MOVQ $0x8000000000008003, AX + ORQ R12, SI + XORQ R10, AX + XORQ AX, SI + MOVQ SI, (DI) + XORQ R9, R14 + ROLQ $0x0e, R14 + MOVQ R10, R15 + ANDQ R11, R15 + XORQ R14, R15 + MOVQ R15, 32(DI) + XORQ R8, R13 + ROLQ $0x15, R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 16(DI) + NOTQ R12 + ORQ R10, R14 + ORQ R13, R12 + XORQ R13, R14 + XORQ R11, R12 + MOVQ R14, 24(DI) + MOVQ R12, 8(DI) + MOVQ R12, BP + + // Result g + MOVQ 72(SP), R11 + XORQ R9, R11 + MOVQ 80(SP), R12 + ROLQ $0x14, R11 + XORQ BX, R12 + ROLQ $0x03, R12 + MOVQ 24(SP), R10 + MOVQ R11, AX + ORQ R12, AX + XORQ R8, R10 + MOVQ 128(SP), R13 + MOVQ 176(SP), R14 + ROLQ $0x1c, R10 + XORQ R10, AX + MOVQ AX, 40(DI) + XORQ AX, SI + XORQ CX, R13 + ROLQ $0x2d, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 48(DI) + XORQ AX, BP + XORQ DX, R14 + ROLQ $0x3d, R14 + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 64(DI) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 72(DI) + NOTQ R14 + XORQ R10, R15 + ORQ R14, R13 + XORQ R12, R13 + MOVQ R13, 56(DI) + + // Result k + MOVQ 8(SP), R10 + MOVQ 56(SP), R11 + MOVQ 104(SP), R12 + MOVQ 152(SP), R13 + MOVQ 160(SP), R14 + XORQ DX, R11 + ROLQ $0x06, R11 + XORQ R8, R12 + ROLQ $0x19, R12 + MOVQ R11, AX + ORQ R12, AX + XORQ CX, R10 + ROLQ $0x01, R10 + XORQ R10, AX + MOVQ AX, 80(DI) + XORQ AX, SI + XORQ R9, R13 + ROLQ $0x08, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 88(DI) + XORQ AX, BP + XORQ BX, R14 + ROLQ $0x12, R14 + NOTQ R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 96(DI) + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 104(DI) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 112(DI) + XORQ R10, R15 + + // Result m + MOVQ 40(SP), R11 + XORQ BX, R11 + MOVQ 88(SP), R12 + ROLQ $0x24, R11 + XORQ CX, R12 + MOVQ 32(SP), R10 + ROLQ $0x0a, R12 + MOVQ R11, AX + MOVQ 136(SP), R13 + ANDQ R12, AX + XORQ R9, R10 + MOVQ 184(SP), R14 + ROLQ $0x1b, R10 + XORQ R10, AX + MOVQ AX, 120(DI) + XORQ AX, SI + XORQ DX, R13 + ROLQ $0x0f, R13 + MOVQ R12, AX + ORQ R13, AX + XORQ R11, AX + MOVQ AX, 128(DI) + XORQ AX, BP + XORQ R8, R14 + ROLQ $0x38, R14 + NOTQ R13 + MOVQ R13, AX + ORQ R14, AX + XORQ R12, AX + MOVQ AX, 136(DI) + ORQ R10, R11 + XORQ R14, R11 + MOVQ R11, 152(DI) + ANDQ R10, R14 + XORQ R13, R14 + MOVQ R14, 144(DI) + XORQ R11, R15 + + // Result s + MOVQ 16(SP), R10 + MOVQ 64(SP), R11 + MOVQ 112(SP), R12 + XORQ DX, R10 + MOVQ 120(SP), R13 + ROLQ $0x3e, R10 + XORQ R8, R11 + MOVQ 168(SP), R14 + ROLQ $0x37, R11 + XORQ R9, R12 + MOVQ R10, R9 + XORQ CX, R14 + ROLQ $0x02, R14 + ANDQ R11, R9 + XORQ R14, R9 + MOVQ R9, 192(DI) + ROLQ $0x27, R12 + XORQ R9, R15 + NOTQ R11 + XORQ BX, R13 + MOVQ R11, BX + ANDQ R12, BX + XORQ R10, BX + MOVQ BX, 160(DI) + XORQ BX, SI + ROLQ $0x29, R13 + MOVQ R12, CX + ORQ R13, CX + XORQ R11, CX + MOVQ CX, 168(DI) + XORQ CX, BP + MOVQ R13, DX + MOVQ R14, R8 + ANDQ R14, DX + ORQ R10, R8 + XORQ R12, DX + XORQ R13, R8 + MOVQ DX, 176(DI) + MOVQ R8, 184(DI) + + // Prepare round + MOVQ BP, BX + ROLQ $0x01, BX + MOVQ 16(DI), R12 + XORQ 56(DI), DX + XORQ R15, BX + XORQ 96(DI), R12 + XORQ 136(DI), DX + XORQ DX, R12 + MOVQ R12, CX + ROLQ $0x01, CX + MOVQ 24(DI), R13 + XORQ 64(DI), R8 + XORQ SI, CX + XORQ 104(DI), R13 + XORQ 144(DI), R8 + XORQ R8, R13 + MOVQ R13, DX + ROLQ $0x01, DX + MOVQ R15, R8 + XORQ BP, DX + ROLQ $0x01, R8 + MOVQ SI, R9 + XORQ R12, R8 + ROLQ $0x01, R9 + + // Result b + MOVQ (DI), R10 + MOVQ 48(DI), R11 + XORQ R13, R9 + MOVQ 96(DI), R12 + MOVQ 144(DI), R13 + MOVQ 192(DI), R14 + XORQ CX, R11 + ROLQ $0x2c, R11 + XORQ DX, R12 + XORQ BX, R10 + ROLQ $0x2b, R12 + MOVQ R11, SI + MOVQ $0x8000000000008002, AX + ORQ R12, SI + XORQ R10, AX + XORQ AX, SI + MOVQ SI, (SP) + XORQ R9, R14 + ROLQ $0x0e, R14 + MOVQ R10, R15 + ANDQ R11, R15 + XORQ R14, R15 + MOVQ R15, 32(SP) + XORQ R8, R13 + ROLQ $0x15, R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 16(SP) + NOTQ R12 + ORQ R10, R14 + ORQ R13, R12 + XORQ R13, R14 + XORQ R11, R12 + MOVQ R14, 24(SP) + MOVQ R12, 8(SP) + MOVQ R12, BP + + // Result g + MOVQ 72(DI), R11 + XORQ R9, R11 + MOVQ 80(DI), R12 + ROLQ $0x14, R11 + XORQ BX, R12 + ROLQ $0x03, R12 + MOVQ 24(DI), R10 + MOVQ R11, AX + ORQ R12, AX + XORQ R8, R10 + MOVQ 128(DI), R13 + MOVQ 176(DI), R14 + ROLQ $0x1c, R10 + XORQ R10, AX + MOVQ AX, 40(SP) + XORQ AX, SI + XORQ CX, R13 + ROLQ $0x2d, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 48(SP) + XORQ AX, BP + XORQ DX, R14 + ROLQ $0x3d, R14 + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 64(SP) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 72(SP) + NOTQ R14 + XORQ R10, R15 + ORQ R14, R13 + XORQ R12, R13 + MOVQ R13, 56(SP) + + // Result k + MOVQ 8(DI), R10 + MOVQ 56(DI), R11 + MOVQ 104(DI), R12 + MOVQ 152(DI), R13 + MOVQ 160(DI), R14 + XORQ DX, R11 + ROLQ $0x06, R11 + XORQ R8, R12 + ROLQ $0x19, R12 + MOVQ R11, AX + ORQ R12, AX + XORQ CX, R10 + ROLQ $0x01, R10 + XORQ R10, AX + MOVQ AX, 80(SP) + XORQ AX, SI + XORQ R9, R13 + ROLQ $0x08, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 88(SP) + XORQ AX, BP + XORQ BX, R14 + ROLQ $0x12, R14 + NOTQ R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 96(SP) + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 104(SP) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 112(SP) + XORQ R10, R15 + + // Result m + MOVQ 40(DI), R11 + XORQ BX, R11 + MOVQ 88(DI), R12 + ROLQ $0x24, R11 + XORQ CX, R12 + MOVQ 32(DI), R10 + ROLQ $0x0a, R12 + MOVQ R11, AX + MOVQ 136(DI), R13 + ANDQ R12, AX + XORQ R9, R10 + MOVQ 184(DI), R14 + ROLQ $0x1b, R10 + XORQ R10, AX + MOVQ AX, 120(SP) + XORQ AX, SI + XORQ DX, R13 + ROLQ $0x0f, R13 + MOVQ R12, AX + ORQ R13, AX + XORQ R11, AX + MOVQ AX, 128(SP) + XORQ AX, BP + XORQ R8, R14 + ROLQ $0x38, R14 + NOTQ R13 + MOVQ R13, AX + ORQ R14, AX + XORQ R12, AX + MOVQ AX, 136(SP) + ORQ R10, R11 + XORQ R14, R11 + MOVQ R11, 152(SP) + ANDQ R10, R14 + XORQ R13, R14 + MOVQ R14, 144(SP) + XORQ R11, R15 + + // Result s + MOVQ 16(DI), R10 + MOVQ 64(DI), R11 + MOVQ 112(DI), R12 + XORQ DX, R10 + MOVQ 120(DI), R13 + ROLQ $0x3e, R10 + XORQ R8, R11 + MOVQ 168(DI), R14 + ROLQ $0x37, R11 + XORQ R9, R12 + MOVQ R10, R9 + XORQ CX, R14 + ROLQ $0x02, R14 + ANDQ R11, R9 + XORQ R14, R9 + MOVQ R9, 192(SP) + ROLQ $0x27, R12 + XORQ R9, R15 + NOTQ R11 + XORQ BX, R13 + MOVQ R11, BX + ANDQ R12, BX + XORQ R10, BX + MOVQ BX, 160(SP) + XORQ BX, SI + ROLQ $0x29, R13 + MOVQ R12, CX + ORQ R13, CX + XORQ R11, CX + MOVQ CX, 168(SP) + XORQ CX, BP + MOVQ R13, DX + MOVQ R14, R8 + ANDQ R14, DX + ORQ R10, R8 + XORQ R12, DX + XORQ R13, R8 + MOVQ DX, 176(SP) + MOVQ R8, 184(SP) + + // Prepare round + MOVQ BP, BX + ROLQ $0x01, BX + MOVQ 16(SP), R12 + XORQ 56(SP), DX + XORQ R15, BX + XORQ 96(SP), R12 + XORQ 136(SP), DX + XORQ DX, R12 + MOVQ R12, CX + ROLQ $0x01, CX + MOVQ 24(SP), R13 + XORQ 64(SP), R8 + XORQ SI, CX + XORQ 104(SP), R13 + XORQ 144(SP), R8 + XORQ R8, R13 + MOVQ R13, DX + ROLQ $0x01, DX + MOVQ R15, R8 + XORQ BP, DX + ROLQ $0x01, R8 + MOVQ SI, R9 + XORQ R12, R8 + ROLQ $0x01, R9 + + // Result b + MOVQ (SP), R10 + MOVQ 48(SP), R11 + XORQ R13, R9 + MOVQ 96(SP), R12 + MOVQ 144(SP), R13 + MOVQ 192(SP), R14 + XORQ CX, R11 + ROLQ $0x2c, R11 + XORQ DX, R12 + XORQ BX, R10 + ROLQ $0x2b, R12 + MOVQ R11, SI + MOVQ $0x8000000000000080, AX + ORQ R12, SI + XORQ R10, AX + XORQ AX, SI + MOVQ SI, (DI) + XORQ R9, R14 + ROLQ $0x0e, R14 + MOVQ R10, R15 + ANDQ R11, R15 + XORQ R14, R15 + MOVQ R15, 32(DI) + XORQ R8, R13 + ROLQ $0x15, R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 16(DI) + NOTQ R12 + ORQ R10, R14 + ORQ R13, R12 + XORQ R13, R14 + XORQ R11, R12 + MOVQ R14, 24(DI) + MOVQ R12, 8(DI) + MOVQ R12, BP + + // Result g + MOVQ 72(SP), R11 + XORQ R9, R11 + MOVQ 80(SP), R12 + ROLQ $0x14, R11 + XORQ BX, R12 + ROLQ $0x03, R12 + MOVQ 24(SP), R10 + MOVQ R11, AX + ORQ R12, AX + XORQ R8, R10 + MOVQ 128(SP), R13 + MOVQ 176(SP), R14 + ROLQ $0x1c, R10 + XORQ R10, AX + MOVQ AX, 40(DI) + XORQ AX, SI + XORQ CX, R13 + ROLQ $0x2d, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 48(DI) + XORQ AX, BP + XORQ DX, R14 + ROLQ $0x3d, R14 + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 64(DI) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 72(DI) + NOTQ R14 + XORQ R10, R15 + ORQ R14, R13 + XORQ R12, R13 + MOVQ R13, 56(DI) + + // Result k + MOVQ 8(SP), R10 + MOVQ 56(SP), R11 + MOVQ 104(SP), R12 + MOVQ 152(SP), R13 + MOVQ 160(SP), R14 + XORQ DX, R11 + ROLQ $0x06, R11 + XORQ R8, R12 + ROLQ $0x19, R12 + MOVQ R11, AX + ORQ R12, AX + XORQ CX, R10 + ROLQ $0x01, R10 + XORQ R10, AX + MOVQ AX, 80(DI) + XORQ AX, SI + XORQ R9, R13 + ROLQ $0x08, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 88(DI) + XORQ AX, BP + XORQ BX, R14 + ROLQ $0x12, R14 + NOTQ R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 96(DI) + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 104(DI) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 112(DI) + XORQ R10, R15 + + // Result m + MOVQ 40(SP), R11 + XORQ BX, R11 + MOVQ 88(SP), R12 + ROLQ $0x24, R11 + XORQ CX, R12 + MOVQ 32(SP), R10 + ROLQ $0x0a, R12 + MOVQ R11, AX + MOVQ 136(SP), R13 + ANDQ R12, AX + XORQ R9, R10 + MOVQ 184(SP), R14 + ROLQ $0x1b, R10 + XORQ R10, AX + MOVQ AX, 120(DI) + XORQ AX, SI + XORQ DX, R13 + ROLQ $0x0f, R13 + MOVQ R12, AX + ORQ R13, AX + XORQ R11, AX + MOVQ AX, 128(DI) + XORQ AX, BP + XORQ R8, R14 + ROLQ $0x38, R14 + NOTQ R13 + MOVQ R13, AX + ORQ R14, AX + XORQ R12, AX + MOVQ AX, 136(DI) + ORQ R10, R11 + XORQ R14, R11 + MOVQ R11, 152(DI) + ANDQ R10, R14 + XORQ R13, R14 + MOVQ R14, 144(DI) + XORQ R11, R15 + + // Result s + MOVQ 16(SP), R10 + MOVQ 64(SP), R11 + MOVQ 112(SP), R12 + XORQ DX, R10 + MOVQ 120(SP), R13 + ROLQ $0x3e, R10 + XORQ R8, R11 + MOVQ 168(SP), R14 + ROLQ $0x37, R11 + XORQ R9, R12 + MOVQ R10, R9 + XORQ CX, R14 + ROLQ $0x02, R14 + ANDQ R11, R9 + XORQ R14, R9 + MOVQ R9, 192(DI) + ROLQ $0x27, R12 + XORQ R9, R15 + NOTQ R11 + XORQ BX, R13 + MOVQ R11, BX + ANDQ R12, BX + XORQ R10, BX + MOVQ BX, 160(DI) + XORQ BX, SI + ROLQ $0x29, R13 + MOVQ R12, CX + ORQ R13, CX + XORQ R11, CX + MOVQ CX, 168(DI) + XORQ CX, BP + MOVQ R13, DX + MOVQ R14, R8 + ANDQ R14, DX + ORQ R10, R8 + XORQ R12, DX + XORQ R13, R8 + MOVQ DX, 176(DI) + MOVQ R8, 184(DI) + + // Prepare round + MOVQ BP, BX + ROLQ $0x01, BX + MOVQ 16(DI), R12 + XORQ 56(DI), DX + XORQ R15, BX + XORQ 96(DI), R12 + XORQ 136(DI), DX + XORQ DX, R12 + MOVQ R12, CX + ROLQ $0x01, CX + MOVQ 24(DI), R13 + XORQ 64(DI), R8 + XORQ SI, CX + XORQ 104(DI), R13 + XORQ 144(DI), R8 + XORQ R8, R13 + MOVQ R13, DX + ROLQ $0x01, DX + MOVQ R15, R8 + XORQ BP, DX + ROLQ $0x01, R8 + MOVQ SI, R9 + XORQ R12, R8 + ROLQ $0x01, R9 + + // Result b + MOVQ (DI), R10 + MOVQ 48(DI), R11 + XORQ R13, R9 + MOVQ 96(DI), R12 + MOVQ 144(DI), R13 + MOVQ 192(DI), R14 + XORQ CX, R11 + ROLQ $0x2c, R11 + XORQ DX, R12 + XORQ BX, R10 + ROLQ $0x2b, R12 + MOVQ R11, SI + MOVQ $0x000000000000800a, AX + ORQ R12, SI + XORQ R10, AX + XORQ AX, SI + MOVQ SI, (SP) + XORQ R9, R14 + ROLQ $0x0e, R14 + MOVQ R10, R15 + ANDQ R11, R15 + XORQ R14, R15 + MOVQ R15, 32(SP) + XORQ R8, R13 + ROLQ $0x15, R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 16(SP) + NOTQ R12 + ORQ R10, R14 + ORQ R13, R12 + XORQ R13, R14 + XORQ R11, R12 + MOVQ R14, 24(SP) + MOVQ R12, 8(SP) + MOVQ R12, BP + + // Result g + MOVQ 72(DI), R11 + XORQ R9, R11 + MOVQ 80(DI), R12 + ROLQ $0x14, R11 + XORQ BX, R12 + ROLQ $0x03, R12 + MOVQ 24(DI), R10 + MOVQ R11, AX + ORQ R12, AX + XORQ R8, R10 + MOVQ 128(DI), R13 + MOVQ 176(DI), R14 + ROLQ $0x1c, R10 + XORQ R10, AX + MOVQ AX, 40(SP) + XORQ AX, SI + XORQ CX, R13 + ROLQ $0x2d, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 48(SP) + XORQ AX, BP + XORQ DX, R14 + ROLQ $0x3d, R14 + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 64(SP) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 72(SP) + NOTQ R14 + XORQ R10, R15 + ORQ R14, R13 + XORQ R12, R13 + MOVQ R13, 56(SP) + + // Result k + MOVQ 8(DI), R10 + MOVQ 56(DI), R11 + MOVQ 104(DI), R12 + MOVQ 152(DI), R13 + MOVQ 160(DI), R14 + XORQ DX, R11 + ROLQ $0x06, R11 + XORQ R8, R12 + ROLQ $0x19, R12 + MOVQ R11, AX + ORQ R12, AX + XORQ CX, R10 + ROLQ $0x01, R10 + XORQ R10, AX + MOVQ AX, 80(SP) + XORQ AX, SI + XORQ R9, R13 + ROLQ $0x08, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 88(SP) + XORQ AX, BP + XORQ BX, R14 + ROLQ $0x12, R14 + NOTQ R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 96(SP) + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 104(SP) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 112(SP) + XORQ R10, R15 + + // Result m + MOVQ 40(DI), R11 + XORQ BX, R11 + MOVQ 88(DI), R12 + ROLQ $0x24, R11 + XORQ CX, R12 + MOVQ 32(DI), R10 + ROLQ $0x0a, R12 + MOVQ R11, AX + MOVQ 136(DI), R13 + ANDQ R12, AX + XORQ R9, R10 + MOVQ 184(DI), R14 + ROLQ $0x1b, R10 + XORQ R10, AX + MOVQ AX, 120(SP) + XORQ AX, SI + XORQ DX, R13 + ROLQ $0x0f, R13 + MOVQ R12, AX + ORQ R13, AX + XORQ R11, AX + MOVQ AX, 128(SP) + XORQ AX, BP + XORQ R8, R14 + ROLQ $0x38, R14 + NOTQ R13 + MOVQ R13, AX + ORQ R14, AX + XORQ R12, AX + MOVQ AX, 136(SP) + ORQ R10, R11 + XORQ R14, R11 + MOVQ R11, 152(SP) + ANDQ R10, R14 + XORQ R13, R14 + MOVQ R14, 144(SP) + XORQ R11, R15 + + // Result s + MOVQ 16(DI), R10 + MOVQ 64(DI), R11 + MOVQ 112(DI), R12 + XORQ DX, R10 + MOVQ 120(DI), R13 + ROLQ $0x3e, R10 + XORQ R8, R11 + MOVQ 168(DI), R14 + ROLQ $0x37, R11 + XORQ R9, R12 + MOVQ R10, R9 + XORQ CX, R14 + ROLQ $0x02, R14 + ANDQ R11, R9 + XORQ R14, R9 + MOVQ R9, 192(SP) + ROLQ $0x27, R12 + XORQ R9, R15 + NOTQ R11 + XORQ BX, R13 + MOVQ R11, BX + ANDQ R12, BX + XORQ R10, BX + MOVQ BX, 160(SP) + XORQ BX, SI + ROLQ $0x29, R13 + MOVQ R12, CX + ORQ R13, CX + XORQ R11, CX + MOVQ CX, 168(SP) + XORQ CX, BP + MOVQ R13, DX + MOVQ R14, R8 + ANDQ R14, DX + ORQ R10, R8 + XORQ R12, DX + XORQ R13, R8 + MOVQ DX, 176(SP) + MOVQ R8, 184(SP) + + // Prepare round + MOVQ BP, BX + ROLQ $0x01, BX + MOVQ 16(SP), R12 + XORQ 56(SP), DX + XORQ R15, BX + XORQ 96(SP), R12 + XORQ 136(SP), DX + XORQ DX, R12 + MOVQ R12, CX + ROLQ $0x01, CX + MOVQ 24(SP), R13 + XORQ 64(SP), R8 + XORQ SI, CX + XORQ 104(SP), R13 + XORQ 144(SP), R8 + XORQ R8, R13 + MOVQ R13, DX + ROLQ $0x01, DX + MOVQ R15, R8 + XORQ BP, DX + ROLQ $0x01, R8 + MOVQ SI, R9 + XORQ R12, R8 + ROLQ $0x01, R9 + + // Result b + MOVQ (SP), R10 + MOVQ 48(SP), R11 + XORQ R13, R9 + MOVQ 96(SP), R12 + MOVQ 144(SP), R13 + MOVQ 192(SP), R14 + XORQ CX, R11 + ROLQ $0x2c, R11 + XORQ DX, R12 + XORQ BX, R10 + ROLQ $0x2b, R12 + MOVQ R11, SI + MOVQ $0x800000008000000a, AX + ORQ R12, SI + XORQ R10, AX + XORQ AX, SI + MOVQ SI, (DI) + XORQ R9, R14 + ROLQ $0x0e, R14 + MOVQ R10, R15 + ANDQ R11, R15 + XORQ R14, R15 + MOVQ R15, 32(DI) + XORQ R8, R13 + ROLQ $0x15, R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 16(DI) + NOTQ R12 + ORQ R10, R14 + ORQ R13, R12 + XORQ R13, R14 + XORQ R11, R12 + MOVQ R14, 24(DI) + MOVQ R12, 8(DI) + MOVQ R12, BP + + // Result g + MOVQ 72(SP), R11 + XORQ R9, R11 + MOVQ 80(SP), R12 + ROLQ $0x14, R11 + XORQ BX, R12 + ROLQ $0x03, R12 + MOVQ 24(SP), R10 + MOVQ R11, AX + ORQ R12, AX + XORQ R8, R10 + MOVQ 128(SP), R13 + MOVQ 176(SP), R14 + ROLQ $0x1c, R10 + XORQ R10, AX + MOVQ AX, 40(DI) + XORQ AX, SI + XORQ CX, R13 + ROLQ $0x2d, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 48(DI) + XORQ AX, BP + XORQ DX, R14 + ROLQ $0x3d, R14 + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 64(DI) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 72(DI) + NOTQ R14 + XORQ R10, R15 + ORQ R14, R13 + XORQ R12, R13 + MOVQ R13, 56(DI) + + // Result k + MOVQ 8(SP), R10 + MOVQ 56(SP), R11 + MOVQ 104(SP), R12 + MOVQ 152(SP), R13 + MOVQ 160(SP), R14 + XORQ DX, R11 + ROLQ $0x06, R11 + XORQ R8, R12 + ROLQ $0x19, R12 + MOVQ R11, AX + ORQ R12, AX + XORQ CX, R10 + ROLQ $0x01, R10 + XORQ R10, AX + MOVQ AX, 80(DI) + XORQ AX, SI + XORQ R9, R13 + ROLQ $0x08, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 88(DI) + XORQ AX, BP + XORQ BX, R14 + ROLQ $0x12, R14 + NOTQ R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 96(DI) + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 104(DI) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 112(DI) + XORQ R10, R15 + + // Result m + MOVQ 40(SP), R11 + XORQ BX, R11 + MOVQ 88(SP), R12 + ROLQ $0x24, R11 + XORQ CX, R12 + MOVQ 32(SP), R10 + ROLQ $0x0a, R12 + MOVQ R11, AX + MOVQ 136(SP), R13 + ANDQ R12, AX + XORQ R9, R10 + MOVQ 184(SP), R14 + ROLQ $0x1b, R10 + XORQ R10, AX + MOVQ AX, 120(DI) + XORQ AX, SI + XORQ DX, R13 + ROLQ $0x0f, R13 + MOVQ R12, AX + ORQ R13, AX + XORQ R11, AX + MOVQ AX, 128(DI) + XORQ AX, BP + XORQ R8, R14 + ROLQ $0x38, R14 + NOTQ R13 + MOVQ R13, AX + ORQ R14, AX + XORQ R12, AX + MOVQ AX, 136(DI) + ORQ R10, R11 + XORQ R14, R11 + MOVQ R11, 152(DI) + ANDQ R10, R14 + XORQ R13, R14 + MOVQ R14, 144(DI) + XORQ R11, R15 + + // Result s + MOVQ 16(SP), R10 + MOVQ 64(SP), R11 + MOVQ 112(SP), R12 + XORQ DX, R10 + MOVQ 120(SP), R13 + ROLQ $0x3e, R10 + XORQ R8, R11 + MOVQ 168(SP), R14 + ROLQ $0x37, R11 + XORQ R9, R12 + MOVQ R10, R9 + XORQ CX, R14 + ROLQ $0x02, R14 + ANDQ R11, R9 + XORQ R14, R9 + MOVQ R9, 192(DI) + ROLQ $0x27, R12 + XORQ R9, R15 + NOTQ R11 + XORQ BX, R13 + MOVQ R11, BX + ANDQ R12, BX + XORQ R10, BX + MOVQ BX, 160(DI) + XORQ BX, SI + ROLQ $0x29, R13 + MOVQ R12, CX + ORQ R13, CX + XORQ R11, CX + MOVQ CX, 168(DI) + XORQ CX, BP + MOVQ R13, DX + MOVQ R14, R8 + ANDQ R14, DX + ORQ R10, R8 + XORQ R12, DX + XORQ R13, R8 + MOVQ DX, 176(DI) + MOVQ R8, 184(DI) + + // Prepare round + MOVQ BP, BX + ROLQ $0x01, BX + MOVQ 16(DI), R12 + XORQ 56(DI), DX + XORQ R15, BX + XORQ 96(DI), R12 + XORQ 136(DI), DX + XORQ DX, R12 + MOVQ R12, CX + ROLQ $0x01, CX + MOVQ 24(DI), R13 + XORQ 64(DI), R8 + XORQ SI, CX + XORQ 104(DI), R13 + XORQ 144(DI), R8 + XORQ R8, R13 + MOVQ R13, DX + ROLQ $0x01, DX + MOVQ R15, R8 + XORQ BP, DX + ROLQ $0x01, R8 + MOVQ SI, R9 + XORQ R12, R8 + ROLQ $0x01, R9 + + // Result b + MOVQ (DI), R10 + MOVQ 48(DI), R11 + XORQ R13, R9 + MOVQ 96(DI), R12 + MOVQ 144(DI), R13 + MOVQ 192(DI), R14 + XORQ CX, R11 + ROLQ $0x2c, R11 + XORQ DX, R12 + XORQ BX, R10 + ROLQ $0x2b, R12 + MOVQ R11, SI + MOVQ $0x8000000080008081, AX + ORQ R12, SI + XORQ R10, AX + XORQ AX, SI + MOVQ SI, (SP) + XORQ R9, R14 + ROLQ $0x0e, R14 + MOVQ R10, R15 + ANDQ R11, R15 + XORQ R14, R15 + MOVQ R15, 32(SP) + XORQ R8, R13 + ROLQ $0x15, R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 16(SP) + NOTQ R12 + ORQ R10, R14 + ORQ R13, R12 + XORQ R13, R14 + XORQ R11, R12 + MOVQ R14, 24(SP) + MOVQ R12, 8(SP) + MOVQ R12, BP + + // Result g + MOVQ 72(DI), R11 + XORQ R9, R11 + MOVQ 80(DI), R12 + ROLQ $0x14, R11 + XORQ BX, R12 + ROLQ $0x03, R12 + MOVQ 24(DI), R10 + MOVQ R11, AX + ORQ R12, AX + XORQ R8, R10 + MOVQ 128(DI), R13 + MOVQ 176(DI), R14 + ROLQ $0x1c, R10 + XORQ R10, AX + MOVQ AX, 40(SP) + XORQ AX, SI + XORQ CX, R13 + ROLQ $0x2d, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 48(SP) + XORQ AX, BP + XORQ DX, R14 + ROLQ $0x3d, R14 + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 64(SP) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 72(SP) + NOTQ R14 + XORQ R10, R15 + ORQ R14, R13 + XORQ R12, R13 + MOVQ R13, 56(SP) + + // Result k + MOVQ 8(DI), R10 + MOVQ 56(DI), R11 + MOVQ 104(DI), R12 + MOVQ 152(DI), R13 + MOVQ 160(DI), R14 + XORQ DX, R11 + ROLQ $0x06, R11 + XORQ R8, R12 + ROLQ $0x19, R12 + MOVQ R11, AX + ORQ R12, AX + XORQ CX, R10 + ROLQ $0x01, R10 + XORQ R10, AX + MOVQ AX, 80(SP) + XORQ AX, SI + XORQ R9, R13 + ROLQ $0x08, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 88(SP) + XORQ AX, BP + XORQ BX, R14 + ROLQ $0x12, R14 + NOTQ R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 96(SP) + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 104(SP) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 112(SP) + XORQ R10, R15 + + // Result m + MOVQ 40(DI), R11 + XORQ BX, R11 + MOVQ 88(DI), R12 + ROLQ $0x24, R11 + XORQ CX, R12 + MOVQ 32(DI), R10 + ROLQ $0x0a, R12 + MOVQ R11, AX + MOVQ 136(DI), R13 + ANDQ R12, AX + XORQ R9, R10 + MOVQ 184(DI), R14 + ROLQ $0x1b, R10 + XORQ R10, AX + MOVQ AX, 120(SP) + XORQ AX, SI + XORQ DX, R13 + ROLQ $0x0f, R13 + MOVQ R12, AX + ORQ R13, AX + XORQ R11, AX + MOVQ AX, 128(SP) + XORQ AX, BP + XORQ R8, R14 + ROLQ $0x38, R14 + NOTQ R13 + MOVQ R13, AX + ORQ R14, AX + XORQ R12, AX + MOVQ AX, 136(SP) + ORQ R10, R11 + XORQ R14, R11 + MOVQ R11, 152(SP) + ANDQ R10, R14 + XORQ R13, R14 + MOVQ R14, 144(SP) + XORQ R11, R15 + + // Result s + MOVQ 16(DI), R10 + MOVQ 64(DI), R11 + MOVQ 112(DI), R12 + XORQ DX, R10 + MOVQ 120(DI), R13 + ROLQ $0x3e, R10 + XORQ R8, R11 + MOVQ 168(DI), R14 + ROLQ $0x37, R11 + XORQ R9, R12 + MOVQ R10, R9 + XORQ CX, R14 + ROLQ $0x02, R14 + ANDQ R11, R9 + XORQ R14, R9 + MOVQ R9, 192(SP) + ROLQ $0x27, R12 + XORQ R9, R15 + NOTQ R11 + XORQ BX, R13 + MOVQ R11, BX + ANDQ R12, BX + XORQ R10, BX + MOVQ BX, 160(SP) + XORQ BX, SI + ROLQ $0x29, R13 + MOVQ R12, CX + ORQ R13, CX + XORQ R11, CX + MOVQ CX, 168(SP) + XORQ CX, BP + MOVQ R13, DX + MOVQ R14, R8 + ANDQ R14, DX + ORQ R10, R8 + XORQ R12, DX + XORQ R13, R8 + MOVQ DX, 176(SP) + MOVQ R8, 184(SP) + + // Prepare round + MOVQ BP, BX + ROLQ $0x01, BX + MOVQ 16(SP), R12 + XORQ 56(SP), DX + XORQ R15, BX + XORQ 96(SP), R12 + XORQ 136(SP), DX + XORQ DX, R12 + MOVQ R12, CX + ROLQ $0x01, CX + MOVQ 24(SP), R13 + XORQ 64(SP), R8 + XORQ SI, CX + XORQ 104(SP), R13 + XORQ 144(SP), R8 + XORQ R8, R13 + MOVQ R13, DX + ROLQ $0x01, DX + MOVQ R15, R8 + XORQ BP, DX + ROLQ $0x01, R8 + MOVQ SI, R9 + XORQ R12, R8 + ROLQ $0x01, R9 + + // Result b + MOVQ (SP), R10 + MOVQ 48(SP), R11 + XORQ R13, R9 + MOVQ 96(SP), R12 + MOVQ 144(SP), R13 + MOVQ 192(SP), R14 + XORQ CX, R11 + ROLQ $0x2c, R11 + XORQ DX, R12 + XORQ BX, R10 + ROLQ $0x2b, R12 + MOVQ R11, SI + MOVQ $0x8000000000008080, AX + ORQ R12, SI + XORQ R10, AX + XORQ AX, SI + MOVQ SI, (DI) + XORQ R9, R14 + ROLQ $0x0e, R14 + MOVQ R10, R15 + ANDQ R11, R15 + XORQ R14, R15 + MOVQ R15, 32(DI) + XORQ R8, R13 + ROLQ $0x15, R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 16(DI) + NOTQ R12 + ORQ R10, R14 + ORQ R13, R12 + XORQ R13, R14 + XORQ R11, R12 + MOVQ R14, 24(DI) + MOVQ R12, 8(DI) + MOVQ R12, BP + + // Result g + MOVQ 72(SP), R11 + XORQ R9, R11 + MOVQ 80(SP), R12 + ROLQ $0x14, R11 + XORQ BX, R12 + ROLQ $0x03, R12 + MOVQ 24(SP), R10 + MOVQ R11, AX + ORQ R12, AX + XORQ R8, R10 + MOVQ 128(SP), R13 + MOVQ 176(SP), R14 + ROLQ $0x1c, R10 + XORQ R10, AX + MOVQ AX, 40(DI) + XORQ AX, SI + XORQ CX, R13 + ROLQ $0x2d, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 48(DI) + XORQ AX, BP + XORQ DX, R14 + ROLQ $0x3d, R14 + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 64(DI) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 72(DI) + NOTQ R14 + XORQ R10, R15 + ORQ R14, R13 + XORQ R12, R13 + MOVQ R13, 56(DI) + + // Result k + MOVQ 8(SP), R10 + MOVQ 56(SP), R11 + MOVQ 104(SP), R12 + MOVQ 152(SP), R13 + MOVQ 160(SP), R14 + XORQ DX, R11 + ROLQ $0x06, R11 + XORQ R8, R12 + ROLQ $0x19, R12 + MOVQ R11, AX + ORQ R12, AX + XORQ CX, R10 + ROLQ $0x01, R10 + XORQ R10, AX + MOVQ AX, 80(DI) + XORQ AX, SI + XORQ R9, R13 + ROLQ $0x08, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 88(DI) + XORQ AX, BP + XORQ BX, R14 + ROLQ $0x12, R14 + NOTQ R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 96(DI) + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 104(DI) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 112(DI) + XORQ R10, R15 + + // Result m + MOVQ 40(SP), R11 + XORQ BX, R11 + MOVQ 88(SP), R12 + ROLQ $0x24, R11 + XORQ CX, R12 + MOVQ 32(SP), R10 + ROLQ $0x0a, R12 + MOVQ R11, AX + MOVQ 136(SP), R13 + ANDQ R12, AX + XORQ R9, R10 + MOVQ 184(SP), R14 + ROLQ $0x1b, R10 + XORQ R10, AX + MOVQ AX, 120(DI) + XORQ AX, SI + XORQ DX, R13 + ROLQ $0x0f, R13 + MOVQ R12, AX + ORQ R13, AX + XORQ R11, AX + MOVQ AX, 128(DI) + XORQ AX, BP + XORQ R8, R14 + ROLQ $0x38, R14 + NOTQ R13 + MOVQ R13, AX + ORQ R14, AX + XORQ R12, AX + MOVQ AX, 136(DI) + ORQ R10, R11 + XORQ R14, R11 + MOVQ R11, 152(DI) + ANDQ R10, R14 + XORQ R13, R14 + MOVQ R14, 144(DI) + XORQ R11, R15 + + // Result s + MOVQ 16(SP), R10 + MOVQ 64(SP), R11 + MOVQ 112(SP), R12 + XORQ DX, R10 + MOVQ 120(SP), R13 + ROLQ $0x3e, R10 + XORQ R8, R11 + MOVQ 168(SP), R14 + ROLQ $0x37, R11 + XORQ R9, R12 + MOVQ R10, R9 + XORQ CX, R14 + ROLQ $0x02, R14 + ANDQ R11, R9 + XORQ R14, R9 + MOVQ R9, 192(DI) + ROLQ $0x27, R12 + XORQ R9, R15 + NOTQ R11 + XORQ BX, R13 + MOVQ R11, BX + ANDQ R12, BX + XORQ R10, BX + MOVQ BX, 160(DI) + XORQ BX, SI + ROLQ $0x29, R13 + MOVQ R12, CX + ORQ R13, CX + XORQ R11, CX + MOVQ CX, 168(DI) + XORQ CX, BP + MOVQ R13, DX + MOVQ R14, R8 + ANDQ R14, DX + ORQ R10, R8 + XORQ R12, DX + XORQ R13, R8 + MOVQ DX, 176(DI) + MOVQ R8, 184(DI) + + // Prepare round + MOVQ BP, BX + ROLQ $0x01, BX + MOVQ 16(DI), R12 + XORQ 56(DI), DX + XORQ R15, BX + XORQ 96(DI), R12 + XORQ 136(DI), DX + XORQ DX, R12 + MOVQ R12, CX + ROLQ $0x01, CX + MOVQ 24(DI), R13 + XORQ 64(DI), R8 + XORQ SI, CX + XORQ 104(DI), R13 + XORQ 144(DI), R8 + XORQ R8, R13 + MOVQ R13, DX + ROLQ $0x01, DX + MOVQ R15, R8 + XORQ BP, DX + ROLQ $0x01, R8 + MOVQ SI, R9 + XORQ R12, R8 + ROLQ $0x01, R9 + + // Result b + MOVQ (DI), R10 + MOVQ 48(DI), R11 + XORQ R13, R9 + MOVQ 96(DI), R12 + MOVQ 144(DI), R13 + MOVQ 192(DI), R14 + XORQ CX, R11 + ROLQ $0x2c, R11 + XORQ DX, R12 + XORQ BX, R10 + ROLQ $0x2b, R12 + MOVQ R11, SI + MOVQ $0x0000000080000001, AX + ORQ R12, SI + XORQ R10, AX + XORQ AX, SI + MOVQ SI, (SP) + XORQ R9, R14 + ROLQ $0x0e, R14 + MOVQ R10, R15 + ANDQ R11, R15 + XORQ R14, R15 + MOVQ R15, 32(SP) + XORQ R8, R13 + ROLQ $0x15, R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 16(SP) + NOTQ R12 + ORQ R10, R14 + ORQ R13, R12 + XORQ R13, R14 + XORQ R11, R12 + MOVQ R14, 24(SP) + MOVQ R12, 8(SP) + MOVQ R12, BP + + // Result g + MOVQ 72(DI), R11 + XORQ R9, R11 + MOVQ 80(DI), R12 + ROLQ $0x14, R11 + XORQ BX, R12 + ROLQ $0x03, R12 + MOVQ 24(DI), R10 + MOVQ R11, AX + ORQ R12, AX + XORQ R8, R10 + MOVQ 128(DI), R13 + MOVQ 176(DI), R14 + ROLQ $0x1c, R10 + XORQ R10, AX + MOVQ AX, 40(SP) + XORQ AX, SI + XORQ CX, R13 + ROLQ $0x2d, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 48(SP) + XORQ AX, BP + XORQ DX, R14 + ROLQ $0x3d, R14 + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 64(SP) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 72(SP) + NOTQ R14 + XORQ R10, R15 + ORQ R14, R13 + XORQ R12, R13 + MOVQ R13, 56(SP) + + // Result k + MOVQ 8(DI), R10 + MOVQ 56(DI), R11 + MOVQ 104(DI), R12 + MOVQ 152(DI), R13 + MOVQ 160(DI), R14 + XORQ DX, R11 + ROLQ $0x06, R11 + XORQ R8, R12 + ROLQ $0x19, R12 + MOVQ R11, AX + ORQ R12, AX + XORQ CX, R10 + ROLQ $0x01, R10 + XORQ R10, AX + MOVQ AX, 80(SP) + XORQ AX, SI + XORQ R9, R13 + ROLQ $0x08, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 88(SP) + XORQ AX, BP + XORQ BX, R14 + ROLQ $0x12, R14 + NOTQ R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 96(SP) + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 104(SP) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 112(SP) + XORQ R10, R15 + + // Result m + MOVQ 40(DI), R11 + XORQ BX, R11 + MOVQ 88(DI), R12 + ROLQ $0x24, R11 + XORQ CX, R12 + MOVQ 32(DI), R10 + ROLQ $0x0a, R12 + MOVQ R11, AX + MOVQ 136(DI), R13 + ANDQ R12, AX + XORQ R9, R10 + MOVQ 184(DI), R14 + ROLQ $0x1b, R10 + XORQ R10, AX + MOVQ AX, 120(SP) + XORQ AX, SI + XORQ DX, R13 + ROLQ $0x0f, R13 + MOVQ R12, AX + ORQ R13, AX + XORQ R11, AX + MOVQ AX, 128(SP) + XORQ AX, BP + XORQ R8, R14 + ROLQ $0x38, R14 + NOTQ R13 + MOVQ R13, AX + ORQ R14, AX + XORQ R12, AX + MOVQ AX, 136(SP) + ORQ R10, R11 + XORQ R14, R11 + MOVQ R11, 152(SP) + ANDQ R10, R14 + XORQ R13, R14 + MOVQ R14, 144(SP) + XORQ R11, R15 + + // Result s + MOVQ 16(DI), R10 + MOVQ 64(DI), R11 + MOVQ 112(DI), R12 + XORQ DX, R10 + MOVQ 120(DI), R13 + ROLQ $0x3e, R10 + XORQ R8, R11 + MOVQ 168(DI), R14 + ROLQ $0x37, R11 + XORQ R9, R12 + MOVQ R10, R9 + XORQ CX, R14 + ROLQ $0x02, R14 + ANDQ R11, R9 + XORQ R14, R9 + MOVQ R9, 192(SP) + ROLQ $0x27, R12 + XORQ R9, R15 + NOTQ R11 + XORQ BX, R13 + MOVQ R11, BX + ANDQ R12, BX + XORQ R10, BX + MOVQ BX, 160(SP) + XORQ BX, SI + ROLQ $0x29, R13 + MOVQ R12, CX + ORQ R13, CX + XORQ R11, CX + MOVQ CX, 168(SP) + XORQ CX, BP + MOVQ R13, DX + MOVQ R14, R8 + ANDQ R14, DX + ORQ R10, R8 + XORQ R12, DX + XORQ R13, R8 + MOVQ DX, 176(SP) + MOVQ R8, 184(SP) + + // Prepare round + MOVQ BP, BX + ROLQ $0x01, BX + MOVQ 16(SP), R12 + XORQ 56(SP), DX + XORQ R15, BX + XORQ 96(SP), R12 + XORQ 136(SP), DX + XORQ DX, R12 + MOVQ R12, CX + ROLQ $0x01, CX + MOVQ 24(SP), R13 + XORQ 64(SP), R8 + XORQ SI, CX + XORQ 104(SP), R13 + XORQ 144(SP), R8 + XORQ R8, R13 + MOVQ R13, DX + ROLQ $0x01, DX + MOVQ R15, R8 + XORQ BP, DX + ROLQ $0x01, R8 + MOVQ SI, R9 + XORQ R12, R8 + ROLQ $0x01, R9 + + // Result b + MOVQ (SP), R10 + MOVQ 48(SP), R11 + XORQ R13, R9 + MOVQ 96(SP), R12 + MOVQ 144(SP), R13 + MOVQ 192(SP), R14 + XORQ CX, R11 + ROLQ $0x2c, R11 + XORQ DX, R12 + XORQ BX, R10 + ROLQ $0x2b, R12 + MOVQ R11, SI + MOVQ $0x8000000080008008, AX + ORQ R12, SI + XORQ R10, AX + XORQ AX, SI + MOVQ SI, (DI) + XORQ R9, R14 + ROLQ $0x0e, R14 + MOVQ R10, R15 + ANDQ R11, R15 + XORQ R14, R15 + MOVQ R15, 32(DI) + XORQ R8, R13 + ROLQ $0x15, R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 16(DI) + NOTQ R12 + ORQ R10, R14 + ORQ R13, R12 + XORQ R13, R14 + XORQ R11, R12 + MOVQ R14, 24(DI) + MOVQ R12, 8(DI) + NOP + + // Result g + MOVQ 72(SP), R11 + XORQ R9, R11 + MOVQ 80(SP), R12 + ROLQ $0x14, R11 + XORQ BX, R12 + ROLQ $0x03, R12 + MOVQ 24(SP), R10 + MOVQ R11, AX + ORQ R12, AX + XORQ R8, R10 + MOVQ 128(SP), R13 + MOVQ 176(SP), R14 + ROLQ $0x1c, R10 + XORQ R10, AX + MOVQ AX, 40(DI) + NOP + XORQ CX, R13 + ROLQ $0x2d, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 48(DI) + NOP + XORQ DX, R14 + ROLQ $0x3d, R14 + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 64(DI) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 72(DI) + NOTQ R14 + NOP + ORQ R14, R13 + XORQ R12, R13 + MOVQ R13, 56(DI) + + // Result k + MOVQ 8(SP), R10 + MOVQ 56(SP), R11 + MOVQ 104(SP), R12 + MOVQ 152(SP), R13 + MOVQ 160(SP), R14 + XORQ DX, R11 + ROLQ $0x06, R11 + XORQ R8, R12 + ROLQ $0x19, R12 + MOVQ R11, AX + ORQ R12, AX + XORQ CX, R10 + ROLQ $0x01, R10 + XORQ R10, AX + MOVQ AX, 80(DI) + NOP + XORQ R9, R13 + ROLQ $0x08, R13 + MOVQ R12, AX + ANDQ R13, AX + XORQ R11, AX + MOVQ AX, 88(DI) + NOP + XORQ BX, R14 + ROLQ $0x12, R14 + NOTQ R13 + MOVQ R13, AX + ANDQ R14, AX + XORQ R12, AX + MOVQ AX, 96(DI) + MOVQ R14, AX + ORQ R10, AX + XORQ R13, AX + MOVQ AX, 104(DI) + ANDQ R11, R10 + XORQ R14, R10 + MOVQ R10, 112(DI) + NOP + + // Result m + MOVQ 40(SP), R11 + XORQ BX, R11 + MOVQ 88(SP), R12 + ROLQ $0x24, R11 + XORQ CX, R12 + MOVQ 32(SP), R10 + ROLQ $0x0a, R12 + MOVQ R11, AX + MOVQ 136(SP), R13 + ANDQ R12, AX + XORQ R9, R10 + MOVQ 184(SP), R14 + ROLQ $0x1b, R10 + XORQ R10, AX + MOVQ AX, 120(DI) + NOP + XORQ DX, R13 + ROLQ $0x0f, R13 + MOVQ R12, AX + ORQ R13, AX + XORQ R11, AX + MOVQ AX, 128(DI) + NOP + XORQ R8, R14 + ROLQ $0x38, R14 + NOTQ R13 + MOVQ R13, AX + ORQ R14, AX + XORQ R12, AX + MOVQ AX, 136(DI) + ORQ R10, R11 + XORQ R14, R11 + MOVQ R11, 152(DI) + ANDQ R10, R14 + XORQ R13, R14 + MOVQ R14, 144(DI) + NOP + + // Result s + MOVQ 16(SP), R10 + MOVQ 64(SP), R11 + MOVQ 112(SP), R12 + XORQ DX, R10 + MOVQ 120(SP), R13 + ROLQ $0x3e, R10 + XORQ R8, R11 + MOVQ 168(SP), R14 + ROLQ $0x37, R11 + XORQ R9, R12 + MOVQ R10, R9 + XORQ CX, R14 + ROLQ $0x02, R14 + ANDQ R11, R9 + XORQ R14, R9 + MOVQ R9, 192(DI) + ROLQ $0x27, R12 + NOP + NOTQ R11 + XORQ BX, R13 + MOVQ R11, BX + ANDQ R12, BX + XORQ R10, BX + MOVQ BX, 160(DI) + NOP + ROLQ $0x29, R13 + MOVQ R12, CX + ORQ R13, CX + XORQ R11, CX + MOVQ CX, 168(DI) + NOP + MOVQ R13, DX + MOVQ R14, R8 + ANDQ R14, DX + ORQ R10, R8 + XORQ R12, DX + XORQ R13, R8 + MOVQ DX, 176(DI) + MOVQ R8, 184(DI) + + // Revert the internal state to the user state + NOTQ 8(DI) + NOTQ 16(DI) + NOTQ 64(DI) + NOTQ 96(DI) + NOTQ 136(DI) + NOTQ 160(DI) + RET diff --git a/kubewatch/vendor/golang.org/x/crypto/sha3/legacy_hash.go b/kubewatch/vendor/golang.org/x/crypto/sha3/sha3.go similarity index 83% rename from kubewatch/vendor/golang.org/x/crypto/sha3/legacy_hash.go rename to kubewatch/vendor/golang.org/x/crypto/sha3/sha3.go index b8784536e..6658c4447 100644 --- a/kubewatch/vendor/golang.org/x/crypto/sha3/legacy_hash.go +++ b/kubewatch/vendor/golang.org/x/crypto/sha3/sha3.go @@ -4,46 +4,15 @@ package sha3 -// This implementation is only used for NewLegacyKeccak256 and -// NewLegacyKeccak512, which are not implemented by crypto/sha3. -// All other functions in this package are wrappers around crypto/sha3. - import ( "crypto/subtle" "encoding/binary" "errors" - "hash" "unsafe" "golang.org/x/sys/cpu" ) -const ( - dsbyteKeccak = 0b00000001 - - // rateK[c] is the rate in bytes for Keccak[c] where c is the capacity in - // bits. Given the sponge size is 1600 bits, the rate is 1600 - c bits. - rateK256 = (1600 - 256) / 8 - rateK512 = (1600 - 512) / 8 - rateK1024 = (1600 - 1024) / 8 -) - -// NewLegacyKeccak256 creates a new Keccak-256 hash. -// -// Only use this function if you require compatibility with an existing cryptosystem -// that uses non-standard padding. All other users should use New256 instead. -func NewLegacyKeccak256() hash.Hash { - return &state{rate: rateK512, outputLen: 32, dsbyte: dsbyteKeccak} -} - -// NewLegacyKeccak512 creates a new Keccak-512 hash. -// -// Only use this function if you require compatibility with an existing cryptosystem -// that uses non-standard padding. All other users should use New512 instead. -func NewLegacyKeccak512() hash.Hash { - return &state{rate: rateK1024, outputLen: 64, dsbyte: dsbyteKeccak} -} - // spongeDirection indicates the direction bytes are flowing through the sponge. type spongeDirection int @@ -204,9 +173,12 @@ func (d *state) Sum(in []byte) []byte { } const ( + magicSHA3 = "sha\x08" + magicShake = "sha\x09" + magicCShake = "sha\x0a" magicKeccak = "sha\x0b" // magic || rate || main state || n || sponge direction - marshaledSize = len(magicKeccak) + 1 + 200 + 1 + 1 + marshaledSize = len(magicSHA3) + 1 + 200 + 1 + 1 ) func (d *state) MarshalBinary() ([]byte, error) { @@ -215,6 +187,12 @@ func (d *state) MarshalBinary() ([]byte, error) { func (d *state) AppendBinary(b []byte) ([]byte, error) { switch d.dsbyte { + case dsbyteSHA3: + b = append(b, magicSHA3...) + case dsbyteShake: + b = append(b, magicShake...) + case dsbyteCShake: + b = append(b, magicCShake...) case dsbyteKeccak: b = append(b, magicKeccak...) default: @@ -232,9 +210,12 @@ func (d *state) UnmarshalBinary(b []byte) error { return errors.New("sha3: invalid hash state") } - magic := string(b[:len(magicKeccak)]) - b = b[len(magicKeccak):] + magic := string(b[:len(magicSHA3)]) + b = b[len(magicSHA3):] switch { + case magic == magicSHA3 && d.dsbyte == dsbyteSHA3: + case magic == magicShake && d.dsbyte == dsbyteShake: + case magic == magicCShake && d.dsbyte == dsbyteCShake: case magic == magicKeccak && d.dsbyte == dsbyteKeccak: default: return errors.New("sha3: invalid hash state identifier") diff --git a/kubewatch/vendor/golang.org/x/crypto/sha3/sha3_s390x.go b/kubewatch/vendor/golang.org/x/crypto/sha3/sha3_s390x.go new file mode 100644 index 000000000..00d8034ae --- /dev/null +++ b/kubewatch/vendor/golang.org/x/crypto/sha3/sha3_s390x.go @@ -0,0 +1,303 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build gc && !purego + +package sha3 + +// This file contains code for using the 'compute intermediate +// message digest' (KIMD) and 'compute last message digest' (KLMD) +// instructions to compute SHA-3 and SHAKE hashes on IBM Z. + +import ( + "hash" + + "golang.org/x/sys/cpu" +) + +// codes represent 7-bit KIMD/KLMD function codes as defined in +// the Principles of Operation. +type code uint64 + +const ( + // function codes for KIMD/KLMD + sha3_224 code = 32 + sha3_256 = 33 + sha3_384 = 34 + sha3_512 = 35 + shake_128 = 36 + shake_256 = 37 + nopad = 0x100 +) + +// kimd is a wrapper for the 'compute intermediate message digest' instruction. +// src must be a multiple of the rate for the given function code. +// +//go:noescape +func kimd(function code, chain *[200]byte, src []byte) + +// klmd is a wrapper for the 'compute last message digest' instruction. +// src padding is handled by the instruction. +// +//go:noescape +func klmd(function code, chain *[200]byte, dst, src []byte) + +type asmState struct { + a [200]byte // 1600 bit state + buf []byte // care must be taken to ensure cap(buf) is a multiple of rate + rate int // equivalent to block size + storage [3072]byte // underlying storage for buf + outputLen int // output length for full security + function code // KIMD/KLMD function code + state spongeDirection // whether the sponge is absorbing or squeezing +} + +func newAsmState(function code) *asmState { + var s asmState + s.function = function + switch function { + case sha3_224: + s.rate = 144 + s.outputLen = 28 + case sha3_256: + s.rate = 136 + s.outputLen = 32 + case sha3_384: + s.rate = 104 + s.outputLen = 48 + case sha3_512: + s.rate = 72 + s.outputLen = 64 + case shake_128: + s.rate = 168 + s.outputLen = 32 + case shake_256: + s.rate = 136 + s.outputLen = 64 + default: + panic("sha3: unrecognized function code") + } + + // limit s.buf size to a multiple of s.rate + s.resetBuf() + return &s +} + +func (s *asmState) clone() *asmState { + c := *s + c.buf = c.storage[:len(s.buf):cap(s.buf)] + return &c +} + +// copyIntoBuf copies b into buf. It will panic if there is not enough space to +// store all of b. +func (s *asmState) copyIntoBuf(b []byte) { + bufLen := len(s.buf) + s.buf = s.buf[:len(s.buf)+len(b)] + copy(s.buf[bufLen:], b) +} + +// resetBuf points buf at storage, sets the length to 0 and sets cap to be a +// multiple of the rate. +func (s *asmState) resetBuf() { + max := (cap(s.storage) / s.rate) * s.rate + s.buf = s.storage[:0:max] +} + +// Write (via the embedded io.Writer interface) adds more data to the running hash. +// It never returns an error. +func (s *asmState) Write(b []byte) (int, error) { + if s.state != spongeAbsorbing { + panic("sha3: Write after Read") + } + length := len(b) + for len(b) > 0 { + if len(s.buf) == 0 && len(b) >= cap(s.buf) { + // Hash the data directly and push any remaining bytes + // into the buffer. + remainder := len(b) % s.rate + kimd(s.function, &s.a, b[:len(b)-remainder]) + if remainder != 0 { + s.copyIntoBuf(b[len(b)-remainder:]) + } + return length, nil + } + + if len(s.buf) == cap(s.buf) { + // flush the buffer + kimd(s.function, &s.a, s.buf) + s.buf = s.buf[:0] + } + + // copy as much as we can into the buffer + n := len(b) + if len(b) > cap(s.buf)-len(s.buf) { + n = cap(s.buf) - len(s.buf) + } + s.copyIntoBuf(b[:n]) + b = b[n:] + } + return length, nil +} + +// Read squeezes an arbitrary number of bytes from the sponge. +func (s *asmState) Read(out []byte) (n int, err error) { + // The 'compute last message digest' instruction only stores the digest + // at the first operand (dst) for SHAKE functions. + if s.function != shake_128 && s.function != shake_256 { + panic("sha3: can only call Read for SHAKE functions") + } + + n = len(out) + + // need to pad if we were absorbing + if s.state == spongeAbsorbing { + s.state = spongeSqueezing + + // write hash directly into out if possible + if len(out)%s.rate == 0 { + klmd(s.function, &s.a, out, s.buf) // len(out) may be 0 + s.buf = s.buf[:0] + return + } + + // write hash into buffer + max := cap(s.buf) + if max > len(out) { + max = (len(out)/s.rate)*s.rate + s.rate + } + klmd(s.function, &s.a, s.buf[:max], s.buf) + s.buf = s.buf[:max] + } + + for len(out) > 0 { + // flush the buffer + if len(s.buf) != 0 { + c := copy(out, s.buf) + out = out[c:] + s.buf = s.buf[c:] + continue + } + + // write hash directly into out if possible + if len(out)%s.rate == 0 { + klmd(s.function|nopad, &s.a, out, nil) + return + } + + // write hash into buffer + s.resetBuf() + if cap(s.buf) > len(out) { + s.buf = s.buf[:(len(out)/s.rate)*s.rate+s.rate] + } + klmd(s.function|nopad, &s.a, s.buf, nil) + } + return +} + +// Sum appends the current hash to b and returns the resulting slice. +// It does not change the underlying hash state. +func (s *asmState) Sum(b []byte) []byte { + if s.state != spongeAbsorbing { + panic("sha3: Sum after Read") + } + + // Copy the state to preserve the original. + a := s.a + + // Hash the buffer. Note that we don't clear it because we + // aren't updating the state. + switch s.function { + case sha3_224, sha3_256, sha3_384, sha3_512: + klmd(s.function, &a, nil, s.buf) + return append(b, a[:s.outputLen]...) + case shake_128, shake_256: + d := make([]byte, s.outputLen, 64) + klmd(s.function, &a, d, s.buf) + return append(b, d[:s.outputLen]...) + default: + panic("sha3: unknown function") + } +} + +// Reset resets the Hash to its initial state. +func (s *asmState) Reset() { + for i := range s.a { + s.a[i] = 0 + } + s.resetBuf() + s.state = spongeAbsorbing +} + +// Size returns the number of bytes Sum will return. +func (s *asmState) Size() int { + return s.outputLen +} + +// BlockSize returns the hash's underlying block size. +// The Write method must be able to accept any amount +// of data, but it may operate more efficiently if all writes +// are a multiple of the block size. +func (s *asmState) BlockSize() int { + return s.rate +} + +// Clone returns a copy of the ShakeHash in its current state. +func (s *asmState) Clone() ShakeHash { + return s.clone() +} + +// new224 returns an assembly implementation of SHA3-224 if available, +// otherwise it returns a generic implementation. +func new224() hash.Hash { + if cpu.S390X.HasSHA3 { + return newAsmState(sha3_224) + } + return new224Generic() +} + +// new256 returns an assembly implementation of SHA3-256 if available, +// otherwise it returns a generic implementation. +func new256() hash.Hash { + if cpu.S390X.HasSHA3 { + return newAsmState(sha3_256) + } + return new256Generic() +} + +// new384 returns an assembly implementation of SHA3-384 if available, +// otherwise it returns a generic implementation. +func new384() hash.Hash { + if cpu.S390X.HasSHA3 { + return newAsmState(sha3_384) + } + return new384Generic() +} + +// new512 returns an assembly implementation of SHA3-512 if available, +// otherwise it returns a generic implementation. +func new512() hash.Hash { + if cpu.S390X.HasSHA3 { + return newAsmState(sha3_512) + } + return new512Generic() +} + +// newShake128 returns an assembly implementation of SHAKE-128 if available, +// otherwise it returns a generic implementation. +func newShake128() ShakeHash { + if cpu.S390X.HasSHA3 { + return newAsmState(shake_128) + } + return newShake128Generic() +} + +// newShake256 returns an assembly implementation of SHAKE-256 if available, +// otherwise it returns a generic implementation. +func newShake256() ShakeHash { + if cpu.S390X.HasSHA3 { + return newAsmState(shake_256) + } + return newShake256Generic() +} diff --git a/kubewatch/vendor/golang.org/x/crypto/sha3/sha3_s390x.s b/kubewatch/vendor/golang.org/x/crypto/sha3/sha3_s390x.s new file mode 100644 index 000000000..826b862c7 --- /dev/null +++ b/kubewatch/vendor/golang.org/x/crypto/sha3/sha3_s390x.s @@ -0,0 +1,33 @@ +// Copyright 2017 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build gc && !purego + +#include "textflag.h" + +// func kimd(function code, chain *[200]byte, src []byte) +TEXT ·kimd(SB), NOFRAME|NOSPLIT, $0-40 + MOVD function+0(FP), R0 + MOVD chain+8(FP), R1 + LMG src+16(FP), R2, R3 // R2=base, R3=len + +continue: + WORD $0xB93E0002 // KIMD --, R2 + BVS continue // continue if interrupted + MOVD $0, R0 // reset R0 for pre-go1.8 compilers + RET + +// func klmd(function code, chain *[200]byte, dst, src []byte) +TEXT ·klmd(SB), NOFRAME|NOSPLIT, $0-64 + // TODO: SHAKE support + MOVD function+0(FP), R0 + MOVD chain+8(FP), R1 + LMG dst+16(FP), R2, R3 // R2=base, R3=len + LMG src+40(FP), R4, R5 // R4=base, R5=len + +continue: + WORD $0xB93F0024 // KLMD R2, R4 + BVS continue // continue if interrupted + MOVD $0, R0 // reset R0 for pre-go1.8 compilers + RET diff --git a/kubewatch/vendor/golang.org/x/crypto/sha3/shake.go b/kubewatch/vendor/golang.org/x/crypto/sha3/shake.go index 6f3f70c26..a6b3a4281 100644 --- a/kubewatch/vendor/golang.org/x/crypto/sha3/shake.go +++ b/kubewatch/vendor/golang.org/x/crypto/sha3/shake.go @@ -4,10 +4,24 @@ package sha3 +// This file defines the ShakeHash interface, and provides +// functions for creating SHAKE and cSHAKE instances, as well as utility +// functions for hashing bytes to arbitrary-length output. +// +// +// SHAKE implementation is based on FIPS PUB 202 [1] +// cSHAKE implementations is based on NIST SP 800-185 [2] +// +// [1] https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf +// [2] https://doi.org/10.6028/NIST.SP.800-185 + import ( - "crypto/sha3" + "bytes" + "encoding/binary" + "errors" "hash" "io" + "math/bits" ) // ShakeHash defines the interface to hash functions that support @@ -18,7 +32,7 @@ type ShakeHash interface { hash.Hash // Read reads more output from the hash; reading affects the hash's - // state. (ShakeHash.Read is thus very different from Hash.Sum.) + // state. (ShakeHash.Read is thus very different from Hash.Sum) // It never returns an error, but subsequent calls to Write or Sum // will panic. io.Reader @@ -27,18 +41,115 @@ type ShakeHash interface { Clone() ShakeHash } +// cSHAKE specific context +type cshakeState struct { + *state // SHA-3 state context and Read/Write operations + + // initBlock is the cSHAKE specific initialization set of bytes. It is initialized + // by newCShake function and stores concatenation of N followed by S, encoded + // by the method specified in 3.3 of [1]. + // It is stored here in order for Reset() to be able to put context into + // initial state. + initBlock []byte +} + +func bytepad(data []byte, rate int) []byte { + out := make([]byte, 0, 9+len(data)+rate-1) + out = append(out, leftEncode(uint64(rate))...) + out = append(out, data...) + if padlen := rate - len(out)%rate; padlen < rate { + out = append(out, make([]byte, padlen)...) + } + return out +} + +func leftEncode(x uint64) []byte { + // Let n be the smallest positive integer for which 2^(8n) > x. + n := (bits.Len64(x) + 7) / 8 + if n == 0 { + n = 1 + } + // Return n || x with n as a byte and x an n bytes in big-endian order. + b := make([]byte, 9) + binary.BigEndian.PutUint64(b[1:], x) + b = b[9-n-1:] + b[0] = byte(n) + return b +} + +func newCShake(N, S []byte, rate, outputLen int, dsbyte byte) ShakeHash { + c := cshakeState{state: &state{rate: rate, outputLen: outputLen, dsbyte: dsbyte}} + c.initBlock = make([]byte, 0, 9+len(N)+9+len(S)) // leftEncode returns max 9 bytes + 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, S...) + c.Write(bytepad(c.initBlock, c.rate)) + return &c +} + +// Reset resets the hash to initial state. +func (c *cshakeState) Reset() { + c.state.Reset() + c.Write(bytepad(c.initBlock, c.rate)) +} + +// Clone returns copy of a cSHAKE context within its current state. +func (c *cshakeState) Clone() ShakeHash { + b := make([]byte, len(c.initBlock)) + copy(b, c.initBlock) + return &cshakeState{state: c.clone(), initBlock: b} +} + +// Clone returns copy of SHAKE context within its current state. +func (c *state) Clone() ShakeHash { + return c.clone() +} + +func (c *cshakeState) MarshalBinary() ([]byte, error) { + return c.AppendBinary(make([]byte, 0, marshaledSize+len(c.initBlock))) +} + +func (c *cshakeState) AppendBinary(b []byte) ([]byte, error) { + b, err := c.state.AppendBinary(b) + if err != nil { + return nil, err + } + b = append(b, c.initBlock...) + return b, nil +} + +func (c *cshakeState) UnmarshalBinary(b []byte) error { + if len(b) <= marshaledSize { + return errors.New("sha3: invalid hash state") + } + if err := c.state.UnmarshalBinary(b[:marshaledSize]); err != nil { + return err + } + c.initBlock = bytes.Clone(b[marshaledSize:]) + return nil +} + // NewShake128 creates a new SHAKE128 variable-output-length ShakeHash. // Its generic security strength is 128 bits against all attacks if at // least 32 bytes of its output are used. func NewShake128() ShakeHash { - return &shakeWrapper{sha3.NewSHAKE128(), 32, false, sha3.NewSHAKE128} + return newShake128() } // NewShake256 creates a new SHAKE256 variable-output-length ShakeHash. // Its generic security strength is 256 bits against all attacks if // at least 64 bytes of its output are used. func NewShake256() ShakeHash { - return &shakeWrapper{sha3.NewSHAKE256(), 64, false, sha3.NewSHAKE256} + return newShake256() +} + +func newShake128Generic() *state { + return &state{rate: rateK256, outputLen: 32, dsbyte: dsbyteShake} +} + +func newShake256Generic() *state { + return &state{rate: rateK512, outputLen: 64, dsbyte: dsbyteShake} } // NewCShake128 creates a new instance of cSHAKE128 variable-output-length ShakeHash, @@ -48,9 +159,10 @@ func NewShake256() ShakeHash { // computations on same input with different S yield unrelated outputs. // When N and S are both empty, this is equivalent to NewShake128. func NewCShake128(N, S []byte) ShakeHash { - return &shakeWrapper{sha3.NewCSHAKE128(N, S), 32, false, func() *sha3.SHAKE { - return sha3.NewCSHAKE128(N, S) - }} + if len(N) == 0 && len(S) == 0 { + return NewShake128() + } + return newCShake(N, S, rateK256, 32, dsbyteCShake) } // NewCShake256 creates a new instance of cSHAKE256 variable-output-length ShakeHash, @@ -60,9 +172,10 @@ func NewCShake128(N, S []byte) ShakeHash { // computations on same input with different S yield unrelated outputs. // When N and S are both empty, this is equivalent to NewShake256. func NewCShake256(N, S []byte) ShakeHash { - return &shakeWrapper{sha3.NewCSHAKE256(N, S), 64, false, func() *sha3.SHAKE { - return sha3.NewCSHAKE256(N, S) - }} + if len(N) == 0 && len(S) == 0 { + return NewShake256() + } + return newCShake(N, S, rateK512, 64, dsbyteCShake) } // ShakeSum128 writes an arbitrary-length digest of data into hash. @@ -78,42 +191,3 @@ func ShakeSum256(hash, data []byte) { h.Write(data) h.Read(hash) } - -// shakeWrapper adds the Size, Sum, and Clone methods to a sha3.SHAKE -// to implement the ShakeHash interface. -type shakeWrapper struct { - *sha3.SHAKE - outputLen int - squeezing bool - newSHAKE func() *sha3.SHAKE -} - -func (w *shakeWrapper) Read(p []byte) (n int, err error) { - w.squeezing = true - return w.SHAKE.Read(p) -} - -func (w *shakeWrapper) Clone() ShakeHash { - s := w.newSHAKE() - b, err := w.MarshalBinary() - if err != nil { - panic(err) // unreachable - } - if err := s.UnmarshalBinary(b); err != nil { - panic(err) // unreachable - } - return &shakeWrapper{s, w.outputLen, w.squeezing, w.newSHAKE} -} - -func (w *shakeWrapper) Size() int { return w.outputLen } - -func (w *shakeWrapper) Sum(b []byte) []byte { - if w.squeezing { - panic("sha3: Sum after Read") - } - out := make([]byte, w.outputLen) - // Clone the state so that we don't affect future Write calls. - s := w.Clone() - s.Read(out) - return append(b, out...) -} diff --git a/kubewatch/vendor/golang.org/x/crypto/sha3/shake_noasm.go b/kubewatch/vendor/golang.org/x/crypto/sha3/shake_noasm.go new file mode 100644 index 000000000..4276ba4ab --- /dev/null +++ b/kubewatch/vendor/golang.org/x/crypto/sha3/shake_noasm.go @@ -0,0 +1,15 @@ +// Copyright 2023 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !gc || purego || !s390x + +package sha3 + +func newShake128() *state { + return newShake128Generic() +} + +func newShake256() *state { + return newShake256Generic() +} diff --git a/kubewatch/vendor/golang.org/x/crypto/ssh/agent/client.go b/kubewatch/vendor/golang.org/x/crypto/ssh/agent/client.go index b357e18b0..37525e1a1 100644 --- a/kubewatch/vendor/golang.org/x/crypto/ssh/agent/client.go +++ b/kubewatch/vendor/golang.org/x/crypto/ssh/agent/client.go @@ -430,9 +430,8 @@ func (c *client) List() ([]*Key, error) { return keys, nil case *failureAgentMsg: return nil, errors.New("agent: failed to list keys") - default: - return nil, fmt.Errorf("agent: failed to list keys, unexpected message type %T", msg) } + panic("unreachable") } // Sign has the agent sign the data using a protocol 2 key as defined @@ -463,9 +462,8 @@ func (c *client) SignWithFlags(key ssh.PublicKey, data []byte, flags SignatureFl return &sig, nil case *failureAgentMsg: return nil, errors.New("agent: failed to sign challenge") - default: - return nil, fmt.Errorf("agent: failed to sign challenge, unexpected message type %T", msg) } + panic("unreachable") } // unmarshal parses an agent message in packet, returning the parsed diff --git a/kubewatch/vendor/golang.org/x/crypto/ssh/agent/keyring.go b/kubewatch/vendor/golang.org/x/crypto/ssh/agent/keyring.go index d12987551..c1b436108 100644 --- a/kubewatch/vendor/golang.org/x/crypto/ssh/agent/keyring.go +++ b/kubewatch/vendor/golang.org/x/crypto/ssh/agent/keyring.go @@ -112,7 +112,7 @@ func (r *keyring) Unlock(passphrase []byte) error { } // expireKeysLocked removes expired keys from the keyring. If a key was added -// with a lifetimesecs constraint and seconds >= lifetimesecs seconds have +// with a lifetimesecs contraint and seconds >= lifetimesecs seconds have // elapsed, it is removed. The caller *must* be holding the keyring mutex. func (r *keyring) expireKeysLocked() { for _, k := range r.keys { diff --git a/kubewatch/vendor/golang.org/x/crypto/ssh/agent/server.go b/kubewatch/vendor/golang.org/x/crypto/ssh/agent/server.go index 4e8ff86b6..88ce4da6c 100644 --- a/kubewatch/vendor/golang.org/x/crypto/ssh/agent/server.go +++ b/kubewatch/vendor/golang.org/x/crypto/ssh/agent/server.go @@ -203,9 +203,6 @@ func parseConstraints(constraints []byte) (lifetimeSecs uint32, confirmBeforeUse for len(constraints) != 0 { switch constraints[0] { case agentConstrainLifetime: - if len(constraints) < 5 { - return 0, false, nil, io.ErrUnexpectedEOF - } lifetimeSecs = binary.BigEndian.Uint32(constraints[1:5]) constraints = constraints[5:] case agentConstrainConfirm: diff --git a/kubewatch/vendor/golang.org/x/crypto/ssh/cipher.go b/kubewatch/vendor/golang.org/x/crypto/ssh/cipher.go index 7554ed57a..6a5b582aa 100644 --- a/kubewatch/vendor/golang.org/x/crypto/ssh/cipher.go +++ b/kubewatch/vendor/golang.org/x/crypto/ssh/cipher.go @@ -8,7 +8,6 @@ import ( "crypto/aes" "crypto/cipher" "crypto/des" - "crypto/fips140" "crypto/rc4" "crypto/subtle" "encoding/binary" @@ -16,7 +15,6 @@ import ( "fmt" "hash" "io" - "slices" "golang.org/x/crypto/chacha20" "golang.org/x/crypto/internal/poly1305" @@ -95,41 +93,41 @@ func streamCipherMode(skip int, createFunc func(key, iv []byte) (cipher.Stream, } // cipherModes documents properties of supported ciphers. Ciphers not included -// are not supported and will not be negotiated, even if explicitly configured. -// When FIPS mode is enabled, only FIPS-approved algorithms are included. -var cipherModes = map[string]*cipherMode{} - -func init() { - cipherModes[CipherAES128CTR] = &cipherMode{16, aes.BlockSize, streamCipherMode(0, newAESCTR)} - cipherModes[CipherAES192CTR] = &cipherMode{24, aes.BlockSize, streamCipherMode(0, newAESCTR)} - cipherModes[CipherAES256CTR] = &cipherMode{32, aes.BlockSize, streamCipherMode(0, newAESCTR)} - // Use of GCM with arbitrary IVs is not allowed in FIPS 140-only mode, - // we'll wire it up to NewGCMForSSH in Go 1.26. - // - // For now it means we'll work with fips140=on but not fips140=only. - cipherModes[CipherAES128GCM] = &cipherMode{16, 12, newGCMCipher} - cipherModes[CipherAES256GCM] = &cipherMode{32, 12, newGCMCipher} - - if fips140.Enabled() { - defaultCiphers = slices.DeleteFunc(defaultCiphers, func(algo string) bool { - _, ok := cipherModes[algo] - return !ok - }) - return - } - - cipherModes[CipherChaCha20Poly1305] = &cipherMode{64, 0, newChaCha20Cipher} - // Insecure ciphers not included in the default configuration. - cipherModes[InsecureCipherRC4128] = &cipherMode{16, 0, streamCipherMode(1536, newRC4)} - cipherModes[InsecureCipherRC4256] = &cipherMode{32, 0, streamCipherMode(1536, newRC4)} - cipherModes[InsecureCipherRC4] = &cipherMode{16, 0, streamCipherMode(0, newRC4)} +// are not supported and will not be negotiated, even if explicitly requested in +// ClientConfig.Crypto.Ciphers. +var cipherModes = map[string]*cipherMode{ + // Ciphers from RFC 4344, which introduced many CTR-based ciphers. Algorithms + // are defined in the order specified in the RFC. + CipherAES128CTR: {16, aes.BlockSize, streamCipherMode(0, newAESCTR)}, + CipherAES192CTR: {24, aes.BlockSize, streamCipherMode(0, newAESCTR)}, + CipherAES256CTR: {32, aes.BlockSize, streamCipherMode(0, newAESCTR)}, + + // Ciphers from RFC 4345, which introduces security-improved arcfour ciphers. + // They are defined in the order specified in the RFC. + InsecureCipherRC4128: {16, 0, streamCipherMode(1536, newRC4)}, + InsecureCipherRC4256: {32, 0, streamCipherMode(1536, newRC4)}, + + // Cipher defined in RFC 4253, which describes SSH Transport Layer Protocol. + // Note that this cipher is not safe, as stated in RFC 4253: "Arcfour (and + // RC4) has problems with weak keys, and should be used with caution." + // RFC 4345 introduces improved versions of Arcfour. + InsecureCipherRC4: {16, 0, streamCipherMode(0, newRC4)}, + + // AEAD ciphers + CipherAES128GCM: {16, 12, newGCMCipher}, + CipherAES256GCM: {32, 12, newGCMCipher}, + CipherChaCha20Poly1305: {64, 0, newChaCha20Cipher}, + // CBC mode is insecure and so is not included in the default config. // (See https://www.ieee-security.org/TC/SP2013/papers/4977a526.pdf). If absolutely // needed, it's possible to specify a custom Config to enable it. // You should expect that an active attacker can recover plaintext if // you do. - cipherModes[InsecureCipherAES128CBC] = &cipherMode{16, aes.BlockSize, newAESCBCCipher} - cipherModes[InsecureCipherTripleDESCBC] = &cipherMode{24, des.BlockSize, newTripleDESCBCCipher} + InsecureCipherAES128CBC: {16, aes.BlockSize, newAESCBCCipher}, + + // 3des-cbc is insecure and is not included in the default + // config. + InsecureCipherTripleDESCBC: {24, des.BlockSize, newTripleDESCBCCipher}, } // prefixLen is the length of the packet prefix that contains the packet length diff --git a/kubewatch/vendor/golang.org/x/crypto/ssh/client_auth.go b/kubewatch/vendor/golang.org/x/crypto/ssh/client_auth.go index 3127e4990..c12818fdc 100644 --- a/kubewatch/vendor/golang.org/x/crypto/ssh/client_auth.go +++ b/kubewatch/vendor/golang.org/x/crypto/ssh/client_auth.go @@ -9,7 +9,6 @@ import ( "errors" "fmt" "io" - "slices" "strings" ) @@ -84,7 +83,7 @@ func (c *connection) clientAuthenticate(config *ClientConfig) error { // success return nil } else if ok == authFailure { - if m := auth.method(); !slices.Contains(tried, m) { + if m := auth.method(); !contains(tried, m) { tried = append(tried, m) } } @@ -98,7 +97,7 @@ func (c *connection) clientAuthenticate(config *ClientConfig) error { findNext: for _, a := range config.Auth { candidateMethod := a.method() - if slices.Contains(tried, candidateMethod) { + if contains(tried, candidateMethod) { continue } for _, meth := range methods { @@ -118,6 +117,15 @@ func (c *connection) clientAuthenticate(config *ClientConfig) error { return fmt.Errorf("ssh: unable to authenticate, attempted methods %v, no supported methods remain", tried) } +func contains(list []string, e string) bool { + for _, s := range list { + if s == e { + return true + } + } + return false +} + // An AuthMethod represents an instance of an RFC 4252 authentication method. type AuthMethod interface { // auth authenticates user over transport t. @@ -247,7 +255,7 @@ func pickSignatureAlgorithm(signer Signer, extensions map[string][]byte) (MultiA // Fallback to use if there is no "server-sig-algs" extension or a // common algorithm cannot be found. We use the public key format if the // MultiAlgorithmSigner supports it, otherwise we return an error. - if !slices.Contains(as.Algorithms(), underlyingAlgo(keyFormat)) { + if !contains(as.Algorithms(), underlyingAlgo(keyFormat)) { return "", fmt.Errorf("ssh: no common public key signature algorithm, server only supports %q for key type %q, signer only supports %v", underlyingAlgo(keyFormat), keyFormat, as.Algorithms()) } @@ -276,7 +284,7 @@ func pickSignatureAlgorithm(signer Signer, extensions map[string][]byte) (MultiA // Filter algorithms based on those supported by MultiAlgorithmSigner. var keyAlgos []string for _, algo := range algorithmsForKeyFormat(keyFormat) { - if slices.Contains(as.Algorithms(), underlyingAlgo(algo)) { + if contains(as.Algorithms(), underlyingAlgo(algo)) { keyAlgos = append(keyAlgos, algo) } } @@ -326,7 +334,7 @@ func (cb publicKeyCallback) auth(session []byte, user string, c packetConn, rand // the key try to use the obtained algorithm as if "server-sig-algs" had // not been implemented if supported from the algorithm signer. if !ok && idx < origSignersLen && isRSACert(algo) && algo != CertAlgoRSAv01 { - if slices.Contains(as.Algorithms(), KeyAlgoRSA) { + if contains(as.Algorithms(), KeyAlgoRSA) { // We retry using the compat algorithm after all signers have // been tried normally. signers = append(signers, &multiAlgorithmSigner{ @@ -377,7 +385,7 @@ func (cb publicKeyCallback) auth(session []byte, user string, c packetConn, rand // contain the "publickey" method, do not attempt to authenticate with any // other keys. According to RFC 4252 Section 7, the latter can occur when // additional authentication methods are required. - if success == authSuccess || !slices.Contains(methods, cb.method()) { + if success == authSuccess || !contains(methods, cb.method()) { return success, methods, err } } @@ -426,7 +434,7 @@ func confirmKeyAck(key PublicKey, c packetConn) (bool, error) { // servers send the key type instead. OpenSSH allows any algorithm // that matches the public key, so we do the same. // https://github.com/openssh/openssh-portable/blob/86bdd385/sshconnect2.c#L709 - if !slices.Contains(algorithmsForKeyFormat(key.Type()), msg.Algo) { + if !contains(algorithmsForKeyFormat(key.Type()), msg.Algo) { return false, nil } if !bytes.Equal(msg.PubKey, pubKey) { diff --git a/kubewatch/vendor/golang.org/x/crypto/ssh/common.go b/kubewatch/vendor/golang.org/x/crypto/ssh/common.go index 2e44e9c9e..f2ec0896c 100644 --- a/kubewatch/vendor/golang.org/x/crypto/ssh/common.go +++ b/kubewatch/vendor/golang.org/x/crypto/ssh/common.go @@ -6,7 +6,6 @@ package ssh import ( "crypto" - "crypto/fips140" "crypto/rand" "fmt" "io" @@ -84,7 +83,6 @@ var ( // supportedKexAlgos specifies key-exchange algorithms implemented by this // package in preference order, excluding those with security issues. supportedKexAlgos = []string{ - KeyExchangeMLKEM768X25519, KeyExchangeCurve25519, KeyExchangeECDHP256, KeyExchangeECDHP384, @@ -96,7 +94,6 @@ var ( // defaultKexAlgos specifies the default preference for key-exchange // algorithms in preference order. defaultKexAlgos = []string{ - KeyExchangeMLKEM768X25519, KeyExchangeCurve25519, KeyExchangeECDHP256, KeyExchangeECDHP384, @@ -257,40 +254,6 @@ type Algorithms struct { PublicKeyAuths []string } -func init() { - if fips140.Enabled() { - defaultHostKeyAlgos = slices.DeleteFunc(defaultHostKeyAlgos, func(algo string) bool { - _, err := hashFunc(underlyingAlgo(algo)) - return err != nil - }) - defaultPubKeyAuthAlgos = slices.DeleteFunc(defaultPubKeyAuthAlgos, func(algo string) bool { - _, err := hashFunc(underlyingAlgo(algo)) - return err != nil - }) - } -} - -func hashFunc(format string) (crypto.Hash, error) { - switch format { - case KeyAlgoRSASHA256, KeyAlgoECDSA256, KeyAlgoSKED25519, KeyAlgoSKECDSA256: - return crypto.SHA256, nil - case KeyAlgoECDSA384: - return crypto.SHA384, nil - case KeyAlgoRSASHA512, KeyAlgoECDSA521: - return crypto.SHA512, nil - case KeyAlgoED25519: - // KeyAlgoED25519 doesn't pre-hash. - return 0, nil - case KeyAlgoRSA, InsecureKeyAlgoDSA: - if fips140.Enabled() { - return 0, fmt.Errorf("ssh: hash algorithm for format %q not allowed in FIPS 140 mode", format) - } - return crypto.SHA1, nil - default: - return 0, fmt.Errorf("ssh: hash algorithm for format %q not mapped", format) - } -} - // SupportedAlgorithms returns algorithms currently implemented by this package, // excluding those with security issues, which are returned by // InsecureAlgorithms. The algorithms listed here are in preference order. @@ -318,6 +281,21 @@ func InsecureAlgorithms() Algorithms { var supportedCompressions = []string{compressionNone} +// hashFuncs keeps the mapping of supported signature algorithms to their +// respective hashes needed for signing and verification. +var hashFuncs = map[string]crypto.Hash{ + KeyAlgoRSA: crypto.SHA1, + KeyAlgoRSASHA256: crypto.SHA256, + KeyAlgoRSASHA512: crypto.SHA512, + InsecureKeyAlgoDSA: crypto.SHA1, + KeyAlgoECDSA256: crypto.SHA256, + KeyAlgoECDSA384: crypto.SHA384, + KeyAlgoECDSA521: crypto.SHA512, + // KeyAlgoED25519 doesn't pre-hash. + KeyAlgoSKECDSA256: crypto.SHA256, + KeyAlgoSKED25519: crypto.SHA256, +} + // algorithmsForKeyFormat returns the supported signature algorithms for a given // public key format (PublicKey.Type), in order of preference. See RFC 8332, // Section 2. See also the note in sendKexInit on backwards compatibility. @@ -332,40 +310,11 @@ func algorithmsForKeyFormat(keyFormat string) []string { } } -// keyFormatForAlgorithm returns the key format corresponding to the given -// signature algorithm. It returns an empty string if the signature algorithm is -// invalid or unsupported. -func keyFormatForAlgorithm(sigAlgo string) string { - switch sigAlgo { - case KeyAlgoRSA, KeyAlgoRSASHA256, KeyAlgoRSASHA512: - return KeyAlgoRSA - case CertAlgoRSAv01, CertAlgoRSASHA256v01, CertAlgoRSASHA512v01: - return CertAlgoRSAv01 - case KeyAlgoED25519, - KeyAlgoSKED25519, - KeyAlgoSKECDSA256, - KeyAlgoECDSA256, - KeyAlgoECDSA384, - KeyAlgoECDSA521, - InsecureKeyAlgoDSA, - InsecureCertAlgoDSAv01, - CertAlgoECDSA256v01, - CertAlgoECDSA384v01, - CertAlgoECDSA521v01, - CertAlgoSKECDSA256v01, - CertAlgoED25519v01, - CertAlgoSKED25519v01: - return sigAlgo - default: - return "" - } -} - // isRSA returns whether algo is a supported RSA algorithm, including certificate // algorithms. func isRSA(algo string) bool { algos := algorithmsForKeyFormat(KeyAlgoRSA) - return slices.Contains(algos, underlyingAlgo(algo)) + return contains(algos, underlyingAlgo(algo)) } func isRSACert(algo string) bool { @@ -564,7 +513,7 @@ func (c *Config) SetDefaults() { if kexAlgoMap[k] != nil { // Ignore the KEX if we have no kexAlgoMap definition. kexs = append(kexs, k) - if k == KeyExchangeCurve25519 && !slices.Contains(c.KeyExchanges, keyExchangeCurve25519LibSSH) { + if k == KeyExchangeCurve25519 && !contains(c.KeyExchanges, keyExchangeCurve25519LibSSH) { kexs = append(kexs, keyExchangeCurve25519LibSSH) } } diff --git a/kubewatch/vendor/golang.org/x/crypto/ssh/doc.go b/kubewatch/vendor/golang.org/x/crypto/ssh/doc.go index 5b4de9eff..04ccce346 100644 --- a/kubewatch/vendor/golang.org/x/crypto/ssh/doc.go +++ b/kubewatch/vendor/golang.org/x/crypto/ssh/doc.go @@ -17,18 +17,8 @@ References: [PROTOCOL.certkeys]: http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/PROTOCOL.certkeys?rev=HEAD [SSH-PARAMETERS]: http://www.iana.org/assignments/ssh-parameters/ssh-parameters.xml#ssh-parameters-1 [SSH-CERTS]: https://datatracker.ietf.org/doc/html/draft-miller-ssh-cert-01 - [FIPS 140-3 mode]: https://go.dev/doc/security/fips140 This package does not fall under the stability promise of the Go language itself, so its API may be changed when pressing needs arise. - -# FIPS 140-3 mode - -When the program is in [FIPS 140-3 mode], this package behaves as if only SP -800-140C and SP 800-140D approved cipher suites, signature algorithms, -certificate public key types and sizes, and key exchange and derivation -algorithms were implemented. Others are silently ignored and not negotiated, or -rejected. This set may depend on the algorithms supported by the FIPS 140-3 Go -Cryptographic Module selected with GOFIPS140, and may change across Go versions. */ package ssh diff --git a/kubewatch/vendor/golang.org/x/crypto/ssh/handshake.go b/kubewatch/vendor/golang.org/x/crypto/ssh/handshake.go index 4be3cbb6d..a90bfe331 100644 --- a/kubewatch/vendor/golang.org/x/crypto/ssh/handshake.go +++ b/kubewatch/vendor/golang.org/x/crypto/ssh/handshake.go @@ -10,7 +10,6 @@ import ( "io" "log" "net" - "slices" "strings" "sync" ) @@ -528,7 +527,7 @@ func (t *handshakeTransport) sendKexInit() error { switch s := k.(type) { case MultiAlgorithmSigner: for _, algo := range algorithmsForKeyFormat(keyFormat) { - if slices.Contains(s.Algorithms(), underlyingAlgo(algo)) { + if contains(s.Algorithms(), underlyingAlgo(algo)) { msg.ServerHostKeyAlgos = append(msg.ServerHostKeyAlgos, algo) } } @@ -680,7 +679,7 @@ func (t *handshakeTransport) enterKeyExchange(otherInitPacket []byte) error { return err } - if t.sessionID == nil && ((isClient && slices.Contains(serverInit.KexAlgos, kexStrictServer)) || (!isClient && slices.Contains(clientInit.KexAlgos, kexStrictClient))) { + if t.sessionID == nil && ((isClient && contains(serverInit.KexAlgos, kexStrictServer)) || (!isClient && contains(clientInit.KexAlgos, kexStrictClient))) { t.strictMode = true if err := t.conn.setStrictMode(); err != nil { return err @@ -737,7 +736,7 @@ func (t *handshakeTransport) enterKeyExchange(otherInitPacket []byte) error { // On the server side, after the first SSH_MSG_NEWKEYS, send a SSH_MSG_EXT_INFO // message with the server-sig-algs extension if the client supports it. See // RFC 8308, Sections 2.4 and 3.1, and [PROTOCOL], Section 1.9. - if !isClient && firstKeyExchange && slices.Contains(clientInit.KexAlgos, "ext-info-c") { + if !isClient && firstKeyExchange && contains(clientInit.KexAlgos, "ext-info-c") { supportedPubKeyAuthAlgosList := strings.Join(t.publicKeyAuthAlgorithms, ",") extInfo := &extInfoMsg{ NumExtensions: 2, @@ -791,7 +790,7 @@ func (a algorithmSignerWrapper) SignWithAlgorithm(rand io.Reader, data []byte, a func pickHostKey(hostKeys []Signer, algo string) AlgorithmSigner { for _, k := range hostKeys { if s, ok := k.(MultiAlgorithmSigner); ok { - if !slices.Contains(s.Algorithms(), underlyingAlgo(algo)) { + if !contains(s.Algorithms(), underlyingAlgo(algo)) { continue } } diff --git a/kubewatch/vendor/golang.org/x/crypto/ssh/kex.go b/kubewatch/vendor/golang.org/x/crypto/ssh/kex.go index 5f7fdd851..cf388a92a 100644 --- a/kubewatch/vendor/golang.org/x/crypto/ssh/kex.go +++ b/kubewatch/vendor/golang.org/x/crypto/ssh/kex.go @@ -8,14 +8,13 @@ import ( "crypto" "crypto/ecdsa" "crypto/elliptic" - "crypto/fips140" "crypto/rand" + "crypto/subtle" "encoding/binary" "errors" "fmt" "io" "math/big" - "slices" "golang.org/x/crypto/curve25519" ) @@ -397,27 +396,9 @@ func ecHash(curve elliptic.Curve) crypto.Hash { return crypto.SHA512 } -// kexAlgoMap defines the supported KEXs. KEXs not included are not supported -// and will not be negotiated, even if explicitly configured. When FIPS mode is -// enabled, only FIPS-approved algorithms are included. var kexAlgoMap = map[string]kexAlgorithm{} func init() { - // mlkem768x25519-sha256 we'll work with fips140=on but not fips140=only - // until Go 1.26. - kexAlgoMap[KeyExchangeMLKEM768X25519] = &mlkem768WithCurve25519sha256{} - kexAlgoMap[KeyExchangeECDHP521] = &ecdh{elliptic.P521()} - kexAlgoMap[KeyExchangeECDHP384] = &ecdh{elliptic.P384()} - kexAlgoMap[KeyExchangeECDHP256] = &ecdh{elliptic.P256()} - - if fips140.Enabled() { - defaultKexAlgos = slices.DeleteFunc(defaultKexAlgos, func(algo string) bool { - _, ok := kexAlgoMap[algo] - return !ok - }) - return - } - p, _ := new(big.Int).SetString(oakleyGroup2, 16) kexAlgoMap[InsecureKeyExchangeDH1SHA1] = &dhGroup{ g: new(big.Int).SetInt64(2), @@ -451,6 +432,9 @@ func init() { hashFunc: crypto.SHA512, } + kexAlgoMap[KeyExchangeECDHP521] = &ecdh{elliptic.P521()} + kexAlgoMap[KeyExchangeECDHP384] = &ecdh{elliptic.P384()} + kexAlgoMap[KeyExchangeECDHP256] = &ecdh{elliptic.P256()} kexAlgoMap[KeyExchangeCurve25519] = &curve25519sha256{} kexAlgoMap[keyExchangeCurve25519LibSSH] = &curve25519sha256{} kexAlgoMap[InsecureKeyExchangeDHGEXSHA1] = &dhGEXSHA{hashFunc: crypto.SHA1} @@ -470,17 +454,15 @@ func (kp *curve25519KeyPair) generate(rand io.Reader) error { if _, err := io.ReadFull(rand, kp.priv[:]); err != nil { return err } - p, err := curve25519.X25519(kp.priv[:], curve25519.Basepoint) - if err != nil { - return fmt.Errorf("curve25519: %w", err) - } - if len(p) != 32 { - return fmt.Errorf("curve25519: internal error: X25519 returned %d bytes, expected 32", len(p)) - } - copy(kp.pub[:], p) + curve25519.ScalarBaseMult(&kp.pub, &kp.priv) return nil } +// curve25519Zeros is just an array of 32 zero bytes so that we have something +// convenient to compare against in order to reject curve25519 points with the +// wrong order. +var curve25519Zeros [32]byte + func (kex *curve25519sha256) Client(c packetConn, rand io.Reader, magics *handshakeMagics) (*kexResult, error) { var kp curve25519KeyPair if err := kp.generate(rand); err != nil { @@ -503,9 +485,11 @@ func (kex *curve25519sha256) Client(c packetConn, rand io.Reader, magics *handsh return nil, errors.New("ssh: peer's curve25519 public value has wrong length") } - secret, err := curve25519.X25519(kp.priv[:], reply.EphemeralPubKey) - if err != nil { - return nil, fmt.Errorf("ssh: peer's curve25519 public value is not valid: %w", err) + var servPub, secret [32]byte + copy(servPub[:], reply.EphemeralPubKey) + curve25519.ScalarMult(&secret, &kp.priv, &servPub) + if subtle.ConstantTimeCompare(secret[:], curve25519Zeros[:]) == 1 { + return nil, errors.New("ssh: peer's curve25519 public value has wrong order") } h := crypto.SHA256.New() @@ -547,9 +531,11 @@ func (kex *curve25519sha256) Server(c packetConn, rand io.Reader, magics *handsh return nil, err } - secret, err := curve25519.X25519(kp.priv[:], kexInit.ClientPubKey) - if err != nil { - return nil, fmt.Errorf("ssh: peer's curve25519 public value is not valid: %w", err) + var clientPub, secret [32]byte + copy(clientPub[:], kexInit.ClientPubKey) + curve25519.ScalarMult(&secret, &kp.priv, &clientPub) + if subtle.ConstantTimeCompare(secret[:], curve25519Zeros[:]) == 1 { + return nil, errors.New("ssh: peer's curve25519 public value has wrong order") } hostKeyBytes := priv.PublicKey().Marshal() diff --git a/kubewatch/vendor/golang.org/x/crypto/ssh/keys.go b/kubewatch/vendor/golang.org/x/crypto/ssh/keys.go index 47a07539d..a28c0de50 100644 --- a/kubewatch/vendor/golang.org/x/crypto/ssh/keys.go +++ b/kubewatch/vendor/golang.org/x/crypto/ssh/keys.go @@ -27,7 +27,6 @@ import ( "fmt" "io" "math/big" - "slices" "strings" "golang.org/x/crypto/ssh/internal/bcrypt_pbkdf" @@ -90,11 +89,6 @@ func parsePubKey(in []byte, algo string) (pubKey PublicKey, rest []byte, err err } return cert, nil, nil } - if keyFormat := keyFormatForAlgorithm(algo); keyFormat != "" { - return nil, nil, fmt.Errorf("ssh: signature algorithm %q isn't a key format; key is malformed and should be re-encoded with type %q", - algo, keyFormat) - } - return nil, nil, fmt.Errorf("ssh: unknown key algorithm: %v", algo) } @@ -197,10 +191,9 @@ func ParseKnownHosts(in []byte) (marker string, hosts []string, pubKey PublicKey return "", nil, nil, "", nil, io.EOF } -// ParseAuthorizedKey parses a public key from an authorized_keys file used in -// OpenSSH according to the sshd(8) manual page. Invalid lines are ignored. +// ParseAuthorizedKey parses a public key from an authorized_keys +// file used in OpenSSH according to the sshd(8) manual page. func ParseAuthorizedKey(in []byte) (out PublicKey, comment string, options []string, rest []byte, err error) { - var lastErr error for len(in) > 0 { end := bytes.IndexByte(in, '\n') if end != -1 { @@ -229,8 +222,6 @@ func ParseAuthorizedKey(in []byte) (out PublicKey, comment string, options []str if out, comment, err = parseAuthorizedKey(in[i:]); err == nil { return out, comment, options, rest, nil - } else { - lastErr = err } // No key type recognised. Maybe there's an options field at @@ -273,18 +264,12 @@ func ParseAuthorizedKey(in []byte) (out PublicKey, comment string, options []str if out, comment, err = parseAuthorizedKey(in[i:]); err == nil { options = candidateOptions return out, comment, options, rest, nil - } else { - lastErr = err } in = rest continue } - if lastErr != nil { - return nil, "", nil, nil, fmt.Errorf("ssh: no key found; last parsing error for ignored line: %w", lastErr) - } - return nil, "", nil, nil, errors.New("ssh: no key found") } @@ -410,11 +395,11 @@ func NewSignerWithAlgorithms(signer AlgorithmSigner, algorithms []string) (Multi } for _, algo := range algorithms { - if !slices.Contains(supportedAlgos, algo) { + if !contains(supportedAlgos, algo) { return nil, fmt.Errorf("ssh: algorithm %q is not supported for key type %q", algo, signer.PublicKey().Type()) } - if !slices.Contains(signerAlgos, algo) { + if !contains(signerAlgos, algo) { return nil, fmt.Errorf("ssh: algorithm %q is restricted for the provided signer", algo) } } @@ -501,13 +486,10 @@ func (r *rsaPublicKey) Marshal() []byte { func (r *rsaPublicKey) Verify(data []byte, sig *Signature) error { supportedAlgos := algorithmsForKeyFormat(r.Type()) - if !slices.Contains(supportedAlgos, sig.Format) { + if !contains(supportedAlgos, sig.Format) { return fmt.Errorf("ssh: signature type %s for key type %s", sig.Format, r.Type()) } - hash, err := hashFunc(sig.Format) - if err != nil { - return err - } + hash := hashFuncs[sig.Format] h := hash.New() h.Write(data) digest := h.Sum(nil) @@ -624,11 +606,7 @@ func (k *dsaPublicKey) Verify(data []byte, sig *Signature) error { if sig.Format != k.Type() { return fmt.Errorf("ssh: signature type %s for key type %s", sig.Format, k.Type()) } - hash, err := hashFunc(sig.Format) - if err != nil { - return err - } - h := hash.New() + h := hashFuncs[sig.Format].New() h.Write(data) digest := h.Sum(nil) @@ -673,11 +651,7 @@ func (k *dsaPrivateKey) SignWithAlgorithm(rand io.Reader, data []byte, algorithm return nil, fmt.Errorf("ssh: unsupported signature algorithm %s", algorithm) } - hash, err := hashFunc(k.PublicKey().Type()) - if err != nil { - return nil, err - } - h := hash.New() + h := hashFuncs[k.PublicKey().Type()].New() h.Write(data) digest := h.Sum(nil) r, s, err := dsa.Sign(rand, k.PrivateKey, digest) @@ -827,11 +801,8 @@ func (k *ecdsaPublicKey) Verify(data []byte, sig *Signature) error { if sig.Format != k.Type() { return fmt.Errorf("ssh: signature type %s for key type %s", sig.Format, k.Type()) } - hash, err := hashFunc(sig.Format) - if err != nil { - return err - } - h := hash.New() + + h := hashFuncs[sig.Format].New() h.Write(data) digest := h.Sum(nil) @@ -934,11 +905,8 @@ func (k *skECDSAPublicKey) Verify(data []byte, sig *Signature) error { if sig.Format != k.Type() { return fmt.Errorf("ssh: signature type %s for key type %s", sig.Format, k.Type()) } - hash, err := hashFunc(sig.Format) - if err != nil { - return err - } - h := hash.New() + + h := hashFuncs[sig.Format].New() h.Write([]byte(k.application)) appDigest := h.Sum(nil) @@ -1041,11 +1009,7 @@ func (k *skEd25519PublicKey) Verify(data []byte, sig *Signature) error { return fmt.Errorf("invalid size %d for Ed25519 public key", l) } - hash, err := hashFunc(sig.Format) - if err != nil { - return err - } - h := hash.New() + h := hashFuncs[sig.Format].New() h.Write([]byte(k.application)) appDigest := h.Sum(nil) @@ -1148,14 +1112,11 @@ func (s *wrappedSigner) SignWithAlgorithm(rand io.Reader, data []byte, algorithm algorithm = s.pubKey.Type() } - if !slices.Contains(s.Algorithms(), algorithm) { + if !contains(s.Algorithms(), algorithm) { return nil, fmt.Errorf("ssh: unsupported signature algorithm %q for key format %q", algorithm, s.pubKey.Type()) } - hashFunc, err := hashFunc(algorithm) - if err != nil { - return nil, err - } + hashFunc := hashFuncs[algorithm] var digest []byte if hashFunc != 0 { h := hashFunc.New() @@ -1490,7 +1451,6 @@ type openSSHEncryptedPrivateKey struct { NumKeys uint32 PubKey []byte PrivKeyBlock []byte - Rest []byte `ssh:"rest"` } type openSSHPrivateKey struct { diff --git a/kubewatch/vendor/golang.org/x/crypto/ssh/knownhosts/knownhosts.go b/kubewatch/vendor/golang.org/x/crypto/ssh/knownhosts/knownhosts.go index 1ebd7e6da..c022e411f 100644 --- a/kubewatch/vendor/golang.org/x/crypto/ssh/knownhosts/knownhosts.go +++ b/kubewatch/vendor/golang.org/x/crypto/ssh/knownhosts/knownhosts.go @@ -421,26 +421,20 @@ func New(files ...string) (ssh.HostKeyCallback, error) { return certChecker.CheckHostKey, nil } -// Normalize normalizes an address into the form used in known_hosts. Supports -// IPv4, hostnames, bracketed IPv6. Any other non-standard formats are returned -// with minimal transformation. +// Normalize normalizes an address into the form used in known_hosts func Normalize(address string) string { - const defaultSSHPort = "22" - host, port, err := net.SplitHostPort(address) if err != nil { host = address - port = defaultSSHPort - } - - if strings.HasPrefix(host, "[") && strings.HasSuffix(host, "]") { - host = host[1 : len(host)-1] + port = "22" } - - if port == defaultSSHPort { - return host + entry := host + if port != "22" { + entry = "[" + entry + "]:" + port + } else if strings.Contains(host, ":") && !strings.HasPrefix(host, "[") { + entry = "[" + entry + "]" } - return "[" + host + "]:" + port + return entry } // Line returns a line to add append to the known_hosts files. diff --git a/kubewatch/vendor/golang.org/x/crypto/ssh/mac.go b/kubewatch/vendor/golang.org/x/crypto/ssh/mac.go index 87d626fbb..de2639d57 100644 --- a/kubewatch/vendor/golang.org/x/crypto/ssh/mac.go +++ b/kubewatch/vendor/golang.org/x/crypto/ssh/mac.go @@ -7,13 +7,11 @@ package ssh // Message authentication support import ( - "crypto/fips140" "crypto/hmac" "crypto/sha1" "crypto/sha256" "crypto/sha512" "hash" - "slices" ) type macMode struct { @@ -48,37 +46,23 @@ func (t truncatingMAC) Size() int { func (t truncatingMAC) BlockSize() int { return t.hmac.BlockSize() } -// macModes defines the supported MACs. MACs not included are not supported -// and will not be negotiated, even if explicitly configured. When FIPS mode is -// enabled, only FIPS-approved algorithms are included. -var macModes = map[string]*macMode{} - -func init() { - macModes[HMACSHA512ETM] = &macMode{64, true, func(key []byte) hash.Hash { +var macModes = map[string]*macMode{ + HMACSHA512ETM: {64, true, func(key []byte) hash.Hash { return hmac.New(sha512.New, key) - }} - macModes[HMACSHA256ETM] = &macMode{32, true, func(key []byte) hash.Hash { + }}, + HMACSHA256ETM: {32, true, func(key []byte) hash.Hash { return hmac.New(sha256.New, key) - }} - macModes[HMACSHA512] = &macMode{64, false, func(key []byte) hash.Hash { + }}, + HMACSHA512: {64, false, func(key []byte) hash.Hash { return hmac.New(sha512.New, key) - }} - macModes[HMACSHA256] = &macMode{32, false, func(key []byte) hash.Hash { + }}, + HMACSHA256: {32, false, func(key []byte) hash.Hash { return hmac.New(sha256.New, key) - }} - - if fips140.Enabled() { - defaultMACs = slices.DeleteFunc(defaultMACs, func(algo string) bool { - _, ok := macModes[algo] - return !ok - }) - return - } - - macModes[HMACSHA1] = &macMode{20, false, func(key []byte) hash.Hash { + }}, + HMACSHA1: {20, false, func(key []byte) hash.Hash { return hmac.New(sha1.New, key) - }} - macModes[InsecureHMACSHA196] = &macMode{20, false, func(key []byte) hash.Hash { + }}, + InsecureHMACSHA196: {20, false, func(key []byte) hash.Hash { return truncatingMAC{12, hmac.New(sha1.New, key)} - }} + }}, } diff --git a/kubewatch/vendor/golang.org/x/crypto/ssh/messages.go b/kubewatch/vendor/golang.org/x/crypto/ssh/messages.go index ab22c3d38..251b9d06a 100644 --- a/kubewatch/vendor/golang.org/x/crypto/ssh/messages.go +++ b/kubewatch/vendor/golang.org/x/crypto/ssh/messages.go @@ -792,7 +792,7 @@ func marshalString(to []byte, s []byte) []byte { return to[len(s):] } -var bigIntType = reflect.TypeFor[*big.Int]() +var bigIntType = reflect.TypeOf((*big.Int)(nil)) // Decode a packet into its corresponding message. func decode(packet []byte) (interface{}, error) { diff --git a/kubewatch/vendor/golang.org/x/crypto/ssh/mlkem.go b/kubewatch/vendor/golang.org/x/crypto/ssh/mlkem.go index ddc0ed1fc..657e1079d 100644 --- a/kubewatch/vendor/golang.org/x/crypto/ssh/mlkem.go +++ b/kubewatch/vendor/golang.org/x/crypto/ssh/mlkem.go @@ -2,6 +2,8 @@ // 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 ssh import ( @@ -11,10 +13,23 @@ import ( "errors" "fmt" "io" + "runtime" + "slices" "golang.org/x/crypto/curve25519" ) +func init() { + // After Go 1.24rc1 mlkem swapped the order of return values of Encapsulate. + // See #70950. + if runtime.Version() == "go1.24rc1" { + return + } + supportedKexAlgos = slices.Insert(supportedKexAlgos, 0, KeyExchangeMLKEM768X25519) + defaultKexAlgos = slices.Insert(defaultKexAlgos, 0, KeyExchangeMLKEM768X25519) + kexAlgoMap[KeyExchangeMLKEM768X25519] = &mlkem768WithCurve25519sha256{} +} + // mlkem768WithCurve25519sha256 implements the hybrid ML-KEM768 with // curve25519-sha256 key exchange method, as described by // draft-kampanakis-curdle-ssh-pq-ke-05 section 2.3.3. diff --git a/kubewatch/vendor/golang.org/x/crypto/ssh/server.go b/kubewatch/vendor/golang.org/x/crypto/ssh/server.go index 064dcbaf5..98679ba5b 100644 --- a/kubewatch/vendor/golang.org/x/crypto/ssh/server.go +++ b/kubewatch/vendor/golang.org/x/crypto/ssh/server.go @@ -10,7 +10,6 @@ import ( "fmt" "io" "net" - "slices" "strings" ) @@ -44,9 +43,6 @@ type Permissions struct { // pass data from the authentication callbacks to the server // application layer. Extensions map[string]string - - // ExtraData allows to store user defined data. - ExtraData map[any]any } type GSSAPIWithMICConfig struct { @@ -130,21 +126,6 @@ type ServerConfig struct { // Permissions.Extensions entry. PublicKeyCallback func(conn ConnMetadata, key PublicKey) (*Permissions, error) - // VerifiedPublicKeyCallback, if non-nil, is called after a client - // successfully confirms having control over a key that was previously - // approved by PublicKeyCallback. The permissions object passed to the - // callback is the one returned by PublicKeyCallback for the given public - // key and its ownership is transferred to the callback. The returned - // Permissions object can be the same object, optionally modified, or a - // completely new object. If VerifiedPublicKeyCallback is non-nil, - // PublicKeyCallback is not allowed to return a PartialSuccessError, which - // can instead be returned by VerifiedPublicKeyCallback. - // - // VerifiedPublicKeyCallback does not affect which authentication methods - // are included in the list of methods that can be attempted by the client. - VerifiedPublicKeyCallback func(conn ConnMetadata, key PublicKey, permissions *Permissions, - signatureAlgorithm string) (*Permissions, error) - // KeyboardInteractiveCallback, if non-nil, is called when // keyboard-interactive authentication is selected (RFC // 4256). The client object's Challenge function should be @@ -265,7 +246,7 @@ func NewServerConn(c net.Conn, config *ServerConfig) (*ServerConn, <-chan NewCha fullConf.PublicKeyAuthAlgorithms = defaultPubKeyAuthAlgos } else { for _, algo := range fullConf.PublicKeyAuthAlgorithms { - if !slices.Contains(SupportedAlgorithms().PublicKeyAuths, algo) && !slices.Contains(InsecureAlgorithms().PublicKeyAuths, algo) { + if !contains(SupportedAlgorithms().PublicKeyAuths, algo) && !contains(InsecureAlgorithms().PublicKeyAuths, algo) { c.Close() return nil, nil, nil, fmt.Errorf("ssh: unsupported public key authentication algorithm %s", algo) } @@ -650,7 +631,7 @@ userAuthLoop: return nil, parseError(msgUserAuthRequest) } algo := string(algoBytes) - if !slices.Contains(config.PublicKeyAuthAlgorithms, underlyingAlgo(algo)) { + if !contains(config.PublicKeyAuthAlgorithms, underlyingAlgo(algo)) { authErr = fmt.Errorf("ssh: algorithm %q not accepted", algo) break } @@ -671,9 +652,6 @@ userAuthLoop: candidate.pubKeyData = pubKeyData candidate.perms, candidate.result = authConfig.PublicKeyCallback(s, pubKey) _, isPartialSuccessError := candidate.result.(*PartialSuccessError) - if isPartialSuccessError && config.VerifiedPublicKeyCallback != nil { - return nil, errors.New("ssh: invalid library usage: PublicKeyCallback must not return partial success when VerifiedPublicKeyCallback is defined") - } if (candidate.result == nil || isPartialSuccessError) && candidate.perms != nil && @@ -717,7 +695,7 @@ userAuthLoop: // ssh-rsa-cert-v01@openssh.com algorithm with ssh-rsa public // key type. The algorithm and public key type must be // consistent: both must be certificate algorithms, or neither. - if !slices.Contains(algorithmsForKeyFormat(pubKey.Type()), algo) { + if !contains(algorithmsForKeyFormat(pubKey.Type()), algo) { authErr = fmt.Errorf("ssh: public key type %q not compatible with selected algorithm %q", pubKey.Type(), algo) break @@ -727,7 +705,7 @@ userAuthLoop: // algorithm name that corresponds to algo with // sig.Format. This is usually the same, but // for certs, the names differ. - if !slices.Contains(config.PublicKeyAuthAlgorithms, sig.Format) { + if !contains(config.PublicKeyAuthAlgorithms, sig.Format) { authErr = fmt.Errorf("ssh: algorithm %q not accepted", sig.Format) break } @@ -744,12 +722,6 @@ userAuthLoop: authErr = candidate.result perms = candidate.perms - if authErr == nil && config.VerifiedPublicKeyCallback != nil { - // Only call VerifiedPublicKeyCallback after the key has been accepted - // and successfully verified. If authErr is non-nil, the key is not - // considered verified and the callback must not run. - perms, authErr = config.VerifiedPublicKeyCallback(s, pubKey, perms, algo) - } } case "gssapi-with-mic": if authConfig.GSSAPIWithMICConfig == nil { diff --git a/kubewatch/vendor/golang.org/x/crypto/ssh/ssh_gss.go b/kubewatch/vendor/golang.org/x/crypto/ssh/ssh_gss.go index a6249a122..24bd7c8e8 100644 --- a/kubewatch/vendor/golang.org/x/crypto/ssh/ssh_gss.go +++ b/kubewatch/vendor/golang.org/x/crypto/ssh/ssh_gss.go @@ -106,13 +106,6 @@ func parseGSSAPIPayload(payload []byte) (*userAuthRequestGSSAPI, error) { if !ok { return nil, errors.New("parse uint32 failed") } - // Each ASN.1 encoded OID must have a minimum - // of 2 bytes; 64 maximum mechanisms is an - // arbitrary, but reasonable ceiling. - const maxMechs = 64 - if n > maxMechs || int(n)*2 > len(rest) { - return nil, errors.New("invalid mechanism count") - } s := &userAuthRequestGSSAPI{ N: n, OIDS: make([]asn1.ObjectIdentifier, n), @@ -129,6 +122,7 @@ func parseGSSAPIPayload(payload []byte) (*userAuthRequestGSSAPI, error) { if rest, err = asn1.Unmarshal(desiredMech, &s.OIDS[i]); err != nil { return nil, err } + } return s, nil } diff --git a/kubewatch/vendor/golang.org/x/crypto/ssh/streamlocal.go b/kubewatch/vendor/golang.org/x/crypto/ssh/streamlocal.go index 152470fcb..b171b330b 100644 --- a/kubewatch/vendor/golang.org/x/crypto/ssh/streamlocal.go +++ b/kubewatch/vendor/golang.org/x/crypto/ssh/streamlocal.go @@ -44,7 +44,7 @@ func (c *Client) ListenUnix(socketPath string) (net.Listener, error) { if !ok { return nil, errors.New("ssh: streamlocal-forward@openssh.com request denied by peer") } - ch := c.forwards.add("unix", socketPath) + ch := c.forwards.add(&net.UnixAddr{Name: socketPath, Net: "unix"}) return &unixListener{socketPath, c, ch}, nil } @@ -96,7 +96,7 @@ func (l *unixListener) Accept() (net.Conn, error) { // Close closes the listener. func (l *unixListener) Close() error { // this also closes the listener. - l.conn.forwards.remove("unix", l.socketPath) + l.conn.forwards.remove(&net.UnixAddr{Name: l.socketPath, Net: "unix"}) m := streamLocalChannelForwardMsg{ l.socketPath, } diff --git a/kubewatch/vendor/golang.org/x/crypto/ssh/tcpip.go b/kubewatch/vendor/golang.org/x/crypto/ssh/tcpip.go index 78c41fe5a..93d844f03 100644 --- a/kubewatch/vendor/golang.org/x/crypto/ssh/tcpip.go +++ b/kubewatch/vendor/golang.org/x/crypto/ssh/tcpip.go @@ -11,7 +11,6 @@ import ( "io" "math/rand" "net" - "net/netip" "strconv" "strings" "sync" @@ -23,21 +22,14 @@ import ( // the returned net.Listener. The listener must be serviced, or the // SSH connection may hang. // N must be "tcp", "tcp4", "tcp6", or "unix". -// -// If the address is a hostname, it is sent to the remote peer as-is, without -// being resolved locally, and the Listener Addr method will return a zero IP. func (c *Client) Listen(n, addr string) (net.Listener, error) { switch n { case "tcp", "tcp4", "tcp6": - host, portStr, err := net.SplitHostPort(addr) - if err != nil { - return nil, err - } - port, err := strconv.ParseInt(portStr, 10, 32) + laddr, err := net.ResolveTCPAddr(n, addr) if err != nil { return nil, err } - return c.listenTCPInternal(host, int(port)) + return c.ListenTCP(laddr) case "unix": return c.ListenUnix(addr) default: @@ -110,24 +102,15 @@ func (c *Client) handleForwards() { // ListenTCP requests the remote peer open a listening socket // on laddr. Incoming connections will be available by calling // Accept on the returned net.Listener. -// -// ListenTCP accepts an IP address, to provide a hostname use [Client.Listen] -// with "tcp", "tcp4", or "tcp6" network instead. func (c *Client) ListenTCP(laddr *net.TCPAddr) (net.Listener, error) { c.handleForwardsOnce.Do(c.handleForwards) if laddr.Port == 0 && isBrokenOpenSSHVersion(string(c.ServerVersion())) { return c.autoPortListenWorkaround(laddr) } - return c.listenTCPInternal(laddr.IP.String(), laddr.Port) -} - -func (c *Client) listenTCPInternal(host string, port int) (net.Listener, error) { - c.handleForwardsOnce.Do(c.handleForwards) - m := channelForwardMsg{ - host, - uint32(port), + laddr.IP.String(), + uint32(laddr.Port), } // send message ok, resp, err := c.SendRequest("tcpip-forward", true, Marshal(&m)) @@ -140,33 +123,20 @@ func (c *Client) listenTCPInternal(host string, port int) (net.Listener, error) // If the original port was 0, then the remote side will // supply a real port number in the response. - if port == 0 { + if laddr.Port == 0 { var p struct { Port uint32 } if err := Unmarshal(resp, &p); err != nil { return nil, err } - port = int(p.Port) - } - // Construct a local address placeholder for the remote listener. If the - // original host is an IP address, preserve it so that Listener.Addr() - // reports the same IP. If the host is a hostname or cannot be parsed as an - // IP, fall back to IPv4zero. The port field is always set, even if the - // original port was 0, because in that case the remote server will assign - // one, allowing callers to determine which port was selected. - ip := net.IPv4zero - if parsed, err := netip.ParseAddr(host); err == nil { - ip = net.IP(parsed.AsSlice()) - } - laddr := &net.TCPAddr{ - IP: ip, - Port: port, + laddr.Port = int(p.Port) } - addr := net.JoinHostPort(host, strconv.FormatInt(int64(port), 10)) - ch := c.forwards.add("tcp", addr) - return &tcpListener{laddr, addr, c, ch}, nil + // Register this forward, using the port number we obtained. + ch := c.forwards.add(laddr) + + return &tcpListener{laddr, c, ch}, nil } // forwardList stores a mapping between remote @@ -179,9 +149,8 @@ type forwardList struct { // forwardEntry represents an established mapping of a laddr on a // remote ssh server to a channel connected to a tcpListener. type forwardEntry struct { - addr string // host:port or socket path - network string // tcp or unix - c chan forward + laddr net.Addr + c chan forward } // forward represents an incoming forwarded tcpip connection. The @@ -192,13 +161,12 @@ type forward struct { raddr net.Addr // the raddr of the incoming connection } -func (l *forwardList) add(n, addr string) chan forward { +func (l *forwardList) add(addr net.Addr) chan forward { l.Lock() defer l.Unlock() f := forwardEntry{ - addr: addr, - network: n, - c: make(chan forward, 1), + laddr: addr, + c: make(chan forward, 1), } l.entries = append(l.entries, f) return f.c @@ -217,20 +185,19 @@ func parseTCPAddr(addr string, port uint32) (*net.TCPAddr, error) { if port == 0 || port > 65535 { return nil, fmt.Errorf("ssh: port number out of range: %d", port) } - ip, err := netip.ParseAddr(addr) - if err != nil { + ip := net.ParseIP(string(addr)) + if ip == nil { return nil, fmt.Errorf("ssh: cannot parse IP address %q", addr) } - return &net.TCPAddr{IP: net.IP(ip.AsSlice()), Port: int(port)}, nil + return &net.TCPAddr{IP: ip, Port: int(port)}, nil } func (l *forwardList) handleChannels(in <-chan NewChannel) { for ch := range in { var ( - addr string - network string - raddr net.Addr - err error + laddr net.Addr + raddr net.Addr + err error ) switch channelType := ch.ChannelType(); channelType { case "forwarded-tcpip": @@ -240,34 +207,40 @@ func (l *forwardList) handleChannels(in <-chan NewChannel) { continue } - // RFC 4254 section 7.2 specifies that incoming addresses should - // list the address that was connected, in string format. It is the - // same address used in the tcpip-forward request. The originator - // address is an IP address instead. - addr = net.JoinHostPort(payload.Addr, strconv.FormatUint(uint64(payload.Port), 10)) - + // RFC 4254 section 7.2 specifies that incoming + // addresses should list the address, in string + // format. It is implied that this should be an IP + // address, as it would be impossible to connect to it + // otherwise. + laddr, err = parseTCPAddr(payload.Addr, payload.Port) + if err != nil { + ch.Reject(ConnectionFailed, err.Error()) + continue + } raddr, err = parseTCPAddr(payload.OriginAddr, payload.OriginPort) if err != nil { ch.Reject(ConnectionFailed, err.Error()) continue } - network = "tcp" + case "forwarded-streamlocal@openssh.com": var payload forwardedStreamLocalPayload if err = Unmarshal(ch.ExtraData(), &payload); err != nil { ch.Reject(ConnectionFailed, "could not parse forwarded-streamlocal@openssh.com payload: "+err.Error()) continue } - addr = payload.SocketPath + laddr = &net.UnixAddr{ + Name: payload.SocketPath, + Net: "unix", + } raddr = &net.UnixAddr{ Name: "@", Net: "unix", } - network = "unix" default: panic(fmt.Errorf("ssh: unknown channel type %s", channelType)) } - if ok := l.forward(network, addr, raddr, ch); !ok { + if ok := l.forward(laddr, raddr, ch); !ok { // Section 7.2, implementations MUST reject spurious incoming // connections. ch.Reject(Prohibited, "no forward for address") @@ -279,11 +252,11 @@ func (l *forwardList) handleChannels(in <-chan NewChannel) { // remove removes the forward entry, and the channel feeding its // listener. -func (l *forwardList) remove(n, addr string) { +func (l *forwardList) remove(addr net.Addr) { l.Lock() defer l.Unlock() for i, f := range l.entries { - if n == f.network && addr == f.addr { + if addr.Network() == f.laddr.Network() && addr.String() == f.laddr.String() { l.entries = append(l.entries[:i], l.entries[i+1:]...) close(f.c) return @@ -301,11 +274,11 @@ func (l *forwardList) closeAll() { l.entries = nil } -func (l *forwardList) forward(n, addr string, raddr net.Addr, ch NewChannel) bool { +func (l *forwardList) forward(laddr, raddr net.Addr, ch NewChannel) bool { l.Lock() defer l.Unlock() for _, f := range l.entries { - if n == f.network && addr == f.addr { + if laddr.Network() == f.laddr.Network() && laddr.String() == f.laddr.String() { f.c <- forward{newCh: ch, raddr: raddr} return true } @@ -315,7 +288,6 @@ func (l *forwardList) forward(n, addr string, raddr net.Addr, ch NewChannel) boo type tcpListener struct { laddr *net.TCPAddr - addr string conn *Client in <-chan forward @@ -342,21 +314,13 @@ func (l *tcpListener) Accept() (net.Conn, error) { // Close closes the listener. func (l *tcpListener) Close() error { - host, port, err := net.SplitHostPort(l.addr) - if err != nil { - return err - } - rport, err := strconv.ParseUint(port, 10, 32) - if err != nil { - return err - } m := channelForwardMsg{ - host, - uint32(rport), + l.laddr.IP.String(), + uint32(l.laddr.Port), } // this also closes the listener. - l.conn.forwards.remove("tcp", l.addr) + l.conn.forwards.remove(l.laddr) ok, _, err := l.conn.SendRequest("cancel-tcpip-forward", true, Marshal(&m)) if err == nil && !ok { err = errors.New("ssh: cancel-tcpip-forward failed") diff --git a/kubewatch/vendor/golang.org/x/crypto/ssh/transport.go b/kubewatch/vendor/golang.org/x/crypto/ssh/transport.go index fa3dd6a42..663619845 100644 --- a/kubewatch/vendor/golang.org/x/crypto/ssh/transport.go +++ b/kubewatch/vendor/golang.org/x/crypto/ssh/transport.go @@ -8,7 +8,6 @@ import ( "bufio" "bytes" "errors" - "fmt" "io" "log" ) @@ -255,9 +254,6 @@ var ( // (to setup server->client keys) or clientKeys (for client->server keys). func newPacketCipher(d direction, algs DirectionAlgorithms, kex *kexResult) (packetCipher, error) { cipherMode := cipherModes[algs.Cipher] - if cipherMode == nil { - return nil, fmt.Errorf("ssh: unsupported cipher %v", algs.Cipher) - } iv := make([]byte, cipherMode.ivSize) key := make([]byte, cipherMode.keySize) diff --git a/kubewatch/vendor/golang.org/x/net/context/context.go b/kubewatch/vendor/golang.org/x/net/context/context.go index 24cea6882..db1c95fab 100644 --- a/kubewatch/vendor/golang.org/x/net/context/context.go +++ b/kubewatch/vendor/golang.org/x/net/context/context.go @@ -2,9 +2,44 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Package context has been superseded by the standard library [context] package. +// Package context defines the Context type, which carries deadlines, +// cancellation signals, and other request-scoped values across API boundaries +// and between processes. +// As of Go 1.7 this package is available in the standard library under the +// name [context], and migrating to it can be done automatically with [go fix]. +// +// Incoming requests to a server should create a [Context], and outgoing +// calls to servers should accept a Context. The chain of function +// calls between them must propagate the Context, optionally replacing +// it with a derived Context created using [WithCancel], [WithDeadline], +// [WithTimeout], or [WithValue]. +// +// Programs that use Contexts should follow these rules to keep interfaces +// consistent across packages and enable static analysis tools to check context +// propagation: +// +// Do not store Contexts inside a struct type; instead, pass a Context +// explicitly to each function that needs it. This is discussed further in +// https://go.dev/blog/context-and-structs. The Context should be the first +// parameter, typically named ctx: +// +// func DoSomething(ctx context.Context, arg Arg) error { +// // ... use ctx ... +// } +// +// Do not pass a nil [Context], even if a function permits it. Pass [context.TODO] +// if you are unsure about which Context to use. +// +// Use context Values only for request-scoped data that transits processes and +// APIs, not for passing optional parameters to functions. // -// Deprecated: Use the standard library context package instead. +// The same Context may be passed to functions running in different goroutines; +// Contexts are safe for simultaneous use by multiple goroutines. +// +// See https://go.dev/blog/context for example code for a server that uses +// Contexts. +// +// [go fix]: https://go.dev/cmd/go#hdr-Update_packages_to_use_new_APIs package context import ( @@ -16,37 +51,36 @@ import ( // API boundaries. // // Context's methods may be called by multiple goroutines simultaneously. -// -//go:fix inline type Context = context.Context // Canceled is the error returned by [Context.Err] when the context is canceled // for some reason other than its deadline passing. -// -//go:fix inline var Canceled = context.Canceled // DeadlineExceeded is the error returned by [Context.Err] when the context is canceled // due to its deadline passing. -// -//go:fix inline var DeadlineExceeded = context.DeadlineExceeded // Background returns a non-nil, empty Context. It is never canceled, has no // values, and has no deadline. It is typically used by the main function, // initialization, and tests, and as the top-level Context for incoming // requests. -// -//go:fix inline -func Background() Context { return context.Background() } +func Background() Context { + return background +} // TODO returns a non-nil, empty Context. Code should use context.TODO when // it's unclear which Context to use or it is not yet available (because the // surrounding function has not yet been extended to accept a Context // parameter). -// -//go:fix inline -func TODO() Context { return context.TODO() } +func TODO() Context { + return todo +} + +var ( + background = context.Background() + todo = context.TODO() +) // A CancelFunc tells an operation to abandon its work. // A CancelFunc does not wait for the work to stop. @@ -61,8 +95,6 @@ type CancelFunc = context.CancelFunc // // Canceling this context releases resources associated with it, so code should // call cancel as soon as the operations running in this [Context] complete. -// -//go:fix inline func WithCancel(parent Context) (ctx Context, cancel CancelFunc) { return context.WithCancel(parent) } @@ -76,8 +108,6 @@ func WithCancel(parent Context) (ctx Context, cancel CancelFunc) { // // Canceling this context releases resources associated with it, so code should // call cancel as soon as the operations running in this [Context] complete. -// -//go:fix inline func WithDeadline(parent Context, d time.Time) (Context, CancelFunc) { return context.WithDeadline(parent, d) } @@ -92,8 +122,6 @@ func WithDeadline(parent Context, d time.Time) (Context, CancelFunc) { // defer cancel() // releases resources if slowOperation completes before timeout elapses // return slowOperation(ctx) // } -// -//go:fix inline func WithTimeout(parent Context, timeout time.Duration) (Context, CancelFunc) { return context.WithTimeout(parent, timeout) } @@ -111,8 +139,6 @@ func WithTimeout(parent Context, timeout time.Duration) (Context, CancelFunc) { // interface{}, context keys often have concrete type // struct{}. Alternatively, exported context key variables' static // type should be a pointer or interface. -// -//go:fix inline func WithValue(parent Context, key, val interface{}) Context { return context.WithValue(parent, key, val) } diff --git a/kubewatch/vendor/golang.org/x/net/html/escape.go b/kubewatch/vendor/golang.org/x/net/html/escape.go index 12f227370..04c6bec21 100644 --- a/kubewatch/vendor/golang.org/x/net/html/escape.go +++ b/kubewatch/vendor/golang.org/x/net/html/escape.go @@ -299,7 +299,7 @@ func escape(w writer, s string) error { case '\r': esc = " " default: - panic("html: unrecognized escape character") + panic("unrecognized escape character") } s = s[i+1:] if _, err := w.WriteString(esc); err != nil { diff --git a/kubewatch/vendor/golang.org/x/net/html/parse.go b/kubewatch/vendor/golang.org/x/net/html/parse.go index 88fc0056a..518ee4c94 100644 --- a/kubewatch/vendor/golang.org/x/net/html/parse.go +++ b/kubewatch/vendor/golang.org/x/net/html/parse.go @@ -136,7 +136,7 @@ func (p *parser) indexOfElementInScope(s scope, matchTags ...a.Atom) int { return -1 } default: - panic(fmt.Sprintf("html: internal error: indexOfElementInScope unknown scope: %d", s)) + panic("unreachable") } } switch s { @@ -179,7 +179,7 @@ func (p *parser) clearStackToContext(s scope) { return } default: - panic(fmt.Sprintf("html: internal error: clearStackToContext unknown scope: %d", s)) + panic("unreachable") } } } @@ -231,14 +231,7 @@ func (p *parser) addChild(n *Node) { } if n.Type == ElementNode { - p.insertOpenElement(n) - } -} - -func (p *parser) insertOpenElement(n *Node) { - p.oe = append(p.oe, n) - if len(p.oe) > 512 { - panic("html: open stack of elements exceeds 512 nodes") + p.oe = append(p.oe, n) } } @@ -817,7 +810,7 @@ func afterHeadIM(p *parser) bool { p.im = inFramesetIM return true case a.Base, a.Basefont, a.Bgsound, a.Link, a.Meta, a.Noframes, a.Script, a.Style, a.Template, a.Title: - p.insertOpenElement(p.head) + p.oe = append(p.oe, p.head) defer p.oe.remove(p.head) return inHeadIM(p) case a.Head: @@ -1685,7 +1678,7 @@ func inTableBodyIM(p *parser) bool { return inTableIM(p) } -// Section 13.2.6.4.14. +// Section 12.2.6.4.14. func inRowIM(p *parser) bool { switch p.tok.Type { case StartTagToken: @@ -1697,9 +1690,7 @@ func inRowIM(p *parser) bool { p.im = inCellIM return true case a.Caption, a.Col, a.Colgroup, a.Tbody, a.Tfoot, a.Thead, a.Tr: - if p.elementInScope(tableScope, a.Tr) { - p.clearStackToContext(tableRowScope) - p.oe.pop() + if p.popUntil(tableScope, a.Tr) { p.im = inTableBodyIM return false } @@ -1709,28 +1700,22 @@ func inRowIM(p *parser) bool { case EndTagToken: switch p.tok.DataAtom { case a.Tr: - if p.elementInScope(tableScope, a.Tr) { - p.clearStackToContext(tableRowScope) - p.oe.pop() + if p.popUntil(tableScope, a.Tr) { p.im = inTableBodyIM return true } // Ignore the token. return true case a.Table: - if p.elementInScope(tableScope, a.Tr) { - p.clearStackToContext(tableRowScope) - p.oe.pop() + if p.popUntil(tableScope, a.Tr) { p.im = inTableBodyIM return false } // Ignore the token. return true case a.Tbody, a.Tfoot, a.Thead: - if p.elementInScope(tableScope, p.tok.DataAtom) && p.elementInScope(tableScope, a.Tr) { - p.clearStackToContext(tableRowScope) - p.oe.pop() - p.im = inTableBodyIM + if p.elementInScope(tableScope, p.tok.DataAtom) { + p.parseImpliedToken(EndTagToken, a.Tr, a.Tr.String()) return false } // Ignore the token. @@ -2237,20 +2222,16 @@ func parseForeignContent(p *parser) bool { p.acknowledgeSelfClosingTag() } case EndTagToken: - if strings.EqualFold(p.oe[len(p.oe)-1].Data, p.tok.Data) { - p.oe = p.oe[:len(p.oe)-1] - return true - } for i := len(p.oe) - 1; i >= 0; i-- { + if p.oe[i].Namespace == "" { + return p.im(p) + } if strings.EqualFold(p.oe[i].Data, p.tok.Data) { p.oe = p.oe[:i] - return true - } - if i > 0 && p.oe[i-1].Namespace == "" { break } } - return p.im(p) + return true default: // Ignore the token. } @@ -2331,13 +2312,9 @@ func (p *parser) parseCurrentToken() { } } -func (p *parser) parse() (err error) { - defer func() { - if panicErr := recover(); panicErr != nil { - err = fmt.Errorf("%s", panicErr) - } - }() +func (p *parser) parse() error { // Iterate until EOF. Any other error will cause an early return. + var err error for err != io.EOF { // CDATA sections are allowed only in foreign content. n := p.oe.top() @@ -2366,8 +2343,6 @@ func (p *parser) parse() (err error) { // s. Conversely, explicit s in r's data can be silently dropped, // with no corresponding node in the resulting tree. // -// Parse will reject HTML that is nested deeper than 512 elements. -// // The input is assumed to be UTF-8 encoded. func Parse(r io.Reader) (*Node, error) { return ParseWithOptions(r) diff --git a/kubewatch/vendor/golang.org/x/net/html/render.go b/kubewatch/vendor/golang.org/x/net/html/render.go index 0157d89e1..e8c123345 100644 --- a/kubewatch/vendor/golang.org/x/net/html/render.go +++ b/kubewatch/vendor/golang.org/x/net/html/render.go @@ -184,7 +184,7 @@ func render1(w writer, n *Node) error { return err } - // Add initial newline where there is danger of a newline being ignored. + // Add initial newline where there is danger of a newline beging ignored. if c := n.FirstChild; c != nil && c.Type == TextNode && strings.HasPrefix(c.Data, "\n") { switch n.Data { case "pre", "listing", "textarea": diff --git a/kubewatch/vendor/golang.org/x/net/http2/config.go b/kubewatch/vendor/golang.org/x/net/http2/config.go index 8a7a89d01..ca645d9a1 100644 --- a/kubewatch/vendor/golang.org/x/net/http2/config.go +++ b/kubewatch/vendor/golang.org/x/net/http2/config.go @@ -27,7 +27,6 @@ import ( // - If the resulting value is zero or out of range, use a default. type http2Config struct { MaxConcurrentStreams uint32 - StrictMaxConcurrentRequests bool MaxDecoderHeaderTableSize uint32 MaxEncoderHeaderTableSize uint32 MaxReadFrameSize uint32 @@ -56,7 +55,7 @@ func configFromServer(h1 *http.Server, h2 *Server) http2Config { PermitProhibitedCipherSuites: h2.PermitProhibitedCipherSuites, CountError: h2.CountError, } - fillNetHTTPConfig(&conf, h1.HTTP2) + fillNetHTTPServerConfig(&conf, h1) setConfigDefaults(&conf, true) return conf } @@ -65,13 +64,12 @@ func configFromServer(h1 *http.Server, h2 *Server) http2Config { // (the net/http Transport). func configFromTransport(h2 *Transport) http2Config { conf := http2Config{ - StrictMaxConcurrentRequests: h2.StrictMaxConcurrentStreams, - MaxEncoderHeaderTableSize: h2.MaxEncoderHeaderTableSize, - MaxDecoderHeaderTableSize: h2.MaxDecoderHeaderTableSize, - MaxReadFrameSize: h2.MaxReadFrameSize, - SendPingTimeout: h2.ReadIdleTimeout, - PingTimeout: h2.PingTimeout, - WriteByteTimeout: h2.WriteByteTimeout, + 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, @@ -83,7 +81,7 @@ func configFromTransport(h2 *Transport) http2Config { } if h2.t1 != nil { - fillNetHTTPConfig(&conf, h2.t1.HTTP2) + fillNetHTTPTransportConfig(&conf, h2.t1) } setConfigDefaults(&conf, false) return conf @@ -122,48 +120,3 @@ func adjustHTTP1MaxHeaderSize(n int64) int64 { const typicalHeaders = 10 // conservative return n + typicalHeaders*perFieldOverhead } - -func fillNetHTTPConfig(conf *http2Config, h2 *http.HTTP2Config) { - if h2 == nil { - return - } - if h2.MaxConcurrentStreams != 0 { - conf.MaxConcurrentStreams = uint32(h2.MaxConcurrentStreams) - } - if http2ConfigStrictMaxConcurrentRequests(h2) { - conf.StrictMaxConcurrentRequests = true - } - 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 - } -} diff --git a/kubewatch/vendor/golang.org/x/net/http2/config_go124.go b/kubewatch/vendor/golang.org/x/net/http2/config_go124.go new file mode 100644 index 000000000..5b516c55f --- /dev/null +++ b/kubewatch/vendor/golang.org/x/net/http2/config_go124.go @@ -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) +} + +// fillNetHTTPTransportConfig 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 + } +} diff --git a/kubewatch/vendor/golang.org/x/net/http2/config_go125.go b/kubewatch/vendor/golang.org/x/net/http2/config_go125.go deleted file mode 100644 index b4373fe33..000000000 --- a/kubewatch/vendor/golang.org/x/net/http2/config_go125.go +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2025 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.26 - -package http2 - -import ( - "net/http" -) - -func http2ConfigStrictMaxConcurrentRequests(h2 *http.HTTP2Config) bool { - return false -} diff --git a/kubewatch/vendor/golang.org/x/net/http2/config_go126.go b/kubewatch/vendor/golang.org/x/net/http2/config_go126.go deleted file mode 100644 index 6b071c149..000000000 --- a/kubewatch/vendor/golang.org/x/net/http2/config_go126.go +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2025 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.26 - -package http2 - -import ( - "net/http" -) - -func http2ConfigStrictMaxConcurrentRequests(h2 *http.HTTP2Config) bool { - return h2.StrictMaxConcurrentRequests -} diff --git a/kubewatch/vendor/golang.org/x/net/http2/config_pre_go124.go b/kubewatch/vendor/golang.org/x/net/http2/config_pre_go124.go new file mode 100644 index 000000000..060fd6c64 --- /dev/null +++ b/kubewatch/vendor/golang.org/x/net/http2/config_pre_go124.go @@ -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) {} diff --git a/kubewatch/vendor/golang.org/x/net/http2/frame.go b/kubewatch/vendor/golang.org/x/net/http2/frame.go index 9a4bd123c..db3264da8 100644 --- a/kubewatch/vendor/golang.org/x/net/http2/frame.go +++ b/kubewatch/vendor/golang.org/x/net/http2/frame.go @@ -280,8 +280,6 @@ type Framer struct { // lastHeaderStream is non-zero if the last frame was an // unfinished HEADERS/CONTINUATION. lastHeaderStream uint32 - // lastFrameType holds the type of the last frame for verifying frame order. - lastFrameType FrameType maxReadSize uint32 headerBuf [frameHeaderLen]byte @@ -349,7 +347,7 @@ func (fr *Framer) maxHeaderListSize() uint32 { func (f *Framer) startWrite(ftype FrameType, flags Flags, streamID uint32) { // Write the FrameHeader. f.wbuf = append(f.wbuf[:0], - 0, // 3 bytes of length, filled in endWrite + 0, // 3 bytes of length, filled in in endWrite 0, 0, byte(ftype), @@ -490,41 +488,30 @@ func terminalReadFrameError(err error) bool { return err != nil } -// ReadFrameHeader reads the header of the next frame. -// It reads the 9-byte fixed frame header, and does not read any portion of the -// frame payload. The caller is responsible for consuming the payload, either -// with ReadFrameForHeader or directly from the Framer's io.Reader. +// ReadFrame reads a single frame. The returned Frame is only valid +// until the next call to ReadFrame. // -// If the frame is larger than previously set with SetMaxReadFrameSize, it -// returns the frame header and ErrFrameTooLarge. +// If the frame is larger than previously set with SetMaxReadFrameSize, the +// returned error is ErrFrameTooLarge. Other errors may be of type +// ConnectionError, StreamError, or anything else from the underlying +// reader. // -// If the returned FrameHeader.StreamID is non-zero, it indicates the stream -// responsible for the error. -func (fr *Framer) ReadFrameHeader() (FrameHeader, error) { +// If ReadFrame returns an error and a non-nil Frame, the Frame's StreamID +// indicates the stream responsible for the error. +func (fr *Framer) ReadFrame() (Frame, error) { fr.errDetail = nil + if fr.lastFrame != nil { + fr.lastFrame.invalidate() + } fh, err := readFrameHeader(fr.headerBuf[:], fr.r) if err != nil { - return fh, err + return nil, err } if fh.Length > fr.maxReadSize { if fh == invalidHTTP1LookingFrameHeader() { - return fh, fmt.Errorf("http2: failed reading the frame payload: %w, note that the frame header looked like an HTTP/1.1 header", ErrFrameTooLarge) + return nil, fmt.Errorf("http2: failed reading the frame payload: %w, note that the frame header looked like an HTTP/1.1 header", ErrFrameTooLarge) } - return fh, ErrFrameTooLarge - } - if err := fr.checkFrameOrder(fh); err != nil { - return fh, err - } - return fh, nil -} - -// ReadFrameForHeader reads the payload for the frame with the given FrameHeader. -// -// It behaves identically to ReadFrame, other than not checking the maximum -// frame size. -func (fr *Framer) ReadFrameForHeader(fh FrameHeader) (Frame, error) { - if fr.lastFrame != nil { - fr.lastFrame.invalidate() + return nil, ErrFrameTooLarge } payload := fr.getReadBuf(fh.Length) if _, err := io.ReadFull(fr.r, payload); err != nil { @@ -540,7 +527,9 @@ func (fr *Framer) ReadFrameForHeader(fh FrameHeader) (Frame, error) { } return nil, err } - fr.lastFrame = f + if err := fr.checkFrameOrder(f); err != nil { + return nil, err + } if fr.logReads { fr.debugReadLoggerf("http2: Framer %p: read %v", fr, summarizeFrame(f)) } @@ -550,24 +539,6 @@ func (fr *Framer) ReadFrameForHeader(fh FrameHeader) (Frame, error) { return f, nil } -// ReadFrame reads a single frame. The returned Frame is only valid -// until the next call to ReadFrame or ReadFrameBodyForHeader. -// -// If the frame is larger than previously set with SetMaxReadFrameSize, the -// returned error is ErrFrameTooLarge. Other errors may be of type -// ConnectionError, StreamError, or anything else from the underlying -// reader. -// -// If ReadFrame returns an error and a non-nil Frame, the Frame's StreamID -// indicates the stream responsible for the error. -func (fr *Framer) ReadFrame() (Frame, error) { - fh, err := fr.ReadFrameHeader() - if err != nil { - return nil, err - } - return fr.ReadFrameForHeader(fh) -} - // connError returns ConnectionError(code) but first // stashes away a public reason to the caller can optionally relay it // to the peer before hanging up on them. This might help others debug @@ -580,19 +551,20 @@ func (fr *Framer) connError(code ErrCode, reason string) error { // checkFrameOrder reports an error if f is an invalid frame to return // next from ReadFrame. Mostly it checks whether HEADERS and // CONTINUATION frames are contiguous. -func (fr *Framer) checkFrameOrder(fh FrameHeader) error { - lastType := fr.lastFrameType - fr.lastFrameType = fh.Type +func (fr *Framer) checkFrameOrder(f Frame) error { + last := fr.lastFrame + fr.lastFrame = f if fr.AllowIllegalReads { return nil } + fh := f.Header() if fr.lastHeaderStream != 0 { if fh.Type != FrameContinuation { return fr.connError(ErrCodeProtocol, fmt.Sprintf("got %s for stream %d; expected CONTINUATION following %s for stream %d", fh.Type, fh.StreamID, - lastType, fr.lastHeaderStream)) + last.Header().Type, fr.lastHeaderStream)) } if fh.StreamID != fr.lastHeaderStream { return fr.connError(ErrCodeProtocol, @@ -1180,16 +1152,7 @@ type PriorityFrame struct { PriorityParam } -var defaultRFC9218Priority = PriorityParam{ - incremental: 0, - urgency: 3, -} - -// Note that HTTP/2 has had two different prioritization schemes, and -// PriorityParam struct below is a superset of both schemes. The exported -// symbols are from RFC 7540 and the non-exported ones are from RFC 9218. - -// PriorityParam are the stream prioritization parameters. +// PriorityParam are the stream prioritzation parameters. type PriorityParam struct { // StreamDep is a 31-bit stream identifier for the // stream that this stream depends on. Zero means no @@ -1204,20 +1167,6 @@ type PriorityParam struct { // the spec, "Add one to the value to obtain a weight between // 1 and 256." Weight uint8 - - // "The urgency (u) parameter value is Integer (see Section 3.3.1 of - // [STRUCTURED-FIELDS]), between 0 and 7 inclusive, in descending order of - // priority. The default is 3." - urgency uint8 - - // "The incremental (i) parameter value is Boolean (see Section 3.3.6 of - // [STRUCTURED-FIELDS]). It indicates if an HTTP response can be processed - // incrementally, i.e., provide some meaningful output as chunks of the - // response arrive." - // - // We use uint8 (i.e. 0 is false, 1 is true) instead of bool so we can - // avoid unnecessary type conversions and because either type takes 1 byte. - incremental uint8 } func (p PriorityParam) IsZero() bool { diff --git a/kubewatch/vendor/golang.org/x/net/http2/gotrack.go b/kubewatch/vendor/golang.org/x/net/http2/gotrack.go index 9921ca096..9933c9f8c 100644 --- a/kubewatch/vendor/golang.org/x/net/http2/gotrack.go +++ b/kubewatch/vendor/golang.org/x/net/http2/gotrack.go @@ -15,32 +15,21 @@ import ( "runtime" "strconv" "sync" - "sync/atomic" ) var DebugGoroutines = os.Getenv("DEBUG_HTTP2_GOROUTINES") == "1" -// Setting DebugGoroutines to false during a test to disable goroutine debugging -// results in race detector complaints when a test leaves goroutines running before -// returning. Tests shouldn't do this, of course, but when they do it generally shows -// up as infrequent, hard-to-debug flakes. (See #66519.) -// -// Disable goroutine debugging during individual tests with an atomic bool. -// (Note that it's safe to enable/disable debugging mid-test, so the actual race condition -// here is harmless.) -var disableDebugGoroutines atomic.Bool - type goroutineLock uint64 func newGoroutineLock() goroutineLock { - if !DebugGoroutines || disableDebugGoroutines.Load() { + if !DebugGoroutines { return 0 } return goroutineLock(curGoroutineID()) } func (g goroutineLock) check() { - if !DebugGoroutines || disableDebugGoroutines.Load() { + if !DebugGoroutines { return } if curGoroutineID() != uint64(g) { @@ -49,7 +38,7 @@ func (g goroutineLock) check() { } func (g goroutineLock) checkNotOn() { - if !DebugGoroutines || disableDebugGoroutines.Load() { + if !DebugGoroutines { return } if curGoroutineID() == uint64(g) { diff --git a/kubewatch/vendor/golang.org/x/net/http2/http2.go b/kubewatch/vendor/golang.org/x/net/http2/http2.go index 105fe12fe..6c18ea230 100644 --- a/kubewatch/vendor/golang.org/x/net/http2/http2.go +++ b/kubewatch/vendor/golang.org/x/net/http2/http2.go @@ -11,10 +11,13 @@ // requires Go 1.6 or later) // // See https://http2.github.io/ for more information on HTTP/2. +// +// See https://http2.golang.org/ for a test server running this code. package http2 // import "golang.org/x/net/http2" import ( "bufio" + "context" "crypto/tls" "errors" "fmt" @@ -34,6 +37,7 @@ var ( VerboseLogs bool logFrameWrites bool logFrameReads bool + inTests bool // Enabling extended CONNECT by causes browsers to attempt to use // WebSockets-over-HTTP/2. This results in problems when the server's websocket @@ -253,13 +257,15 @@ func (cw closeWaiter) Wait() { // idle memory usage with many connections. type bufferedWriter struct { _ incomparable - conn net.Conn // immutable - bw *bufio.Writer // non-nil when data is buffered - byteTimeout time.Duration // immutable, WriteByteTimeout + group synctestGroupInterface // immutable + conn net.Conn // immutable + bw *bufio.Writer // non-nil when data is buffered + byteTimeout time.Duration // immutable, WriteByteTimeout } -func newBufferedWriter(conn net.Conn, timeout time.Duration) *bufferedWriter { +func newBufferedWriter(group synctestGroupInterface, conn net.Conn, timeout time.Duration) *bufferedWriter { return &bufferedWriter{ + group: group, conn: conn, byteTimeout: timeout, } @@ -310,18 +316,24 @@ func (w *bufferedWriter) Flush() error { type bufferedWriterTimeoutWriter bufferedWriter func (w *bufferedWriterTimeoutWriter) Write(p []byte) (n int, err error) { - return writeWithByteTimeout(w.conn, w.byteTimeout, p) + 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(conn net.Conn, timeout time.Duration, p []byte) (n int, err error) { +func writeWithByteTimeout(group synctestGroupInterface, conn net.Conn, timeout time.Duration, p []byte) (n int, err error) { if timeout <= 0 { return conn.Write(p) } for { - conn.SetWriteDeadline(time.Now().Add(timeout)) + 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) { @@ -407,3 +419,14 @@ func (s *sorter) SortStrings(ss []string) { // makes that struct also non-comparable, and generally doesn't add // any size (as long as it's first). type incomparable [0]func() + +// synctestGroupInterface is the methods of synctestGroup used by Server and Transport. +// It's defined as an interface here to let us keep synctestGroup entirely test-only +// and not a part of non-test builds. +type synctestGroupInterface interface { + Join() + Now() time.Time + NewTimer(d time.Duration) timer + AfterFunc(d time.Duration, f func()) timer + ContextWithTimeout(ctx context.Context, d time.Duration) (context.Context, context.CancelFunc) +} diff --git a/kubewatch/vendor/golang.org/x/net/http2/server.go b/kubewatch/vendor/golang.org/x/net/http2/server.go index bdc5520eb..51fca38f6 100644 --- a/kubewatch/vendor/golang.org/x/net/http2/server.go +++ b/kubewatch/vendor/golang.org/x/net/http2/server.go @@ -176,15 +176,44 @@ type Server struct { // so that we don't embed a Mutex in this struct, which will make the // struct non-copyable, which might break some callers. state *serverInternalState + + // Synchronization group used for testing. + // Outside of tests, this is nil. + group synctestGroupInterface +} + +func (s *Server) markNewGoroutine() { + if s.group != nil { + s.group.Join() + } +} + +func (s *Server) now() time.Time { + if s.group != nil { + return s.group.Now() + } + return time.Now() +} + +// newTimer creates a new time.Timer, or a synthetic timer in tests. +func (s *Server) newTimer(d time.Duration) timer { + if s.group != nil { + return s.group.NewTimer(d) + } + return timeTimer{time.NewTimer(d)} +} + +// afterFunc creates a new time.AfterFunc timer, or a synthetic timer in tests. +func (s *Server) afterFunc(d time.Duration, f func()) timer { + if s.group != nil { + return s.group.AfterFunc(d, f) + } + return timeTimer{time.AfterFunc(d, f)} } type serverInternalState struct { mu sync.Mutex activeConns map[*serverConn]struct{} - - // Pool of error channels. This is per-Server rather than global - // because channels can't be reused across synctest bubbles. - errChanPool sync.Pool } func (s *serverInternalState) registerConn(sc *serverConn) { @@ -216,27 +245,6 @@ func (s *serverInternalState) startGracefulShutdown() { s.mu.Unlock() } -// Global error channel pool used for uninitialized Servers. -// We use a per-Server pool when possible to avoid using channels across synctest bubbles. -var errChanPool = sync.Pool{ - New: func() any { return make(chan error, 1) }, -} - -func (s *serverInternalState) getErrChan() chan error { - if s == nil { - return errChanPool.Get().(chan error) // Server used without calling ConfigureServer - } - return s.errChanPool.Get().(chan error) -} - -func (s *serverInternalState) putErrChan(ch chan error) { - if s == nil { - errChanPool.Put(ch) // Server used without calling ConfigureServer - return - } - s.errChanPool.Put(ch) -} - // ConfigureServer adds HTTP/2 support to a net/http Server. // // The configuration conf may be nil. @@ -249,10 +257,7 @@ func ConfigureServer(s *http.Server, conf *Server) error { if conf == nil { conf = new(Server) } - conf.state = &serverInternalState{ - activeConns: make(map[*serverConn]struct{}), - errChanPool: sync.Pool{New: func() any { return make(chan error, 1) }}, - } + conf.state = &serverInternalState{activeConns: make(map[*serverConn]struct{})} if h1, h2 := s, conf; h2.IdleTimeout == 0 { if h1.IdleTimeout != 0 { h2.IdleTimeout = h1.IdleTimeout @@ -418,9 +423,6 @@ func (o *ServeConnOpts) handler() http.Handler { // // The opts parameter is optional. If nil, default values are used. func (s *Server) ServeConn(c net.Conn, opts *ServeConnOpts) { - if opts == nil { - opts = &ServeConnOpts{} - } s.serveConn(c, opts, nil) } @@ -436,7 +438,7 @@ func (s *Server) serveConn(c net.Conn, opts *ServeConnOpts, newf func(*serverCon conn: c, baseCtx: baseCtx, remoteAddrStr: c.RemoteAddr().String(), - bw: newBufferedWriter(c, conf.WriteByteTimeout), + bw: newBufferedWriter(s.group, c, conf.WriteByteTimeout), handler: opts.handler(), streams: make(map[uint32]*stream), readFrameCh: make(chan readFrameResult), @@ -636,11 +638,11 @@ type serverConn struct { pingSent bool sentPingData [8]byte goAwayCode ErrCode - shutdownTimer *time.Timer // nil until used - idleTimer *time.Timer // nil if unused + shutdownTimer timer // nil until used + idleTimer timer // nil if unused readIdleTimeout time.Duration pingTimeout time.Duration - readIdleTimer *time.Timer // nil if unused + readIdleTimer timer // nil if unused // Owned by the writeFrameAsync goroutine: headerWriteBuf bytes.Buffer @@ -685,12 +687,12 @@ type stream struct { flow outflow // limits writing from Handler to client inflow inflow // what the client is allowed to POST/etc to us state streamState - resetQueued bool // RST_STREAM queued for write; set by sc.resetStream - gotTrailerHeader bool // HEADER frame for trailers was seen - wroteHeaders bool // whether we wrote headers (not status 100) - readDeadline *time.Timer // nil if unused - writeDeadline *time.Timer // nil if unused - closeErr error // set before cw is closed + resetQueued bool // RST_STREAM queued for write; set by sc.resetStream + gotTrailerHeader bool // HEADER frame for trailers was seen + wroteHeaders bool // whether we wrote headers (not status 100) + readDeadline timer // nil if unused + writeDeadline timer // nil if unused + closeErr error // set before cw is closed trailer http.Header // accumulated trailers reqTrailer http.Header // handler's Request.Trailer @@ -846,6 +848,7 @@ type readFrameResult struct { // consumer is done with the frame. // It's run on its own goroutine. func (sc *serverConn) readFrames() { + sc.srv.markNewGoroutine() gate := make(chan struct{}) gateDone := func() { gate <- struct{}{} } for { @@ -878,6 +881,7 @@ type frameWriteResult struct { // At most one goroutine can be running writeFrameAsync at a time per // serverConn. func (sc *serverConn) writeFrameAsync(wr FrameWriteRequest, wd *writeData) { + sc.srv.markNewGoroutine() var err error if wd == nil { err = wr.write.writeFrame(sc) @@ -961,22 +965,22 @@ func (sc *serverConn) serve(conf http2Config) { sc.setConnState(http.StateIdle) if sc.srv.IdleTimeout > 0 { - sc.idleTimer = time.AfterFunc(sc.srv.IdleTimeout, sc.onIdleTimer) + sc.idleTimer = sc.srv.afterFunc(sc.srv.IdleTimeout, sc.onIdleTimer) defer sc.idleTimer.Stop() } if conf.SendPingTimeout > 0 { sc.readIdleTimeout = conf.SendPingTimeout - sc.readIdleTimer = time.AfterFunc(conf.SendPingTimeout, sc.onReadIdleTimer) + sc.readIdleTimer = sc.srv.afterFunc(conf.SendPingTimeout, sc.onReadIdleTimer) defer sc.readIdleTimer.Stop() } go sc.readFrames() // closed by defer sc.conn.Close above - settingsTimer := time.AfterFunc(firstSettingsTimeout, sc.onSettingsTimer) + settingsTimer := sc.srv.afterFunc(firstSettingsTimeout, sc.onSettingsTimer) defer settingsTimer.Stop() - lastFrameTime := time.Now() + lastFrameTime := sc.srv.now() loopNum := 0 for { loopNum++ @@ -990,7 +994,7 @@ func (sc *serverConn) serve(conf http2Config) { case res := <-sc.wroteFrameCh: sc.wroteFrame(res) case res := <-sc.readFrameCh: - lastFrameTime = time.Now() + 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 { @@ -1073,7 +1077,7 @@ func (sc *serverConn) handlePingTimer(lastFrameReadTime time.Time) { } pingAt := lastFrameReadTime.Add(sc.readIdleTimeout) - now := time.Now() + now := sc.srv.now() if pingAt.After(now) { // We received frames since arming the ping timer. // Reset it for the next possible timeout. @@ -1137,10 +1141,10 @@ func (sc *serverConn) readPreface() error { errc <- nil } }() - timer := time.NewTimer(prefaceTimeout) // TODO: configurable on *Server? + timer := sc.srv.newTimer(prefaceTimeout) // TODO: configurable on *Server? defer timer.Stop() select { - case <-timer.C: + case <-timer.C(): return errPrefaceTimeout case err := <-errc: if err == nil { @@ -1152,6 +1156,10 @@ func (sc *serverConn) readPreface() error { } } +var errChanPool = sync.Pool{ + New: func() interface{} { return make(chan error, 1) }, +} + var writeDataPool = sync.Pool{ New: func() interface{} { return new(writeData) }, } @@ -1159,7 +1167,7 @@ var writeDataPool = sync.Pool{ // writeDataFromHandler writes DATA response frames from a handler on // the given stream. func (sc *serverConn) writeDataFromHandler(stream *stream, data []byte, endStream bool) error { - ch := sc.srv.state.getErrChan() + ch := errChanPool.Get().(chan error) writeArg := writeDataPool.Get().(*writeData) *writeArg = writeData{stream.id, data, endStream} err := sc.writeFrameFromHandler(FrameWriteRequest{ @@ -1191,7 +1199,7 @@ func (sc *serverConn) writeDataFromHandler(stream *stream, data []byte, endStrea return errStreamClosed } } - sc.srv.state.putErrChan(ch) + errChanPool.Put(ch) if frameWriteDone { writeDataPool.Put(writeArg) } @@ -1505,7 +1513,7 @@ func (sc *serverConn) goAway(code ErrCode) { func (sc *serverConn) shutDownIn(d time.Duration) { sc.serveG.check() - sc.shutdownTimer = time.AfterFunc(d, sc.onShutdownTimer) + sc.shutdownTimer = sc.srv.afterFunc(d, sc.onShutdownTimer) } func (sc *serverConn) resetStream(se StreamError) { @@ -2110,7 +2118,7 @@ func (sc *serverConn) processHeaders(f *MetaHeadersFrame) error { // (in Go 1.8), though. That's a more sane option anyway. if sc.hs.ReadTimeout > 0 { sc.conn.SetReadDeadline(time.Time{}) - st.readDeadline = time.AfterFunc(sc.hs.ReadTimeout, st.onReadTimeout) + st.readDeadline = sc.srv.afterFunc(sc.hs.ReadTimeout, st.onReadTimeout) } return sc.scheduleHandler(id, rw, req, handler) @@ -2208,7 +2216,7 @@ func (sc *serverConn) newStream(id, pusherID uint32, state streamState) *stream st.flow.add(sc.initialStreamSendWindowSize) st.inflow.init(sc.initialStreamRecvWindowSize) if sc.hs.WriteTimeout > 0 { - st.writeDeadline = time.AfterFunc(sc.hs.WriteTimeout, st.onWriteTimeout) + st.writeDeadline = sc.srv.afterFunc(sc.hs.WriteTimeout, st.onWriteTimeout) } sc.streams[id] = st @@ -2397,6 +2405,7 @@ func (sc *serverConn) handlerDone() { // Run on its own goroutine. func (sc *serverConn) runHandler(rw *responseWriter, req *http.Request, handler func(http.ResponseWriter, *http.Request)) { + sc.srv.markNewGoroutine() defer sc.sendServeMsg(handlerDoneMsg) didPanic := true defer func() { @@ -2445,7 +2454,7 @@ func (sc *serverConn) writeHeaders(st *stream, headerData *writeResHeaders) erro // waiting for this frame to be written, so an http.Flush mid-handler // writes out the correct value of keys, before a handler later potentially // mutates it. - errc = sc.srv.state.getErrChan() + errc = errChanPool.Get().(chan error) } if err := sc.writeFrameFromHandler(FrameWriteRequest{ write: headerData, @@ -2457,7 +2466,7 @@ func (sc *serverConn) writeHeaders(st *stream, headerData *writeResHeaders) erro if errc != nil { select { case err := <-errc: - sc.srv.state.putErrChan(errc) + errChanPool.Put(errc) return err case <-sc.doneServing: return errClientDisconnected @@ -2564,7 +2573,7 @@ func (b *requestBody) Read(p []byte) (n int, err error) { if err == io.EOF { b.sawEOF = true } - if b.conn == nil { + if b.conn == nil && inTests { return } b.conn.noteBodyReadFromHandler(b.stream, n, err) @@ -2693,7 +2702,7 @@ func (rws *responseWriterState) writeChunk(p []byte) (n int, err error) { var date string if _, ok := rws.snapHeader["Date"]; !ok { // TODO(bradfitz): be faster here, like net/http? measure. - date = time.Now().UTC().Format(http.TimeFormat) + date = rws.conn.srv.now().UTC().Format(http.TimeFormat) } for _, v := range rws.snapHeader["Trailer"] { @@ -2815,7 +2824,7 @@ func (rws *responseWriterState) promoteUndeclaredTrailers() { func (w *responseWriter) SetReadDeadline(deadline time.Time) error { st := w.rws.stream - if !deadline.IsZero() && deadline.Before(time.Now()) { + if !deadline.IsZero() && deadline.Before(w.rws.conn.srv.now()) { // If we're setting a deadline in the past, reset the stream immediately // so writes after SetWriteDeadline returns will fail. st.onReadTimeout() @@ -2831,9 +2840,9 @@ func (w *responseWriter) SetReadDeadline(deadline time.Time) error { if deadline.IsZero() { st.readDeadline = nil } else if st.readDeadline == nil { - st.readDeadline = time.AfterFunc(deadline.Sub(time.Now()), st.onReadTimeout) + st.readDeadline = sc.srv.afterFunc(deadline.Sub(sc.srv.now()), st.onReadTimeout) } else { - st.readDeadline.Reset(deadline.Sub(time.Now())) + st.readDeadline.Reset(deadline.Sub(sc.srv.now())) } }) return nil @@ -2841,7 +2850,7 @@ func (w *responseWriter) SetReadDeadline(deadline time.Time) error { func (w *responseWriter) SetWriteDeadline(deadline time.Time) error { st := w.rws.stream - if !deadline.IsZero() && deadline.Before(time.Now()) { + if !deadline.IsZero() && deadline.Before(w.rws.conn.srv.now()) { // If we're setting a deadline in the past, reset the stream immediately // so writes after SetWriteDeadline returns will fail. st.onWriteTimeout() @@ -2857,9 +2866,9 @@ func (w *responseWriter) SetWriteDeadline(deadline time.Time) error { if deadline.IsZero() { st.writeDeadline = nil } else if st.writeDeadline == nil { - st.writeDeadline = time.AfterFunc(deadline.Sub(time.Now()), st.onWriteTimeout) + st.writeDeadline = sc.srv.afterFunc(deadline.Sub(sc.srv.now()), st.onWriteTimeout) } else { - st.writeDeadline.Reset(deadline.Sub(time.Now())) + st.writeDeadline.Reset(deadline.Sub(sc.srv.now())) } }) return nil @@ -3138,7 +3147,7 @@ func (w *responseWriter) Push(target string, opts *http.PushOptions) error { method: opts.Method, url: u, header: cloneHeader(opts.Header), - done: sc.srv.state.getErrChan(), + done: errChanPool.Get().(chan error), } select { @@ -3155,7 +3164,7 @@ func (w *responseWriter) Push(target string, opts *http.PushOptions) error { case <-st.cw: return errStreamClosed case err := <-msg.done: - sc.srv.state.putErrChan(msg.done) + errChanPool.Put(msg.done) return err } } diff --git a/kubewatch/vendor/golang.org/x/net/http2/timer.go b/kubewatch/vendor/golang.org/x/net/http2/timer.go new file mode 100644 index 000000000..0b1c17b81 --- /dev/null +++ b/kubewatch/vendor/golang.org/x/net/http2/timer.go @@ -0,0 +1,20 @@ +// 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 "time" + +// A timer is a time.Timer, as an interface which can be replaced in tests. +type timer = interface { + C() <-chan time.Time + Reset(d time.Duration) bool + Stop() bool +} + +// timeTimer adapts a time.Timer to the timer interface. +type timeTimer struct { + *time.Timer +} + +func (t timeTimer) C() <-chan time.Time { return t.Timer.C } diff --git a/kubewatch/vendor/golang.org/x/net/http2/transport.go b/kubewatch/vendor/golang.org/x/net/http2/transport.go index 1965913e5..f26356b9c 100644 --- a/kubewatch/vendor/golang.org/x/net/http2/transport.go +++ b/kubewatch/vendor/golang.org/x/net/http2/transport.go @@ -9,7 +9,6 @@ package http2 import ( "bufio" "bytes" - "compress/flate" "compress/gzip" "context" "crypto/rand" @@ -194,6 +193,50 @@ type Transport struct { type transportTestHooks struct { newclientconn func(*ClientConn) + group synctestGroupInterface +} + +func (t *Transport) markNewGoroutine() { + if t != nil && t.transportTestHooks != nil { + t.transportTestHooks.group.Join() + } +} + +func (t *Transport) now() time.Time { + if t != nil && t.transportTestHooks != nil { + return t.transportTestHooks.group.Now() + } + return time.Now() +} + +func (t *Transport) timeSince(when time.Time) time.Duration { + if t != nil && t.transportTestHooks != nil { + return t.now().Sub(when) + } + return time.Since(when) +} + +// newTimer creates a new time.Timer, or a synthetic timer in tests. +func (t *Transport) newTimer(d time.Duration) timer { + if t.transportTestHooks != nil { + return t.transportTestHooks.group.NewTimer(d) + } + return timeTimer{time.NewTimer(d)} +} + +// afterFunc creates a new time.AfterFunc timer, or a synthetic timer in tests. +func (t *Transport) afterFunc(d time.Duration, f func()) timer { + if t.transportTestHooks != nil { + return t.transportTestHooks.group.AfterFunc(d, f) + } + return timeTimer{time.AfterFunc(d, f)} +} + +func (t *Transport) contextWithTimeout(ctx context.Context, d time.Duration) (context.Context, context.CancelFunc) { + if t.transportTestHooks != nil { + return t.transportTestHooks.group.ContextWithTimeout(ctx, d) + } + return context.WithTimeout(ctx, d) } func (t *Transport) maxHeaderListSize() uint32 { @@ -323,7 +366,7 @@ type ClientConn struct { readerErr error // set before readerDone is closed idleTimeout time.Duration // or 0 for never - idleTimer *time.Timer + idleTimer timer mu sync.Mutex // guards following cond *sync.Cond // hold mu; broadcast on flow/closed changes @@ -356,7 +399,6 @@ type ClientConn struct { readIdleTimeout time.Duration pingTimeout time.Duration extendedConnectAllowed bool - strictMaxConcurrentStreams bool // rstStreamPingsBlocked works around an unfortunate gRPC behavior. // gRPC strictly limits the number of PING frames that it will receive. @@ -492,12 +534,14 @@ func (cs *clientStream) closeReqBodyLocked() { cs.reqBodyClosed = make(chan struct{}) reqBodyClosed := cs.reqBodyClosed go func() { + cs.cc.t.markNewGoroutine() cs.reqBody.Close() close(reqBodyClosed) }() } type stickyErrWriter struct { + group synctestGroupInterface conn net.Conn timeout time.Duration err *error @@ -507,7 +551,7 @@ func (sew stickyErrWriter) Write(p []byte) (n int, err error) { if *sew.err != nil { return 0, *sew.err } - n, err = writeWithByteTimeout(sew.conn, sew.timeout, p) + n, err = writeWithByteTimeout(sew.group, sew.conn, sew.timeout, p) *sew.err = err return n, err } @@ -606,9 +650,9 @@ func (t *Transport) RoundTripOpt(req *http.Request, opt RoundTripOpt) (*http.Res backoff := float64(uint(1) << (uint(retry) - 1)) backoff += backoff * (0.1 * mathrand.Float64()) d := time.Second * time.Duration(backoff) - tm := time.NewTimer(d) + tm := t.newTimer(d) select { - case <-tm.C: + case <-tm.C(): t.vlogf("RoundTrip retrying after failure: %v", roundTripErr) continue case <-req.Context().Done(): @@ -655,7 +699,6 @@ var ( errClientConnUnusable = errors.New("http2: client conn not usable") errClientConnNotEstablished = errors.New("http2: client conn could not be established") errClientConnGotGoAway = errors.New("http2: Transport received Server's graceful shutdown GOAWAY") - errClientConnForceClosed = errors.New("http2: client connection force closed via ClientConn.Close") ) // shouldRetryRequest is called by RoundTrip when a request fails to get @@ -786,8 +829,7 @@ func (t *Transport) newClientConn(c net.Conn, singleUse bool) (*ClientConn, erro initialWindowSize: 65535, // spec default initialStreamRecvWindowSize: conf.MaxUploadBufferPerStream, maxConcurrentStreams: initialMaxConcurrentStreams, // "infinite", per spec. Use a smaller value until we have received server settings. - strictMaxConcurrentStreams: conf.StrictMaxConcurrentRequests, - peerMaxHeaderListSize: 0xffffffffffffffff, // "infinite", per spec. Use 2^64-1 instead. + peerMaxHeaderListSize: 0xffffffffffffffff, // "infinite", per spec. Use 2^64-1 instead. streams: make(map[uint32]*clientStream), singleUse: singleUse, seenSettingsChan: make(chan struct{}), @@ -796,11 +838,14 @@ func (t *Transport) newClientConn(c net.Conn, singleUse bool) (*ClientConn, erro pingTimeout: conf.PingTimeout, pings: make(map[[8]byte]chan struct{}), reqHeaderMu: make(chan struct{}, 1), - lastActive: time.Now(), + lastActive: t.now(), } + 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()) @@ -812,6 +857,7 @@ 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: conf.WriteByteTimeout, err: &cc.werr, @@ -860,7 +906,7 @@ func (t *Transport) newClientConn(c net.Conn, singleUse bool) (*ClientConn, erro // Start the idle timer after the connection is fully initialized. if d := t.idleConnTimeout(); d != 0 { cc.idleTimeout = d - cc.idleTimer = time.AfterFunc(d, cc.onIdleTimeout) + cc.idleTimer = t.afterFunc(d, cc.onIdleTimeout) } go cc.readLoop() @@ -871,7 +917,7 @@ func (cc *ClientConn) healthCheck() { 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 := context.WithTimeout(context.Background(), pingTimeout) + ctx, cancel := cc.t.contextWithTimeout(context.Background(), pingTimeout) defer cancel() cc.vlogf("http2: Transport sending health check") err := cc.Ping(ctx) @@ -1021,7 +1067,7 @@ func (cc *ClientConn) idleStateLocked() (st clientConnIdleState) { return } var maxConcurrentOkay bool - if cc.strictMaxConcurrentStreams { + if cc.t.StrictMaxConcurrentStreams { // We'll tell the caller we can take a new request to // prevent the caller from dialing a new TCP // connection, but then we'll block later before @@ -1074,7 +1120,7 @@ func (cc *ClientConn) tooIdleLocked() bool { // times are compared based on their wall time. We don't want // to reuse a connection that's been sitting idle during // VM/laptop suspend if monotonic time was also frozen. - return cc.idleTimeout != 0 && !cc.lastIdle.IsZero() && time.Since(cc.lastIdle.Round(0)) > cc.idleTimeout + return cc.idleTimeout != 0 && !cc.lastIdle.IsZero() && cc.t.timeSince(cc.lastIdle.Round(0)) > cc.idleTimeout } // onIdleTimeout is called from a time.AfterFunc goroutine. It will @@ -1140,6 +1186,7 @@ func (cc *ClientConn) Shutdown(ctx context.Context) error { done := make(chan struct{}) cancelled := false // guarded by cc.mu go func() { + cc.t.markNewGoroutine() cc.mu.Lock() defer cc.mu.Unlock() for { @@ -1210,7 +1257,8 @@ func (cc *ClientConn) closeForError(err error) { // // In-flight requests are interrupted. For a graceful shutdown, use Shutdown instead. func (cc *ClientConn) Close() error { - cc.closeForError(errClientConnForceClosed) + err := errors.New("http2: client connection force closed via ClientConn.Close") + cc.closeForError(err) return nil } @@ -1379,6 +1427,7 @@ func (cc *ClientConn) roundTrip(req *http.Request, streamf func(*clientStream)) // // It sends the request and performs post-request cleanup (closing Request.Body, etc.). func (cs *clientStream) doRequest(req *http.Request, streamf func(*clientStream)) { + cs.cc.t.markNewGoroutine() err := cs.writeRequest(req, streamf) cs.cleanupWriteRequest(err) } @@ -1509,9 +1558,9 @@ func (cs *clientStream) writeRequest(req *http.Request, streamf func(*clientStre var respHeaderTimer <-chan time.Time var respHeaderRecv chan struct{} if d := cc.responseHeaderTimeout(); d != 0 { - timer := time.NewTimer(d) + timer := cc.t.newTimer(d) defer timer.Stop() - respHeaderTimer = timer.C + respHeaderTimer = timer.C() respHeaderRecv = cs.respHeaderRecv } // Wait until the peer half-closes its end of the stream, @@ -1704,7 +1753,7 @@ func (cc *ClientConn) awaitOpenSlotForStreamLocked(cs *clientStream) error { // Return a fatal error which aborts the retry loop. return errClientConnNotEstablished } - cc.lastActive = time.Now() + cc.lastActive = cc.t.now() if cc.closed || !cc.canTakeNewRequestLocked() { return errClientConnUnusable } @@ -2043,10 +2092,10 @@ func (cc *ClientConn) forgetStreamID(id uint32) { if len(cc.streams) != slen-1 { panic("forgetting unknown stream id") } - cc.lastActive = time.Now() + cc.lastActive = cc.t.now() if len(cc.streams) == 0 && cc.idleTimer != nil { cc.idleTimer.Reset(cc.idleTimeout) - cc.lastIdle = time.Now() + cc.lastIdle = cc.t.now() } // Wake up writeRequestBody via clientStream.awaitFlowControl and // wake up RoundTrip if there is a pending request. @@ -2072,6 +2121,7 @@ type clientConnReadLoop struct { // readLoop runs in its own goroutine and reads and dispatches frames. func (cc *ClientConn) readLoop() { + cc.t.markNewGoroutine() rl := &clientConnReadLoop{cc: cc} defer rl.cleanup() cc.readerErr = rl.run() @@ -2138,9 +2188,9 @@ func (rl *clientConnReadLoop) cleanup() { if cc.idleTimeout > 0 && unusedWaitTime > cc.idleTimeout { unusedWaitTime = cc.idleTimeout } - idleTime := time.Now().Sub(cc.lastActive) + idleTime := cc.t.now().Sub(cc.lastActive) if atomic.LoadUint32(&cc.atomicReused) == 0 && idleTime < unusedWaitTime && !cc.closedOnIdle { - cc.idleTimer = time.AfterFunc(unusedWaitTime-idleTime, func() { + cc.idleTimer = cc.t.afterFunc(unusedWaitTime-idleTime, func() { cc.t.connPool().MarkDead(cc) }) } else { @@ -2200,9 +2250,9 @@ func (rl *clientConnReadLoop) run() error { cc := rl.cc gotSettings := false readIdleTimeout := cc.readIdleTimeout - var t *time.Timer + var t timer if readIdleTimeout != 0 { - t = time.AfterFunc(readIdleTimeout, cc.healthCheck) + t = cc.t.afterFunc(readIdleTimeout, cc.healthCheck) } for { f, err := cc.fr.ReadFrame() @@ -2948,6 +2998,7 @@ func (cc *ClientConn) Ping(ctx context.Context) error { var pingError error errc := make(chan struct{}) go func() { + cc.t.markNewGoroutine() cc.wmu.Lock() defer cc.wmu.Unlock() if pingError = cc.fr.WritePing(false, p); pingError != nil { @@ -3077,102 +3128,35 @@ type erringRoundTripper struct{ err error } func (rt erringRoundTripper) RoundTripErr() error { return rt.err } func (rt erringRoundTripper) RoundTrip(*http.Request) (*http.Response, error) { return nil, rt.err } -var errConcurrentReadOnResBody = errors.New("http2: concurrent read on response body") - // gzipReader wraps a response body so it can lazily -// get gzip.Reader from the pool on the first call to Read. -// After Close is called it puts gzip.Reader to the pool immediately -// if there is no Read in progress or later when Read completes. +// call gzip.NewReader on the first call to Read type gzipReader struct { _ incomparable body io.ReadCloser // underlying Response.Body - mu sync.Mutex // guards zr and zerr - zr *gzip.Reader // stores gzip reader from the pool between reads - zerr error // sticky gzip reader init error or sentinel value to detect concurrent read and read after close -} - -type eofReader struct{} - -func (eofReader) Read([]byte) (int, error) { return 0, io.EOF } -func (eofReader) ReadByte() (byte, error) { return 0, io.EOF } - -var gzipPool = sync.Pool{New: func() any { return new(gzip.Reader) }} - -// gzipPoolGet gets a gzip.Reader from the pool and resets it to read from r. -func gzipPoolGet(r io.Reader) (*gzip.Reader, error) { - zr := gzipPool.Get().(*gzip.Reader) - if err := zr.Reset(r); err != nil { - gzipPoolPut(zr) - return nil, err - } - return zr, nil -} - -// gzipPoolPut puts a gzip.Reader back into the pool. -func gzipPoolPut(zr *gzip.Reader) { - // Reset will allocate bufio.Reader if we pass it anything - // other than a flate.Reader, so ensure that it's getting one. - var r flate.Reader = eofReader{} - zr.Reset(r) - gzipPool.Put(zr) + zr *gzip.Reader // lazily-initialized gzip reader + zerr error // sticky error } -// acquire returns a gzip.Reader for reading response body. -// The reader must be released after use. -func (gz *gzipReader) acquire() (*gzip.Reader, error) { - gz.mu.Lock() - defer gz.mu.Unlock() +func (gz *gzipReader) Read(p []byte) (n int, err error) { if gz.zerr != nil { - return nil, gz.zerr + return 0, gz.zerr } if gz.zr == nil { - gz.zr, gz.zerr = gzipPoolGet(gz.body) - if gz.zerr != nil { - return nil, gz.zerr + gz.zr, err = gzip.NewReader(gz.body) + if err != nil { + gz.zerr = err + return 0, err } } - ret := gz.zr - gz.zr, gz.zerr = nil, errConcurrentReadOnResBody - return ret, nil -} - -// release returns the gzip.Reader to the pool if Close was called during Read. -func (gz *gzipReader) release(zr *gzip.Reader) { - gz.mu.Lock() - defer gz.mu.Unlock() - if gz.zerr == errConcurrentReadOnResBody { - gz.zr, gz.zerr = zr, nil - } else { // fs.ErrClosed - gzipPoolPut(zr) - } + return gz.zr.Read(p) } -// close returns the gzip.Reader to the pool immediately or -// signals release to do so after Read completes. -func (gz *gzipReader) close() { - gz.mu.Lock() - defer gz.mu.Unlock() - if gz.zerr == nil && gz.zr != nil { - gzipPoolPut(gz.zr) - gz.zr = nil +func (gz *gzipReader) Close() error { + if err := gz.body.Close(); err != nil { + return err } gz.zerr = fs.ErrClosed -} - -func (gz *gzipReader) Read(p []byte) (n int, err error) { - zr, err := gz.acquire() - if err != nil { - return 0, err - } - defer gz.release(zr) - - return zr.Read(p) -} - -func (gz *gzipReader) Close() error { - gz.close() - - return gz.body.Close() + return nil } type errorReader struct{ err error } @@ -3244,7 +3228,7 @@ func traceGotConn(req *http.Request, cc *ClientConn, reused bool) { cc.mu.Lock() ci.WasIdle = len(cc.streams) == 0 && reused if ci.WasIdle && !cc.lastActive.IsZero() { - ci.IdleTime = time.Since(cc.lastActive) + ci.IdleTime = cc.t.timeSince(cc.lastActive) } cc.mu.Unlock() diff --git a/kubewatch/vendor/golang.org/x/net/http2/writesched.go b/kubewatch/vendor/golang.org/x/net/http2/writesched.go index 7de27be52..cc893adc2 100644 --- a/kubewatch/vendor/golang.org/x/net/http2/writesched.go +++ b/kubewatch/vendor/golang.org/x/net/http2/writesched.go @@ -42,8 +42,6 @@ type OpenStreamOptions struct { // PusherID is zero if the stream was initiated by the client. Otherwise, // PusherID names the stream that pushed the newly opened stream. PusherID uint32 - // priority is used to set the priority of the newly opened stream. - priority PriorityParam } // FrameWriteRequest is a request to write a frame. @@ -185,75 +183,45 @@ func (wr *FrameWriteRequest) replyToWriter(err error) { } // writeQueue is used by implementations of WriteScheduler. -// -// Each writeQueue contains a queue of FrameWriteRequests, meant to store all -// FrameWriteRequests associated with a given stream. This is implemented as a -// two-stage queue: currQueue[currPos:] and nextQueue. Removing an item is done -// by incrementing currPos of currQueue. Adding an item is done by appending it -// to the nextQueue. If currQueue is empty when trying to remove an item, we -// can swap currQueue and nextQueue to remedy the situation. -// This two-stage queue is analogous to the use of two lists in Okasaki's -// purely functional queue but without the overhead of reversing the list when -// swapping stages. -// -// writeQueue also contains prev and next, this can be used by implementations -// of WriteScheduler to construct data structures that represent the order of -// writing between different streams (e.g. circular linked list). type writeQueue struct { - currQueue []FrameWriteRequest - nextQueue []FrameWriteRequest - currPos int - + s []FrameWriteRequest prev, next *writeQueue } -func (q *writeQueue) empty() bool { - return (len(q.currQueue) - q.currPos + len(q.nextQueue)) == 0 -} +func (q *writeQueue) empty() bool { return len(q.s) == 0 } func (q *writeQueue) push(wr FrameWriteRequest) { - q.nextQueue = append(q.nextQueue, wr) + q.s = append(q.s, wr) } func (q *writeQueue) shift() FrameWriteRequest { - if q.empty() { + if len(q.s) == 0 { panic("invalid use of queue") } - if q.currPos >= len(q.currQueue) { - q.currQueue, q.currPos, q.nextQueue = q.nextQueue, 0, q.currQueue[:0] - } - wr := q.currQueue[q.currPos] - q.currQueue[q.currPos] = FrameWriteRequest{} - q.currPos++ + wr := q.s[0] + // TODO: less copy-happy queue. + copy(q.s, q.s[1:]) + q.s[len(q.s)-1] = FrameWriteRequest{} + q.s = q.s[:len(q.s)-1] return wr } -func (q *writeQueue) peek() *FrameWriteRequest { - if q.currPos < len(q.currQueue) { - return &q.currQueue[q.currPos] - } - if len(q.nextQueue) > 0 { - return &q.nextQueue[0] - } - return nil -} - // consume consumes up to n bytes from q.s[0]. If the frame is // entirely consumed, it is removed from the queue. If the frame // is partially consumed, the frame is kept with the consumed // bytes removed. Returns true iff any bytes were consumed. func (q *writeQueue) consume(n int32) (FrameWriteRequest, bool) { - if q.empty() { + if len(q.s) == 0 { return FrameWriteRequest{}, false } - consumed, rest, numresult := q.peek().Consume(n) + consumed, rest, numresult := q.s[0].Consume(n) switch numresult { case 0: return FrameWriteRequest{}, false case 1: q.shift() case 2: - *q.peek() = rest + q.s[0] = rest } return consumed, true } @@ -262,15 +230,10 @@ type writeQueuePool []*writeQueue // put inserts an unused writeQueue into the pool. func (p *writeQueuePool) put(q *writeQueue) { - for i := range q.currQueue { - q.currQueue[i] = FrameWriteRequest{} - } - for i := range q.nextQueue { - q.nextQueue[i] = FrameWriteRequest{} + for i := range q.s { + q.s[i] = FrameWriteRequest{} } - q.currQueue = q.currQueue[:0] - q.nextQueue = q.nextQueue[:0] - q.currPos = 0 + q.s = q.s[:0] *p = append(*p, q) } diff --git a/kubewatch/vendor/golang.org/x/net/http2/writesched_priority_rfc7540.go b/kubewatch/vendor/golang.org/x/net/http2/writesched_priority.go similarity index 77% rename from kubewatch/vendor/golang.org/x/net/http2/writesched_priority_rfc7540.go rename to kubewatch/vendor/golang.org/x/net/http2/writesched_priority.go index 4e33c29a2..f6783339d 100644 --- a/kubewatch/vendor/golang.org/x/net/http2/writesched_priority_rfc7540.go +++ b/kubewatch/vendor/golang.org/x/net/http2/writesched_priority.go @@ -11,7 +11,7 @@ import ( ) // RFC 7540, Section 5.3.5: the default weight is 16. -const priorityDefaultWeightRFC7540 = 15 // 16 = 15 + 1 +const priorityDefaultWeight = 15 // 16 = 15 + 1 // PriorityWriteSchedulerConfig configures a priorityWriteScheduler. type PriorityWriteSchedulerConfig struct { @@ -66,8 +66,8 @@ func NewPriorityWriteScheduler(cfg *PriorityWriteSchedulerConfig) WriteScheduler } } - ws := &priorityWriteSchedulerRFC7540{ - nodes: make(map[uint32]*priorityNodeRFC7540), + ws := &priorityWriteScheduler{ + nodes: make(map[uint32]*priorityNode), maxClosedNodesInTree: cfg.MaxClosedNodesInTree, maxIdleNodesInTree: cfg.MaxIdleNodesInTree, enableWriteThrottle: cfg.ThrottleOutOfOrderWrites, @@ -81,32 +81,32 @@ func NewPriorityWriteScheduler(cfg *PriorityWriteSchedulerConfig) WriteScheduler return ws } -type priorityNodeStateRFC7540 int +type priorityNodeState int const ( - priorityNodeOpenRFC7540 priorityNodeStateRFC7540 = iota - priorityNodeClosedRFC7540 - priorityNodeIdleRFC7540 + priorityNodeOpen priorityNodeState = iota + priorityNodeClosed + priorityNodeIdle ) -// priorityNodeRFC7540 is a node in an HTTP/2 priority tree. +// priorityNode is a node in an HTTP/2 priority tree. // Each node is associated with a single stream ID. // See RFC 7540, Section 5.3. -type priorityNodeRFC7540 struct { - q writeQueue // queue of pending frames to write - id uint32 // id of the stream, or 0 for the root of the tree - weight uint8 // the actual weight is weight+1, so the value is in [1,256] - state priorityNodeStateRFC7540 // open | closed | idle - bytes int64 // number of bytes written by this node, or 0 if closed - subtreeBytes int64 // sum(node.bytes) of all nodes in this subtree +type priorityNode struct { + q writeQueue // queue of pending frames to write + id uint32 // id of the stream, or 0 for the root of the tree + weight uint8 // the actual weight is weight+1, so the value is in [1,256] + state priorityNodeState // open | closed | idle + bytes int64 // number of bytes written by this node, or 0 if closed + subtreeBytes int64 // sum(node.bytes) of all nodes in this subtree // These links form the priority tree. - parent *priorityNodeRFC7540 - kids *priorityNodeRFC7540 // start of the kids list - prev, next *priorityNodeRFC7540 // doubly-linked list of siblings + parent *priorityNode + kids *priorityNode // start of the kids list + prev, next *priorityNode // doubly-linked list of siblings } -func (n *priorityNodeRFC7540) setParent(parent *priorityNodeRFC7540) { +func (n *priorityNode) setParent(parent *priorityNode) { if n == parent { panic("setParent to self") } @@ -141,7 +141,7 @@ func (n *priorityNodeRFC7540) setParent(parent *priorityNodeRFC7540) { } } -func (n *priorityNodeRFC7540) addBytes(b int64) { +func (n *priorityNode) addBytes(b int64) { n.bytes += b for ; n != nil; n = n.parent { n.subtreeBytes += b @@ -154,7 +154,7 @@ func (n *priorityNodeRFC7540) addBytes(b int64) { // // f(n, openParent) takes two arguments: the node to visit, n, and a bool that is true // if any ancestor p of n is still open (ignoring the root node). -func (n *priorityNodeRFC7540) walkReadyInOrder(openParent bool, tmp *[]*priorityNodeRFC7540, f func(*priorityNodeRFC7540, bool) bool) bool { +func (n *priorityNode) walkReadyInOrder(openParent bool, tmp *[]*priorityNode, f func(*priorityNode, bool) bool) bool { if !n.q.empty() && f(n, openParent) { return true } @@ -165,7 +165,7 @@ func (n *priorityNodeRFC7540) walkReadyInOrder(openParent bool, tmp *[]*priority // Don't consider the root "open" when updating openParent since // we can't send data frames on the root stream (only control frames). if n.id != 0 { - openParent = openParent || (n.state == priorityNodeOpenRFC7540) + openParent = openParent || (n.state == priorityNodeOpen) } // Common case: only one kid or all kids have the same weight. @@ -195,7 +195,7 @@ func (n *priorityNodeRFC7540) walkReadyInOrder(openParent bool, tmp *[]*priority *tmp = append(*tmp, n.kids) n.kids.setParent(nil) } - sort.Sort(sortPriorityNodeSiblingsRFC7540(*tmp)) + sort.Sort(sortPriorityNodeSiblings(*tmp)) for i := len(*tmp) - 1; i >= 0; i-- { (*tmp)[i].setParent(n) // setParent inserts at the head of n.kids } @@ -207,15 +207,15 @@ func (n *priorityNodeRFC7540) walkReadyInOrder(openParent bool, tmp *[]*priority return false } -type sortPriorityNodeSiblingsRFC7540 []*priorityNodeRFC7540 +type sortPriorityNodeSiblings []*priorityNode -func (z sortPriorityNodeSiblingsRFC7540) Len() int { return len(z) } -func (z sortPriorityNodeSiblingsRFC7540) Swap(i, k int) { z[i], z[k] = z[k], z[i] } -func (z sortPriorityNodeSiblingsRFC7540) Less(i, k int) bool { +func (z sortPriorityNodeSiblings) Len() int { return len(z) } +func (z sortPriorityNodeSiblings) Swap(i, k int) { z[i], z[k] = z[k], z[i] } +func (z sortPriorityNodeSiblings) Less(i, k int) bool { // Prefer the subtree that has sent fewer bytes relative to its weight. // See sections 5.3.2 and 5.3.4. - wi, bi := float64(z[i].weight)+1, float64(z[i].subtreeBytes) - wk, bk := float64(z[k].weight)+1, float64(z[k].subtreeBytes) + wi, bi := float64(z[i].weight+1), float64(z[i].subtreeBytes) + wk, bk := float64(z[k].weight+1), float64(z[k].subtreeBytes) if bi == 0 && bk == 0 { return wi >= wk } @@ -225,13 +225,13 @@ func (z sortPriorityNodeSiblingsRFC7540) Less(i, k int) bool { return bi/bk <= wi/wk } -type priorityWriteSchedulerRFC7540 struct { +type priorityWriteScheduler struct { // root is the root of the priority tree, where root.id = 0. // The root queues control frames that are not associated with any stream. - root priorityNodeRFC7540 + root priorityNode // nodes maps stream ids to priority tree nodes. - nodes map[uint32]*priorityNodeRFC7540 + nodes map[uint32]*priorityNode // maxID is the maximum stream id in nodes. maxID uint32 @@ -239,7 +239,7 @@ type priorityWriteSchedulerRFC7540 struct { // lists of nodes that have been closed or are idle, but are kept in // the tree for improved prioritization. When the lengths exceed either // maxClosedNodesInTree or maxIdleNodesInTree, old nodes are discarded. - closedNodes, idleNodes []*priorityNodeRFC7540 + closedNodes, idleNodes []*priorityNode // From the config. maxClosedNodesInTree int @@ -248,19 +248,19 @@ type priorityWriteSchedulerRFC7540 struct { enableWriteThrottle bool // tmp is scratch space for priorityNode.walkReadyInOrder to reduce allocations. - tmp []*priorityNodeRFC7540 + tmp []*priorityNode // pool of empty queues for reuse. queuePool writeQueuePool } -func (ws *priorityWriteSchedulerRFC7540) OpenStream(streamID uint32, options OpenStreamOptions) { +func (ws *priorityWriteScheduler) OpenStream(streamID uint32, options OpenStreamOptions) { // The stream may be currently idle but cannot be opened or closed. if curr := ws.nodes[streamID]; curr != nil { - if curr.state != priorityNodeIdleRFC7540 { + if curr.state != priorityNodeIdle { panic(fmt.Sprintf("stream %d already opened", streamID)) } - curr.state = priorityNodeOpenRFC7540 + curr.state = priorityNodeOpen return } @@ -272,11 +272,11 @@ func (ws *priorityWriteSchedulerRFC7540) OpenStream(streamID uint32, options Ope if parent == nil { parent = &ws.root } - n := &priorityNodeRFC7540{ + n := &priorityNode{ q: *ws.queuePool.get(), id: streamID, - weight: priorityDefaultWeightRFC7540, - state: priorityNodeOpenRFC7540, + weight: priorityDefaultWeight, + state: priorityNodeOpen, } n.setParent(parent) ws.nodes[streamID] = n @@ -285,23 +285,24 @@ func (ws *priorityWriteSchedulerRFC7540) OpenStream(streamID uint32, options Ope } } -func (ws *priorityWriteSchedulerRFC7540) CloseStream(streamID uint32) { +func (ws *priorityWriteScheduler) CloseStream(streamID uint32) { if streamID == 0 { panic("violation of WriteScheduler interface: cannot close stream 0") } if ws.nodes[streamID] == nil { panic(fmt.Sprintf("violation of WriteScheduler interface: unknown stream %d", streamID)) } - if ws.nodes[streamID].state != priorityNodeOpenRFC7540 { + if ws.nodes[streamID].state != priorityNodeOpen { panic(fmt.Sprintf("violation of WriteScheduler interface: stream %d already closed", streamID)) } n := ws.nodes[streamID] - n.state = priorityNodeClosedRFC7540 + n.state = priorityNodeClosed n.addBytes(-n.bytes) q := n.q ws.queuePool.put(&q) + n.q.s = nil if ws.maxClosedNodesInTree > 0 { ws.addClosedOrIdleNode(&ws.closedNodes, ws.maxClosedNodesInTree, n) } else { @@ -309,7 +310,7 @@ func (ws *priorityWriteSchedulerRFC7540) CloseStream(streamID uint32) { } } -func (ws *priorityWriteSchedulerRFC7540) AdjustStream(streamID uint32, priority PriorityParam) { +func (ws *priorityWriteScheduler) AdjustStream(streamID uint32, priority PriorityParam) { if streamID == 0 { panic("adjustPriority on root") } @@ -323,11 +324,11 @@ func (ws *priorityWriteSchedulerRFC7540) AdjustStream(streamID uint32, priority return } ws.maxID = streamID - n = &priorityNodeRFC7540{ + n = &priorityNode{ q: *ws.queuePool.get(), id: streamID, - weight: priorityDefaultWeightRFC7540, - state: priorityNodeIdleRFC7540, + weight: priorityDefaultWeight, + state: priorityNodeIdle, } n.setParent(&ws.root) ws.nodes[streamID] = n @@ -339,7 +340,7 @@ func (ws *priorityWriteSchedulerRFC7540) AdjustStream(streamID uint32, priority parent := ws.nodes[priority.StreamDep] if parent == nil { n.setParent(&ws.root) - n.weight = priorityDefaultWeightRFC7540 + n.weight = priorityDefaultWeight return } @@ -380,8 +381,8 @@ func (ws *priorityWriteSchedulerRFC7540) AdjustStream(streamID uint32, priority n.weight = priority.Weight } -func (ws *priorityWriteSchedulerRFC7540) Push(wr FrameWriteRequest) { - var n *priorityNodeRFC7540 +func (ws *priorityWriteScheduler) Push(wr FrameWriteRequest) { + var n *priorityNode if wr.isControl() { n = &ws.root } else { @@ -400,8 +401,8 @@ func (ws *priorityWriteSchedulerRFC7540) Push(wr FrameWriteRequest) { n.q.push(wr) } -func (ws *priorityWriteSchedulerRFC7540) Pop() (wr FrameWriteRequest, ok bool) { - ws.root.walkReadyInOrder(false, &ws.tmp, func(n *priorityNodeRFC7540, openParent bool) bool { +func (ws *priorityWriteScheduler) Pop() (wr FrameWriteRequest, ok bool) { + ws.root.walkReadyInOrder(false, &ws.tmp, func(n *priorityNode, openParent bool) bool { limit := int32(math.MaxInt32) if openParent { limit = ws.writeThrottleLimit @@ -427,7 +428,7 @@ func (ws *priorityWriteSchedulerRFC7540) Pop() (wr FrameWriteRequest, ok bool) { return wr, ok } -func (ws *priorityWriteSchedulerRFC7540) addClosedOrIdleNode(list *[]*priorityNodeRFC7540, maxSize int, n *priorityNodeRFC7540) { +func (ws *priorityWriteScheduler) addClosedOrIdleNode(list *[]*priorityNode, maxSize int, n *priorityNode) { if maxSize == 0 { return } @@ -441,7 +442,7 @@ func (ws *priorityWriteSchedulerRFC7540) addClosedOrIdleNode(list *[]*priorityNo *list = append(*list, n) } -func (ws *priorityWriteSchedulerRFC7540) removeNode(n *priorityNodeRFC7540) { +func (ws *priorityWriteScheduler) removeNode(n *priorityNode) { for n.kids != nil { n.kids.setParent(n.parent) } diff --git a/kubewatch/vendor/golang.org/x/net/http2/writesched_priority_rfc9218.go b/kubewatch/vendor/golang.org/x/net/http2/writesched_priority_rfc9218.go deleted file mode 100644 index cb4cadc32..000000000 --- a/kubewatch/vendor/golang.org/x/net/http2/writesched_priority_rfc9218.go +++ /dev/null @@ -1,209 +0,0 @@ -// Copyright 2025 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 ( - "fmt" - "math" -) - -type streamMetadata struct { - location *writeQueue - priority PriorityParam -} - -type priorityWriteSchedulerRFC9218 struct { - // control contains control frames (SETTINGS, PING, etc.). - control writeQueue - - // heads contain the head of a circular list of streams. - // We put these heads within a nested array that represents urgency and - // incremental, as defined in - // https://www.rfc-editor.org/rfc/rfc9218.html#name-priority-parameters. - // 8 represents u=0 up to u=7, and 2 represents i=false and i=true. - heads [8][2]*writeQueue - - // streams contains a mapping between each stream ID and their metadata, so - // we can quickly locate them when needing to, for example, adjust their - // priority. - streams map[uint32]streamMetadata - - // queuePool are empty queues for reuse. - queuePool writeQueuePool - - // prioritizeIncremental is used to determine whether we should prioritize - // incremental streams or not, when urgency is the same in a given Pop() - // call. - prioritizeIncremental bool -} - -func newPriorityWriteSchedulerRFC9218() WriteScheduler { - ws := &priorityWriteSchedulerRFC9218{ - streams: make(map[uint32]streamMetadata), - } - return ws -} - -func (ws *priorityWriteSchedulerRFC9218) OpenStream(streamID uint32, opt OpenStreamOptions) { - if ws.streams[streamID].location != nil { - panic(fmt.Errorf("stream %d already opened", streamID)) - } - q := ws.queuePool.get() - ws.streams[streamID] = streamMetadata{ - location: q, - priority: opt.priority, - } - - u, i := opt.priority.urgency, opt.priority.incremental - if ws.heads[u][i] == nil { - ws.heads[u][i] = q - q.next = q - q.prev = q - } else { - // Queues are stored in a ring. - // Insert the new stream before ws.head, putting it at the end of the list. - q.prev = ws.heads[u][i].prev - q.next = ws.heads[u][i] - q.prev.next = q - q.next.prev = q - } -} - -func (ws *priorityWriteSchedulerRFC9218) CloseStream(streamID uint32) { - metadata := ws.streams[streamID] - q, u, i := metadata.location, metadata.priority.urgency, metadata.priority.incremental - if q == nil { - return - } - if q.next == q { - // This was the only open stream. - ws.heads[u][i] = nil - } else { - q.prev.next = q.next - q.next.prev = q.prev - if ws.heads[u][i] == q { - ws.heads[u][i] = q.next - } - } - delete(ws.streams, streamID) - ws.queuePool.put(q) -} - -func (ws *priorityWriteSchedulerRFC9218) AdjustStream(streamID uint32, priority PriorityParam) { - metadata := ws.streams[streamID] - q, u, i := metadata.location, metadata.priority.urgency, metadata.priority.incremental - if q == nil { - return - } - - // Remove stream from current location. - if q.next == q { - // This was the only open stream. - ws.heads[u][i] = nil - } else { - q.prev.next = q.next - q.next.prev = q.prev - if ws.heads[u][i] == q { - ws.heads[u][i] = q.next - } - } - - // Insert stream to the new queue. - u, i = priority.urgency, priority.incremental - if ws.heads[u][i] == nil { - ws.heads[u][i] = q - q.next = q - q.prev = q - } else { - // Queues are stored in a ring. - // Insert the new stream before ws.head, putting it at the end of the list. - q.prev = ws.heads[u][i].prev - q.next = ws.heads[u][i] - q.prev.next = q - q.next.prev = q - } - - // Update the metadata. - ws.streams[streamID] = streamMetadata{ - location: q, - priority: priority, - } -} - -func (ws *priorityWriteSchedulerRFC9218) Push(wr FrameWriteRequest) { - if wr.isControl() { - ws.control.push(wr) - return - } - q := ws.streams[wr.StreamID()].location - if q == nil { - // This is a closed stream. - // wr should not be a HEADERS or DATA frame. - // We push the request onto the control queue. - if wr.DataSize() > 0 { - panic("add DATA on non-open stream") - } - ws.control.push(wr) - return - } - q.push(wr) -} - -func (ws *priorityWriteSchedulerRFC9218) Pop() (FrameWriteRequest, bool) { - // Control and RST_STREAM frames first. - if !ws.control.empty() { - return ws.control.shift(), true - } - - // On the next Pop(), we want to prioritize incremental if we prioritized - // non-incremental request of the same urgency this time. Vice-versa. - // i.e. when there are incremental and non-incremental requests at the same - // priority, we give 50% of our bandwidth to the incremental ones in - // aggregate and 50% to the first non-incremental one (since - // non-incremental streams do not use round-robin writes). - ws.prioritizeIncremental = !ws.prioritizeIncremental - - // Always prioritize lowest u (i.e. highest urgency level). - for u := range ws.heads { - for i := range ws.heads[u] { - // When we want to prioritize incremental, we try to pop i=true - // first before i=false when u is the same. - if ws.prioritizeIncremental { - i = (i + 1) % 2 - } - q := ws.heads[u][i] - if q == nil { - continue - } - for { - if wr, ok := q.consume(math.MaxInt32); ok { - if i == 1 { - // For incremental streams, we update head to q.next so - // we can round-robin between multiple streams that can - // immediately benefit from partial writes. - ws.heads[u][i] = q.next - } else { - // For non-incremental streams, we try to finish one to - // completion rather than doing round-robin. However, - // we update head here so that if q.consume() is !ok - // (e.g. the stream has no more frame to consume), head - // is updated to the next q that has frames to consume - // on future iterations. This way, we do not prioritize - // writing to unavailable stream on next Pop() calls, - // preventing head-of-line blocking. - ws.heads[u][i] = q - } - return wr, true - } - q = q.next - if q == ws.heads[u][i] { - break - } - } - - } - } - return FrameWriteRequest{}, false -} diff --git a/kubewatch/vendor/golang.org/x/net/http2/writesched_roundrobin.go b/kubewatch/vendor/golang.org/x/net/http2/writesched_roundrobin.go index 737cff9ec..54fe86322 100644 --- a/kubewatch/vendor/golang.org/x/net/http2/writesched_roundrobin.go +++ b/kubewatch/vendor/golang.org/x/net/http2/writesched_roundrobin.go @@ -25,7 +25,7 @@ type roundRobinWriteScheduler struct { } // newRoundRobinWriteScheduler constructs a new write scheduler. -// The round robin scheduler prioritizes control frames +// The round robin scheduler priorizes control frames // like SETTINGS and PING over DATA frames. // When there are no control frames to send, it performs a round-robin // selection from the ready streams. diff --git a/kubewatch/vendor/golang.org/x/net/internal/httpcommon/request.go b/kubewatch/vendor/golang.org/x/net/internal/httpcommon/request.go index 1e10f89eb..4b7055317 100644 --- a/kubewatch/vendor/golang.org/x/net/internal/httpcommon/request.go +++ b/kubewatch/vendor/golang.org/x/net/internal/httpcommon/request.go @@ -51,7 +51,7 @@ type EncodeHeadersParam struct { DefaultUserAgent string } -// EncodeHeadersResult is the result of EncodeHeaders. +// EncodeHeadersParam is the result of EncodeHeaders. type EncodeHeadersResult struct { HasBody bool HasTrailers bool @@ -399,7 +399,7 @@ type ServerRequestResult struct { // If the request should be rejected, this is a short string suitable for passing // to the http2 package's CountError function. - // It might be a bit odd to return errors this way rather than returning an error, + // It might be a bit odd to return errors this way rather than returing an error, // but this ensures we don't forget to include a CountError reason. InvalidReason string } diff --git a/kubewatch/vendor/golang.org/x/net/internal/socks/socks.go b/kubewatch/vendor/golang.org/x/net/internal/socks/socks.go index 8eedb84ce..84fcc32b6 100644 --- a/kubewatch/vendor/golang.org/x/net/internal/socks/socks.go +++ b/kubewatch/vendor/golang.org/x/net/internal/socks/socks.go @@ -297,7 +297,7 @@ func (up *UsernamePassword) Authenticate(ctx context.Context, rw io.ReadWriter, b = append(b, up.Username...) b = append(b, byte(len(up.Password))) b = append(b, up.Password...) - // TODO(mikio): handle IO deadlines and cancellation if + // TODO(mikio): handle IO deadlines and cancelation if // necessary if _, err := rw.Write(b); err != nil { return err diff --git a/kubewatch/vendor/golang.org/x/net/publicsuffix/list.go b/kubewatch/vendor/golang.org/x/net/publicsuffix/list.go index 7ab8b3cf1..047cb30eb 100644 --- a/kubewatch/vendor/golang.org/x/net/publicsuffix/list.go +++ b/kubewatch/vendor/golang.org/x/net/publicsuffix/list.go @@ -51,7 +51,6 @@ package publicsuffix // import "golang.org/x/net/publicsuffix" import ( "fmt" "net/http/cookiejar" - "net/netip" "strings" ) @@ -85,10 +84,6 @@ func (list) String() string { // domains like "foo.appspot.com" can be found at // https://wiki.mozilla.org/Public_Suffix_List/Use_Cases func PublicSuffix(domain string) (publicSuffix string, icann bool) { - if _, err := netip.ParseAddr(domain); err == nil { - return domain, false - } - lo, hi := uint32(0), uint32(numTLD) s, suffix, icannNode, wildcard := domain, len(domain), false, false loop: diff --git a/kubewatch/vendor/golang.org/x/sync/errgroup/errgroup.go b/kubewatch/vendor/golang.org/x/sync/errgroup/errgroup.go index 2f45dbc86..1d8cffae8 100644 --- a/kubewatch/vendor/golang.org/x/sync/errgroup/errgroup.go +++ b/kubewatch/vendor/golang.org/x/sync/errgroup/errgroup.go @@ -3,7 +3,7 @@ // license that can be found in the LICENSE file. // Package errgroup provides synchronization, error propagation, and Context -// cancellation for groups of goroutines working on subtasks of a common task. +// cancelation for groups of goroutines working on subtasks of a common task. // // [errgroup.Group] is related to [sync.WaitGroup] but adds handling of tasks // returning errors. diff --git a/kubewatch/vendor/golang.org/x/sys/cpu/cpu.go b/kubewatch/vendor/golang.org/x/sys/cpu/cpu.go index 34c9ae76e..63541994e 100644 --- a/kubewatch/vendor/golang.org/x/sys/cpu/cpu.go +++ b/kubewatch/vendor/golang.org/x/sys/cpu/cpu.go @@ -92,9 +92,6 @@ var ARM64 struct { HasSHA2 bool // SHA2 hardware implementation HasCRC32 bool // CRC32 hardware implementation HasATOMICS bool // Atomic memory operation instruction set - HasHPDS bool // Hierarchical permission disables in translations tables - HasLOR bool // Limited ordering regions - HasPAN bool // Privileged access never HasFPHP bool // Half precision floating-point instruction set HasASIMDHP bool // Advanced SIMD half precision instruction set HasCPUID bool // CPUID identification scheme registers diff --git a/kubewatch/vendor/golang.org/x/sys/cpu/cpu_arm64.go b/kubewatch/vendor/golang.org/x/sys/cpu/cpu_arm64.go index f449c679f..af2aa99f9 100644 --- a/kubewatch/vendor/golang.org/x/sys/cpu/cpu_arm64.go +++ b/kubewatch/vendor/golang.org/x/sys/cpu/cpu_arm64.go @@ -65,10 +65,10 @@ func setMinimalFeatures() { func readARM64Registers() { Initialized = true - parseARM64SystemRegisters(getisar0(), getisar1(), getmmfr1(), getpfr0()) + parseARM64SystemRegisters(getisar0(), getisar1(), getpfr0()) } -func parseARM64SystemRegisters(isar0, isar1, mmfr1, pfr0 uint64) { +func parseARM64SystemRegisters(isar0, isar1, pfr0 uint64) { // ID_AA64ISAR0_EL1 switch extractBits(isar0, 4, 7) { case 1: @@ -152,22 +152,6 @@ func parseARM64SystemRegisters(isar0, isar1, mmfr1, pfr0 uint64) { ARM64.HasI8MM = true } - // ID_AA64MMFR1_EL1 - switch extractBits(mmfr1, 12, 15) { - case 1, 2: - ARM64.HasHPDS = true - } - - switch extractBits(mmfr1, 16, 19) { - case 1: - ARM64.HasLOR = true - } - - switch extractBits(mmfr1, 20, 23) { - case 1, 2, 3: - ARM64.HasPAN = true - } - // ID_AA64PFR0_EL1 switch extractBits(pfr0, 16, 19) { case 0: diff --git a/kubewatch/vendor/golang.org/x/sys/cpu/cpu_arm64.s b/kubewatch/vendor/golang.org/x/sys/cpu/cpu_arm64.s index a4f24b3b0..22cc99844 100644 --- a/kubewatch/vendor/golang.org/x/sys/cpu/cpu_arm64.s +++ b/kubewatch/vendor/golang.org/x/sys/cpu/cpu_arm64.s @@ -9,34 +9,31 @@ // func getisar0() uint64 TEXT ·getisar0(SB),NOSPLIT,$0-8 // get Instruction Set Attributes 0 into x0 - MRS ID_AA64ISAR0_EL1, R0 + // mrs x0, ID_AA64ISAR0_EL1 = d5380600 + WORD $0xd5380600 MOVD R0, ret+0(FP) RET // func getisar1() uint64 TEXT ·getisar1(SB),NOSPLIT,$0-8 // get Instruction Set Attributes 1 into x0 - MRS ID_AA64ISAR1_EL1, R0 - MOVD R0, ret+0(FP) - RET - -// func getmmfr1() uint64 -TEXT ·getmmfr1(SB),NOSPLIT,$0-8 - // get Memory Model Feature Register 1 into x0 - MRS ID_AA64MMFR1_EL1, R0 + // mrs x0, ID_AA64ISAR1_EL1 = d5380620 + WORD $0xd5380620 MOVD R0, ret+0(FP) RET // func getpfr0() uint64 TEXT ·getpfr0(SB),NOSPLIT,$0-8 // get Processor Feature Register 0 into x0 - MRS ID_AA64PFR0_EL1, R0 + // mrs x0, ID_AA64PFR0_EL1 = d5380400 + WORD $0xd5380400 MOVD R0, ret+0(FP) RET // func getzfr0() uint64 TEXT ·getzfr0(SB),NOSPLIT,$0-8 // get SVE Feature Register 0 into x0 - MRS ID_AA64ZFR0_EL1, R0 + // mrs x0, ID_AA64ZFR0_EL1 = d5380480 + WORD $0xd5380480 MOVD R0, ret+0(FP) RET diff --git a/kubewatch/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go b/kubewatch/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go index e3fc5a8d3..6ac6e1efb 100644 --- a/kubewatch/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go +++ b/kubewatch/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go @@ -8,6 +8,5 @@ package cpu func getisar0() uint64 func getisar1() uint64 -func getmmfr1() uint64 func getpfr0() uint64 func getzfr0() uint64 diff --git a/kubewatch/vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go b/kubewatch/vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go index 8df2079e1..7f1946780 100644 --- a/kubewatch/vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go +++ b/kubewatch/vendor/golang.org/x/sys/cpu/cpu_gccgo_arm64.go @@ -8,5 +8,4 @@ package cpu func getisar0() uint64 { return 0 } func getisar1() uint64 { return 0 } -func getmmfr1() uint64 { return 0 } func getpfr0() uint64 { return 0 } diff --git a/kubewatch/vendor/golang.org/x/sys/cpu/cpu_netbsd_arm64.go b/kubewatch/vendor/golang.org/x/sys/cpu/cpu_netbsd_arm64.go index 19aea0633..ebfb3fc8e 100644 --- a/kubewatch/vendor/golang.org/x/sys/cpu/cpu_netbsd_arm64.go +++ b/kubewatch/vendor/golang.org/x/sys/cpu/cpu_netbsd_arm64.go @@ -167,7 +167,7 @@ func doinit() { setMinimalFeatures() return } - parseARM64SystemRegisters(cpuid.aa64isar0, cpuid.aa64isar1, cpuid.aa64mmfr1, cpuid.aa64pfr0) + parseARM64SystemRegisters(cpuid.aa64isar0, cpuid.aa64isar1, cpuid.aa64pfr0) Initialized = true } diff --git a/kubewatch/vendor/golang.org/x/sys/cpu/cpu_openbsd_arm64.go b/kubewatch/vendor/golang.org/x/sys/cpu/cpu_openbsd_arm64.go index 87fd3a778..85b64d5cc 100644 --- a/kubewatch/vendor/golang.org/x/sys/cpu/cpu_openbsd_arm64.go +++ b/kubewatch/vendor/golang.org/x/sys/cpu/cpu_openbsd_arm64.go @@ -59,7 +59,7 @@ func doinit() { if !ok { return } - parseARM64SystemRegisters(isar0, isar1, 0, 0) + parseARM64SystemRegisters(isar0, isar1, 0) Initialized = true } diff --git a/kubewatch/vendor/golang.org/x/sys/plan9/pwd_go15_plan9.go b/kubewatch/vendor/golang.org/x/sys/plan9/pwd_go15_plan9.go new file mode 100644 index 000000000..73687de74 --- /dev/null +++ b/kubewatch/vendor/golang.org/x/sys/plan9/pwd_go15_plan9.go @@ -0,0 +1,21 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build go1.5 + +package plan9 + +import "syscall" + +func fixwd() { + syscall.Fixwd() +} + +func Getwd() (wd string, err error) { + return syscall.Getwd() +} + +func Chdir(path string) error { + return syscall.Chdir(path) +} diff --git a/kubewatch/vendor/golang.org/x/sys/plan9/pwd_plan9.go b/kubewatch/vendor/golang.org/x/sys/plan9/pwd_plan9.go index 7a76489db..fb9458218 100644 --- a/kubewatch/vendor/golang.org/x/sys/plan9/pwd_plan9.go +++ b/kubewatch/vendor/golang.org/x/sys/plan9/pwd_plan9.go @@ -2,18 +2,22 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -package plan9 +//go:build !go1.5 -import "syscall" +package plan9 func fixwd() { - syscall.Fixwd() } func Getwd() (wd string, err error) { - return syscall.Getwd() + fd, err := open(".", O_RDONLY) + if err != nil { + return "", err + } + defer Close(fd) + return Fd2path(fd) } func Chdir(path string) error { - return syscall.Chdir(path) + return chdir(path) } diff --git a/kubewatch/vendor/golang.org/x/sys/unix/affinity_linux.go b/kubewatch/vendor/golang.org/x/sys/unix/affinity_linux.go index 3ea470387..6e5c81acd 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/affinity_linux.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/affinity_linux.go @@ -38,15 +38,8 @@ func SchedSetaffinity(pid int, set *CPUSet) error { // Zero clears the set s, so that it contains no CPUs. func (s *CPUSet) Zero() { - clear(s[:]) -} - -// Fill adds all possible CPU bits to the set s. On Linux, [SchedSetaffinity] -// will silently ignore any invalid CPU bits in [CPUSet] so this is an -// efficient way of resetting the CPU affinity of a process. -func (s *CPUSet) Fill() { for i := range s { - s[i] = ^cpuMask(0) + s[i] = 0 } } diff --git a/kubewatch/vendor/golang.org/x/sys/unix/fdset.go b/kubewatch/vendor/golang.org/x/sys/unix/fdset.go index 62ed12645..9e83d18cd 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/fdset.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/fdset.go @@ -23,5 +23,7 @@ func (fds *FdSet) IsSet(fd int) bool { // Zero clears the set fds. func (fds *FdSet) Zero() { - clear(fds.Bits[:]) + for i := range fds.Bits { + fds.Bits[i] = 0 + } } diff --git a/kubewatch/vendor/golang.org/x/sys/unix/ifreq_linux.go b/kubewatch/vendor/golang.org/x/sys/unix/ifreq_linux.go index 309f5a2b0..848840ae4 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/ifreq_linux.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/ifreq_linux.go @@ -111,7 +111,9 @@ func (ifr *Ifreq) SetUint32(v uint32) { // clear zeroes the ifreq's union field to prevent trailing garbage data from // being sent to the kernel if an ifreq is reused. func (ifr *Ifreq) clear() { - clear(ifr.raw.Ifru[:]) + for i := range ifr.raw.Ifru { + ifr.raw.Ifru[i] = 0 + } } // TODO(mdlayher): export as IfreqData? For now we can provide helpers such as diff --git a/kubewatch/vendor/golang.org/x/sys/unix/mkall.sh b/kubewatch/vendor/golang.org/x/sys/unix/mkall.sh index d0ed61191..e6f31d374 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/mkall.sh +++ b/kubewatch/vendor/golang.org/x/sys/unix/mkall.sh @@ -49,7 +49,6 @@ esac if [[ "$GOOS" = "linux" ]]; then # Use the Docker-based build system # Files generated through docker (use $cmd so you can Ctl-C the build or run) - set -e $cmd docker build --tag generate:$GOOS $GOOS $cmd docker run --interactive --tty --volume $(cd -- "$(dirname -- "$0")/.." && pwd):/build generate:$GOOS exit diff --git a/kubewatch/vendor/golang.org/x/sys/unix/mkerrors.sh b/kubewatch/vendor/golang.org/x/sys/unix/mkerrors.sh index 42517077c..6ab02b6c3 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/mkerrors.sh +++ b/kubewatch/vendor/golang.org/x/sys/unix/mkerrors.sh @@ -226,7 +226,6 @@ struct ltchars { #include #include #include -#include #include #include #include @@ -350,9 +349,6 @@ struct ltchars { #define _HIDIOCGRAWPHYS HIDIOCGRAWPHYS(_HIDIOCGRAWPHYS_LEN) #define _HIDIOCGRAWUNIQ HIDIOCGRAWUNIQ(_HIDIOCGRAWUNIQ_LEN) -// Renamed in v6.16, commit c6d732c38f93 ("net: ethtool: remove duplicate defines for family info") -#define ETHTOOL_FAMILY_NAME ETHTOOL_GENL_NAME -#define ETHTOOL_FAMILY_VERSION ETHTOOL_GENL_VERSION ' includes_NetBSD=' @@ -530,7 +526,6 @@ ccflags="$@" $2 ~ /^O[CNPFPL][A-Z]+[^_][A-Z]+$/ || $2 ~ /^(NL|CR|TAB|BS|VT|FF)DLY$/ || $2 ~ /^(NL|CR|TAB|BS|VT|FF)[0-9]$/ || - $2 ~ /^(DT|EI|ELF|EV|NN|NT|PF|SHF|SHN|SHT|STB|STT|VER)_/ || $2 ~ /^O?XTABS$/ || $2 ~ /^TC[IO](ON|OFF)$/ || $2 ~ /^IN_/ || diff --git a/kubewatch/vendor/golang.org/x/sys/unix/syscall_darwin.go b/kubewatch/vendor/golang.org/x/sys/unix/syscall_darwin.go index 7838ca5db..798f61ad3 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/syscall_darwin.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/syscall_darwin.go @@ -602,9 +602,14 @@ func Connectx(fd int, srcIf uint32, srcAddr, dstAddr Sockaddr, associd SaeAssocI return } +// sys connectx(fd int, endpoints *SaEndpoints, associd SaeAssocID, flags uint32, iov []Iovec, n *uintptr, connid *SaeConnID) (err error) const minIovec = 8 func Readv(fd int, iovs [][]byte) (n int, err error) { + if !darwinKernelVersionMin(11, 0, 0) { + return 0, ENOSYS + } + iovecs := make([]Iovec, 0, minIovec) iovecs = appendBytes(iovecs, iovs) n, err = readv(fd, iovecs) @@ -613,6 +618,9 @@ func Readv(fd int, iovs [][]byte) (n int, err error) { } func Preadv(fd int, iovs [][]byte, offset int64) (n int, err error) { + if !darwinKernelVersionMin(11, 0, 0) { + return 0, ENOSYS + } iovecs := make([]Iovec, 0, minIovec) iovecs = appendBytes(iovecs, iovs) n, err = preadv(fd, iovecs, offset) @@ -621,6 +629,10 @@ func Preadv(fd int, iovs [][]byte, offset int64) (n int, err error) { } func Writev(fd int, iovs [][]byte) (n int, err error) { + if !darwinKernelVersionMin(11, 0, 0) { + return 0, ENOSYS + } + iovecs := make([]Iovec, 0, minIovec) iovecs = appendBytes(iovecs, iovs) if raceenabled { @@ -632,6 +644,10 @@ func Writev(fd int, iovs [][]byte) (n int, err error) { } func Pwritev(fd int, iovs [][]byte, offset int64) (n int, err error) { + if !darwinKernelVersionMin(11, 0, 0) { + return 0, ENOSYS + } + iovecs := make([]Iovec, 0, minIovec) iovecs = appendBytes(iovecs, iovs) if raceenabled { @@ -691,7 +707,45 @@ func readvRacedetect(iovecs []Iovec, n int, err error) { } } -//sys connectx(fd int, endpoints *SaEndpoints, associd SaeAssocID, flags uint32, iov []Iovec, n *uintptr, connid *SaeConnID) (err error) +func darwinMajorMinPatch() (maj, min, patch int, err error) { + var un Utsname + err = Uname(&un) + if err != nil { + return + } + + var mmp [3]int + c := 0 +Loop: + for _, b := range un.Release[:] { + switch { + case b >= '0' && b <= '9': + mmp[c] = 10*mmp[c] + int(b-'0') + case b == '.': + c++ + if c > 2 { + return 0, 0, 0, ENOTSUP + } + case b == 0: + break Loop + default: + return 0, 0, 0, ENOTSUP + } + } + if c != 2 { + return 0, 0, 0, ENOTSUP + } + return mmp[0], mmp[1], mmp[2], nil +} + +func darwinKernelVersionMin(maj, min, patch int) bool { + actualMaj, actualMin, actualPatch, err := darwinMajorMinPatch() + if err != nil { + return false + } + return actualMaj > maj || actualMaj == maj && (actualMin > min || actualMin == min && actualPatch >= patch) +} + //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) diff --git a/kubewatch/vendor/golang.org/x/sys/unix/syscall_linux.go b/kubewatch/vendor/golang.org/x/sys/unix/syscall_linux.go index 06c0eea6f..4958a6570 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/syscall_linux.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/syscall_linux.go @@ -801,7 +801,9 @@ func (sa *SockaddrPPPoE) sockaddr() (unsafe.Pointer, _Socklen, error) { // one. The kernel expects SID to be in network byte order. binary.BigEndian.PutUint16(sa.raw[6:8], sa.SID) copy(sa.raw[8:14], sa.Remote) - clear(sa.raw[14 : 14+IFNAMSIZ]) + for i := 14; i < 14+IFNAMSIZ; i++ { + sa.raw[i] = 0 + } copy(sa.raw[14:], sa.Dev) return unsafe.Pointer(&sa.raw), SizeofSockaddrPPPoX, nil } @@ -2643,9 +2645,3 @@ func SchedGetAttr(pid int, flags uint) (*SchedAttr, error) { //sys Cachestat(fd uint, crange *CachestatRange, cstat *Cachestat_t, flags uint) (err error) //sys Mseal(b []byte, flags uint) (err error) - -//sys setMemPolicy(mode int, mask *CPUSet, size int) (err error) = SYS_SET_MEMPOLICY - -func SetMemPolicy(mode int, mask *CPUSet) error { - return setMemPolicy(mode, mask, _CPU_SETSIZE) -} diff --git a/kubewatch/vendor/golang.org/x/sys/unix/syscall_netbsd.go b/kubewatch/vendor/golang.org/x/sys/unix/syscall_netbsd.go index 34a467697..88162099a 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/syscall_netbsd.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/syscall_netbsd.go @@ -248,23 +248,6 @@ func Statvfs(path string, buf *Statvfs_t) (err error) { return Statvfs1(path, buf, ST_WAIT) } -func Getvfsstat(buf []Statvfs_t, flags int) (n int, err error) { - var ( - _p0 unsafe.Pointer - bufsize uintptr - ) - if len(buf) > 0 { - _p0 = unsafe.Pointer(&buf[0]) - bufsize = unsafe.Sizeof(Statvfs_t{}) * uintptr(len(buf)) - } - r0, _, e1 := Syscall(SYS_GETVFSSTAT, uintptr(_p0), bufsize, uintptr(flags)) - n = int(r0) - if e1 != 0 { - err = e1 - } - return -} - /* * Exposed directly */ diff --git a/kubewatch/vendor/golang.org/x/sys/unix/syscall_solaris.go b/kubewatch/vendor/golang.org/x/sys/unix/syscall_solaris.go index 18a3d9bda..abc395547 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/syscall_solaris.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/syscall_solaris.go @@ -629,7 +629,7 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys Kill(pid int, signum syscall.Signal) (err error) //sys Lchown(path string, uid int, gid int) (err error) //sys Link(path string, link string) (err error) -//sys Listen(s int, backlog int) (err error) = libsocket.__xnet_listen +//sys Listen(s int, backlog int) (err error) = libsocket.__xnet_llisten //sys Lstat(path string, stat *Stat_t) (err error) //sys Madvise(b []byte, advice int) (err error) //sys Mkdir(path string, mode uint32) (err error) diff --git a/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux.go b/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux.go index d0a75da57..9e7a6c5a4 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux.go @@ -328,8 +328,6 @@ const ( AUDIT_KERNEL = 0x7d0 AUDIT_KERNEL_OTHER = 0x524 AUDIT_KERN_MODULE = 0x532 - AUDIT_LANDLOCK_ACCESS = 0x58f - AUDIT_LANDLOCK_DOMAIN = 0x590 AUDIT_LAST_FEATURE = 0x1 AUDIT_LAST_KERN_ANOM_MSG = 0x707 AUDIT_LAST_USER_MSG = 0x4af @@ -494,7 +492,6 @@ const ( BPF_F_BEFORE = 0x8 BPF_F_ID = 0x20 BPF_F_NETFILTER_IP_DEFRAG = 0x1 - BPF_F_PREORDER = 0x40 BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_REDIRECT_FLAGS = 0x19 BPF_F_REPLACE = 0x4 @@ -531,7 +528,6 @@ const ( BPF_LDX = 0x1 BPF_LEN = 0x80 BPF_LL_OFF = -0x200000 - BPF_LOAD_ACQ = 0x100 BPF_LSH = 0x60 BPF_MAJOR_VERSION = 0x1 BPF_MAXINSNS = 0x1000 @@ -559,7 +555,6 @@ const ( BPF_RET = 0x6 BPF_RSH = 0x70 BPF_ST = 0x2 - BPF_STORE_REL = 0x110 BPF_STX = 0x3 BPF_SUB = 0x10 BPF_TAG_SIZE = 0x8 @@ -849,90 +844,24 @@ const ( DM_UUID_FLAG = 0x4000 DM_UUID_LEN = 0x81 DM_VERSION = 0xc138fd00 - DM_VERSION_EXTRA = "-ioctl (2025-04-28)" + DM_VERSION_EXTRA = "-ioctl (2025-01-17)" DM_VERSION_MAJOR = 0x4 - DM_VERSION_MINOR = 0x32 + DM_VERSION_MINOR = 0x31 DM_VERSION_PATCHLEVEL = 0x0 - DT_ADDRRNGHI = 0x6ffffeff - DT_ADDRRNGLO = 0x6ffffe00 DT_BLK = 0x6 DT_CHR = 0x2 - DT_DEBUG = 0x15 DT_DIR = 0x4 - DT_ENCODING = 0x20 DT_FIFO = 0x1 - DT_FINI = 0xd - DT_FLAGS_1 = 0x6ffffffb - DT_GNU_HASH = 0x6ffffef5 - DT_HASH = 0x4 - DT_HIOS = 0x6ffff000 - DT_HIPROC = 0x7fffffff - DT_INIT = 0xc - DT_JMPREL = 0x17 DT_LNK = 0xa - DT_LOOS = 0x6000000d - DT_LOPROC = 0x70000000 - DT_NEEDED = 0x1 - DT_NULL = 0x0 - DT_PLTGOT = 0x3 - DT_PLTREL = 0x14 - DT_PLTRELSZ = 0x2 DT_REG = 0x8 - DT_REL = 0x11 - DT_RELA = 0x7 - DT_RELACOUNT = 0x6ffffff9 - DT_RELAENT = 0x9 - DT_RELASZ = 0x8 - DT_RELCOUNT = 0x6ffffffa - DT_RELENT = 0x13 - DT_RELSZ = 0x12 - DT_RPATH = 0xf DT_SOCK = 0xc - DT_SONAME = 0xe - DT_STRSZ = 0xa - DT_STRTAB = 0x5 - DT_SYMBOLIC = 0x10 - DT_SYMENT = 0xb - DT_SYMTAB = 0x6 - DT_TEXTREL = 0x16 DT_UNKNOWN = 0x0 - DT_VALRNGHI = 0x6ffffdff - DT_VALRNGLO = 0x6ffffd00 - DT_VERDEF = 0x6ffffffc - DT_VERDEFNUM = 0x6ffffffd - DT_VERNEED = 0x6ffffffe - DT_VERNEEDNUM = 0x6fffffff - DT_VERSYM = 0x6ffffff0 DT_WHT = 0xe ECHO = 0x8 ECRYPTFS_SUPER_MAGIC = 0xf15f EFD_SEMAPHORE = 0x1 EFIVARFS_MAGIC = 0xde5e81e4 EFS_SUPER_MAGIC = 0x414a53 - EI_CLASS = 0x4 - EI_DATA = 0x5 - EI_MAG0 = 0x0 - EI_MAG1 = 0x1 - EI_MAG2 = 0x2 - EI_MAG3 = 0x3 - EI_NIDENT = 0x10 - EI_OSABI = 0x7 - EI_PAD = 0x8 - EI_VERSION = 0x6 - ELFCLASS32 = 0x1 - ELFCLASS64 = 0x2 - ELFCLASSNONE = 0x0 - ELFCLASSNUM = 0x3 - ELFDATA2LSB = 0x1 - ELFDATA2MSB = 0x2 - ELFDATANONE = 0x0 - ELFMAG = "\177ELF" - ELFMAG0 = 0x7f - ELFMAG1 = 'E' - ELFMAG2 = 'L' - ELFMAG3 = 'F' - ELFOSABI_LINUX = 0x3 - ELFOSABI_NONE = 0x0 EM_386 = 0x3 EM_486 = 0x6 EM_68K = 0x4 @@ -1008,6 +937,9 @@ const ( EPOLL_CTL_MOD = 0x3 EPOLL_IOC_TYPE = 0x8a EROFS_SUPER_MAGIC_V1 = 0xe0f5e1e2 + ESP_V4_FLOW = 0xa + ESP_V6_FLOW = 0xc + ETHER_FLOW = 0x12 ETHTOOL_BUSINFO_LEN = 0x20 ETHTOOL_EROMVERS_LEN = 0x20 ETHTOOL_FAMILY_NAME = "ethtool" @@ -1218,24 +1150,14 @@ const ( ETH_P_WCCP = 0x883e ETH_P_X25 = 0x805 ETH_P_XDSA = 0xf8 - ET_CORE = 0x4 - ET_DYN = 0x3 - ET_EXEC = 0x2 - ET_HIPROC = 0xffff - ET_LOPROC = 0xff00 - ET_NONE = 0x0 - ET_REL = 0x1 EV_ABS = 0x3 EV_CNT = 0x20 - EV_CURRENT = 0x1 EV_FF = 0x15 EV_FF_STATUS = 0x17 EV_KEY = 0x1 EV_LED = 0x11 EV_MAX = 0x1f EV_MSC = 0x4 - EV_NONE = 0x0 - EV_NUM = 0x2 EV_PWR = 0x16 EV_REL = 0x2 EV_REP = 0x14 @@ -1291,7 +1213,6 @@ const ( FAN_EVENT_INFO_TYPE_DFID_NAME = 0x2 FAN_EVENT_INFO_TYPE_ERROR = 0x5 FAN_EVENT_INFO_TYPE_FID = 0x1 - FAN_EVENT_INFO_TYPE_MNT = 0x7 FAN_EVENT_INFO_TYPE_NEW_DFID_NAME = 0xc FAN_EVENT_INFO_TYPE_OLD_DFID_NAME = 0xa FAN_EVENT_INFO_TYPE_PIDFD = 0x4 @@ -1310,12 +1231,9 @@ const ( FAN_MARK_IGNORED_SURV_MODIFY = 0x40 FAN_MARK_IGNORE_SURV = 0x440 FAN_MARK_INODE = 0x0 - FAN_MARK_MNTNS = 0x110 FAN_MARK_MOUNT = 0x10 FAN_MARK_ONLYDIR = 0x8 FAN_MARK_REMOVE = 0x2 - FAN_MNT_ATTACH = 0x1000000 - FAN_MNT_DETACH = 0x2000000 FAN_MODIFY = 0x2 FAN_MOVE = 0xc0 FAN_MOVED_FROM = 0x40 @@ -1337,7 +1255,6 @@ const ( FAN_REPORT_DIR_FID = 0x400 FAN_REPORT_FD_ERROR = 0x2000 FAN_REPORT_FID = 0x200 - FAN_REPORT_MNT = 0x4000 FAN_REPORT_NAME = 0x800 FAN_REPORT_PIDFD = 0x80 FAN_REPORT_TARGET_FID = 0x1000 @@ -1357,7 +1274,6 @@ const ( FIB_RULE_PERMANENT = 0x1 FIB_RULE_UNRESOLVED = 0x4 FIDEDUPERANGE = 0xc0189436 - FSCRYPT_ADD_KEY_FLAG_HW_WRAPPED = 0x1 FSCRYPT_KEY_DESCRIPTOR_SIZE = 0x8 FSCRYPT_KEY_DESC_PREFIX = "fscrypt:" FSCRYPT_KEY_DESC_PREFIX_SIZE = 0x8 @@ -1666,6 +1582,7 @@ const ( IPV6_DONTFRAG = 0x3e IPV6_DROP_MEMBERSHIP = 0x15 IPV6_DSTOPTS = 0x3b + IPV6_FLOW = 0x11 IPV6_FREEBIND = 0x4e IPV6_HDRINCL = 0x24 IPV6_HOPLIMIT = 0x34 @@ -1716,6 +1633,7 @@ const ( IPV6_TRANSPARENT = 0x4b IPV6_UNICAST_HOPS = 0x10 IPV6_UNICAST_IF = 0x4c + IPV6_USER_FLOW = 0xe IPV6_V6ONLY = 0x1a IPV6_VERSION = 0x60 IPV6_VERSION_MASK = 0xf0 @@ -1777,6 +1695,7 @@ const ( IP_TTL = 0x2 IP_UNBLOCK_SOURCE = 0x25 IP_UNICAST_IF = 0x32 + IP_USER_FLOW = 0xd IP_XFRM_POLICY = 0x11 ISOFS_SUPER_MAGIC = 0x9660 ISTRIP = 0x20 @@ -1898,11 +1817,7 @@ const ( LANDLOCK_ACCESS_FS_WRITE_FILE = 0x2 LANDLOCK_ACCESS_NET_BIND_TCP = 0x1 LANDLOCK_ACCESS_NET_CONNECT_TCP = 0x2 - LANDLOCK_CREATE_RULESET_ERRATA = 0x2 LANDLOCK_CREATE_RULESET_VERSION = 0x1 - LANDLOCK_RESTRICT_SELF_LOG_NEW_EXEC_ON = 0x2 - LANDLOCK_RESTRICT_SELF_LOG_SAME_EXEC_OFF = 0x1 - LANDLOCK_RESTRICT_SELF_LOG_SUBDOMAINS_OFF = 0x4 LANDLOCK_SCOPE_ABSTRACT_UNIX_SOCKET = 0x1 LANDLOCK_SCOPE_SIGNAL = 0x2 LINUX_REBOOT_CMD_CAD_OFF = 0x0 @@ -2352,167 +2267,7 @@ const ( NLM_F_REPLACE = 0x100 NLM_F_REQUEST = 0x1 NLM_F_ROOT = 0x100 - NN_386_IOPERM = "LINUX" - NN_386_TLS = "LINUX" - NN_ARC_V2 = "LINUX" - NN_ARM_FPMR = "LINUX" - NN_ARM_GCS = "LINUX" - NN_ARM_HW_BREAK = "LINUX" - NN_ARM_HW_WATCH = "LINUX" - NN_ARM_PACA_KEYS = "LINUX" - NN_ARM_PACG_KEYS = "LINUX" - NN_ARM_PAC_ENABLED_KEYS = "LINUX" - NN_ARM_PAC_MASK = "LINUX" - NN_ARM_POE = "LINUX" - NN_ARM_SSVE = "LINUX" - NN_ARM_SVE = "LINUX" - NN_ARM_SYSTEM_CALL = "LINUX" - NN_ARM_TAGGED_ADDR_CTRL = "LINUX" - NN_ARM_TLS = "LINUX" - NN_ARM_VFP = "LINUX" - NN_ARM_ZA = "LINUX" - NN_ARM_ZT = "LINUX" - NN_AUXV = "CORE" - NN_FILE = "CORE" - NN_GNU_PROPERTY_TYPE_0 = "GNU" - NN_LOONGARCH_CPUCFG = "LINUX" - NN_LOONGARCH_CSR = "LINUX" - NN_LOONGARCH_HW_BREAK = "LINUX" - NN_LOONGARCH_HW_WATCH = "LINUX" - NN_LOONGARCH_LASX = "LINUX" - NN_LOONGARCH_LBT = "LINUX" - NN_LOONGARCH_LSX = "LINUX" - NN_MIPS_DSP = "LINUX" - NN_MIPS_FP_MODE = "LINUX" - NN_MIPS_MSA = "LINUX" - NN_PPC_DEXCR = "LINUX" - NN_PPC_DSCR = "LINUX" - NN_PPC_EBB = "LINUX" - NN_PPC_HASHKEYR = "LINUX" - NN_PPC_PKEY = "LINUX" - NN_PPC_PMU = "LINUX" - NN_PPC_PPR = "LINUX" - NN_PPC_SPE = "LINUX" - NN_PPC_TAR = "LINUX" - NN_PPC_TM_CDSCR = "LINUX" - NN_PPC_TM_CFPR = "LINUX" - NN_PPC_TM_CGPR = "LINUX" - NN_PPC_TM_CPPR = "LINUX" - NN_PPC_TM_CTAR = "LINUX" - NN_PPC_TM_CVMX = "LINUX" - NN_PPC_TM_CVSX = "LINUX" - NN_PPC_TM_SPR = "LINUX" - NN_PPC_VMX = "LINUX" - NN_PPC_VSX = "LINUX" - NN_PRFPREG = "CORE" - NN_PRPSINFO = "CORE" - NN_PRSTATUS = "CORE" - NN_PRXFPREG = "LINUX" - NN_RISCV_CSR = "LINUX" - NN_RISCV_TAGGED_ADDR_CTRL = "LINUX" - NN_RISCV_VECTOR = "LINUX" - NN_S390_CTRS = "LINUX" - NN_S390_GS_BC = "LINUX" - NN_S390_GS_CB = "LINUX" - NN_S390_HIGH_GPRS = "LINUX" - NN_S390_LAST_BREAK = "LINUX" - NN_S390_PREFIX = "LINUX" - NN_S390_PV_CPU_DATA = "LINUX" - NN_S390_RI_CB = "LINUX" - NN_S390_SYSTEM_CALL = "LINUX" - NN_S390_TDB = "LINUX" - NN_S390_TIMER = "LINUX" - NN_S390_TODCMP = "LINUX" - NN_S390_TODPREG = "LINUX" - NN_S390_VXRS_HIGH = "LINUX" - NN_S390_VXRS_LOW = "LINUX" - NN_SIGINFO = "CORE" - NN_TASKSTRUCT = "CORE" - NN_VMCOREDD = "LINUX" - NN_X86_SHSTK = "LINUX" - NN_X86_XSAVE_LAYOUT = "LINUX" - NN_X86_XSTATE = "LINUX" NSFS_MAGIC = 0x6e736673 - NT_386_IOPERM = 0x201 - NT_386_TLS = 0x200 - NT_ARC_V2 = 0x600 - NT_ARM_FPMR = 0x40e - NT_ARM_GCS = 0x410 - NT_ARM_HW_BREAK = 0x402 - NT_ARM_HW_WATCH = 0x403 - NT_ARM_PACA_KEYS = 0x407 - NT_ARM_PACG_KEYS = 0x408 - NT_ARM_PAC_ENABLED_KEYS = 0x40a - NT_ARM_PAC_MASK = 0x406 - NT_ARM_POE = 0x40f - NT_ARM_SSVE = 0x40b - NT_ARM_SVE = 0x405 - NT_ARM_SYSTEM_CALL = 0x404 - NT_ARM_TAGGED_ADDR_CTRL = 0x409 - NT_ARM_TLS = 0x401 - NT_ARM_VFP = 0x400 - NT_ARM_ZA = 0x40c - NT_ARM_ZT = 0x40d - NT_AUXV = 0x6 - NT_FILE = 0x46494c45 - NT_GNU_PROPERTY_TYPE_0 = 0x5 - NT_LOONGARCH_CPUCFG = 0xa00 - NT_LOONGARCH_CSR = 0xa01 - NT_LOONGARCH_HW_BREAK = 0xa05 - NT_LOONGARCH_HW_WATCH = 0xa06 - NT_LOONGARCH_LASX = 0xa03 - NT_LOONGARCH_LBT = 0xa04 - NT_LOONGARCH_LSX = 0xa02 - NT_MIPS_DSP = 0x800 - NT_MIPS_FP_MODE = 0x801 - NT_MIPS_MSA = 0x802 - NT_PPC_DEXCR = 0x111 - NT_PPC_DSCR = 0x105 - NT_PPC_EBB = 0x106 - NT_PPC_HASHKEYR = 0x112 - NT_PPC_PKEY = 0x110 - NT_PPC_PMU = 0x107 - NT_PPC_PPR = 0x104 - NT_PPC_SPE = 0x101 - NT_PPC_TAR = 0x103 - NT_PPC_TM_CDSCR = 0x10f - NT_PPC_TM_CFPR = 0x109 - NT_PPC_TM_CGPR = 0x108 - NT_PPC_TM_CPPR = 0x10e - NT_PPC_TM_CTAR = 0x10d - NT_PPC_TM_CVMX = 0x10a - NT_PPC_TM_CVSX = 0x10b - NT_PPC_TM_SPR = 0x10c - NT_PPC_VMX = 0x100 - NT_PPC_VSX = 0x102 - NT_PRFPREG = 0x2 - NT_PRPSINFO = 0x3 - NT_PRSTATUS = 0x1 - NT_PRXFPREG = 0x46e62b7f - NT_RISCV_CSR = 0x900 - NT_RISCV_TAGGED_ADDR_CTRL = 0x902 - NT_RISCV_VECTOR = 0x901 - NT_S390_CTRS = 0x304 - NT_S390_GS_BC = 0x30c - NT_S390_GS_CB = 0x30b - NT_S390_HIGH_GPRS = 0x300 - NT_S390_LAST_BREAK = 0x306 - NT_S390_PREFIX = 0x305 - NT_S390_PV_CPU_DATA = 0x30e - NT_S390_RI_CB = 0x30d - NT_S390_SYSTEM_CALL = 0x307 - NT_S390_TDB = 0x308 - NT_S390_TIMER = 0x301 - NT_S390_TODCMP = 0x302 - NT_S390_TODPREG = 0x303 - NT_S390_VXRS_HIGH = 0x30a - NT_S390_VXRS_LOW = 0x309 - NT_SIGINFO = 0x53494749 - NT_TASKSTRUCT = 0x4 - NT_VMCOREDD = 0x700 - NT_X86_SHSTK = 0x204 - NT_X86_XSAVE_LAYOUT = 0x205 - NT_X86_XSTATE = 0x202 OCFS2_SUPER_MAGIC = 0x7461636f OCRNL = 0x8 OFDEL = 0x80 @@ -2699,59 +2454,6 @@ const ( PERF_RECORD_MISC_USER = 0x2 PERF_SAMPLE_BRANCH_PLM_ALL = 0x7 PERF_SAMPLE_WEIGHT_TYPE = 0x1004000 - PF_ALG = 0x26 - PF_APPLETALK = 0x5 - PF_ASH = 0x12 - PF_ATMPVC = 0x8 - PF_ATMSVC = 0x14 - PF_AX25 = 0x3 - PF_BLUETOOTH = 0x1f - PF_BRIDGE = 0x7 - PF_CAIF = 0x25 - PF_CAN = 0x1d - PF_DECnet = 0xc - PF_ECONET = 0x13 - PF_FILE = 0x1 - PF_IB = 0x1b - PF_IEEE802154 = 0x24 - PF_INET = 0x2 - PF_INET6 = 0xa - PF_IPX = 0x4 - PF_IRDA = 0x17 - PF_ISDN = 0x22 - PF_IUCV = 0x20 - PF_KCM = 0x29 - PF_KEY = 0xf - PF_LLC = 0x1a - PF_LOCAL = 0x1 - PF_MAX = 0x2e - PF_MCTP = 0x2d - PF_MPLS = 0x1c - PF_NETBEUI = 0xd - PF_NETLINK = 0x10 - PF_NETROM = 0x6 - PF_NFC = 0x27 - PF_PACKET = 0x11 - PF_PHONET = 0x23 - PF_PPPOX = 0x18 - PF_QIPCRTR = 0x2a - PF_R = 0x4 - PF_RDS = 0x15 - PF_ROSE = 0xb - PF_ROUTE = 0x10 - PF_RXRPC = 0x21 - PF_SECURITY = 0xe - PF_SMC = 0x2b - PF_SNA = 0x16 - PF_TIPC = 0x1e - PF_UNIX = 0x1 - PF_UNSPEC = 0x0 - PF_VSOCK = 0x28 - PF_W = 0x2 - PF_WANPIPE = 0x19 - PF_X = 0x1 - PF_X25 = 0x9 - PF_XDP = 0x2c PID_FS_MAGIC = 0x50494446 PIPEFS_MAGIC = 0x50495045 PPPIOCGNPMODE = 0xc008744c @@ -2791,10 +2493,6 @@ const ( PR_FP_EXC_UND = 0x40000 PR_FP_MODE_FR = 0x1 PR_FP_MODE_FRE = 0x2 - PR_FUTEX_HASH = 0x4e - PR_FUTEX_HASH_GET_IMMUTABLE = 0x3 - PR_FUTEX_HASH_GET_SLOTS = 0x2 - PR_FUTEX_HASH_SET_SLOTS = 0x1 PR_GET_AUXV = 0x41555856 PR_GET_CHILD_SUBREAPER = 0x25 PR_GET_DUMPABLE = 0x3 @@ -2954,10 +2652,6 @@ const ( PR_TAGGED_ADDR_ENABLE = 0x1 PR_TASK_PERF_EVENTS_DISABLE = 0x1f PR_TASK_PERF_EVENTS_ENABLE = 0x20 - PR_TIMER_CREATE_RESTORE_IDS = 0x4d - PR_TIMER_CREATE_RESTORE_IDS_GET = 0x2 - PR_TIMER_CREATE_RESTORE_IDS_OFF = 0x0 - PR_TIMER_CREATE_RESTORE_IDS_ON = 0x1 PR_TIMING_STATISTICAL = 0x0 PR_TIMING_TIMESTAMP = 0x1 PR_TSC_ENABLE = 0x1 @@ -3038,7 +2732,6 @@ const ( PTRACE_SETREGSET = 0x4205 PTRACE_SETSIGINFO = 0x4203 PTRACE_SETSIGMASK = 0x420b - PTRACE_SET_SYSCALL_INFO = 0x4212 PTRACE_SET_SYSCALL_USER_DISPATCH_CONFIG = 0x4210 PTRACE_SINGLESTEP = 0x9 PTRACE_SYSCALL = 0x18 @@ -3047,23 +2740,6 @@ const ( PTRACE_SYSCALL_INFO_NONE = 0x0 PTRACE_SYSCALL_INFO_SECCOMP = 0x3 PTRACE_TRACEME = 0x0 - PT_AARCH64_MEMTAG_MTE = 0x70000002 - PT_DYNAMIC = 0x2 - PT_GNU_EH_FRAME = 0x6474e550 - PT_GNU_PROPERTY = 0x6474e553 - PT_GNU_RELRO = 0x6474e552 - PT_GNU_STACK = 0x6474e551 - PT_HIOS = 0x6fffffff - PT_HIPROC = 0x7fffffff - PT_INTERP = 0x3 - PT_LOAD = 0x1 - PT_LOOS = 0x60000000 - PT_LOPROC = 0x70000000 - PT_NOTE = 0x4 - PT_NULL = 0x0 - PT_PHDR = 0x6 - PT_SHLIB = 0x5 - PT_TLS = 0x7 P_ALL = 0x0 P_PGID = 0x2 P_PID = 0x1 @@ -3306,7 +2982,6 @@ const ( RTPROT_NTK = 0xf RTPROT_OPENR = 0x63 RTPROT_OSPF = 0xbc - RTPROT_OVN = 0x54 RTPROT_RA = 0x9 RTPROT_REDIRECT = 0x1 RTPROT_RIP = 0xbd @@ -3397,47 +3072,6 @@ const ( SEEK_MAX = 0x4 SEEK_SET = 0x0 SELINUX_MAGIC = 0xf97cff8c - SHF_ALLOC = 0x2 - SHF_EXCLUDE = 0x8000000 - SHF_EXECINSTR = 0x4 - SHF_GROUP = 0x200 - SHF_INFO_LINK = 0x40 - SHF_LINK_ORDER = 0x80 - SHF_MASKOS = 0xff00000 - SHF_MASKPROC = 0xf0000000 - SHF_MERGE = 0x10 - SHF_ORDERED = 0x4000000 - SHF_OS_NONCONFORMING = 0x100 - SHF_RELA_LIVEPATCH = 0x100000 - SHF_RO_AFTER_INIT = 0x200000 - SHF_STRINGS = 0x20 - SHF_TLS = 0x400 - SHF_WRITE = 0x1 - SHN_ABS = 0xfff1 - SHN_COMMON = 0xfff2 - SHN_HIPROC = 0xff1f - SHN_HIRESERVE = 0xffff - SHN_LIVEPATCH = 0xff20 - SHN_LOPROC = 0xff00 - SHN_LORESERVE = 0xff00 - SHN_UNDEF = 0x0 - SHT_DYNAMIC = 0x6 - SHT_DYNSYM = 0xb - SHT_HASH = 0x5 - SHT_HIPROC = 0x7fffffff - SHT_HIUSER = 0xffffffff - SHT_LOPROC = 0x70000000 - SHT_LOUSER = 0x80000000 - SHT_NOBITS = 0x8 - SHT_NOTE = 0x7 - SHT_NULL = 0x0 - SHT_NUM = 0xc - SHT_PROGBITS = 0x1 - SHT_REL = 0x9 - SHT_RELA = 0x4 - SHT_SHLIB = 0xa - SHT_STRTAB = 0x3 - SHT_SYMTAB = 0x2 SHUT_RD = 0x0 SHUT_RDWR = 0x2 SHUT_WR = 0x1 @@ -3664,16 +3298,6 @@ const ( STATX_UID = 0x8 STATX_WRITE_ATOMIC = 0x10000 STATX__RESERVED = 0x80000000 - STB_GLOBAL = 0x1 - STB_LOCAL = 0x0 - STB_WEAK = 0x2 - STT_COMMON = 0x5 - STT_FILE = 0x4 - STT_FUNC = 0x2 - STT_NOTYPE = 0x0 - STT_OBJECT = 0x1 - STT_SECTION = 0x3 - STT_TLS = 0x6 SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WRITE = 0x2 @@ -3712,7 +3336,7 @@ const ( TASKSTATS_GENL_NAME = "TASKSTATS" TASKSTATS_GENL_VERSION = 0x1 TASKSTATS_TYPE_MAX = 0x6 - TASKSTATS_VERSION = 0x10 + TASKSTATS_VERSION = 0xf TCIFLUSH = 0x0 TCIOFF = 0x2 TCIOFLUSH = 0x2 @@ -3782,6 +3406,8 @@ const ( TCP_TX_DELAY = 0x25 TCP_ULP = 0x1f TCP_USER_TIMEOUT = 0x12 + TCP_V4_FLOW = 0x1 + TCP_V6_FLOW = 0x5 TCP_WINDOW_CLAMP = 0xa TCP_ZEROCOPY_RECEIVE = 0x23 TFD_TIMER_ABSTIME = 0x1 @@ -3904,14 +3530,14 @@ const ( UDP_NO_CHECK6_RX = 0x66 UDP_NO_CHECK6_TX = 0x65 UDP_SEGMENT = 0x67 + UDP_V4_FLOW = 0x2 + UDP_V6_FLOW = 0x6 UMOUNT_NOFOLLOW = 0x8 USBDEVICE_SUPER_MAGIC = 0x9fa2 UTIME_NOW = 0x3fffffff UTIME_OMIT = 0x3ffffffe V9FS_MAGIC = 0x1021997 VERASE = 0x2 - VER_FLG_BASE = 0x1 - VER_FLG_WEAK = 0x2 VINTR = 0x0 VKILL = 0x3 VLNEXT = 0xf @@ -3948,7 +3574,7 @@ const ( WDIOS_TEMPPANIC = 0x4 WDIOS_UNKNOWN = -0x1 WEXITED = 0x4 - WGALLOWEDIP_A_MAX = 0x4 + WGALLOWEDIP_A_MAX = 0x3 WGDEVICE_A_MAX = 0x8 WGPEER_A_MAX = 0xa WG_CMD_MAX = 0x1 @@ -4062,7 +3688,6 @@ const ( XDP_SHARED_UMEM = 0x1 XDP_STATISTICS = 0x7 XDP_TXMD_FLAGS_CHECKSUM = 0x2 - XDP_TXMD_FLAGS_LAUNCH_TIME = 0x4 XDP_TXMD_FLAGS_TIMESTAMP = 0x1 XDP_TX_METADATA = 0x2 XDP_TX_RING = 0x3 diff --git a/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_386.go b/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_386.go index 1c37f9fbc..a8c421e29 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_386.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_386.go @@ -68,7 +68,6 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 - DM_MPATH_PROBE_PATHS = 0xfd12 ECCGETLAYOUT = 0x81484d11 ECCGETSTATS = 0x80104d12 ECHOCTL = 0x200 @@ -361,7 +360,6 @@ const ( SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 SO_PASSPIDFD = 0x4c - SO_PASSRIGHTS = 0x53 SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x11 diff --git a/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go b/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go index 6f54d34ae..9a88d1813 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go @@ -68,7 +68,6 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 - DM_MPATH_PROBE_PATHS = 0xfd12 ECCGETLAYOUT = 0x81484d11 ECCGETSTATS = 0x80104d12 ECHOCTL = 0x200 @@ -362,7 +361,6 @@ const ( SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 SO_PASSPIDFD = 0x4c - SO_PASSRIGHTS = 0x53 SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x11 diff --git a/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go b/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go index 783ec5c12..7cb6a867e 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go @@ -68,7 +68,6 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 - DM_MPATH_PROBE_PATHS = 0xfd12 ECCGETLAYOUT = 0x81484d11 ECCGETSTATS = 0x80104d12 ECHOCTL = 0x200 @@ -367,7 +366,6 @@ const ( SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 SO_PASSPIDFD = 0x4c - SO_PASSRIGHTS = 0x53 SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x11 diff --git a/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go b/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go index ca83d3ba1..d0ecd2c58 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go @@ -68,7 +68,6 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 - DM_MPATH_PROBE_PATHS = 0xfd12 ECCGETLAYOUT = 0x81484d11 ECCGETSTATS = 0x80104d12 ECHOCTL = 0x200 @@ -360,7 +359,6 @@ const ( SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 SO_PASSPIDFD = 0x4c - SO_PASSRIGHTS = 0x53 SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x11 diff --git a/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go b/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go index 607e611c0..7a2940ae0 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go @@ -68,7 +68,6 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 - DM_MPATH_PROBE_PATHS = 0xfd12 ECCGETLAYOUT = 0x81484d11 ECCGETSTATS = 0x80104d12 ECHOCTL = 0x200 @@ -354,7 +353,6 @@ const ( SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 SO_PASSPIDFD = 0x4c - SO_PASSRIGHTS = 0x53 SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x11 diff --git a/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go b/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go index b9cb5bd3c..d14ca8f2e 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go @@ -68,7 +68,6 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 - DM_MPATH_PROBE_PATHS = 0x2000fd12 ECCGETLAYOUT = 0x41484d11 ECCGETSTATS = 0x40104d12 ECHOCTL = 0x200 @@ -360,7 +359,6 @@ const ( SO_OOBINLINE = 0x100 SO_PASSCRED = 0x11 SO_PASSPIDFD = 0x4c - SO_PASSRIGHTS = 0x53 SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x12 diff --git a/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go b/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go index 65b078a63..2da1bac1e 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go @@ -68,7 +68,6 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 - DM_MPATH_PROBE_PATHS = 0x2000fd12 ECCGETLAYOUT = 0x41484d11 ECCGETSTATS = 0x40104d12 ECHOCTL = 0x200 @@ -360,7 +359,6 @@ const ( SO_OOBINLINE = 0x100 SO_PASSCRED = 0x11 SO_PASSPIDFD = 0x4c - SO_PASSRIGHTS = 0x53 SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x12 diff --git a/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go b/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go index 5298a3033..28727514b 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go @@ -68,7 +68,6 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 - DM_MPATH_PROBE_PATHS = 0x2000fd12 ECCGETLAYOUT = 0x41484d11 ECCGETSTATS = 0x40104d12 ECHOCTL = 0x200 @@ -360,7 +359,6 @@ const ( SO_OOBINLINE = 0x100 SO_PASSCRED = 0x11 SO_PASSPIDFD = 0x4c - SO_PASSRIGHTS = 0x53 SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x12 diff --git a/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go b/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go index 7bc557c87..7f287b54b 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go @@ -68,7 +68,6 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 - DM_MPATH_PROBE_PATHS = 0x2000fd12 ECCGETLAYOUT = 0x41484d11 ECCGETSTATS = 0x40104d12 ECHOCTL = 0x200 @@ -360,7 +359,6 @@ const ( SO_OOBINLINE = 0x100 SO_PASSCRED = 0x11 SO_PASSPIDFD = 0x4c - SO_PASSRIGHTS = 0x53 SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x12 diff --git a/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go b/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go index 152399bb0..7e5f9e6aa 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go @@ -68,7 +68,6 @@ const ( CS8 = 0x300 CSIZE = 0x300 CSTOPB = 0x400 - DM_MPATH_PROBE_PATHS = 0x2000fd12 ECCGETLAYOUT = 0x41484d11 ECCGETSTATS = 0x40104d12 ECHOCTL = 0x40 @@ -415,7 +414,6 @@ const ( SO_OOBINLINE = 0xa SO_PASSCRED = 0x14 SO_PASSPIDFD = 0x4c - SO_PASSRIGHTS = 0x53 SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x15 diff --git a/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go b/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go index 1a1ce2409..37c87952f 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go @@ -68,7 +68,6 @@ const ( CS8 = 0x300 CSIZE = 0x300 CSTOPB = 0x400 - DM_MPATH_PROBE_PATHS = 0x2000fd12 ECCGETLAYOUT = 0x41484d11 ECCGETSTATS = 0x40104d12 ECHOCTL = 0x40 @@ -419,7 +418,6 @@ const ( SO_OOBINLINE = 0xa SO_PASSCRED = 0x14 SO_PASSPIDFD = 0x4c - SO_PASSRIGHTS = 0x53 SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x15 diff --git a/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go b/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go index 4231a1fb5..522013361 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go @@ -68,7 +68,6 @@ const ( CS8 = 0x300 CSIZE = 0x300 CSTOPB = 0x400 - DM_MPATH_PROBE_PATHS = 0x2000fd12 ECCGETLAYOUT = 0x41484d11 ECCGETSTATS = 0x40104d12 ECHOCTL = 0x40 @@ -419,7 +418,6 @@ const ( SO_OOBINLINE = 0xa SO_PASSCRED = 0x14 SO_PASSPIDFD = 0x4c - SO_PASSRIGHTS = 0x53 SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x15 diff --git a/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go b/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go index 21c0e9526..4bfe2b5b6 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go @@ -68,7 +68,6 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 - DM_MPATH_PROBE_PATHS = 0xfd12 ECCGETLAYOUT = 0x81484d11 ECCGETSTATS = 0x80104d12 ECHOCTL = 0x200 @@ -351,7 +350,6 @@ const ( SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 SO_PASSPIDFD = 0x4c - SO_PASSRIGHTS = 0x53 SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x11 diff --git a/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go b/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go index f00d1cd7c..e3cffb869 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go @@ -68,7 +68,6 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 - DM_MPATH_PROBE_PATHS = 0xfd12 ECCGETLAYOUT = 0x81484d11 ECCGETSTATS = 0x80104d12 ECHOCTL = 0x200 @@ -423,7 +422,6 @@ const ( SO_OOBINLINE = 0xa SO_PASSCRED = 0x10 SO_PASSPIDFD = 0x4c - SO_PASSRIGHTS = 0x53 SO_PASSSEC = 0x22 SO_PEEK_OFF = 0x2a SO_PEERCRED = 0x11 diff --git a/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go b/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go index bc8d539e6..c219c8db3 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go @@ -71,7 +71,6 @@ const ( CS8 = 0x30 CSIZE = 0x30 CSTOPB = 0x40 - DM_MPATH_PROBE_PATHS = 0x2000fd12 ECCGETLAYOUT = 0x41484d11 ECCGETSTATS = 0x40104d12 ECHOCTL = 0x200 @@ -462,7 +461,6 @@ const ( SO_OOBINLINE = 0x100 SO_PASSCRED = 0x2 SO_PASSPIDFD = 0x55 - SO_PASSRIGHTS = 0x5c SO_PASSSEC = 0x1f SO_PEEK_OFF = 0x26 SO_PEERCRED = 0x40 diff --git a/kubewatch/vendor/golang.org/x/sys/unix/zsyscall_linux.go b/kubewatch/vendor/golang.org/x/sys/unix/zsyscall_linux.go index 8935d10a3..5cc1e8eb2 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/zsyscall_linux.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/zsyscall_linux.go @@ -2238,13 +2238,3 @@ func Mseal(b []byte, flags uint) (err error) { } return } - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func setMemPolicy(mode int, mask *CPUSet, size int) (err error) { - _, _, e1 := Syscall(SYS_SET_MEMPOLICY, uintptr(mode), uintptr(unsafe.Pointer(mask)), uintptr(size)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/kubewatch/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go b/kubewatch/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go index b4609c20c..c6545413c 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go @@ -72,7 +72,7 @@ import ( //go:cgo_import_dynamic libc_kill kill "libc.so" //go:cgo_import_dynamic libc_lchown lchown "libc.so" //go:cgo_import_dynamic libc_link link "libc.so" -//go:cgo_import_dynamic libc___xnet_listen __xnet_listen "libsocket.so" +//go:cgo_import_dynamic libc___xnet_llisten __xnet_llisten "libsocket.so" //go:cgo_import_dynamic libc_lstat lstat "libc.so" //go:cgo_import_dynamic libc_madvise madvise "libc.so" //go:cgo_import_dynamic libc_mkdir mkdir "libc.so" @@ -221,7 +221,7 @@ import ( //go:linkname procKill libc_kill //go:linkname procLchown libc_lchown //go:linkname procLink libc_link -//go:linkname proc__xnet_listen libc___xnet_listen +//go:linkname proc__xnet_llisten libc___xnet_llisten //go:linkname procLstat libc_lstat //go:linkname procMadvise libc_madvise //go:linkname procMkdir libc_mkdir @@ -371,7 +371,7 @@ var ( procKill, procLchown, procLink, - proc__xnet_listen, + proc__xnet_llisten, procLstat, procMadvise, procMkdir, @@ -1178,7 +1178,7 @@ func Link(path string, link string) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Listen(s int, backlog int) (err error) { - _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_listen)), 2, uintptr(s), uintptr(backlog), 0, 0, 0, 0) + _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&proc__xnet_llisten)), 2, uintptr(s), uintptr(backlog), 0, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } diff --git a/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go b/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go index aca56ee49..c79aaff30 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go @@ -462,5 +462,4 @@ const ( SYS_GETXATTRAT = 464 SYS_LISTXATTRAT = 465 SYS_REMOVEXATTRAT = 466 - SYS_OPEN_TREE_ATTR = 467 ) diff --git a/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go b/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go index 2ea1ef58c..5eb450695 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go @@ -385,5 +385,4 @@ const ( SYS_GETXATTRAT = 464 SYS_LISTXATTRAT = 465 SYS_REMOVEXATTRAT = 466 - SYS_OPEN_TREE_ATTR = 467 ) diff --git a/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go b/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go index d22c8af31..05e502974 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go @@ -426,5 +426,4 @@ const ( SYS_GETXATTRAT = 464 SYS_LISTXATTRAT = 465 SYS_REMOVEXATTRAT = 466 - SYS_OPEN_TREE_ATTR = 467 ) diff --git a/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go b/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go index 5ee264ae9..38c53ec51 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go @@ -329,5 +329,4 @@ const ( SYS_GETXATTRAT = 464 SYS_LISTXATTRAT = 465 SYS_REMOVEXATTRAT = 466 - SYS_OPEN_TREE_ATTR = 467 ) diff --git a/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go b/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go index f9f03ebf5..31d2e71a1 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go @@ -325,5 +325,4 @@ const ( SYS_GETXATTRAT = 464 SYS_LISTXATTRAT = 465 SYS_REMOVEXATTRAT = 466 - SYS_OPEN_TREE_ATTR = 467 ) diff --git a/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go b/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go index 87c2118e8..f4184a336 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go @@ -446,5 +446,4 @@ const ( SYS_GETXATTRAT = 4464 SYS_LISTXATTRAT = 4465 SYS_REMOVEXATTRAT = 4466 - SYS_OPEN_TREE_ATTR = 4467 ) diff --git a/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go b/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go index 391ad102f..05b996227 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go @@ -376,5 +376,4 @@ const ( SYS_GETXATTRAT = 5464 SYS_LISTXATTRAT = 5465 SYS_REMOVEXATTRAT = 5466 - SYS_OPEN_TREE_ATTR = 5467 ) diff --git a/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go b/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go index 565615775..43a256e9e 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go @@ -376,5 +376,4 @@ const ( SYS_GETXATTRAT = 5464 SYS_LISTXATTRAT = 5465 SYS_REMOVEXATTRAT = 5466 - SYS_OPEN_TREE_ATTR = 5467 ) diff --git a/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go b/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go index 0482b52e3..eea5ddfc2 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go @@ -446,5 +446,4 @@ const ( SYS_GETXATTRAT = 4464 SYS_LISTXATTRAT = 4465 SYS_REMOVEXATTRAT = 4466 - SYS_OPEN_TREE_ATTR = 4467 ) diff --git a/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go b/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go index 71806f08f..0d777bfbb 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go @@ -453,5 +453,4 @@ const ( SYS_GETXATTRAT = 464 SYS_LISTXATTRAT = 465 SYS_REMOVEXATTRAT = 466 - SYS_OPEN_TREE_ATTR = 467 ) diff --git a/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go b/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go index e35a71058..b44636502 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go @@ -425,5 +425,4 @@ const ( SYS_GETXATTRAT = 464 SYS_LISTXATTRAT = 465 SYS_REMOVEXATTRAT = 466 - SYS_OPEN_TREE_ATTR = 467 ) diff --git a/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go b/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go index 2aea47670..0c7d21c18 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go @@ -425,5 +425,4 @@ const ( SYS_GETXATTRAT = 464 SYS_LISTXATTRAT = 465 SYS_REMOVEXATTRAT = 466 - SYS_OPEN_TREE_ATTR = 467 ) diff --git a/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go b/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go index 6c9bb4e56..840539169 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go @@ -330,5 +330,4 @@ const ( SYS_GETXATTRAT = 464 SYS_LISTXATTRAT = 465 SYS_REMOVEXATTRAT = 466 - SYS_OPEN_TREE_ATTR = 467 ) diff --git a/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go b/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go index 680bc9915..fcf1b790d 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go @@ -391,5 +391,4 @@ const ( SYS_GETXATTRAT = 464 SYS_LISTXATTRAT = 465 SYS_REMOVEXATTRAT = 466 - SYS_OPEN_TREE_ATTR = 467 ) diff --git a/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go b/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go index 620f27105..52d15b5f9 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go @@ -404,5 +404,4 @@ const ( SYS_GETXATTRAT = 464 SYS_LISTXATTRAT = 465 SYS_REMOVEXATTRAT = 466 - SYS_OPEN_TREE_ATTR = 467 ) diff --git a/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux.go b/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux.go index c1a467017..8bcac2835 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux.go @@ -115,9 +115,7 @@ type Statx_t struct { Atomic_write_unit_max uint32 Atomic_write_segments_max uint32 Dio_read_offset_align uint32 - Atomic_write_unit_max_opt uint32 - _ [1]uint32 - _ [8]uint64 + _ [9]uint64 } type Fsid struct { @@ -201,8 +199,7 @@ type FscryptAddKeyArg struct { Key_spec FscryptKeySpecifier Raw_size uint32 Key_id uint32 - Flags uint32 - _ [7]uint32 + _ [8]uint32 } type FscryptRemoveKeyArg struct { @@ -632,8 +629,6 @@ const ( IFA_FLAGS = 0x8 IFA_RT_PRIORITY = 0x9 IFA_TARGET_NETNSID = 0xa - IFAL_LABEL = 0x2 - IFAL_ADDRESS = 0x1 RT_SCOPE_UNIVERSE = 0x0 RT_SCOPE_SITE = 0xc8 RT_SCOPE_LINK = 0xfd @@ -691,7 +686,6 @@ const ( SizeofRtAttr = 0x4 SizeofIfInfomsg = 0x10 SizeofIfAddrmsg = 0x8 - SizeofIfAddrlblmsg = 0xc SizeofIfaCacheinfo = 0x10 SizeofRtMsg = 0xc SizeofRtNexthop = 0x8 @@ -743,15 +737,6 @@ type IfAddrmsg struct { Index uint32 } -type IfAddrlblmsg struct { - Family uint8 - _ uint8 - Prefixlen uint8 - Flags uint8 - Index uint32 - Seq uint32 -} - type IfaCacheinfo struct { Prefered uint32 Valid uint32 @@ -2332,11 +2317,6 @@ const ( NFT_CT_AVGPKT = 0x10 NFT_CT_ZONE = 0x11 NFT_CT_EVENTMASK = 0x12 - NFT_CT_SRC_IP = 0x13 - NFT_CT_DST_IP = 0x14 - NFT_CT_SRC_IP6 = 0x15 - NFT_CT_DST_IP6 = 0x16 - NFT_CT_ID = 0x17 NFTA_CT_UNSPEC = 0x0 NFTA_CT_DREG = 0x1 NFTA_CT_KEY = 0x2 @@ -2617,8 +2597,8 @@ const ( SOF_TIMESTAMPING_BIND_PHC = 0x8000 SOF_TIMESTAMPING_OPT_ID_TCP = 0x10000 - SOF_TIMESTAMPING_LAST = 0x40000 - SOF_TIMESTAMPING_MASK = 0x7ffff + SOF_TIMESTAMPING_LAST = 0x20000 + SOF_TIMESTAMPING_MASK = 0x3ffff SCM_TSTAMP_SND = 0x0 SCM_TSTAMP_SCHED = 0x1 @@ -3064,23 +3044,6 @@ const ( ) const ( - TCA_UNSPEC = 0x0 - TCA_KIND = 0x1 - TCA_OPTIONS = 0x2 - TCA_STATS = 0x3 - TCA_XSTATS = 0x4 - TCA_RATE = 0x5 - TCA_FCNT = 0x6 - TCA_STATS2 = 0x7 - TCA_STAB = 0x8 - TCA_PAD = 0x9 - TCA_DUMP_INVISIBLE = 0xa - TCA_CHAIN = 0xb - TCA_HW_OFFLOAD = 0xc - TCA_INGRESS_BLOCK = 0xd - TCA_EGRESS_BLOCK = 0xe - TCA_DUMP_FLAGS = 0xf - TCA_EXT_WARN_MSG = 0x10 RTNLGRP_NONE = 0x0 RTNLGRP_LINK = 0x1 RTNLGRP_NOTIFY = 0x2 @@ -3115,18 +3078,6 @@ const ( RTNLGRP_IPV6_MROUTE_R = 0x1f RTNLGRP_NEXTHOP = 0x20 RTNLGRP_BRVLAN = 0x21 - RTNLGRP_MCTP_IFADDR = 0x22 - RTNLGRP_TUNNEL = 0x23 - RTNLGRP_STATS = 0x24 - RTNLGRP_IPV4_MCADDR = 0x25 - RTNLGRP_IPV6_MCADDR = 0x26 - RTNLGRP_IPV6_ACADDR = 0x27 - TCA_ROOT_UNSPEC = 0x0 - TCA_ROOT_TAB = 0x1 - TCA_ROOT_FLAGS = 0x2 - TCA_ROOT_COUNT = 0x3 - TCA_ROOT_TIME_DELTA = 0x4 - TCA_ROOT_EXT_WARN_MSG = 0x5 ) type CapUserHeader struct { @@ -3590,8 +3541,6 @@ type Nhmsg struct { Flags uint32 } -const SizeofNhmsg = 0x8 - type NexthopGrp struct { Id uint32 Weight uint8 @@ -3599,8 +3548,6 @@ type NexthopGrp struct { Resvd2 uint16 } -const SizeofNexthopGrp = 0x8 - const ( NHA_UNSPEC = 0x0 NHA_ID = 0x1 @@ -4097,7 +4044,7 @@ const ( ETHTOOL_A_TSINFO_PHC_INDEX = 0x5 ETHTOOL_A_TSINFO_STATS = 0x6 ETHTOOL_A_TSINFO_HWTSTAMP_PROVIDER = 0x7 - ETHTOOL_A_TSINFO_MAX = 0x9 + ETHTOOL_A_TSINFO_MAX = 0x7 ETHTOOL_A_CABLE_TEST_UNSPEC = 0x0 ETHTOOL_A_CABLE_TEST_HEADER = 0x1 ETHTOOL_A_CABLE_TEST_MAX = 0x1 @@ -4183,19 +4130,6 @@ const ( ETHTOOL_A_TUNNEL_INFO_MAX = 0x2 ) -const ( - TCP_V4_FLOW = 0x1 - UDP_V4_FLOW = 0x2 - TCP_V6_FLOW = 0x5 - UDP_V6_FLOW = 0x6 - ESP_V4_FLOW = 0xa - ESP_V6_FLOW = 0xc - IP_USER_FLOW = 0xd - IPV6_USER_FLOW = 0xe - IPV6_FLOW = 0x11 - ETHER_FLOW = 0x12 -) - const SPEED_UNKNOWN = -0x1 type EthtoolDrvinfo struct { @@ -4846,7 +4780,7 @@ const ( NL80211_ATTR_MAC_HINT = 0xc8 NL80211_ATTR_MAC_MASK = 0xd7 NL80211_ATTR_MAX_AP_ASSOC_STA = 0xca - NL80211_ATTR_MAX = 0x151 + NL80211_ATTR_MAX = 0x150 NL80211_ATTR_MAX_CRIT_PROT_DURATION = 0xb4 NL80211_ATTR_MAX_CSA_COUNTERS = 0xce NL80211_ATTR_MAX_HW_TIMESTAMP_PEERS = 0x143 @@ -5480,7 +5414,7 @@ const ( NL80211_FREQUENCY_ATTR_GO_CONCURRENT = 0xf NL80211_FREQUENCY_ATTR_INDOOR_ONLY = 0xe NL80211_FREQUENCY_ATTR_IR_CONCURRENT = 0xf - NL80211_FREQUENCY_ATTR_MAX = 0x22 + NL80211_FREQUENCY_ATTR_MAX = 0x21 NL80211_FREQUENCY_ATTR_MAX_TX_POWER = 0x6 NL80211_FREQUENCY_ATTR_NO_10MHZ = 0x11 NL80211_FREQUENCY_ATTR_NO_160MHZ = 0xc @@ -5596,7 +5530,7 @@ const ( NL80211_MAX_SUPP_SELECTORS = 0x80 NL80211_MBSSID_CONFIG_ATTR_EMA = 0x5 NL80211_MBSSID_CONFIG_ATTR_INDEX = 0x3 - NL80211_MBSSID_CONFIG_ATTR_MAX = 0x6 + NL80211_MBSSID_CONFIG_ATTR_MAX = 0x5 NL80211_MBSSID_CONFIG_ATTR_MAX_EMA_PROFILE_PERIODICITY = 0x2 NL80211_MBSSID_CONFIG_ATTR_MAX_INTERFACES = 0x1 NL80211_MBSSID_CONFIG_ATTR_TX_IFINDEX = 0x4 @@ -6336,30 +6270,3 @@ type SockDiagReq struct { } const RTM_NEWNVLAN = 0x70 - -const ( - MPOL_BIND = 0x2 - MPOL_DEFAULT = 0x0 - MPOL_F_ADDR = 0x2 - MPOL_F_MEMS_ALLOWED = 0x4 - MPOL_F_MOF = 0x8 - MPOL_F_MORON = 0x10 - MPOL_F_NODE = 0x1 - MPOL_F_NUMA_BALANCING = 0x2000 - MPOL_F_RELATIVE_NODES = 0x4000 - MPOL_F_SHARED = 0x1 - MPOL_F_STATIC_NODES = 0x8000 - MPOL_INTERLEAVE = 0x3 - MPOL_LOCAL = 0x4 - MPOL_MAX = 0x7 - MPOL_MF_INTERNAL = 0x10 - MPOL_MF_LAZY = 0x8 - MPOL_MF_MOVE_ALL = 0x4 - MPOL_MF_MOVE = 0x2 - MPOL_MF_STRICT = 0x1 - MPOL_MF_VALID = 0x7 - MPOL_MODE_FLAGS = 0xe000 - MPOL_PREFERRED = 0x1 - MPOL_PREFERRED_MANY = 0x5 - MPOL_WEIGHTED_INTERLEAVE = 0x6 -) diff --git a/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_386.go b/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_386.go index 485f2d3a1..62db85f6c 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_386.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_386.go @@ -282,13 +282,19 @@ type Taskstats struct { Ac_exitcode uint32 Ac_flag uint8 Ac_nice uint8 - _ [6]byte + _ [4]byte Cpu_count uint64 Cpu_delay_total uint64 + Cpu_delay_max uint64 + Cpu_delay_min uint64 Blkio_count uint64 Blkio_delay_total uint64 + Blkio_delay_max uint64 + Blkio_delay_min uint64 Swapin_count uint64 Swapin_delay_total uint64 + Swapin_delay_max uint64 + Swapin_delay_min uint64 Cpu_run_real_total uint64 Cpu_run_virtual_total uint64 Ac_comm [32]int8 @@ -324,11 +330,17 @@ type Taskstats struct { Cpu_scaled_run_real_total uint64 Freepages_count uint64 Freepages_delay_total uint64 + Freepages_delay_max uint64 + Freepages_delay_min uint64 Thrashing_count uint64 Thrashing_delay_total uint64 + Thrashing_delay_max uint64 + Thrashing_delay_min uint64 Ac_btime64 uint64 Compact_count uint64 Compact_delay_total uint64 + Compact_delay_max uint64 + Compact_delay_min uint64 Ac_tgid uint32 _ [4]byte Ac_tgetime uint64 @@ -336,22 +348,10 @@ type Taskstats struct { Ac_exe_inode uint64 Wpcopy_count uint64 Wpcopy_delay_total uint64 - Irq_count uint64 - Irq_delay_total uint64 - Cpu_delay_max uint64 - Cpu_delay_min uint64 - Blkio_delay_max uint64 - Blkio_delay_min uint64 - Swapin_delay_max uint64 - Swapin_delay_min uint64 - Freepages_delay_max uint64 - Freepages_delay_min uint64 - Thrashing_delay_max uint64 - Thrashing_delay_min uint64 - Compact_delay_max uint64 - Compact_delay_min uint64 Wpcopy_delay_max uint64 Wpcopy_delay_min uint64 + Irq_count uint64 + Irq_delay_total uint64 Irq_delay_max uint64 Irq_delay_min uint64 } diff --git a/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go b/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go index ecbd1ad8b..7d89d648d 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go @@ -300,10 +300,16 @@ type Taskstats struct { Ac_nice uint8 Cpu_count uint64 Cpu_delay_total uint64 + Cpu_delay_max uint64 + Cpu_delay_min uint64 Blkio_count uint64 Blkio_delay_total uint64 + Blkio_delay_max uint64 + Blkio_delay_min uint64 Swapin_count uint64 Swapin_delay_total uint64 + Swapin_delay_max uint64 + Swapin_delay_min uint64 Cpu_run_real_total uint64 Cpu_run_virtual_total uint64 Ac_comm [32]int8 @@ -338,33 +344,27 @@ type Taskstats struct { Cpu_scaled_run_real_total uint64 Freepages_count uint64 Freepages_delay_total uint64 + Freepages_delay_max uint64 + Freepages_delay_min uint64 Thrashing_count uint64 Thrashing_delay_total uint64 + Thrashing_delay_max uint64 + Thrashing_delay_min uint64 Ac_btime64 uint64 Compact_count uint64 Compact_delay_total uint64 + Compact_delay_max uint64 + Compact_delay_min uint64 Ac_tgid uint32 Ac_tgetime uint64 Ac_exe_dev uint64 Ac_exe_inode uint64 Wpcopy_count uint64 Wpcopy_delay_total uint64 - Irq_count uint64 - Irq_delay_total uint64 - Cpu_delay_max uint64 - Cpu_delay_min uint64 - Blkio_delay_max uint64 - Blkio_delay_min uint64 - Swapin_delay_max uint64 - Swapin_delay_min uint64 - Freepages_delay_max uint64 - Freepages_delay_min uint64 - Thrashing_delay_max uint64 - Thrashing_delay_min uint64 - Compact_delay_max uint64 - Compact_delay_min uint64 Wpcopy_delay_max uint64 Wpcopy_delay_min uint64 + Irq_count uint64 + Irq_delay_total uint64 Irq_delay_max uint64 Irq_delay_min uint64 } diff --git a/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go b/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go index 02f0463a4..9c0b39eec 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go @@ -91,7 +91,7 @@ type Stat_t struct { Gid uint32 Rdev uint64 _ uint16 - _ [6]byte + _ [4]byte Size int64 Blksize int32 _ [4]byte @@ -273,13 +273,19 @@ type Taskstats struct { Ac_exitcode uint32 Ac_flag uint8 Ac_nice uint8 - _ [6]byte + _ [4]byte Cpu_count uint64 Cpu_delay_total uint64 + Cpu_delay_max uint64 + Cpu_delay_min uint64 Blkio_count uint64 Blkio_delay_total uint64 + Blkio_delay_max uint64 + Blkio_delay_min uint64 Swapin_count uint64 Swapin_delay_total uint64 + Swapin_delay_max uint64 + Swapin_delay_min uint64 Cpu_run_real_total uint64 Cpu_run_virtual_total uint64 Ac_comm [32]uint8 @@ -315,11 +321,17 @@ type Taskstats struct { Cpu_scaled_run_real_total uint64 Freepages_count uint64 Freepages_delay_total uint64 + Freepages_delay_max uint64 + Freepages_delay_min uint64 Thrashing_count uint64 Thrashing_delay_total uint64 + Thrashing_delay_max uint64 + Thrashing_delay_min uint64 Ac_btime64 uint64 Compact_count uint64 Compact_delay_total uint64 + Compact_delay_max uint64 + Compact_delay_min uint64 Ac_tgid uint32 _ [4]byte Ac_tgetime uint64 @@ -327,22 +339,10 @@ type Taskstats struct { Ac_exe_inode uint64 Wpcopy_count uint64 Wpcopy_delay_total uint64 - Irq_count uint64 - Irq_delay_total uint64 - Cpu_delay_max uint64 - Cpu_delay_min uint64 - Blkio_delay_max uint64 - Blkio_delay_min uint64 - Swapin_delay_max uint64 - Swapin_delay_min uint64 - Freepages_delay_max uint64 - Freepages_delay_min uint64 - Thrashing_delay_max uint64 - Thrashing_delay_min uint64 - Compact_delay_max uint64 - Compact_delay_min uint64 Wpcopy_delay_max uint64 Wpcopy_delay_min uint64 + Irq_count uint64 + Irq_delay_total uint64 Irq_delay_max uint64 Irq_delay_min uint64 } diff --git a/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go b/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go index 6f4d400d2..de9c7ff36 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go @@ -279,10 +279,16 @@ type Taskstats struct { Ac_nice uint8 Cpu_count uint64 Cpu_delay_total uint64 + Cpu_delay_max uint64 + Cpu_delay_min uint64 Blkio_count uint64 Blkio_delay_total uint64 + Blkio_delay_max uint64 + Blkio_delay_min uint64 Swapin_count uint64 Swapin_delay_total uint64 + Swapin_delay_max uint64 + Swapin_delay_min uint64 Cpu_run_real_total uint64 Cpu_run_virtual_total uint64 Ac_comm [32]int8 @@ -317,33 +323,27 @@ type Taskstats struct { Cpu_scaled_run_real_total uint64 Freepages_count uint64 Freepages_delay_total uint64 + Freepages_delay_max uint64 + Freepages_delay_min uint64 Thrashing_count uint64 Thrashing_delay_total uint64 + Thrashing_delay_max uint64 + Thrashing_delay_min uint64 Ac_btime64 uint64 Compact_count uint64 Compact_delay_total uint64 + Compact_delay_max uint64 + Compact_delay_min uint64 Ac_tgid uint32 Ac_tgetime uint64 Ac_exe_dev uint64 Ac_exe_inode uint64 Wpcopy_count uint64 Wpcopy_delay_total uint64 - Irq_count uint64 - Irq_delay_total uint64 - Cpu_delay_max uint64 - Cpu_delay_min uint64 - Blkio_delay_max uint64 - Blkio_delay_min uint64 - Swapin_delay_max uint64 - Swapin_delay_min uint64 - Freepages_delay_max uint64 - Freepages_delay_min uint64 - Thrashing_delay_max uint64 - Thrashing_delay_min uint64 - Compact_delay_max uint64 - Compact_delay_min uint64 Wpcopy_delay_max uint64 Wpcopy_delay_min uint64 + Irq_count uint64 + Irq_delay_total uint64 Irq_delay_max uint64 Irq_delay_min uint64 } diff --git a/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go b/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go index cd532cfa5..2336bd2bf 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go @@ -280,10 +280,16 @@ type Taskstats struct { Ac_nice uint8 Cpu_count uint64 Cpu_delay_total uint64 + Cpu_delay_max uint64 + Cpu_delay_min uint64 Blkio_count uint64 Blkio_delay_total uint64 + Blkio_delay_max uint64 + Blkio_delay_min uint64 Swapin_count uint64 Swapin_delay_total uint64 + Swapin_delay_max uint64 + Swapin_delay_min uint64 Cpu_run_real_total uint64 Cpu_run_virtual_total uint64 Ac_comm [32]int8 @@ -318,33 +324,27 @@ type Taskstats struct { Cpu_scaled_run_real_total uint64 Freepages_count uint64 Freepages_delay_total uint64 + Freepages_delay_max uint64 + Freepages_delay_min uint64 Thrashing_count uint64 Thrashing_delay_total uint64 + Thrashing_delay_max uint64 + Thrashing_delay_min uint64 Ac_btime64 uint64 Compact_count uint64 Compact_delay_total uint64 + Compact_delay_max uint64 + Compact_delay_min uint64 Ac_tgid uint32 Ac_tgetime uint64 Ac_exe_dev uint64 Ac_exe_inode uint64 Wpcopy_count uint64 Wpcopy_delay_total uint64 - Irq_count uint64 - Irq_delay_total uint64 - Cpu_delay_max uint64 - Cpu_delay_min uint64 - Blkio_delay_max uint64 - Blkio_delay_min uint64 - Swapin_delay_max uint64 - Swapin_delay_min uint64 - Freepages_delay_max uint64 - Freepages_delay_min uint64 - Thrashing_delay_max uint64 - Thrashing_delay_min uint64 - Compact_delay_max uint64 - Compact_delay_min uint64 Wpcopy_delay_max uint64 Wpcopy_delay_min uint64 + Irq_count uint64 + Irq_delay_total uint64 Irq_delay_max uint64 Irq_delay_min uint64 } diff --git a/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go b/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go index 413362085..4711f0be1 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go @@ -278,13 +278,19 @@ type Taskstats struct { Ac_exitcode uint32 Ac_flag uint8 Ac_nice uint8 - _ [6]byte + _ [4]byte Cpu_count uint64 Cpu_delay_total uint64 + Cpu_delay_max uint64 + Cpu_delay_min uint64 Blkio_count uint64 Blkio_delay_total uint64 + Blkio_delay_max uint64 + Blkio_delay_min uint64 Swapin_count uint64 Swapin_delay_total uint64 + Swapin_delay_max uint64 + Swapin_delay_min uint64 Cpu_run_real_total uint64 Cpu_run_virtual_total uint64 Ac_comm [32]int8 @@ -320,11 +326,17 @@ type Taskstats struct { Cpu_scaled_run_real_total uint64 Freepages_count uint64 Freepages_delay_total uint64 + Freepages_delay_max uint64 + Freepages_delay_min uint64 Thrashing_count uint64 Thrashing_delay_total uint64 + Thrashing_delay_max uint64 + Thrashing_delay_min uint64 Ac_btime64 uint64 Compact_count uint64 Compact_delay_total uint64 + Compact_delay_max uint64 + Compact_delay_min uint64 Ac_tgid uint32 _ [4]byte Ac_tgetime uint64 @@ -332,22 +344,10 @@ type Taskstats struct { Ac_exe_inode uint64 Wpcopy_count uint64 Wpcopy_delay_total uint64 - Irq_count uint64 - Irq_delay_total uint64 - Cpu_delay_max uint64 - Cpu_delay_min uint64 - Blkio_delay_max uint64 - Blkio_delay_min uint64 - Swapin_delay_max uint64 - Swapin_delay_min uint64 - Freepages_delay_max uint64 - Freepages_delay_min uint64 - Thrashing_delay_max uint64 - Thrashing_delay_min uint64 - Compact_delay_max uint64 - Compact_delay_min uint64 Wpcopy_delay_max uint64 Wpcopy_delay_min uint64 + Irq_count uint64 + Irq_delay_total uint64 Irq_delay_max uint64 Irq_delay_min uint64 } diff --git a/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go b/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go index eaa37eb71..ab99a34b9 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go @@ -282,10 +282,16 @@ type Taskstats struct { Ac_nice uint8 Cpu_count uint64 Cpu_delay_total uint64 + Cpu_delay_max uint64 + Cpu_delay_min uint64 Blkio_count uint64 Blkio_delay_total uint64 + Blkio_delay_max uint64 + Blkio_delay_min uint64 Swapin_count uint64 Swapin_delay_total uint64 + Swapin_delay_max uint64 + Swapin_delay_min uint64 Cpu_run_real_total uint64 Cpu_run_virtual_total uint64 Ac_comm [32]int8 @@ -320,33 +326,27 @@ type Taskstats struct { Cpu_scaled_run_real_total uint64 Freepages_count uint64 Freepages_delay_total uint64 + Freepages_delay_max uint64 + Freepages_delay_min uint64 Thrashing_count uint64 Thrashing_delay_total uint64 + Thrashing_delay_max uint64 + Thrashing_delay_min uint64 Ac_btime64 uint64 Compact_count uint64 Compact_delay_total uint64 + Compact_delay_max uint64 + Compact_delay_min uint64 Ac_tgid uint32 Ac_tgetime uint64 Ac_exe_dev uint64 Ac_exe_inode uint64 Wpcopy_count uint64 Wpcopy_delay_total uint64 - Irq_count uint64 - Irq_delay_total uint64 - Cpu_delay_max uint64 - Cpu_delay_min uint64 - Blkio_delay_max uint64 - Blkio_delay_min uint64 - Swapin_delay_max uint64 - Swapin_delay_min uint64 - Freepages_delay_max uint64 - Freepages_delay_min uint64 - Thrashing_delay_max uint64 - Thrashing_delay_min uint64 - Compact_delay_max uint64 - Compact_delay_min uint64 Wpcopy_delay_max uint64 Wpcopy_delay_min uint64 + Irq_count uint64 + Irq_delay_total uint64 Irq_delay_max uint64 Irq_delay_min uint64 } diff --git a/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go b/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go index 98ae6a1e4..04c9866e3 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go @@ -282,10 +282,16 @@ type Taskstats struct { Ac_nice uint8 Cpu_count uint64 Cpu_delay_total uint64 + Cpu_delay_max uint64 + Cpu_delay_min uint64 Blkio_count uint64 Blkio_delay_total uint64 + Blkio_delay_max uint64 + Blkio_delay_min uint64 Swapin_count uint64 Swapin_delay_total uint64 + Swapin_delay_max uint64 + Swapin_delay_min uint64 Cpu_run_real_total uint64 Cpu_run_virtual_total uint64 Ac_comm [32]int8 @@ -320,33 +326,27 @@ type Taskstats struct { Cpu_scaled_run_real_total uint64 Freepages_count uint64 Freepages_delay_total uint64 + Freepages_delay_max uint64 + Freepages_delay_min uint64 Thrashing_count uint64 Thrashing_delay_total uint64 + Thrashing_delay_max uint64 + Thrashing_delay_min uint64 Ac_btime64 uint64 Compact_count uint64 Compact_delay_total uint64 + Compact_delay_max uint64 + Compact_delay_min uint64 Ac_tgid uint32 Ac_tgetime uint64 Ac_exe_dev uint64 Ac_exe_inode uint64 Wpcopy_count uint64 Wpcopy_delay_total uint64 - Irq_count uint64 - Irq_delay_total uint64 - Cpu_delay_max uint64 - Cpu_delay_min uint64 - Blkio_delay_max uint64 - Blkio_delay_min uint64 - Swapin_delay_max uint64 - Swapin_delay_min uint64 - Freepages_delay_max uint64 - Freepages_delay_min uint64 - Thrashing_delay_max uint64 - Thrashing_delay_min uint64 - Compact_delay_max uint64 - Compact_delay_min uint64 Wpcopy_delay_max uint64 Wpcopy_delay_min uint64 + Irq_count uint64 + Irq_delay_total uint64 Irq_delay_max uint64 Irq_delay_min uint64 } diff --git a/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go b/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go index cae196159..60aa69f61 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go @@ -278,13 +278,19 @@ type Taskstats struct { Ac_exitcode uint32 Ac_flag uint8 Ac_nice uint8 - _ [6]byte + _ [4]byte Cpu_count uint64 Cpu_delay_total uint64 + Cpu_delay_max uint64 + Cpu_delay_min uint64 Blkio_count uint64 Blkio_delay_total uint64 + Blkio_delay_max uint64 + Blkio_delay_min uint64 Swapin_count uint64 Swapin_delay_total uint64 + Swapin_delay_max uint64 + Swapin_delay_min uint64 Cpu_run_real_total uint64 Cpu_run_virtual_total uint64 Ac_comm [32]int8 @@ -320,11 +326,17 @@ type Taskstats struct { Cpu_scaled_run_real_total uint64 Freepages_count uint64 Freepages_delay_total uint64 + Freepages_delay_max uint64 + Freepages_delay_min uint64 Thrashing_count uint64 Thrashing_delay_total uint64 + Thrashing_delay_max uint64 + Thrashing_delay_min uint64 Ac_btime64 uint64 Compact_count uint64 Compact_delay_total uint64 + Compact_delay_max uint64 + Compact_delay_min uint64 Ac_tgid uint32 _ [4]byte Ac_tgetime uint64 @@ -332,22 +344,10 @@ type Taskstats struct { Ac_exe_inode uint64 Wpcopy_count uint64 Wpcopy_delay_total uint64 - Irq_count uint64 - Irq_delay_total uint64 - Cpu_delay_max uint64 - Cpu_delay_min uint64 - Blkio_delay_max uint64 - Blkio_delay_min uint64 - Swapin_delay_max uint64 - Swapin_delay_min uint64 - Freepages_delay_max uint64 - Freepages_delay_min uint64 - Thrashing_delay_max uint64 - Thrashing_delay_min uint64 - Compact_delay_max uint64 - Compact_delay_min uint64 Wpcopy_delay_max uint64 Wpcopy_delay_min uint64 + Irq_count uint64 + Irq_delay_total uint64 Irq_delay_max uint64 Irq_delay_min uint64 } diff --git a/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go b/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go index 6ce3b4e02..cb4fad785 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go @@ -90,7 +90,7 @@ type Stat_t struct { Gid uint32 Rdev uint64 _ uint16 - _ [6]byte + _ [4]byte Size int64 Blksize int32 _ [4]byte @@ -285,13 +285,19 @@ type Taskstats struct { Ac_exitcode uint32 Ac_flag uint8 Ac_nice uint8 - _ [6]byte + _ [4]byte Cpu_count uint64 Cpu_delay_total uint64 + Cpu_delay_max uint64 + Cpu_delay_min uint64 Blkio_count uint64 Blkio_delay_total uint64 + Blkio_delay_max uint64 + Blkio_delay_min uint64 Swapin_count uint64 Swapin_delay_total uint64 + Swapin_delay_max uint64 + Swapin_delay_min uint64 Cpu_run_real_total uint64 Cpu_run_virtual_total uint64 Ac_comm [32]uint8 @@ -327,11 +333,17 @@ type Taskstats struct { Cpu_scaled_run_real_total uint64 Freepages_count uint64 Freepages_delay_total uint64 + Freepages_delay_max uint64 + Freepages_delay_min uint64 Thrashing_count uint64 Thrashing_delay_total uint64 + Thrashing_delay_max uint64 + Thrashing_delay_min uint64 Ac_btime64 uint64 Compact_count uint64 Compact_delay_total uint64 + Compact_delay_max uint64 + Compact_delay_min uint64 Ac_tgid uint32 _ [4]byte Ac_tgetime uint64 @@ -339,22 +351,10 @@ type Taskstats struct { Ac_exe_inode uint64 Wpcopy_count uint64 Wpcopy_delay_total uint64 - Irq_count uint64 - Irq_delay_total uint64 - Cpu_delay_max uint64 - Cpu_delay_min uint64 - Blkio_delay_max uint64 - Blkio_delay_min uint64 - Swapin_delay_max uint64 - Swapin_delay_min uint64 - Freepages_delay_max uint64 - Freepages_delay_min uint64 - Thrashing_delay_max uint64 - Thrashing_delay_min uint64 - Compact_delay_max uint64 - Compact_delay_min uint64 Wpcopy_delay_max uint64 Wpcopy_delay_min uint64 + Irq_count uint64 + Irq_delay_total uint64 Irq_delay_max uint64 Irq_delay_min uint64 } diff --git a/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go b/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go index c7429c6a1..60272cfce 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go @@ -289,10 +289,16 @@ type Taskstats struct { Ac_nice uint8 Cpu_count uint64 Cpu_delay_total uint64 + Cpu_delay_max uint64 + Cpu_delay_min uint64 Blkio_count uint64 Blkio_delay_total uint64 + Blkio_delay_max uint64 + Blkio_delay_min uint64 Swapin_count uint64 Swapin_delay_total uint64 + Swapin_delay_max uint64 + Swapin_delay_min uint64 Cpu_run_real_total uint64 Cpu_run_virtual_total uint64 Ac_comm [32]uint8 @@ -327,33 +333,27 @@ type Taskstats struct { Cpu_scaled_run_real_total uint64 Freepages_count uint64 Freepages_delay_total uint64 + Freepages_delay_max uint64 + Freepages_delay_min uint64 Thrashing_count uint64 Thrashing_delay_total uint64 + Thrashing_delay_max uint64 + Thrashing_delay_min uint64 Ac_btime64 uint64 Compact_count uint64 Compact_delay_total uint64 + Compact_delay_max uint64 + Compact_delay_min uint64 Ac_tgid uint32 Ac_tgetime uint64 Ac_exe_dev uint64 Ac_exe_inode uint64 Wpcopy_count uint64 Wpcopy_delay_total uint64 - Irq_count uint64 - Irq_delay_total uint64 - Cpu_delay_max uint64 - Cpu_delay_min uint64 - Blkio_delay_max uint64 - Blkio_delay_min uint64 - Swapin_delay_max uint64 - Swapin_delay_min uint64 - Freepages_delay_max uint64 - Freepages_delay_min uint64 - Thrashing_delay_max uint64 - Thrashing_delay_min uint64 - Compact_delay_max uint64 - Compact_delay_min uint64 Wpcopy_delay_max uint64 Wpcopy_delay_min uint64 + Irq_count uint64 + Irq_delay_total uint64 Irq_delay_max uint64 Irq_delay_min uint64 } diff --git a/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go b/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go index 4bf4baf4c..3f5b91bc0 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go @@ -289,10 +289,16 @@ type Taskstats struct { Ac_nice uint8 Cpu_count uint64 Cpu_delay_total uint64 + Cpu_delay_max uint64 + Cpu_delay_min uint64 Blkio_count uint64 Blkio_delay_total uint64 + Blkio_delay_max uint64 + Blkio_delay_min uint64 Swapin_count uint64 Swapin_delay_total uint64 + Swapin_delay_max uint64 + Swapin_delay_min uint64 Cpu_run_real_total uint64 Cpu_run_virtual_total uint64 Ac_comm [32]uint8 @@ -327,33 +333,27 @@ type Taskstats struct { Cpu_scaled_run_real_total uint64 Freepages_count uint64 Freepages_delay_total uint64 + Freepages_delay_max uint64 + Freepages_delay_min uint64 Thrashing_count uint64 Thrashing_delay_total uint64 + Thrashing_delay_max uint64 + Thrashing_delay_min uint64 Ac_btime64 uint64 Compact_count uint64 Compact_delay_total uint64 + Compact_delay_max uint64 + Compact_delay_min uint64 Ac_tgid uint32 Ac_tgetime uint64 Ac_exe_dev uint64 Ac_exe_inode uint64 Wpcopy_count uint64 Wpcopy_delay_total uint64 - Irq_count uint64 - Irq_delay_total uint64 - Cpu_delay_max uint64 - Cpu_delay_min uint64 - Blkio_delay_max uint64 - Blkio_delay_min uint64 - Swapin_delay_max uint64 - Swapin_delay_min uint64 - Freepages_delay_max uint64 - Freepages_delay_min uint64 - Thrashing_delay_max uint64 - Thrashing_delay_min uint64 - Compact_delay_max uint64 - Compact_delay_min uint64 Wpcopy_delay_max uint64 Wpcopy_delay_min uint64 + Irq_count uint64 + Irq_delay_total uint64 Irq_delay_max uint64 Irq_delay_min uint64 } diff --git a/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go b/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go index e9709d70a..51550f15a 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go @@ -307,10 +307,16 @@ type Taskstats struct { Ac_nice uint8 Cpu_count uint64 Cpu_delay_total uint64 + Cpu_delay_max uint64 + Cpu_delay_min uint64 Blkio_count uint64 Blkio_delay_total uint64 + Blkio_delay_max uint64 + Blkio_delay_min uint64 Swapin_count uint64 Swapin_delay_total uint64 + Swapin_delay_max uint64 + Swapin_delay_min uint64 Cpu_run_real_total uint64 Cpu_run_virtual_total uint64 Ac_comm [32]uint8 @@ -345,33 +351,27 @@ type Taskstats struct { Cpu_scaled_run_real_total uint64 Freepages_count uint64 Freepages_delay_total uint64 + Freepages_delay_max uint64 + Freepages_delay_min uint64 Thrashing_count uint64 Thrashing_delay_total uint64 + Thrashing_delay_max uint64 + Thrashing_delay_min uint64 Ac_btime64 uint64 Compact_count uint64 Compact_delay_total uint64 + Compact_delay_max uint64 + Compact_delay_min uint64 Ac_tgid uint32 Ac_tgetime uint64 Ac_exe_dev uint64 Ac_exe_inode uint64 Wpcopy_count uint64 Wpcopy_delay_total uint64 - Irq_count uint64 - Irq_delay_total uint64 - Cpu_delay_max uint64 - Cpu_delay_min uint64 - Blkio_delay_max uint64 - Blkio_delay_min uint64 - Swapin_delay_max uint64 - Swapin_delay_min uint64 - Freepages_delay_max uint64 - Freepages_delay_min uint64 - Thrashing_delay_max uint64 - Thrashing_delay_min uint64 - Compact_delay_max uint64 - Compact_delay_min uint64 Wpcopy_delay_max uint64 Wpcopy_delay_min uint64 + Irq_count uint64 + Irq_delay_total uint64 Irq_delay_max uint64 Irq_delay_min uint64 } diff --git a/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go b/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go index fb44268ca..3239e50e0 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go @@ -302,10 +302,16 @@ type Taskstats struct { Ac_nice uint8 Cpu_count uint64 Cpu_delay_total uint64 + Cpu_delay_max uint64 + Cpu_delay_min uint64 Blkio_count uint64 Blkio_delay_total uint64 + Blkio_delay_max uint64 + Blkio_delay_min uint64 Swapin_count uint64 Swapin_delay_total uint64 + Swapin_delay_max uint64 + Swapin_delay_min uint64 Cpu_run_real_total uint64 Cpu_run_virtual_total uint64 Ac_comm [32]int8 @@ -340,33 +346,27 @@ type Taskstats struct { Cpu_scaled_run_real_total uint64 Freepages_count uint64 Freepages_delay_total uint64 + Freepages_delay_max uint64 + Freepages_delay_min uint64 Thrashing_count uint64 Thrashing_delay_total uint64 + Thrashing_delay_max uint64 + Thrashing_delay_min uint64 Ac_btime64 uint64 Compact_count uint64 Compact_delay_total uint64 + Compact_delay_max uint64 + Compact_delay_min uint64 Ac_tgid uint32 Ac_tgetime uint64 Ac_exe_dev uint64 Ac_exe_inode uint64 Wpcopy_count uint64 Wpcopy_delay_total uint64 - Irq_count uint64 - Irq_delay_total uint64 - Cpu_delay_max uint64 - Cpu_delay_min uint64 - Blkio_delay_max uint64 - Blkio_delay_min uint64 - Swapin_delay_max uint64 - Swapin_delay_min uint64 - Freepages_delay_max uint64 - Freepages_delay_min uint64 - Thrashing_delay_max uint64 - Thrashing_delay_min uint64 - Compact_delay_max uint64 - Compact_delay_min uint64 Wpcopy_delay_max uint64 Wpcopy_delay_min uint64 + Irq_count uint64 + Irq_delay_total uint64 Irq_delay_max uint64 Irq_delay_min uint64 } diff --git a/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go b/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go index 9c38265c7..faf200278 100644 --- a/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go +++ b/kubewatch/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go @@ -284,10 +284,16 @@ type Taskstats struct { Ac_nice uint8 Cpu_count uint64 Cpu_delay_total uint64 + Cpu_delay_max uint64 + Cpu_delay_min uint64 Blkio_count uint64 Blkio_delay_total uint64 + Blkio_delay_max uint64 + Blkio_delay_min uint64 Swapin_count uint64 Swapin_delay_total uint64 + Swapin_delay_max uint64 + Swapin_delay_min uint64 Cpu_run_real_total uint64 Cpu_run_virtual_total uint64 Ac_comm [32]int8 @@ -322,33 +328,27 @@ type Taskstats struct { Cpu_scaled_run_real_total uint64 Freepages_count uint64 Freepages_delay_total uint64 + Freepages_delay_max uint64 + Freepages_delay_min uint64 Thrashing_count uint64 Thrashing_delay_total uint64 + Thrashing_delay_max uint64 + Thrashing_delay_min uint64 Ac_btime64 uint64 Compact_count uint64 Compact_delay_total uint64 + Compact_delay_max uint64 + Compact_delay_min uint64 Ac_tgid uint32 Ac_tgetime uint64 Ac_exe_dev uint64 Ac_exe_inode uint64 Wpcopy_count uint64 Wpcopy_delay_total uint64 - Irq_count uint64 - Irq_delay_total uint64 - Cpu_delay_max uint64 - Cpu_delay_min uint64 - Blkio_delay_max uint64 - Blkio_delay_min uint64 - Swapin_delay_max uint64 - Swapin_delay_min uint64 - Freepages_delay_max uint64 - Freepages_delay_min uint64 - Thrashing_delay_max uint64 - Thrashing_delay_min uint64 - Compact_delay_max uint64 - Compact_delay_min uint64 Wpcopy_delay_max uint64 Wpcopy_delay_min uint64 + Irq_count uint64 + Irq_delay_total uint64 Irq_delay_max uint64 Irq_delay_min uint64 } diff --git a/kubewatch/vendor/golang.org/x/sys/windows/registry/zsyscall_windows.go b/kubewatch/vendor/golang.org/x/sys/windows/registry/zsyscall_windows.go index bc1ce4360..fc1835d8a 100644 --- a/kubewatch/vendor/golang.org/x/sys/windows/registry/zsyscall_windows.go +++ b/kubewatch/vendor/golang.org/x/sys/windows/registry/zsyscall_windows.go @@ -52,7 +52,7 @@ var ( ) func regConnectRegistry(machinename *uint16, key syscall.Handle, result *syscall.Handle) (regerrno error) { - r0, _, _ := syscall.SyscallN(procRegConnectRegistryW.Addr(), uintptr(unsafe.Pointer(machinename)), uintptr(key), uintptr(unsafe.Pointer(result))) + r0, _, _ := syscall.Syscall(procRegConnectRegistryW.Addr(), 3, uintptr(unsafe.Pointer(machinename)), uintptr(key), uintptr(unsafe.Pointer(result))) if r0 != 0 { regerrno = syscall.Errno(r0) } @@ -60,7 +60,7 @@ func regConnectRegistry(machinename *uint16, key syscall.Handle, result *syscall } func regCreateKeyEx(key syscall.Handle, subkey *uint16, reserved uint32, class *uint16, options uint32, desired uint32, sa *syscall.SecurityAttributes, result *syscall.Handle, disposition *uint32) (regerrno error) { - r0, _, _ := syscall.SyscallN(procRegCreateKeyExW.Addr(), uintptr(key), uintptr(unsafe.Pointer(subkey)), uintptr(reserved), uintptr(unsafe.Pointer(class)), uintptr(options), uintptr(desired), uintptr(unsafe.Pointer(sa)), uintptr(unsafe.Pointer(result)), uintptr(unsafe.Pointer(disposition))) + r0, _, _ := syscall.Syscall9(procRegCreateKeyExW.Addr(), 9, uintptr(key), uintptr(unsafe.Pointer(subkey)), uintptr(reserved), uintptr(unsafe.Pointer(class)), uintptr(options), uintptr(desired), uintptr(unsafe.Pointer(sa)), uintptr(unsafe.Pointer(result)), uintptr(unsafe.Pointer(disposition))) if r0 != 0 { regerrno = syscall.Errno(r0) } @@ -68,7 +68,7 @@ func regCreateKeyEx(key syscall.Handle, subkey *uint16, reserved uint32, class * } func regDeleteKey(key syscall.Handle, subkey *uint16) (regerrno error) { - r0, _, _ := syscall.SyscallN(procRegDeleteKeyW.Addr(), uintptr(key), uintptr(unsafe.Pointer(subkey))) + r0, _, _ := syscall.Syscall(procRegDeleteKeyW.Addr(), 2, uintptr(key), uintptr(unsafe.Pointer(subkey)), 0) if r0 != 0 { regerrno = syscall.Errno(r0) } @@ -76,7 +76,7 @@ func regDeleteKey(key syscall.Handle, subkey *uint16) (regerrno error) { } func regDeleteValue(key syscall.Handle, name *uint16) (regerrno error) { - r0, _, _ := syscall.SyscallN(procRegDeleteValueW.Addr(), uintptr(key), uintptr(unsafe.Pointer(name))) + r0, _, _ := syscall.Syscall(procRegDeleteValueW.Addr(), 2, uintptr(key), uintptr(unsafe.Pointer(name)), 0) if r0 != 0 { regerrno = syscall.Errno(r0) } @@ -84,7 +84,7 @@ func regDeleteValue(key syscall.Handle, name *uint16) (regerrno error) { } func regEnumValue(key syscall.Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) { - r0, _, _ := syscall.SyscallN(procRegEnumValueW.Addr(), uintptr(key), uintptr(index), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(valtype)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(buflen))) + r0, _, _ := syscall.Syscall9(procRegEnumValueW.Addr(), 8, uintptr(key), uintptr(index), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(valtype)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(buflen)), 0) if r0 != 0 { regerrno = syscall.Errno(r0) } @@ -92,7 +92,7 @@ func regEnumValue(key syscall.Handle, index uint32, name *uint16, nameLen *uint3 } func regLoadMUIString(key syscall.Handle, name *uint16, buf *uint16, buflen uint32, buflenCopied *uint32, flags uint32, dir *uint16) (regerrno error) { - r0, _, _ := syscall.SyscallN(procRegLoadMUIStringW.Addr(), uintptr(key), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(buf)), uintptr(buflen), uintptr(unsafe.Pointer(buflenCopied)), uintptr(flags), uintptr(unsafe.Pointer(dir))) + r0, _, _ := syscall.Syscall9(procRegLoadMUIStringW.Addr(), 7, uintptr(key), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(buf)), uintptr(buflen), uintptr(unsafe.Pointer(buflenCopied)), uintptr(flags), uintptr(unsafe.Pointer(dir)), 0, 0) if r0 != 0 { regerrno = syscall.Errno(r0) } @@ -100,7 +100,7 @@ func regLoadMUIString(key syscall.Handle, name *uint16, buf *uint16, buflen uint } func regSetValueEx(key syscall.Handle, valueName *uint16, reserved uint32, vtype uint32, buf *byte, bufsize uint32) (regerrno error) { - r0, _, _ := syscall.SyscallN(procRegSetValueExW.Addr(), uintptr(key), uintptr(unsafe.Pointer(valueName)), uintptr(reserved), uintptr(vtype), uintptr(unsafe.Pointer(buf)), uintptr(bufsize)) + r0, _, _ := syscall.Syscall6(procRegSetValueExW.Addr(), 6, uintptr(key), uintptr(unsafe.Pointer(valueName)), uintptr(reserved), uintptr(vtype), uintptr(unsafe.Pointer(buf)), uintptr(bufsize)) if r0 != 0 { regerrno = syscall.Errno(r0) } @@ -108,7 +108,7 @@ func regSetValueEx(key syscall.Handle, valueName *uint16, reserved uint32, vtype } func expandEnvironmentStrings(src *uint16, dst *uint16, size uint32) (n uint32, err error) { - r0, _, e1 := syscall.SyscallN(procExpandEnvironmentStringsW.Addr(), uintptr(unsafe.Pointer(src)), uintptr(unsafe.Pointer(dst)), uintptr(size)) + r0, _, e1 := syscall.Syscall(procExpandEnvironmentStringsW.Addr(), 3, uintptr(unsafe.Pointer(src)), uintptr(unsafe.Pointer(dst)), uintptr(size)) n = uint32(r0) if n == 0 { err = errnoErr(e1) diff --git a/kubewatch/vendor/golang.org/x/sys/windows/syscall_windows.go b/kubewatch/vendor/golang.org/x/sys/windows/syscall_windows.go index 69439df2a..640f6b153 100644 --- a/kubewatch/vendor/golang.org/x/sys/windows/syscall_windows.go +++ b/kubewatch/vendor/golang.org/x/sys/windows/syscall_windows.go @@ -321,8 +321,6 @@ func NewCallbackCDecl(fn interface{}) uintptr { //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 GetNumberOfConsoleInputEvents(console Handle, numevents *uint32) (err error) = kernel32.GetNumberOfConsoleInputEvents -//sys FlushConsoleInputBuffer(console Handle) (err error) = kernel32.FlushConsoleInputBuffer //sys resizePseudoConsole(pconsole Handle, size uint32) (hr error) = kernel32.ResizePseudoConsole //sys CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, err error) [failretval==InvalidHandle] = kernel32.CreateToolhelp32Snapshot //sys Module32First(snapshot Handle, moduleEntry *ModuleEntry32) (err error) = kernel32.Module32FirstW @@ -892,12 +890,8 @@ const socket_error = uintptr(^uint32(0)) //sys MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int32, err error) = kernel32.MultiByteToWideChar //sys getBestInterfaceEx(sockaddr unsafe.Pointer, pdwBestIfIndex *uint32) (errcode error) = iphlpapi.GetBestInterfaceEx //sys GetIfEntry2Ex(level uint32, row *MibIfRow2) (errcode error) = iphlpapi.GetIfEntry2Ex -//sys GetIpForwardEntry2(row *MibIpForwardRow2) (errcode error) = iphlpapi.GetIpForwardEntry2 -//sys GetIpForwardTable2(family uint16, table **MibIpForwardTable2) (errcode error) = iphlpapi.GetIpForwardTable2 //sys GetUnicastIpAddressEntry(row *MibUnicastIpAddressRow) (errcode error) = iphlpapi.GetUnicastIpAddressEntry -//sys FreeMibTable(memory unsafe.Pointer) = iphlpapi.FreeMibTable //sys NotifyIpInterfaceChange(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) = iphlpapi.NotifyIpInterfaceChange -//sys NotifyRouteChange2(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) = iphlpapi.NotifyRouteChange2 //sys NotifyUnicastIpAddressChange(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) = iphlpapi.NotifyUnicastIpAddressChange //sys CancelMibChangeNotify2(notificationHandle Handle) (errcode error) = iphlpapi.CancelMibChangeNotify2 @@ -920,17 +914,6 @@ type RawSockaddrInet6 struct { Scope_id uint32 } -// RawSockaddrInet is a union that contains an IPv4, an IPv6 address, or an address family. See -// https://learn.microsoft.com/en-us/windows/win32/api/ws2ipdef/ns-ws2ipdef-sockaddr_inet. -// -// A [*RawSockaddrInet] may be converted to a [*RawSockaddrInet4] or [*RawSockaddrInet6] using -// unsafe, depending on the address family. -type RawSockaddrInet struct { - Family uint16 - Port uint16 - Data [6]uint32 -} - type RawSockaddr struct { Family uint16 Data [14]int8 diff --git a/kubewatch/vendor/golang.org/x/sys/windows/types_windows.go b/kubewatch/vendor/golang.org/x/sys/windows/types_windows.go index 6e4f50eb4..958bcf47a 100644 --- a/kubewatch/vendor/golang.org/x/sys/windows/types_windows.go +++ b/kubewatch/vendor/golang.org/x/sys/windows/types_windows.go @@ -65,22 +65,6 @@ var signals = [...]string{ 15: "terminated", } -// File flags for [os.OpenFile]. The O_ prefix is used to indicate -// that these flags are specific to the OpenFile function. -const ( - O_FILE_FLAG_OPEN_NO_RECALL = FILE_FLAG_OPEN_NO_RECALL - O_FILE_FLAG_OPEN_REPARSE_POINT = FILE_FLAG_OPEN_REPARSE_POINT - O_FILE_FLAG_SESSION_AWARE = FILE_FLAG_SESSION_AWARE - O_FILE_FLAG_POSIX_SEMANTICS = FILE_FLAG_POSIX_SEMANTICS - O_FILE_FLAG_BACKUP_SEMANTICS = FILE_FLAG_BACKUP_SEMANTICS - O_FILE_FLAG_DELETE_ON_CLOSE = FILE_FLAG_DELETE_ON_CLOSE - O_FILE_FLAG_SEQUENTIAL_SCAN = FILE_FLAG_SEQUENTIAL_SCAN - O_FILE_FLAG_RANDOM_ACCESS = FILE_FLAG_RANDOM_ACCESS - O_FILE_FLAG_NO_BUFFERING = FILE_FLAG_NO_BUFFERING - O_FILE_FLAG_OVERLAPPED = FILE_FLAG_OVERLAPPED - O_FILE_FLAG_WRITE_THROUGH = FILE_FLAG_WRITE_THROUGH -) - const ( FILE_READ_DATA = 0x00000001 FILE_READ_ATTRIBUTES = 0x00000080 @@ -1992,12 +1976,6 @@ const ( SYMBOLIC_LINK_FLAG_DIRECTORY = 0x1 ) -// FILE_ZERO_DATA_INFORMATION from winioctl.h -type FileZeroDataInformation struct { - FileOffset int64 - BeyondFinalZero int64 -} - const ( ComputerNameNetBIOS = 0 ComputerNameDnsHostname = 1 @@ -2320,82 +2298,6 @@ type MibIfRow2 struct { OutQLen uint64 } -// IP_ADDRESS_PREFIX stores an IP address prefix. See -// https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-ip_address_prefix. -type IpAddressPrefix struct { - Prefix RawSockaddrInet - PrefixLength uint8 -} - -// NL_ROUTE_ORIGIN enumeration from nldef.h or -// https://learn.microsoft.com/en-us/windows/win32/api/nldef/ne-nldef-nl_route_origin. -const ( - NlroManual = 0 - NlroWellKnown = 1 - NlroDHCP = 2 - NlroRouterAdvertisement = 3 - Nlro6to4 = 4 -) - -// NL_ROUTE_ORIGIN enumeration from nldef.h or -// https://learn.microsoft.com/en-us/windows/win32/api/nldef/ne-nldef-nl_route_protocol. -const ( - MIB_IPPROTO_OTHER = 1 - MIB_IPPROTO_LOCAL = 2 - MIB_IPPROTO_NETMGMT = 3 - MIB_IPPROTO_ICMP = 4 - MIB_IPPROTO_EGP = 5 - MIB_IPPROTO_GGP = 6 - MIB_IPPROTO_HELLO = 7 - MIB_IPPROTO_RIP = 8 - MIB_IPPROTO_IS_IS = 9 - MIB_IPPROTO_ES_IS = 10 - MIB_IPPROTO_CISCO = 11 - MIB_IPPROTO_BBN = 12 - MIB_IPPROTO_OSPF = 13 - MIB_IPPROTO_BGP = 14 - MIB_IPPROTO_IDPR = 15 - MIB_IPPROTO_EIGRP = 16 - MIB_IPPROTO_DVMRP = 17 - MIB_IPPROTO_RPL = 18 - MIB_IPPROTO_DHCP = 19 - MIB_IPPROTO_NT_AUTOSTATIC = 10002 - MIB_IPPROTO_NT_STATIC = 10006 - MIB_IPPROTO_NT_STATIC_NON_DOD = 10007 -) - -// MIB_IPFORWARD_ROW2 stores information about an IP route entry. See -// https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-mib_ipforward_row2. -type MibIpForwardRow2 struct { - InterfaceLuid uint64 - InterfaceIndex uint32 - DestinationPrefix IpAddressPrefix - NextHop RawSockaddrInet - SitePrefixLength uint8 - ValidLifetime uint32 - PreferredLifetime uint32 - Metric uint32 - Protocol uint32 - Loopback uint8 - AutoconfigureAddress uint8 - Publish uint8 - Immortal uint8 - Age uint32 - Origin uint32 -} - -// MIB_IPFORWARD_TABLE2 contains a table of IP route entries. See -// https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-mib_ipforward_table2. -type MibIpForwardTable2 struct { - NumEntries uint32 - Table [1]MibIpForwardRow2 -} - -// Rows returns the IP route entries in the table. -func (t *MibIpForwardTable2) Rows() []MibIpForwardRow2 { - return unsafe.Slice(&t.Table[0], t.NumEntries) -} - // MIB_UNICASTIPADDRESS_ROW stores information about a unicast IP address. See // https://learn.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-mib_unicastipaddress_row. type MibUnicastIpAddressRow struct { diff --git a/kubewatch/vendor/golang.org/x/sys/windows/zsyscall_windows.go b/kubewatch/vendor/golang.org/x/sys/windows/zsyscall_windows.go index f25b7308a..a58bc48b8 100644 --- a/kubewatch/vendor/golang.org/x/sys/windows/zsyscall_windows.go +++ b/kubewatch/vendor/golang.org/x/sys/windows/zsyscall_windows.go @@ -182,17 +182,13 @@ var ( procDwmGetWindowAttribute = moddwmapi.NewProc("DwmGetWindowAttribute") procDwmSetWindowAttribute = moddwmapi.NewProc("DwmSetWindowAttribute") procCancelMibChangeNotify2 = modiphlpapi.NewProc("CancelMibChangeNotify2") - procFreeMibTable = modiphlpapi.NewProc("FreeMibTable") procGetAdaptersAddresses = modiphlpapi.NewProc("GetAdaptersAddresses") procGetAdaptersInfo = modiphlpapi.NewProc("GetAdaptersInfo") procGetBestInterfaceEx = modiphlpapi.NewProc("GetBestInterfaceEx") procGetIfEntry = modiphlpapi.NewProc("GetIfEntry") procGetIfEntry2Ex = modiphlpapi.NewProc("GetIfEntry2Ex") - procGetIpForwardEntry2 = modiphlpapi.NewProc("GetIpForwardEntry2") - procGetIpForwardTable2 = modiphlpapi.NewProc("GetIpForwardTable2") procGetUnicastIpAddressEntry = modiphlpapi.NewProc("GetUnicastIpAddressEntry") procNotifyIpInterfaceChange = modiphlpapi.NewProc("NotifyIpInterfaceChange") - procNotifyRouteChange2 = modiphlpapi.NewProc("NotifyRouteChange2") procNotifyUnicastIpAddressChange = modiphlpapi.NewProc("NotifyUnicastIpAddressChange") procAddDllDirectory = modkernel32.NewProc("AddDllDirectory") procAssignProcessToJobObject = modkernel32.NewProc("AssignProcessToJobObject") @@ -242,7 +238,6 @@ var ( procFindResourceW = modkernel32.NewProc("FindResourceW") procFindVolumeClose = modkernel32.NewProc("FindVolumeClose") procFindVolumeMountPointClose = modkernel32.NewProc("FindVolumeMountPointClose") - procFlushConsoleInputBuffer = modkernel32.NewProc("FlushConsoleInputBuffer") procFlushFileBuffers = modkernel32.NewProc("FlushFileBuffers") procFlushViewOfFile = modkernel32.NewProc("FlushViewOfFile") procFormatMessageW = modkernel32.NewProc("FormatMessageW") @@ -289,7 +284,6 @@ var ( procGetNamedPipeHandleStateW = modkernel32.NewProc("GetNamedPipeHandleStateW") procGetNamedPipeInfo = modkernel32.NewProc("GetNamedPipeInfo") procGetNamedPipeServerProcessId = modkernel32.NewProc("GetNamedPipeServerProcessId") - procGetNumberOfConsoleInputEvents = modkernel32.NewProc("GetNumberOfConsoleInputEvents") procGetOverlappedResult = modkernel32.NewProc("GetOverlappedResult") procGetPriorityClass = modkernel32.NewProc("GetPriorityClass") procGetProcAddress = modkernel32.NewProc("GetProcAddress") @@ -552,25 +546,25 @@ var ( ) func cm_Get_DevNode_Status(status *uint32, problemNumber *uint32, devInst DEVINST, flags uint32) (ret CONFIGRET) { - r0, _, _ := syscall.SyscallN(procCM_Get_DevNode_Status.Addr(), uintptr(unsafe.Pointer(status)), uintptr(unsafe.Pointer(problemNumber)), uintptr(devInst), uintptr(flags)) + r0, _, _ := syscall.Syscall6(procCM_Get_DevNode_Status.Addr(), 4, uintptr(unsafe.Pointer(status)), uintptr(unsafe.Pointer(problemNumber)), uintptr(devInst), uintptr(flags), 0, 0) ret = CONFIGRET(r0) return } func cm_Get_Device_Interface_List(interfaceClass *GUID, deviceID *uint16, buffer *uint16, bufferLen uint32, flags uint32) (ret CONFIGRET) { - r0, _, _ := syscall.SyscallN(procCM_Get_Device_Interface_ListW.Addr(), uintptr(unsafe.Pointer(interfaceClass)), uintptr(unsafe.Pointer(deviceID)), uintptr(unsafe.Pointer(buffer)), uintptr(bufferLen), uintptr(flags)) + r0, _, _ := syscall.Syscall6(procCM_Get_Device_Interface_ListW.Addr(), 5, uintptr(unsafe.Pointer(interfaceClass)), uintptr(unsafe.Pointer(deviceID)), uintptr(unsafe.Pointer(buffer)), uintptr(bufferLen), uintptr(flags), 0) ret = CONFIGRET(r0) return } func cm_Get_Device_Interface_List_Size(len *uint32, interfaceClass *GUID, deviceID *uint16, flags uint32) (ret CONFIGRET) { - r0, _, _ := syscall.SyscallN(procCM_Get_Device_Interface_List_SizeW.Addr(), uintptr(unsafe.Pointer(len)), uintptr(unsafe.Pointer(interfaceClass)), uintptr(unsafe.Pointer(deviceID)), uintptr(flags)) + r0, _, _ := syscall.Syscall6(procCM_Get_Device_Interface_List_SizeW.Addr(), 4, uintptr(unsafe.Pointer(len)), uintptr(unsafe.Pointer(interfaceClass)), uintptr(unsafe.Pointer(deviceID)), uintptr(flags), 0, 0) ret = CONFIGRET(r0) return } func cm_MapCrToWin32Err(configRet CONFIGRET, defaultWin32Error Errno) (ret Errno) { - r0, _, _ := syscall.SyscallN(procCM_MapCrToWin32Err.Addr(), uintptr(configRet), uintptr(defaultWin32Error)) + r0, _, _ := syscall.Syscall(procCM_MapCrToWin32Err.Addr(), 2, uintptr(configRet), uintptr(defaultWin32Error), 0) ret = Errno(r0) return } @@ -580,7 +574,7 @@ func AdjustTokenGroups(token Token, resetToDefault bool, newstate *Tokengroups, if resetToDefault { _p0 = 1 } - r1, _, e1 := syscall.SyscallN(procAdjustTokenGroups.Addr(), uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen))) + r1, _, e1 := syscall.Syscall6(procAdjustTokenGroups.Addr(), 6, uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen))) if r1 == 0 { err = errnoErr(e1) } @@ -592,7 +586,7 @@ func AdjustTokenPrivileges(token Token, disableAllPrivileges bool, newstate *Tok if disableAllPrivileges { _p0 = 1 } - r1, _, e1 := syscall.SyscallN(procAdjustTokenPrivileges.Addr(), uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen))) + r1, _, e1 := syscall.Syscall6(procAdjustTokenPrivileges.Addr(), 6, uintptr(token), uintptr(_p0), uintptr(unsafe.Pointer(newstate)), uintptr(buflen), uintptr(unsafe.Pointer(prevstate)), uintptr(unsafe.Pointer(returnlen))) if r1 == 0 { err = errnoErr(e1) } @@ -600,7 +594,7 @@ func AdjustTokenPrivileges(token Token, disableAllPrivileges bool, newstate *Tok } func AllocateAndInitializeSid(identAuth *SidIdentifierAuthority, subAuth byte, subAuth0 uint32, subAuth1 uint32, subAuth2 uint32, subAuth3 uint32, subAuth4 uint32, subAuth5 uint32, subAuth6 uint32, subAuth7 uint32, sid **SID) (err error) { - r1, _, e1 := syscall.SyscallN(procAllocateAndInitializeSid.Addr(), uintptr(unsafe.Pointer(identAuth)), uintptr(subAuth), uintptr(subAuth0), uintptr(subAuth1), uintptr(subAuth2), uintptr(subAuth3), uintptr(subAuth4), uintptr(subAuth5), uintptr(subAuth6), uintptr(subAuth7), uintptr(unsafe.Pointer(sid))) + r1, _, e1 := syscall.Syscall12(procAllocateAndInitializeSid.Addr(), 11, uintptr(unsafe.Pointer(identAuth)), uintptr(subAuth), uintptr(subAuth0), uintptr(subAuth1), uintptr(subAuth2), uintptr(subAuth3), uintptr(subAuth4), uintptr(subAuth5), uintptr(subAuth6), uintptr(subAuth7), uintptr(unsafe.Pointer(sid)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -608,7 +602,7 @@ func AllocateAndInitializeSid(identAuth *SidIdentifierAuthority, subAuth byte, s } func buildSecurityDescriptor(owner *TRUSTEE, group *TRUSTEE, countAccessEntries uint32, accessEntries *EXPLICIT_ACCESS, countAuditEntries uint32, auditEntries *EXPLICIT_ACCESS, oldSecurityDescriptor *SECURITY_DESCRIPTOR, sizeNewSecurityDescriptor *uint32, newSecurityDescriptor **SECURITY_DESCRIPTOR) (ret error) { - r0, _, _ := syscall.SyscallN(procBuildSecurityDescriptorW.Addr(), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(countAccessEntries), uintptr(unsafe.Pointer(accessEntries)), uintptr(countAuditEntries), uintptr(unsafe.Pointer(auditEntries)), uintptr(unsafe.Pointer(oldSecurityDescriptor)), uintptr(unsafe.Pointer(sizeNewSecurityDescriptor)), uintptr(unsafe.Pointer(newSecurityDescriptor))) + r0, _, _ := syscall.Syscall9(procBuildSecurityDescriptorW.Addr(), 9, uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(countAccessEntries), uintptr(unsafe.Pointer(accessEntries)), uintptr(countAuditEntries), uintptr(unsafe.Pointer(auditEntries)), uintptr(unsafe.Pointer(oldSecurityDescriptor)), uintptr(unsafe.Pointer(sizeNewSecurityDescriptor)), uintptr(unsafe.Pointer(newSecurityDescriptor))) if r0 != 0 { ret = syscall.Errno(r0) } @@ -616,7 +610,7 @@ func buildSecurityDescriptor(owner *TRUSTEE, group *TRUSTEE, countAccessEntries } func ChangeServiceConfig2(service Handle, infoLevel uint32, info *byte) (err error) { - r1, _, e1 := syscall.SyscallN(procChangeServiceConfig2W.Addr(), uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(info))) + r1, _, e1 := syscall.Syscall(procChangeServiceConfig2W.Addr(), 3, uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(info))) if r1 == 0 { err = errnoErr(e1) } @@ -624,7 +618,7 @@ func ChangeServiceConfig2(service Handle, infoLevel uint32, info *byte) (err err } func ChangeServiceConfig(service Handle, serviceType uint32, startType uint32, errorControl uint32, binaryPathName *uint16, loadOrderGroup *uint16, tagId *uint32, dependencies *uint16, serviceStartName *uint16, password *uint16, displayName *uint16) (err error) { - r1, _, e1 := syscall.SyscallN(procChangeServiceConfigW.Addr(), uintptr(service), uintptr(serviceType), uintptr(startType), uintptr(errorControl), uintptr(unsafe.Pointer(binaryPathName)), uintptr(unsafe.Pointer(loadOrderGroup)), uintptr(unsafe.Pointer(tagId)), uintptr(unsafe.Pointer(dependencies)), uintptr(unsafe.Pointer(serviceStartName)), uintptr(unsafe.Pointer(password)), uintptr(unsafe.Pointer(displayName))) + r1, _, e1 := syscall.Syscall12(procChangeServiceConfigW.Addr(), 11, uintptr(service), uintptr(serviceType), uintptr(startType), uintptr(errorControl), uintptr(unsafe.Pointer(binaryPathName)), uintptr(unsafe.Pointer(loadOrderGroup)), uintptr(unsafe.Pointer(tagId)), uintptr(unsafe.Pointer(dependencies)), uintptr(unsafe.Pointer(serviceStartName)), uintptr(unsafe.Pointer(password)), uintptr(unsafe.Pointer(displayName)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -632,7 +626,7 @@ func ChangeServiceConfig(service Handle, serviceType uint32, startType uint32, e } func checkTokenMembership(tokenHandle Token, sidToCheck *SID, isMember *int32) (err error) { - r1, _, e1 := syscall.SyscallN(procCheckTokenMembership.Addr(), uintptr(tokenHandle), uintptr(unsafe.Pointer(sidToCheck)), uintptr(unsafe.Pointer(isMember))) + r1, _, e1 := syscall.Syscall(procCheckTokenMembership.Addr(), 3, uintptr(tokenHandle), uintptr(unsafe.Pointer(sidToCheck)), uintptr(unsafe.Pointer(isMember))) if r1 == 0 { err = errnoErr(e1) } @@ -640,7 +634,7 @@ func checkTokenMembership(tokenHandle Token, sidToCheck *SID, isMember *int32) ( } func CloseServiceHandle(handle Handle) (err error) { - r1, _, e1 := syscall.SyscallN(procCloseServiceHandle.Addr(), uintptr(handle)) + r1, _, e1 := syscall.Syscall(procCloseServiceHandle.Addr(), 1, uintptr(handle), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -648,7 +642,7 @@ func CloseServiceHandle(handle Handle) (err error) { } func ControlService(service Handle, control uint32, status *SERVICE_STATUS) (err error) { - r1, _, e1 := syscall.SyscallN(procControlService.Addr(), uintptr(service), uintptr(control), uintptr(unsafe.Pointer(status))) + r1, _, e1 := syscall.Syscall(procControlService.Addr(), 3, uintptr(service), uintptr(control), uintptr(unsafe.Pointer(status))) if r1 == 0 { err = errnoErr(e1) } @@ -656,7 +650,7 @@ func ControlService(service Handle, control uint32, status *SERVICE_STATUS) (err } func convertSecurityDescriptorToStringSecurityDescriptor(sd *SECURITY_DESCRIPTOR, revision uint32, securityInformation SECURITY_INFORMATION, str **uint16, strLen *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procConvertSecurityDescriptorToStringSecurityDescriptorW.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(revision), uintptr(securityInformation), uintptr(unsafe.Pointer(str)), uintptr(unsafe.Pointer(strLen))) + r1, _, e1 := syscall.Syscall6(procConvertSecurityDescriptorToStringSecurityDescriptorW.Addr(), 5, uintptr(unsafe.Pointer(sd)), uintptr(revision), uintptr(securityInformation), uintptr(unsafe.Pointer(str)), uintptr(unsafe.Pointer(strLen)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -664,7 +658,7 @@ func convertSecurityDescriptorToStringSecurityDescriptor(sd *SECURITY_DESCRIPTOR } func ConvertSidToStringSid(sid *SID, stringSid **uint16) (err error) { - r1, _, e1 := syscall.SyscallN(procConvertSidToStringSidW.Addr(), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(stringSid))) + r1, _, e1 := syscall.Syscall(procConvertSidToStringSidW.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(stringSid)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -681,7 +675,7 @@ func convertStringSecurityDescriptorToSecurityDescriptor(str string, revision ui } func _convertStringSecurityDescriptorToSecurityDescriptor(str *uint16, revision uint32, sd **SECURITY_DESCRIPTOR, size *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procConvertStringSecurityDescriptorToSecurityDescriptorW.Addr(), uintptr(unsafe.Pointer(str)), uintptr(revision), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(size))) + r1, _, e1 := syscall.Syscall6(procConvertStringSecurityDescriptorToSecurityDescriptorW.Addr(), 4, uintptr(unsafe.Pointer(str)), uintptr(revision), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(size)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -689,7 +683,7 @@ func _convertStringSecurityDescriptorToSecurityDescriptor(str *uint16, revision } func ConvertStringSidToSid(stringSid *uint16, sid **SID) (err error) { - r1, _, e1 := syscall.SyscallN(procConvertStringSidToSidW.Addr(), uintptr(unsafe.Pointer(stringSid)), uintptr(unsafe.Pointer(sid))) + r1, _, e1 := syscall.Syscall(procConvertStringSidToSidW.Addr(), 2, uintptr(unsafe.Pointer(stringSid)), uintptr(unsafe.Pointer(sid)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -697,7 +691,7 @@ func ConvertStringSidToSid(stringSid *uint16, sid **SID) (err error) { } func CopySid(destSidLen uint32, destSid *SID, srcSid *SID) (err error) { - r1, _, e1 := syscall.SyscallN(procCopySid.Addr(), uintptr(destSidLen), uintptr(unsafe.Pointer(destSid)), uintptr(unsafe.Pointer(srcSid))) + r1, _, e1 := syscall.Syscall(procCopySid.Addr(), 3, uintptr(destSidLen), uintptr(unsafe.Pointer(destSid)), uintptr(unsafe.Pointer(srcSid))) if r1 == 0 { err = errnoErr(e1) } @@ -709,7 +703,7 @@ func CreateProcessAsUser(token Token, appName *uint16, commandLine *uint16, proc if inheritHandles { _p0 = 1 } - r1, _, e1 := syscall.SyscallN(procCreateProcessAsUserW.Addr(), uintptr(token), uintptr(unsafe.Pointer(appName)), uintptr(unsafe.Pointer(commandLine)), uintptr(unsafe.Pointer(procSecurity)), uintptr(unsafe.Pointer(threadSecurity)), uintptr(_p0), uintptr(creationFlags), uintptr(unsafe.Pointer(env)), uintptr(unsafe.Pointer(currentDir)), uintptr(unsafe.Pointer(startupInfo)), uintptr(unsafe.Pointer(outProcInfo))) + r1, _, e1 := syscall.Syscall12(procCreateProcessAsUserW.Addr(), 11, uintptr(token), uintptr(unsafe.Pointer(appName)), uintptr(unsafe.Pointer(commandLine)), uintptr(unsafe.Pointer(procSecurity)), uintptr(unsafe.Pointer(threadSecurity)), uintptr(_p0), uintptr(creationFlags), uintptr(unsafe.Pointer(env)), uintptr(unsafe.Pointer(currentDir)), uintptr(unsafe.Pointer(startupInfo)), uintptr(unsafe.Pointer(outProcInfo)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -717,7 +711,7 @@ func CreateProcessAsUser(token Token, appName *uint16, commandLine *uint16, proc } func CreateService(mgr Handle, serviceName *uint16, displayName *uint16, access uint32, srvType uint32, startType uint32, errCtl uint32, pathName *uint16, loadOrderGroup *uint16, tagId *uint32, dependencies *uint16, serviceStartName *uint16, password *uint16) (handle Handle, err error) { - r0, _, e1 := syscall.SyscallN(procCreateServiceW.Addr(), uintptr(mgr), uintptr(unsafe.Pointer(serviceName)), uintptr(unsafe.Pointer(displayName)), uintptr(access), uintptr(srvType), uintptr(startType), uintptr(errCtl), uintptr(unsafe.Pointer(pathName)), uintptr(unsafe.Pointer(loadOrderGroup)), uintptr(unsafe.Pointer(tagId)), uintptr(unsafe.Pointer(dependencies)), uintptr(unsafe.Pointer(serviceStartName)), uintptr(unsafe.Pointer(password))) + r0, _, e1 := syscall.Syscall15(procCreateServiceW.Addr(), 13, uintptr(mgr), uintptr(unsafe.Pointer(serviceName)), uintptr(unsafe.Pointer(displayName)), uintptr(access), uintptr(srvType), uintptr(startType), uintptr(errCtl), uintptr(unsafe.Pointer(pathName)), uintptr(unsafe.Pointer(loadOrderGroup)), uintptr(unsafe.Pointer(tagId)), uintptr(unsafe.Pointer(dependencies)), uintptr(unsafe.Pointer(serviceStartName)), uintptr(unsafe.Pointer(password)), 0, 0) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -726,7 +720,7 @@ func CreateService(mgr Handle, serviceName *uint16, displayName *uint16, access } func createWellKnownSid(sidType WELL_KNOWN_SID_TYPE, domainSid *SID, sid *SID, sizeSid *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procCreateWellKnownSid.Addr(), uintptr(sidType), uintptr(unsafe.Pointer(domainSid)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sizeSid))) + r1, _, e1 := syscall.Syscall6(procCreateWellKnownSid.Addr(), 4, uintptr(sidType), uintptr(unsafe.Pointer(domainSid)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sizeSid)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -734,7 +728,7 @@ func createWellKnownSid(sidType WELL_KNOWN_SID_TYPE, domainSid *SID, sid *SID, s } func CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16, provtype uint32, flags uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procCryptAcquireContextW.Addr(), uintptr(unsafe.Pointer(provhandle)), uintptr(unsafe.Pointer(container)), uintptr(unsafe.Pointer(provider)), uintptr(provtype), uintptr(flags)) + r1, _, e1 := syscall.Syscall6(procCryptAcquireContextW.Addr(), 5, uintptr(unsafe.Pointer(provhandle)), uintptr(unsafe.Pointer(container)), uintptr(unsafe.Pointer(provider)), uintptr(provtype), uintptr(flags), 0) if r1 == 0 { err = errnoErr(e1) } @@ -742,7 +736,7 @@ func CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16 } func CryptGenRandom(provhandle Handle, buflen uint32, buf *byte) (err error) { - r1, _, e1 := syscall.SyscallN(procCryptGenRandom.Addr(), uintptr(provhandle), uintptr(buflen), uintptr(unsafe.Pointer(buf))) + r1, _, e1 := syscall.Syscall(procCryptGenRandom.Addr(), 3, uintptr(provhandle), uintptr(buflen), uintptr(unsafe.Pointer(buf))) if r1 == 0 { err = errnoErr(e1) } @@ -750,7 +744,7 @@ func CryptGenRandom(provhandle Handle, buflen uint32, buf *byte) (err error) { } func CryptReleaseContext(provhandle Handle, flags uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procCryptReleaseContext.Addr(), uintptr(provhandle), uintptr(flags)) + r1, _, e1 := syscall.Syscall(procCryptReleaseContext.Addr(), 2, uintptr(provhandle), uintptr(flags), 0) if r1 == 0 { err = errnoErr(e1) } @@ -758,7 +752,7 @@ func CryptReleaseContext(provhandle Handle, flags uint32) (err error) { } func DeleteService(service Handle) (err error) { - r1, _, e1 := syscall.SyscallN(procDeleteService.Addr(), uintptr(service)) + r1, _, e1 := syscall.Syscall(procDeleteService.Addr(), 1, uintptr(service), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -766,7 +760,7 @@ func DeleteService(service Handle) (err error) { } func DeregisterEventSource(handle Handle) (err error) { - r1, _, e1 := syscall.SyscallN(procDeregisterEventSource.Addr(), uintptr(handle)) + r1, _, e1 := syscall.Syscall(procDeregisterEventSource.Addr(), 1, uintptr(handle), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -774,7 +768,7 @@ func DeregisterEventSource(handle Handle) (err error) { } func DuplicateTokenEx(existingToken Token, desiredAccess uint32, tokenAttributes *SecurityAttributes, impersonationLevel uint32, tokenType uint32, newToken *Token) (err error) { - r1, _, e1 := syscall.SyscallN(procDuplicateTokenEx.Addr(), uintptr(existingToken), uintptr(desiredAccess), uintptr(unsafe.Pointer(tokenAttributes)), uintptr(impersonationLevel), uintptr(tokenType), uintptr(unsafe.Pointer(newToken))) + r1, _, e1 := syscall.Syscall6(procDuplicateTokenEx.Addr(), 6, uintptr(existingToken), uintptr(desiredAccess), uintptr(unsafe.Pointer(tokenAttributes)), uintptr(impersonationLevel), uintptr(tokenType), uintptr(unsafe.Pointer(newToken))) if r1 == 0 { err = errnoErr(e1) } @@ -782,7 +776,7 @@ func DuplicateTokenEx(existingToken Token, desiredAccess uint32, tokenAttributes } func EnumDependentServices(service Handle, activityState uint32, services *ENUM_SERVICE_STATUS, buffSize uint32, bytesNeeded *uint32, servicesReturned *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procEnumDependentServicesW.Addr(), uintptr(service), uintptr(activityState), uintptr(unsafe.Pointer(services)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded)), uintptr(unsafe.Pointer(servicesReturned))) + r1, _, e1 := syscall.Syscall6(procEnumDependentServicesW.Addr(), 6, uintptr(service), uintptr(activityState), uintptr(unsafe.Pointer(services)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded)), uintptr(unsafe.Pointer(servicesReturned))) if r1 == 0 { err = errnoErr(e1) } @@ -790,7 +784,7 @@ func EnumDependentServices(service Handle, activityState uint32, services *ENUM_ } func EnumServicesStatusEx(mgr Handle, infoLevel uint32, serviceType uint32, serviceState uint32, services *byte, bufSize uint32, bytesNeeded *uint32, servicesReturned *uint32, resumeHandle *uint32, groupName *uint16) (err error) { - r1, _, e1 := syscall.SyscallN(procEnumServicesStatusExW.Addr(), uintptr(mgr), uintptr(infoLevel), uintptr(serviceType), uintptr(serviceState), uintptr(unsafe.Pointer(services)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), uintptr(unsafe.Pointer(servicesReturned)), uintptr(unsafe.Pointer(resumeHandle)), uintptr(unsafe.Pointer(groupName))) + r1, _, e1 := syscall.Syscall12(procEnumServicesStatusExW.Addr(), 10, uintptr(mgr), uintptr(infoLevel), uintptr(serviceType), uintptr(serviceState), uintptr(unsafe.Pointer(services)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), uintptr(unsafe.Pointer(servicesReturned)), uintptr(unsafe.Pointer(resumeHandle)), uintptr(unsafe.Pointer(groupName)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -798,13 +792,13 @@ func EnumServicesStatusEx(mgr Handle, infoLevel uint32, serviceType uint32, serv } func EqualSid(sid1 *SID, sid2 *SID) (isEqual bool) { - r0, _, _ := syscall.SyscallN(procEqualSid.Addr(), uintptr(unsafe.Pointer(sid1)), uintptr(unsafe.Pointer(sid2))) + r0, _, _ := syscall.Syscall(procEqualSid.Addr(), 2, uintptr(unsafe.Pointer(sid1)), uintptr(unsafe.Pointer(sid2)), 0) isEqual = r0 != 0 return } func FreeSid(sid *SID) (err error) { - r1, _, e1 := syscall.SyscallN(procFreeSid.Addr(), uintptr(unsafe.Pointer(sid))) + r1, _, e1 := syscall.Syscall(procFreeSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) if r1 != 0 { err = errnoErr(e1) } @@ -812,7 +806,7 @@ func FreeSid(sid *SID) (err error) { } func GetAce(acl *ACL, aceIndex uint32, pAce **ACCESS_ALLOWED_ACE) (err error) { - r1, _, e1 := syscall.SyscallN(procGetAce.Addr(), uintptr(unsafe.Pointer(acl)), uintptr(aceIndex), uintptr(unsafe.Pointer(pAce))) + r1, _, e1 := syscall.Syscall(procGetAce.Addr(), 3, uintptr(unsafe.Pointer(acl)), uintptr(aceIndex), uintptr(unsafe.Pointer(pAce))) if r1 == 0 { err = errnoErr(e1) } @@ -820,7 +814,7 @@ func GetAce(acl *ACL, aceIndex uint32, pAce **ACCESS_ALLOWED_ACE) (err error) { } func GetLengthSid(sid *SID) (len uint32) { - r0, _, _ := syscall.SyscallN(procGetLengthSid.Addr(), uintptr(unsafe.Pointer(sid))) + r0, _, _ := syscall.Syscall(procGetLengthSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) len = uint32(r0) return } @@ -835,7 +829,7 @@ func getNamedSecurityInfo(objectName string, objectType SE_OBJECT_TYPE, security } func _getNamedSecurityInfo(objectName *uint16, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner **SID, group **SID, dacl **ACL, sacl **ACL, sd **SECURITY_DESCRIPTOR) (ret error) { - r0, _, _ := syscall.SyscallN(procGetNamedSecurityInfoW.Addr(), uintptr(unsafe.Pointer(objectName)), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(sd))) + r0, _, _ := syscall.Syscall9(procGetNamedSecurityInfoW.Addr(), 8, uintptr(unsafe.Pointer(objectName)), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(sd)), 0) if r0 != 0 { ret = syscall.Errno(r0) } @@ -843,7 +837,7 @@ func _getNamedSecurityInfo(objectName *uint16, objectType SE_OBJECT_TYPE, securi } func getSecurityDescriptorControl(sd *SECURITY_DESCRIPTOR, control *SECURITY_DESCRIPTOR_CONTROL, revision *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procGetSecurityDescriptorControl.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(control)), uintptr(unsafe.Pointer(revision))) + r1, _, e1 := syscall.Syscall(procGetSecurityDescriptorControl.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(control)), uintptr(unsafe.Pointer(revision))) if r1 == 0 { err = errnoErr(e1) } @@ -859,7 +853,7 @@ func getSecurityDescriptorDacl(sd *SECURITY_DESCRIPTOR, daclPresent *bool, dacl if *daclDefaulted { _p1 = 1 } - r1, _, e1 := syscall.SyscallN(procGetSecurityDescriptorDacl.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(&_p0)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(&_p1))) + r1, _, e1 := syscall.Syscall6(procGetSecurityDescriptorDacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(&_p0)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(&_p1)), 0, 0) *daclPresent = _p0 != 0 *daclDefaulted = _p1 != 0 if r1 == 0 { @@ -873,7 +867,7 @@ func getSecurityDescriptorGroup(sd *SECURITY_DESCRIPTOR, group **SID, groupDefau if *groupDefaulted { _p0 = 1 } - r1, _, e1 := syscall.SyscallN(procGetSecurityDescriptorGroup.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(&_p0))) + r1, _, e1 := syscall.Syscall(procGetSecurityDescriptorGroup.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(&_p0))) *groupDefaulted = _p0 != 0 if r1 == 0 { err = errnoErr(e1) @@ -882,7 +876,7 @@ func getSecurityDescriptorGroup(sd *SECURITY_DESCRIPTOR, group **SID, groupDefau } func getSecurityDescriptorLength(sd *SECURITY_DESCRIPTOR) (len uint32) { - r0, _, _ := syscall.SyscallN(procGetSecurityDescriptorLength.Addr(), uintptr(unsafe.Pointer(sd))) + r0, _, _ := syscall.Syscall(procGetSecurityDescriptorLength.Addr(), 1, uintptr(unsafe.Pointer(sd)), 0, 0) len = uint32(r0) return } @@ -892,7 +886,7 @@ func getSecurityDescriptorOwner(sd *SECURITY_DESCRIPTOR, owner **SID, ownerDefau if *ownerDefaulted { _p0 = 1 } - r1, _, e1 := syscall.SyscallN(procGetSecurityDescriptorOwner.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(&_p0))) + r1, _, e1 := syscall.Syscall(procGetSecurityDescriptorOwner.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(&_p0))) *ownerDefaulted = _p0 != 0 if r1 == 0 { err = errnoErr(e1) @@ -901,7 +895,7 @@ func getSecurityDescriptorOwner(sd *SECURITY_DESCRIPTOR, owner **SID, ownerDefau } func getSecurityDescriptorRMControl(sd *SECURITY_DESCRIPTOR, rmControl *uint8) (ret error) { - r0, _, _ := syscall.SyscallN(procGetSecurityDescriptorRMControl.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(rmControl))) + r0, _, _ := syscall.Syscall(procGetSecurityDescriptorRMControl.Addr(), 2, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(rmControl)), 0) if r0 != 0 { ret = syscall.Errno(r0) } @@ -917,7 +911,7 @@ func getSecurityDescriptorSacl(sd *SECURITY_DESCRIPTOR, saclPresent *bool, sacl if *saclDefaulted { _p1 = 1 } - r1, _, e1 := syscall.SyscallN(procGetSecurityDescriptorSacl.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(&_p0)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(&_p1))) + r1, _, e1 := syscall.Syscall6(procGetSecurityDescriptorSacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(&_p0)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(&_p1)), 0, 0) *saclPresent = _p0 != 0 *saclDefaulted = _p1 != 0 if r1 == 0 { @@ -927,7 +921,7 @@ func getSecurityDescriptorSacl(sd *SECURITY_DESCRIPTOR, saclPresent *bool, sacl } func getSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner **SID, group **SID, dacl **ACL, sacl **ACL, sd **SECURITY_DESCRIPTOR) (ret error) { - r0, _, _ := syscall.SyscallN(procGetSecurityInfo.Addr(), uintptr(handle), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(sd))) + r0, _, _ := syscall.Syscall9(procGetSecurityInfo.Addr(), 8, uintptr(handle), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(sd)), 0) if r0 != 0 { ret = syscall.Errno(r0) } @@ -935,25 +929,25 @@ func getSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformati } func getSidIdentifierAuthority(sid *SID) (authority *SidIdentifierAuthority) { - r0, _, _ := syscall.SyscallN(procGetSidIdentifierAuthority.Addr(), uintptr(unsafe.Pointer(sid))) + r0, _, _ := syscall.Syscall(procGetSidIdentifierAuthority.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) authority = (*SidIdentifierAuthority)(unsafe.Pointer(r0)) return } func getSidSubAuthority(sid *SID, index uint32) (subAuthority *uint32) { - r0, _, _ := syscall.SyscallN(procGetSidSubAuthority.Addr(), uintptr(unsafe.Pointer(sid)), uintptr(index)) + r0, _, _ := syscall.Syscall(procGetSidSubAuthority.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(index), 0) subAuthority = (*uint32)(unsafe.Pointer(r0)) return } func getSidSubAuthorityCount(sid *SID) (count *uint8) { - r0, _, _ := syscall.SyscallN(procGetSidSubAuthorityCount.Addr(), uintptr(unsafe.Pointer(sid))) + r0, _, _ := syscall.Syscall(procGetSidSubAuthorityCount.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) count = (*uint8)(unsafe.Pointer(r0)) return } func GetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procGetTokenInformation.Addr(), uintptr(token), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), uintptr(unsafe.Pointer(returnedLen))) + r1, _, e1 := syscall.Syscall6(procGetTokenInformation.Addr(), 5, uintptr(token), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), uintptr(unsafe.Pointer(returnedLen)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -961,7 +955,7 @@ func GetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint } func ImpersonateSelf(impersonationlevel uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procImpersonateSelf.Addr(), uintptr(impersonationlevel)) + r1, _, e1 := syscall.Syscall(procImpersonateSelf.Addr(), 1, uintptr(impersonationlevel), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -969,7 +963,7 @@ func ImpersonateSelf(impersonationlevel uint32) (err error) { } func initializeSecurityDescriptor(absoluteSD *SECURITY_DESCRIPTOR, revision uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procInitializeSecurityDescriptor.Addr(), uintptr(unsafe.Pointer(absoluteSD)), uintptr(revision)) + r1, _, e1 := syscall.Syscall(procInitializeSecurityDescriptor.Addr(), 2, uintptr(unsafe.Pointer(absoluteSD)), uintptr(revision), 0) if r1 == 0 { err = errnoErr(e1) } @@ -985,7 +979,7 @@ func InitiateSystemShutdownEx(machineName *uint16, message *uint16, timeout uint if rebootAfterShutdown { _p1 = 1 } - r1, _, e1 := syscall.SyscallN(procInitiateSystemShutdownExW.Addr(), uintptr(unsafe.Pointer(machineName)), uintptr(unsafe.Pointer(message)), uintptr(timeout), uintptr(_p0), uintptr(_p1), uintptr(reason)) + r1, _, e1 := syscall.Syscall6(procInitiateSystemShutdownExW.Addr(), 6, uintptr(unsafe.Pointer(machineName)), uintptr(unsafe.Pointer(message)), uintptr(timeout), uintptr(_p0), uintptr(_p1), uintptr(reason)) if r1 == 0 { err = errnoErr(e1) } @@ -993,7 +987,7 @@ func InitiateSystemShutdownEx(machineName *uint16, message *uint16, timeout uint } func isTokenRestricted(tokenHandle Token) (ret bool, err error) { - r0, _, e1 := syscall.SyscallN(procIsTokenRestricted.Addr(), uintptr(tokenHandle)) + r0, _, e1 := syscall.Syscall(procIsTokenRestricted.Addr(), 1, uintptr(tokenHandle), 0, 0) ret = r0 != 0 if !ret { err = errnoErr(e1) @@ -1002,25 +996,25 @@ func isTokenRestricted(tokenHandle Token) (ret bool, err error) { } func isValidSecurityDescriptor(sd *SECURITY_DESCRIPTOR) (isValid bool) { - r0, _, _ := syscall.SyscallN(procIsValidSecurityDescriptor.Addr(), uintptr(unsafe.Pointer(sd))) + r0, _, _ := syscall.Syscall(procIsValidSecurityDescriptor.Addr(), 1, uintptr(unsafe.Pointer(sd)), 0, 0) isValid = r0 != 0 return } func isValidSid(sid *SID) (isValid bool) { - r0, _, _ := syscall.SyscallN(procIsValidSid.Addr(), uintptr(unsafe.Pointer(sid))) + r0, _, _ := syscall.Syscall(procIsValidSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) isValid = r0 != 0 return } func isWellKnownSid(sid *SID, sidType WELL_KNOWN_SID_TYPE) (isWellKnown bool) { - r0, _, _ := syscall.SyscallN(procIsWellKnownSid.Addr(), uintptr(unsafe.Pointer(sid)), uintptr(sidType)) + r0, _, _ := syscall.Syscall(procIsWellKnownSid.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(sidType), 0) isWellKnown = r0 != 0 return } func LookupAccountName(systemName *uint16, accountName *uint16, sid *SID, sidLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procLookupAccountNameW.Addr(), uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(accountName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sidLen)), uintptr(unsafe.Pointer(refdDomainName)), uintptr(unsafe.Pointer(refdDomainNameLen)), uintptr(unsafe.Pointer(use))) + r1, _, e1 := syscall.Syscall9(procLookupAccountNameW.Addr(), 7, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(accountName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sidLen)), uintptr(unsafe.Pointer(refdDomainName)), uintptr(unsafe.Pointer(refdDomainNameLen)), uintptr(unsafe.Pointer(use)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -1028,7 +1022,7 @@ func LookupAccountName(systemName *uint16, accountName *uint16, sid *SID, sidLen } func LookupAccountSid(systemName *uint16, sid *SID, name *uint16, nameLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procLookupAccountSidW.Addr(), uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(refdDomainName)), uintptr(unsafe.Pointer(refdDomainNameLen)), uintptr(unsafe.Pointer(use))) + r1, _, e1 := syscall.Syscall9(procLookupAccountSidW.Addr(), 7, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(refdDomainName)), uintptr(unsafe.Pointer(refdDomainNameLen)), uintptr(unsafe.Pointer(use)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -1036,7 +1030,7 @@ func LookupAccountSid(systemName *uint16, sid *SID, name *uint16, nameLen *uint3 } func LookupPrivilegeValue(systemname *uint16, name *uint16, luid *LUID) (err error) { - r1, _, e1 := syscall.SyscallN(procLookupPrivilegeValueW.Addr(), uintptr(unsafe.Pointer(systemname)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(luid))) + r1, _, e1 := syscall.Syscall(procLookupPrivilegeValueW.Addr(), 3, uintptr(unsafe.Pointer(systemname)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(luid))) if r1 == 0 { err = errnoErr(e1) } @@ -1044,7 +1038,7 @@ func LookupPrivilegeValue(systemname *uint16, name *uint16, luid *LUID) (err err } func makeAbsoluteSD(selfRelativeSD *SECURITY_DESCRIPTOR, absoluteSD *SECURITY_DESCRIPTOR, absoluteSDSize *uint32, dacl *ACL, daclSize *uint32, sacl *ACL, saclSize *uint32, owner *SID, ownerSize *uint32, group *SID, groupSize *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procMakeAbsoluteSD.Addr(), uintptr(unsafe.Pointer(selfRelativeSD)), uintptr(unsafe.Pointer(absoluteSD)), uintptr(unsafe.Pointer(absoluteSDSize)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(daclSize)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(saclSize)), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(ownerSize)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(groupSize))) + r1, _, e1 := syscall.Syscall12(procMakeAbsoluteSD.Addr(), 11, uintptr(unsafe.Pointer(selfRelativeSD)), uintptr(unsafe.Pointer(absoluteSD)), uintptr(unsafe.Pointer(absoluteSDSize)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(daclSize)), uintptr(unsafe.Pointer(sacl)), uintptr(unsafe.Pointer(saclSize)), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(ownerSize)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(groupSize)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -1052,7 +1046,7 @@ func makeAbsoluteSD(selfRelativeSD *SECURITY_DESCRIPTOR, absoluteSD *SECURITY_DE } func makeSelfRelativeSD(absoluteSD *SECURITY_DESCRIPTOR, selfRelativeSD *SECURITY_DESCRIPTOR, selfRelativeSDSize *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procMakeSelfRelativeSD.Addr(), uintptr(unsafe.Pointer(absoluteSD)), uintptr(unsafe.Pointer(selfRelativeSD)), uintptr(unsafe.Pointer(selfRelativeSDSize))) + r1, _, e1 := syscall.Syscall(procMakeSelfRelativeSD.Addr(), 3, uintptr(unsafe.Pointer(absoluteSD)), uintptr(unsafe.Pointer(selfRelativeSD)), uintptr(unsafe.Pointer(selfRelativeSDSize))) if r1 == 0 { err = errnoErr(e1) } @@ -1060,7 +1054,7 @@ func makeSelfRelativeSD(absoluteSD *SECURITY_DESCRIPTOR, selfRelativeSD *SECURIT } func NotifyServiceStatusChange(service Handle, notifyMask uint32, notifier *SERVICE_NOTIFY) (ret error) { - r0, _, _ := syscall.SyscallN(procNotifyServiceStatusChangeW.Addr(), uintptr(service), uintptr(notifyMask), uintptr(unsafe.Pointer(notifier))) + r0, _, _ := syscall.Syscall(procNotifyServiceStatusChangeW.Addr(), 3, uintptr(service), uintptr(notifyMask), uintptr(unsafe.Pointer(notifier))) if r0 != 0 { ret = syscall.Errno(r0) } @@ -1068,7 +1062,7 @@ func NotifyServiceStatusChange(service Handle, notifyMask uint32, notifier *SERV } func OpenProcessToken(process Handle, access uint32, token *Token) (err error) { - r1, _, e1 := syscall.SyscallN(procOpenProcessToken.Addr(), uintptr(process), uintptr(access), uintptr(unsafe.Pointer(token))) + r1, _, e1 := syscall.Syscall(procOpenProcessToken.Addr(), 3, uintptr(process), uintptr(access), uintptr(unsafe.Pointer(token))) if r1 == 0 { err = errnoErr(e1) } @@ -1076,7 +1070,7 @@ func OpenProcessToken(process Handle, access uint32, token *Token) (err error) { } func OpenSCManager(machineName *uint16, databaseName *uint16, access uint32) (handle Handle, err error) { - r0, _, e1 := syscall.SyscallN(procOpenSCManagerW.Addr(), uintptr(unsafe.Pointer(machineName)), uintptr(unsafe.Pointer(databaseName)), uintptr(access)) + r0, _, e1 := syscall.Syscall(procOpenSCManagerW.Addr(), 3, uintptr(unsafe.Pointer(machineName)), uintptr(unsafe.Pointer(databaseName)), uintptr(access)) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -1085,7 +1079,7 @@ func OpenSCManager(machineName *uint16, databaseName *uint16, access uint32) (ha } func OpenService(mgr Handle, serviceName *uint16, access uint32) (handle Handle, err error) { - r0, _, e1 := syscall.SyscallN(procOpenServiceW.Addr(), uintptr(mgr), uintptr(unsafe.Pointer(serviceName)), uintptr(access)) + r0, _, e1 := syscall.Syscall(procOpenServiceW.Addr(), 3, uintptr(mgr), uintptr(unsafe.Pointer(serviceName)), uintptr(access)) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -1098,7 +1092,7 @@ func OpenThreadToken(thread Handle, access uint32, openAsSelf bool, token *Token if openAsSelf { _p0 = 1 } - r1, _, e1 := syscall.SyscallN(procOpenThreadToken.Addr(), uintptr(thread), uintptr(access), uintptr(_p0), uintptr(unsafe.Pointer(token))) + r1, _, e1 := syscall.Syscall6(procOpenThreadToken.Addr(), 4, uintptr(thread), uintptr(access), uintptr(_p0), uintptr(unsafe.Pointer(token)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -1106,7 +1100,7 @@ func OpenThreadToken(thread Handle, access uint32, openAsSelf bool, token *Token } func QueryServiceConfig2(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procQueryServiceConfig2W.Addr(), uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(buff)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded))) + r1, _, e1 := syscall.Syscall6(procQueryServiceConfig2W.Addr(), 5, uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(buff)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -1114,7 +1108,7 @@ func QueryServiceConfig2(service Handle, infoLevel uint32, buff *byte, buffSize } func QueryServiceConfig(service Handle, serviceConfig *QUERY_SERVICE_CONFIG, bufSize uint32, bytesNeeded *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procQueryServiceConfigW.Addr(), uintptr(service), uintptr(unsafe.Pointer(serviceConfig)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded))) + r1, _, e1 := syscall.Syscall6(procQueryServiceConfigW.Addr(), 4, uintptr(service), uintptr(unsafe.Pointer(serviceConfig)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -1126,7 +1120,7 @@ func QueryServiceDynamicInformation(service Handle, infoLevel uint32, dynamicInf if err != nil { return } - r1, _, e1 := syscall.SyscallN(procQueryServiceDynamicInformation.Addr(), uintptr(service), uintptr(infoLevel), uintptr(dynamicInfo)) + r1, _, e1 := syscall.Syscall(procQueryServiceDynamicInformation.Addr(), 3, uintptr(service), uintptr(infoLevel), uintptr(dynamicInfo)) if r1 == 0 { err = errnoErr(e1) } @@ -1134,7 +1128,7 @@ func QueryServiceDynamicInformation(service Handle, infoLevel uint32, dynamicInf } func QueryServiceLockStatus(mgr Handle, lockStatus *QUERY_SERVICE_LOCK_STATUS, bufSize uint32, bytesNeeded *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procQueryServiceLockStatusW.Addr(), uintptr(mgr), uintptr(unsafe.Pointer(lockStatus)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded))) + r1, _, e1 := syscall.Syscall6(procQueryServiceLockStatusW.Addr(), 4, uintptr(mgr), uintptr(unsafe.Pointer(lockStatus)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -1142,7 +1136,7 @@ func QueryServiceLockStatus(mgr Handle, lockStatus *QUERY_SERVICE_LOCK_STATUS, b } func QueryServiceStatus(service Handle, status *SERVICE_STATUS) (err error) { - r1, _, e1 := syscall.SyscallN(procQueryServiceStatus.Addr(), uintptr(service), uintptr(unsafe.Pointer(status))) + r1, _, e1 := syscall.Syscall(procQueryServiceStatus.Addr(), 2, uintptr(service), uintptr(unsafe.Pointer(status)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -1150,7 +1144,7 @@ func QueryServiceStatus(service Handle, status *SERVICE_STATUS) (err error) { } func QueryServiceStatusEx(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procQueryServiceStatusEx.Addr(), uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(buff)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded))) + r1, _, e1 := syscall.Syscall6(procQueryServiceStatusEx.Addr(), 5, uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(buff)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -1158,7 +1152,7 @@ func QueryServiceStatusEx(service Handle, infoLevel uint32, buff *byte, buffSize } func RegCloseKey(key Handle) (regerrno error) { - r0, _, _ := syscall.SyscallN(procRegCloseKey.Addr(), uintptr(key)) + r0, _, _ := syscall.Syscall(procRegCloseKey.Addr(), 1, uintptr(key), 0, 0) if r0 != 0 { regerrno = syscall.Errno(r0) } @@ -1166,7 +1160,7 @@ func RegCloseKey(key Handle) (regerrno error) { } func RegEnumKeyEx(key Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, class *uint16, classLen *uint32, lastWriteTime *Filetime) (regerrno error) { - r0, _, _ := syscall.SyscallN(procRegEnumKeyExW.Addr(), uintptr(key), uintptr(index), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(class)), uintptr(unsafe.Pointer(classLen)), uintptr(unsafe.Pointer(lastWriteTime))) + r0, _, _ := syscall.Syscall9(procRegEnumKeyExW.Addr(), 8, uintptr(key), uintptr(index), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(class)), uintptr(unsafe.Pointer(classLen)), uintptr(unsafe.Pointer(lastWriteTime)), 0) if r0 != 0 { regerrno = syscall.Errno(r0) } @@ -1182,7 +1176,7 @@ func RegNotifyChangeKeyValue(key Handle, watchSubtree bool, notifyFilter uint32, if asynchronous { _p1 = 1 } - r0, _, _ := syscall.SyscallN(procRegNotifyChangeKeyValue.Addr(), uintptr(key), uintptr(_p0), uintptr(notifyFilter), uintptr(event), uintptr(_p1)) + r0, _, _ := syscall.Syscall6(procRegNotifyChangeKeyValue.Addr(), 5, uintptr(key), uintptr(_p0), uintptr(notifyFilter), uintptr(event), uintptr(_p1), 0) if r0 != 0 { regerrno = syscall.Errno(r0) } @@ -1190,7 +1184,7 @@ func RegNotifyChangeKeyValue(key Handle, watchSubtree bool, notifyFilter uint32, } func RegOpenKeyEx(key Handle, subkey *uint16, options uint32, desiredAccess uint32, result *Handle) (regerrno error) { - r0, _, _ := syscall.SyscallN(procRegOpenKeyExW.Addr(), uintptr(key), uintptr(unsafe.Pointer(subkey)), uintptr(options), uintptr(desiredAccess), uintptr(unsafe.Pointer(result))) + r0, _, _ := syscall.Syscall6(procRegOpenKeyExW.Addr(), 5, uintptr(key), uintptr(unsafe.Pointer(subkey)), uintptr(options), uintptr(desiredAccess), uintptr(unsafe.Pointer(result)), 0) if r0 != 0 { regerrno = syscall.Errno(r0) } @@ -1198,7 +1192,7 @@ func RegOpenKeyEx(key Handle, subkey *uint16, options uint32, desiredAccess uint } func RegQueryInfoKey(key Handle, class *uint16, classLen *uint32, reserved *uint32, subkeysLen *uint32, maxSubkeyLen *uint32, maxClassLen *uint32, valuesLen *uint32, maxValueNameLen *uint32, maxValueLen *uint32, saLen *uint32, lastWriteTime *Filetime) (regerrno error) { - r0, _, _ := syscall.SyscallN(procRegQueryInfoKeyW.Addr(), uintptr(key), uintptr(unsafe.Pointer(class)), uintptr(unsafe.Pointer(classLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(subkeysLen)), uintptr(unsafe.Pointer(maxSubkeyLen)), uintptr(unsafe.Pointer(maxClassLen)), uintptr(unsafe.Pointer(valuesLen)), uintptr(unsafe.Pointer(maxValueNameLen)), uintptr(unsafe.Pointer(maxValueLen)), uintptr(unsafe.Pointer(saLen)), uintptr(unsafe.Pointer(lastWriteTime))) + r0, _, _ := syscall.Syscall12(procRegQueryInfoKeyW.Addr(), 12, uintptr(key), uintptr(unsafe.Pointer(class)), uintptr(unsafe.Pointer(classLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(subkeysLen)), uintptr(unsafe.Pointer(maxSubkeyLen)), uintptr(unsafe.Pointer(maxClassLen)), uintptr(unsafe.Pointer(valuesLen)), uintptr(unsafe.Pointer(maxValueNameLen)), uintptr(unsafe.Pointer(maxValueLen)), uintptr(unsafe.Pointer(saLen)), uintptr(unsafe.Pointer(lastWriteTime))) if r0 != 0 { regerrno = syscall.Errno(r0) } @@ -1206,7 +1200,7 @@ func RegQueryInfoKey(key Handle, class *uint16, classLen *uint32, reserved *uint } func RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) { - r0, _, _ := syscall.SyscallN(procRegQueryValueExW.Addr(), uintptr(key), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(valtype)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(buflen))) + r0, _, _ := syscall.Syscall6(procRegQueryValueExW.Addr(), 6, uintptr(key), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(valtype)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(buflen))) if r0 != 0 { regerrno = syscall.Errno(r0) } @@ -1214,7 +1208,7 @@ func RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32 } func RegisterEventSource(uncServerName *uint16, sourceName *uint16) (handle Handle, err error) { - r0, _, e1 := syscall.SyscallN(procRegisterEventSourceW.Addr(), uintptr(unsafe.Pointer(uncServerName)), uintptr(unsafe.Pointer(sourceName))) + r0, _, e1 := syscall.Syscall(procRegisterEventSourceW.Addr(), 2, uintptr(unsafe.Pointer(uncServerName)), uintptr(unsafe.Pointer(sourceName)), 0) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -1223,7 +1217,7 @@ func RegisterEventSource(uncServerName *uint16, sourceName *uint16) (handle Hand } func RegisterServiceCtrlHandlerEx(serviceName *uint16, handlerProc uintptr, context uintptr) (handle Handle, err error) { - r0, _, e1 := syscall.SyscallN(procRegisterServiceCtrlHandlerExW.Addr(), uintptr(unsafe.Pointer(serviceName)), uintptr(handlerProc), uintptr(context)) + r0, _, e1 := syscall.Syscall(procRegisterServiceCtrlHandlerExW.Addr(), 3, uintptr(unsafe.Pointer(serviceName)), uintptr(handlerProc), uintptr(context)) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -1232,7 +1226,7 @@ func RegisterServiceCtrlHandlerEx(serviceName *uint16, handlerProc uintptr, cont } func ReportEvent(log Handle, etype uint16, category uint16, eventId uint32, usrSId uintptr, numStrings uint16, dataSize uint32, strings **uint16, rawData *byte) (err error) { - r1, _, e1 := syscall.SyscallN(procReportEventW.Addr(), uintptr(log), uintptr(etype), uintptr(category), uintptr(eventId), uintptr(usrSId), uintptr(numStrings), uintptr(dataSize), uintptr(unsafe.Pointer(strings)), uintptr(unsafe.Pointer(rawData))) + r1, _, e1 := syscall.Syscall9(procReportEventW.Addr(), 9, uintptr(log), uintptr(etype), uintptr(category), uintptr(eventId), uintptr(usrSId), uintptr(numStrings), uintptr(dataSize), uintptr(unsafe.Pointer(strings)), uintptr(unsafe.Pointer(rawData))) if r1 == 0 { err = errnoErr(e1) } @@ -1240,7 +1234,7 @@ func ReportEvent(log Handle, etype uint16, category uint16, eventId uint32, usrS } func RevertToSelf() (err error) { - r1, _, e1 := syscall.SyscallN(procRevertToSelf.Addr()) + r1, _, e1 := syscall.Syscall(procRevertToSelf.Addr(), 0, 0, 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -1248,7 +1242,7 @@ func RevertToSelf() (err error) { } func setEntriesInAcl(countExplicitEntries uint32, explicitEntries *EXPLICIT_ACCESS, oldACL *ACL, newACL **ACL) (ret error) { - r0, _, _ := syscall.SyscallN(procSetEntriesInAclW.Addr(), uintptr(countExplicitEntries), uintptr(unsafe.Pointer(explicitEntries)), uintptr(unsafe.Pointer(oldACL)), uintptr(unsafe.Pointer(newACL))) + r0, _, _ := syscall.Syscall6(procSetEntriesInAclW.Addr(), 4, uintptr(countExplicitEntries), uintptr(unsafe.Pointer(explicitEntries)), uintptr(unsafe.Pointer(oldACL)), uintptr(unsafe.Pointer(newACL)), 0, 0) if r0 != 0 { ret = syscall.Errno(r0) } @@ -1256,7 +1250,7 @@ func setEntriesInAcl(countExplicitEntries uint32, explicitEntries *EXPLICIT_ACCE } func SetKernelObjectSecurity(handle Handle, securityInformation SECURITY_INFORMATION, securityDescriptor *SECURITY_DESCRIPTOR) (err error) { - r1, _, e1 := syscall.SyscallN(procSetKernelObjectSecurity.Addr(), uintptr(handle), uintptr(securityInformation), uintptr(unsafe.Pointer(securityDescriptor))) + r1, _, e1 := syscall.Syscall(procSetKernelObjectSecurity.Addr(), 3, uintptr(handle), uintptr(securityInformation), uintptr(unsafe.Pointer(securityDescriptor))) if r1 == 0 { err = errnoErr(e1) } @@ -1273,7 +1267,7 @@ func SetNamedSecurityInfo(objectName string, objectType SE_OBJECT_TYPE, security } func _SetNamedSecurityInfo(objectName *uint16, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) (ret error) { - r0, _, _ := syscall.SyscallN(procSetNamedSecurityInfoW.Addr(), uintptr(unsafe.Pointer(objectName)), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl))) + r0, _, _ := syscall.Syscall9(procSetNamedSecurityInfoW.Addr(), 7, uintptr(unsafe.Pointer(objectName)), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), 0, 0) if r0 != 0 { ret = syscall.Errno(r0) } @@ -1281,7 +1275,7 @@ func _SetNamedSecurityInfo(objectName *uint16, objectType SE_OBJECT_TYPE, securi } func setSecurityDescriptorControl(sd *SECURITY_DESCRIPTOR, controlBitsOfInterest SECURITY_DESCRIPTOR_CONTROL, controlBitsToSet SECURITY_DESCRIPTOR_CONTROL) (err error) { - r1, _, e1 := syscall.SyscallN(procSetSecurityDescriptorControl.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(controlBitsOfInterest), uintptr(controlBitsToSet)) + r1, _, e1 := syscall.Syscall(procSetSecurityDescriptorControl.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(controlBitsOfInterest), uintptr(controlBitsToSet)) if r1 == 0 { err = errnoErr(e1) } @@ -1297,7 +1291,7 @@ func setSecurityDescriptorDacl(sd *SECURITY_DESCRIPTOR, daclPresent bool, dacl * if daclDefaulted { _p1 = 1 } - r1, _, e1 := syscall.SyscallN(procSetSecurityDescriptorDacl.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(_p0), uintptr(unsafe.Pointer(dacl)), uintptr(_p1)) + r1, _, e1 := syscall.Syscall6(procSetSecurityDescriptorDacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(_p0), uintptr(unsafe.Pointer(dacl)), uintptr(_p1), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -1309,7 +1303,7 @@ func setSecurityDescriptorGroup(sd *SECURITY_DESCRIPTOR, group *SID, groupDefaul if groupDefaulted { _p0 = 1 } - r1, _, e1 := syscall.SyscallN(procSetSecurityDescriptorGroup.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(group)), uintptr(_p0)) + r1, _, e1 := syscall.Syscall(procSetSecurityDescriptorGroup.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(group)), uintptr(_p0)) if r1 == 0 { err = errnoErr(e1) } @@ -1321,7 +1315,7 @@ func setSecurityDescriptorOwner(sd *SECURITY_DESCRIPTOR, owner *SID, ownerDefaul if ownerDefaulted { _p0 = 1 } - r1, _, e1 := syscall.SyscallN(procSetSecurityDescriptorOwner.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(owner)), uintptr(_p0)) + r1, _, e1 := syscall.Syscall(procSetSecurityDescriptorOwner.Addr(), 3, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(owner)), uintptr(_p0)) if r1 == 0 { err = errnoErr(e1) } @@ -1329,7 +1323,7 @@ func setSecurityDescriptorOwner(sd *SECURITY_DESCRIPTOR, owner *SID, ownerDefaul } func setSecurityDescriptorRMControl(sd *SECURITY_DESCRIPTOR, rmControl *uint8) { - syscall.SyscallN(procSetSecurityDescriptorRMControl.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(rmControl))) + syscall.Syscall(procSetSecurityDescriptorRMControl.Addr(), 2, uintptr(unsafe.Pointer(sd)), uintptr(unsafe.Pointer(rmControl)), 0) return } @@ -1342,7 +1336,7 @@ func setSecurityDescriptorSacl(sd *SECURITY_DESCRIPTOR, saclPresent bool, sacl * if saclDefaulted { _p1 = 1 } - r1, _, e1 := syscall.SyscallN(procSetSecurityDescriptorSacl.Addr(), uintptr(unsafe.Pointer(sd)), uintptr(_p0), uintptr(unsafe.Pointer(sacl)), uintptr(_p1)) + r1, _, e1 := syscall.Syscall6(procSetSecurityDescriptorSacl.Addr(), 4, uintptr(unsafe.Pointer(sd)), uintptr(_p0), uintptr(unsafe.Pointer(sacl)), uintptr(_p1), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -1350,7 +1344,7 @@ func setSecurityDescriptorSacl(sd *SECURITY_DESCRIPTOR, saclPresent bool, sacl * } func SetSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformation SECURITY_INFORMATION, owner *SID, group *SID, dacl *ACL, sacl *ACL) (ret error) { - r0, _, _ := syscall.SyscallN(procSetSecurityInfo.Addr(), uintptr(handle), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl))) + r0, _, _ := syscall.Syscall9(procSetSecurityInfo.Addr(), 7, uintptr(handle), uintptr(objectType), uintptr(securityInformation), uintptr(unsafe.Pointer(owner)), uintptr(unsafe.Pointer(group)), uintptr(unsafe.Pointer(dacl)), uintptr(unsafe.Pointer(sacl)), 0, 0) if r0 != 0 { ret = syscall.Errno(r0) } @@ -1358,7 +1352,7 @@ func SetSecurityInfo(handle Handle, objectType SE_OBJECT_TYPE, securityInformati } func SetServiceStatus(service Handle, serviceStatus *SERVICE_STATUS) (err error) { - r1, _, e1 := syscall.SyscallN(procSetServiceStatus.Addr(), uintptr(service), uintptr(unsafe.Pointer(serviceStatus))) + r1, _, e1 := syscall.Syscall(procSetServiceStatus.Addr(), 2, uintptr(service), uintptr(unsafe.Pointer(serviceStatus)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -1366,7 +1360,7 @@ func SetServiceStatus(service Handle, serviceStatus *SERVICE_STATUS) (err error) } func SetThreadToken(thread *Handle, token Token) (err error) { - r1, _, e1 := syscall.SyscallN(procSetThreadToken.Addr(), uintptr(unsafe.Pointer(thread)), uintptr(token)) + r1, _, e1 := syscall.Syscall(procSetThreadToken.Addr(), 2, uintptr(unsafe.Pointer(thread)), uintptr(token), 0) if r1 == 0 { err = errnoErr(e1) } @@ -1374,7 +1368,7 @@ func SetThreadToken(thread *Handle, token Token) (err error) { } func SetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procSetTokenInformation.Addr(), uintptr(token), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen)) + r1, _, e1 := syscall.Syscall6(procSetTokenInformation.Addr(), 4, uintptr(token), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -1382,7 +1376,7 @@ func SetTokenInformation(token Token, infoClass uint32, info *byte, infoLen uint } func StartServiceCtrlDispatcher(serviceTable *SERVICE_TABLE_ENTRY) (err error) { - r1, _, e1 := syscall.SyscallN(procStartServiceCtrlDispatcherW.Addr(), uintptr(unsafe.Pointer(serviceTable))) + r1, _, e1 := syscall.Syscall(procStartServiceCtrlDispatcherW.Addr(), 1, uintptr(unsafe.Pointer(serviceTable)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -1390,7 +1384,7 @@ func StartServiceCtrlDispatcher(serviceTable *SERVICE_TABLE_ENTRY) (err error) { } func StartService(service Handle, numArgs uint32, argVectors **uint16) (err error) { - r1, _, e1 := syscall.SyscallN(procStartServiceW.Addr(), uintptr(service), uintptr(numArgs), uintptr(unsafe.Pointer(argVectors))) + r1, _, e1 := syscall.Syscall(procStartServiceW.Addr(), 3, uintptr(service), uintptr(numArgs), uintptr(unsafe.Pointer(argVectors))) if r1 == 0 { err = errnoErr(e1) } @@ -1398,7 +1392,7 @@ func StartService(service Handle, numArgs uint32, argVectors **uint16) (err erro } func CertAddCertificateContextToStore(store Handle, certContext *CertContext, addDisposition uint32, storeContext **CertContext) (err error) { - r1, _, e1 := syscall.SyscallN(procCertAddCertificateContextToStore.Addr(), uintptr(store), uintptr(unsafe.Pointer(certContext)), uintptr(addDisposition), uintptr(unsafe.Pointer(storeContext))) + r1, _, e1 := syscall.Syscall6(procCertAddCertificateContextToStore.Addr(), 4, uintptr(store), uintptr(unsafe.Pointer(certContext)), uintptr(addDisposition), uintptr(unsafe.Pointer(storeContext)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -1406,7 +1400,7 @@ func CertAddCertificateContextToStore(store Handle, certContext *CertContext, ad } func CertCloseStore(store Handle, flags uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procCertCloseStore.Addr(), uintptr(store), uintptr(flags)) + r1, _, e1 := syscall.Syscall(procCertCloseStore.Addr(), 2, uintptr(store), uintptr(flags), 0) if r1 == 0 { err = errnoErr(e1) } @@ -1414,7 +1408,7 @@ func CertCloseStore(store Handle, flags uint32) (err error) { } func CertCreateCertificateContext(certEncodingType uint32, certEncoded *byte, encodedLen uint32) (context *CertContext, err error) { - r0, _, e1 := syscall.SyscallN(procCertCreateCertificateContext.Addr(), uintptr(certEncodingType), uintptr(unsafe.Pointer(certEncoded)), uintptr(encodedLen)) + r0, _, e1 := syscall.Syscall(procCertCreateCertificateContext.Addr(), 3, uintptr(certEncodingType), uintptr(unsafe.Pointer(certEncoded)), uintptr(encodedLen)) context = (*CertContext)(unsafe.Pointer(r0)) if context == nil { err = errnoErr(e1) @@ -1423,7 +1417,7 @@ func CertCreateCertificateContext(certEncodingType uint32, certEncoded *byte, en } func CertDeleteCertificateFromStore(certContext *CertContext) (err error) { - r1, _, e1 := syscall.SyscallN(procCertDeleteCertificateFromStore.Addr(), uintptr(unsafe.Pointer(certContext))) + r1, _, e1 := syscall.Syscall(procCertDeleteCertificateFromStore.Addr(), 1, uintptr(unsafe.Pointer(certContext)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -1431,13 +1425,13 @@ func CertDeleteCertificateFromStore(certContext *CertContext) (err error) { } func CertDuplicateCertificateContext(certContext *CertContext) (dupContext *CertContext) { - r0, _, _ := syscall.SyscallN(procCertDuplicateCertificateContext.Addr(), uintptr(unsafe.Pointer(certContext))) + r0, _, _ := syscall.Syscall(procCertDuplicateCertificateContext.Addr(), 1, uintptr(unsafe.Pointer(certContext)), 0, 0) dupContext = (*CertContext)(unsafe.Pointer(r0)) return } func CertEnumCertificatesInStore(store Handle, prevContext *CertContext) (context *CertContext, err error) { - r0, _, e1 := syscall.SyscallN(procCertEnumCertificatesInStore.Addr(), uintptr(store), uintptr(unsafe.Pointer(prevContext))) + r0, _, e1 := syscall.Syscall(procCertEnumCertificatesInStore.Addr(), 2, uintptr(store), uintptr(unsafe.Pointer(prevContext)), 0) context = (*CertContext)(unsafe.Pointer(r0)) if context == nil { err = errnoErr(e1) @@ -1446,7 +1440,7 @@ func CertEnumCertificatesInStore(store Handle, prevContext *CertContext) (contex } func CertFindCertificateInStore(store Handle, certEncodingType uint32, findFlags uint32, findType uint32, findPara unsafe.Pointer, prevCertContext *CertContext) (cert *CertContext, err error) { - r0, _, e1 := syscall.SyscallN(procCertFindCertificateInStore.Addr(), uintptr(store), uintptr(certEncodingType), uintptr(findFlags), uintptr(findType), uintptr(findPara), uintptr(unsafe.Pointer(prevCertContext))) + r0, _, e1 := syscall.Syscall6(procCertFindCertificateInStore.Addr(), 6, uintptr(store), uintptr(certEncodingType), uintptr(findFlags), uintptr(findType), uintptr(findPara), uintptr(unsafe.Pointer(prevCertContext))) cert = (*CertContext)(unsafe.Pointer(r0)) if cert == nil { err = errnoErr(e1) @@ -1455,7 +1449,7 @@ func CertFindCertificateInStore(store Handle, certEncodingType uint32, findFlags } func CertFindChainInStore(store Handle, certEncodingType uint32, findFlags uint32, findType uint32, findPara unsafe.Pointer, prevChainContext *CertChainContext) (certchain *CertChainContext, err error) { - r0, _, e1 := syscall.SyscallN(procCertFindChainInStore.Addr(), uintptr(store), uintptr(certEncodingType), uintptr(findFlags), uintptr(findType), uintptr(findPara), uintptr(unsafe.Pointer(prevChainContext))) + r0, _, e1 := syscall.Syscall6(procCertFindChainInStore.Addr(), 6, uintptr(store), uintptr(certEncodingType), uintptr(findFlags), uintptr(findType), uintptr(findPara), uintptr(unsafe.Pointer(prevChainContext))) certchain = (*CertChainContext)(unsafe.Pointer(r0)) if certchain == nil { err = errnoErr(e1) @@ -1464,18 +1458,18 @@ func CertFindChainInStore(store Handle, certEncodingType uint32, findFlags uint3 } func CertFindExtension(objId *byte, countExtensions uint32, extensions *CertExtension) (ret *CertExtension) { - r0, _, _ := syscall.SyscallN(procCertFindExtension.Addr(), uintptr(unsafe.Pointer(objId)), uintptr(countExtensions), uintptr(unsafe.Pointer(extensions))) + r0, _, _ := syscall.Syscall(procCertFindExtension.Addr(), 3, uintptr(unsafe.Pointer(objId)), uintptr(countExtensions), uintptr(unsafe.Pointer(extensions))) ret = (*CertExtension)(unsafe.Pointer(r0)) return } func CertFreeCertificateChain(ctx *CertChainContext) { - syscall.SyscallN(procCertFreeCertificateChain.Addr(), uintptr(unsafe.Pointer(ctx))) + syscall.Syscall(procCertFreeCertificateChain.Addr(), 1, uintptr(unsafe.Pointer(ctx)), 0, 0) return } func CertFreeCertificateContext(ctx *CertContext) (err error) { - r1, _, e1 := syscall.SyscallN(procCertFreeCertificateContext.Addr(), uintptr(unsafe.Pointer(ctx))) + r1, _, e1 := syscall.Syscall(procCertFreeCertificateContext.Addr(), 1, uintptr(unsafe.Pointer(ctx)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -1483,7 +1477,7 @@ func CertFreeCertificateContext(ctx *CertContext) (err error) { } func CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, additionalStore Handle, para *CertChainPara, flags uint32, reserved uintptr, chainCtx **CertChainContext) (err error) { - r1, _, e1 := syscall.SyscallN(procCertGetCertificateChain.Addr(), uintptr(engine), uintptr(unsafe.Pointer(leaf)), uintptr(unsafe.Pointer(time)), uintptr(additionalStore), uintptr(unsafe.Pointer(para)), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(chainCtx))) + r1, _, e1 := syscall.Syscall9(procCertGetCertificateChain.Addr(), 8, uintptr(engine), uintptr(unsafe.Pointer(leaf)), uintptr(unsafe.Pointer(time)), uintptr(additionalStore), uintptr(unsafe.Pointer(para)), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(chainCtx)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -1491,13 +1485,13 @@ func CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, a } func CertGetNameString(certContext *CertContext, nameType uint32, flags uint32, typePara unsafe.Pointer, name *uint16, size uint32) (chars uint32) { - r0, _, _ := syscall.SyscallN(procCertGetNameStringW.Addr(), uintptr(unsafe.Pointer(certContext)), uintptr(nameType), uintptr(flags), uintptr(typePara), uintptr(unsafe.Pointer(name)), uintptr(size)) + r0, _, _ := syscall.Syscall6(procCertGetNameStringW.Addr(), 6, uintptr(unsafe.Pointer(certContext)), uintptr(nameType), uintptr(flags), uintptr(typePara), uintptr(unsafe.Pointer(name)), uintptr(size)) chars = uint32(r0) return } func CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptProv uintptr, flags uint32, para uintptr) (handle Handle, err error) { - r0, _, e1 := syscall.SyscallN(procCertOpenStore.Addr(), uintptr(storeProvider), uintptr(msgAndCertEncodingType), uintptr(cryptProv), uintptr(flags), uintptr(para)) + r0, _, e1 := syscall.Syscall6(procCertOpenStore.Addr(), 5, uintptr(storeProvider), uintptr(msgAndCertEncodingType), uintptr(cryptProv), uintptr(flags), uintptr(para), 0) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -1506,7 +1500,7 @@ func CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptPr } func CertOpenSystemStore(hprov Handle, name *uint16) (store Handle, err error) { - r0, _, e1 := syscall.SyscallN(procCertOpenSystemStoreW.Addr(), uintptr(hprov), uintptr(unsafe.Pointer(name))) + r0, _, e1 := syscall.Syscall(procCertOpenSystemStoreW.Addr(), 2, uintptr(hprov), uintptr(unsafe.Pointer(name)), 0) store = Handle(r0) if store == 0 { err = errnoErr(e1) @@ -1515,7 +1509,7 @@ func CertOpenSystemStore(hprov Handle, name *uint16) (store Handle, err error) { } func CertVerifyCertificateChainPolicy(policyOID uintptr, chain *CertChainContext, para *CertChainPolicyPara, status *CertChainPolicyStatus) (err error) { - r1, _, e1 := syscall.SyscallN(procCertVerifyCertificateChainPolicy.Addr(), uintptr(policyOID), uintptr(unsafe.Pointer(chain)), uintptr(unsafe.Pointer(para)), uintptr(unsafe.Pointer(status))) + r1, _, e1 := syscall.Syscall6(procCertVerifyCertificateChainPolicy.Addr(), 4, uintptr(policyOID), uintptr(unsafe.Pointer(chain)), uintptr(unsafe.Pointer(para)), uintptr(unsafe.Pointer(status)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -1527,7 +1521,7 @@ func CryptAcquireCertificatePrivateKey(cert *CertContext, flags uint32, paramete if *callerFreeProvOrNCryptKey { _p0 = 1 } - r1, _, e1 := syscall.SyscallN(procCryptAcquireCertificatePrivateKey.Addr(), uintptr(unsafe.Pointer(cert)), uintptr(flags), uintptr(parameters), uintptr(unsafe.Pointer(cryptProvOrNCryptKey)), uintptr(unsafe.Pointer(keySpec)), uintptr(unsafe.Pointer(&_p0))) + r1, _, e1 := syscall.Syscall6(procCryptAcquireCertificatePrivateKey.Addr(), 6, uintptr(unsafe.Pointer(cert)), uintptr(flags), uintptr(parameters), uintptr(unsafe.Pointer(cryptProvOrNCryptKey)), uintptr(unsafe.Pointer(keySpec)), uintptr(unsafe.Pointer(&_p0))) *callerFreeProvOrNCryptKey = _p0 != 0 if r1 == 0 { err = errnoErr(e1) @@ -1536,7 +1530,7 @@ func CryptAcquireCertificatePrivateKey(cert *CertContext, flags uint32, paramete } func CryptDecodeObject(encodingType uint32, structType *byte, encodedBytes *byte, lenEncodedBytes uint32, flags uint32, decoded unsafe.Pointer, decodedLen *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procCryptDecodeObject.Addr(), uintptr(encodingType), uintptr(unsafe.Pointer(structType)), uintptr(unsafe.Pointer(encodedBytes)), uintptr(lenEncodedBytes), uintptr(flags), uintptr(decoded), uintptr(unsafe.Pointer(decodedLen))) + r1, _, e1 := syscall.Syscall9(procCryptDecodeObject.Addr(), 7, uintptr(encodingType), uintptr(unsafe.Pointer(structType)), uintptr(unsafe.Pointer(encodedBytes)), uintptr(lenEncodedBytes), uintptr(flags), uintptr(decoded), uintptr(unsafe.Pointer(decodedLen)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -1544,7 +1538,7 @@ func CryptDecodeObject(encodingType uint32, structType *byte, encodedBytes *byte } func CryptProtectData(dataIn *DataBlob, name *uint16, optionalEntropy *DataBlob, reserved uintptr, promptStruct *CryptProtectPromptStruct, flags uint32, dataOut *DataBlob) (err error) { - r1, _, e1 := syscall.SyscallN(procCryptProtectData.Addr(), uintptr(unsafe.Pointer(dataIn)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(optionalEntropy)), uintptr(reserved), uintptr(unsafe.Pointer(promptStruct)), uintptr(flags), uintptr(unsafe.Pointer(dataOut))) + r1, _, e1 := syscall.Syscall9(procCryptProtectData.Addr(), 7, uintptr(unsafe.Pointer(dataIn)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(optionalEntropy)), uintptr(reserved), uintptr(unsafe.Pointer(promptStruct)), uintptr(flags), uintptr(unsafe.Pointer(dataOut)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -1552,7 +1546,7 @@ func CryptProtectData(dataIn *DataBlob, name *uint16, optionalEntropy *DataBlob, } func CryptQueryObject(objectType uint32, object unsafe.Pointer, expectedContentTypeFlags uint32, expectedFormatTypeFlags uint32, flags uint32, msgAndCertEncodingType *uint32, contentType *uint32, formatType *uint32, certStore *Handle, msg *Handle, context *unsafe.Pointer) (err error) { - r1, _, e1 := syscall.SyscallN(procCryptQueryObject.Addr(), uintptr(objectType), uintptr(object), uintptr(expectedContentTypeFlags), uintptr(expectedFormatTypeFlags), uintptr(flags), uintptr(unsafe.Pointer(msgAndCertEncodingType)), uintptr(unsafe.Pointer(contentType)), uintptr(unsafe.Pointer(formatType)), uintptr(unsafe.Pointer(certStore)), uintptr(unsafe.Pointer(msg)), uintptr(unsafe.Pointer(context))) + r1, _, e1 := syscall.Syscall12(procCryptQueryObject.Addr(), 11, uintptr(objectType), uintptr(object), uintptr(expectedContentTypeFlags), uintptr(expectedFormatTypeFlags), uintptr(flags), uintptr(unsafe.Pointer(msgAndCertEncodingType)), uintptr(unsafe.Pointer(contentType)), uintptr(unsafe.Pointer(formatType)), uintptr(unsafe.Pointer(certStore)), uintptr(unsafe.Pointer(msg)), uintptr(unsafe.Pointer(context)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -1560,7 +1554,7 @@ func CryptQueryObject(objectType uint32, object unsafe.Pointer, expectedContentT } func CryptUnprotectData(dataIn *DataBlob, name **uint16, optionalEntropy *DataBlob, reserved uintptr, promptStruct *CryptProtectPromptStruct, flags uint32, dataOut *DataBlob) (err error) { - r1, _, e1 := syscall.SyscallN(procCryptUnprotectData.Addr(), uintptr(unsafe.Pointer(dataIn)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(optionalEntropy)), uintptr(reserved), uintptr(unsafe.Pointer(promptStruct)), uintptr(flags), uintptr(unsafe.Pointer(dataOut))) + r1, _, e1 := syscall.Syscall9(procCryptUnprotectData.Addr(), 7, uintptr(unsafe.Pointer(dataIn)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(optionalEntropy)), uintptr(reserved), uintptr(unsafe.Pointer(promptStruct)), uintptr(flags), uintptr(unsafe.Pointer(dataOut)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -1568,7 +1562,7 @@ func CryptUnprotectData(dataIn *DataBlob, name **uint16, optionalEntropy *DataBl } func PFXImportCertStore(pfx *CryptDataBlob, password *uint16, flags uint32) (store Handle, err error) { - r0, _, e1 := syscall.SyscallN(procPFXImportCertStore.Addr(), uintptr(unsafe.Pointer(pfx)), uintptr(unsafe.Pointer(password)), uintptr(flags)) + r0, _, e1 := syscall.Syscall(procPFXImportCertStore.Addr(), 3, uintptr(unsafe.Pointer(pfx)), uintptr(unsafe.Pointer(password)), uintptr(flags)) store = Handle(r0) if store == 0 { err = errnoErr(e1) @@ -1577,7 +1571,7 @@ func PFXImportCertStore(pfx *CryptDataBlob, password *uint16, flags uint32) (sto } func DnsNameCompare(name1 *uint16, name2 *uint16) (same bool) { - r0, _, _ := syscall.SyscallN(procDnsNameCompare_W.Addr(), uintptr(unsafe.Pointer(name1)), uintptr(unsafe.Pointer(name2))) + r0, _, _ := syscall.Syscall(procDnsNameCompare_W.Addr(), 2, uintptr(unsafe.Pointer(name1)), uintptr(unsafe.Pointer(name2)), 0) same = r0 != 0 return } @@ -1592,7 +1586,7 @@ func DnsQuery(name string, qtype uint16, options uint32, extra *byte, qrs **DNSR } func _DnsQuery(name *uint16, qtype uint16, options uint32, extra *byte, qrs **DNSRecord, pr *byte) (status error) { - r0, _, _ := syscall.SyscallN(procDnsQuery_W.Addr(), uintptr(unsafe.Pointer(name)), uintptr(qtype), uintptr(options), uintptr(unsafe.Pointer(extra)), uintptr(unsafe.Pointer(qrs)), uintptr(unsafe.Pointer(pr))) + r0, _, _ := syscall.Syscall6(procDnsQuery_W.Addr(), 6, uintptr(unsafe.Pointer(name)), uintptr(qtype), uintptr(options), uintptr(unsafe.Pointer(extra)), uintptr(unsafe.Pointer(qrs)), uintptr(unsafe.Pointer(pr))) if r0 != 0 { status = syscall.Errno(r0) } @@ -1600,12 +1594,12 @@ func _DnsQuery(name *uint16, qtype uint16, options uint32, extra *byte, qrs **DN } func DnsRecordListFree(rl *DNSRecord, freetype uint32) { - syscall.SyscallN(procDnsRecordListFree.Addr(), uintptr(unsafe.Pointer(rl)), uintptr(freetype)) + syscall.Syscall(procDnsRecordListFree.Addr(), 2, uintptr(unsafe.Pointer(rl)), uintptr(freetype), 0) return } func DwmGetWindowAttribute(hwnd HWND, attribute uint32, value unsafe.Pointer, size uint32) (ret error) { - r0, _, _ := syscall.SyscallN(procDwmGetWindowAttribute.Addr(), uintptr(hwnd), uintptr(attribute), uintptr(value), uintptr(size)) + r0, _, _ := syscall.Syscall6(procDwmGetWindowAttribute.Addr(), 4, uintptr(hwnd), uintptr(attribute), uintptr(value), uintptr(size), 0, 0) if r0 != 0 { ret = syscall.Errno(r0) } @@ -1613,7 +1607,7 @@ func DwmGetWindowAttribute(hwnd HWND, attribute uint32, value unsafe.Pointer, si } func DwmSetWindowAttribute(hwnd HWND, attribute uint32, value unsafe.Pointer, size uint32) (ret error) { - r0, _, _ := syscall.SyscallN(procDwmSetWindowAttribute.Addr(), uintptr(hwnd), uintptr(attribute), uintptr(value), uintptr(size)) + r0, _, _ := syscall.Syscall6(procDwmSetWindowAttribute.Addr(), 4, uintptr(hwnd), uintptr(attribute), uintptr(value), uintptr(size), 0, 0) if r0 != 0 { ret = syscall.Errno(r0) } @@ -1621,20 +1615,15 @@ func DwmSetWindowAttribute(hwnd HWND, attribute uint32, value unsafe.Pointer, si } func CancelMibChangeNotify2(notificationHandle Handle) (errcode error) { - r0, _, _ := syscall.SyscallN(procCancelMibChangeNotify2.Addr(), uintptr(notificationHandle)) + r0, _, _ := syscall.Syscall(procCancelMibChangeNotify2.Addr(), 1, uintptr(notificationHandle), 0, 0) if r0 != 0 { errcode = syscall.Errno(r0) } return } -func FreeMibTable(memory unsafe.Pointer) { - syscall.SyscallN(procFreeMibTable.Addr(), uintptr(memory)) - return -} - func GetAdaptersAddresses(family uint32, flags uint32, reserved uintptr, adapterAddresses *IpAdapterAddresses, sizePointer *uint32) (errcode error) { - r0, _, _ := syscall.SyscallN(procGetAdaptersAddresses.Addr(), uintptr(family), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(adapterAddresses)), uintptr(unsafe.Pointer(sizePointer))) + r0, _, _ := syscall.Syscall6(procGetAdaptersAddresses.Addr(), 5, uintptr(family), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(adapterAddresses)), uintptr(unsafe.Pointer(sizePointer)), 0) if r0 != 0 { errcode = syscall.Errno(r0) } @@ -1642,7 +1631,7 @@ func GetAdaptersAddresses(family uint32, flags uint32, reserved uintptr, adapter } func GetAdaptersInfo(ai *IpAdapterInfo, ol *uint32) (errcode error) { - r0, _, _ := syscall.SyscallN(procGetAdaptersInfo.Addr(), uintptr(unsafe.Pointer(ai)), uintptr(unsafe.Pointer(ol))) + r0, _, _ := syscall.Syscall(procGetAdaptersInfo.Addr(), 2, uintptr(unsafe.Pointer(ai)), uintptr(unsafe.Pointer(ol)), 0) if r0 != 0 { errcode = syscall.Errno(r0) } @@ -1650,7 +1639,7 @@ func GetAdaptersInfo(ai *IpAdapterInfo, ol *uint32) (errcode error) { } func getBestInterfaceEx(sockaddr unsafe.Pointer, pdwBestIfIndex *uint32) (errcode error) { - r0, _, _ := syscall.SyscallN(procGetBestInterfaceEx.Addr(), uintptr(sockaddr), uintptr(unsafe.Pointer(pdwBestIfIndex))) + r0, _, _ := syscall.Syscall(procGetBestInterfaceEx.Addr(), 2, uintptr(sockaddr), uintptr(unsafe.Pointer(pdwBestIfIndex)), 0) if r0 != 0 { errcode = syscall.Errno(r0) } @@ -1658,7 +1647,7 @@ func getBestInterfaceEx(sockaddr unsafe.Pointer, pdwBestIfIndex *uint32) (errcod } func GetIfEntry(pIfRow *MibIfRow) (errcode error) { - r0, _, _ := syscall.SyscallN(procGetIfEntry.Addr(), uintptr(unsafe.Pointer(pIfRow))) + r0, _, _ := syscall.Syscall(procGetIfEntry.Addr(), 1, uintptr(unsafe.Pointer(pIfRow)), 0, 0) if r0 != 0 { errcode = syscall.Errno(r0) } @@ -1666,23 +1655,7 @@ func GetIfEntry(pIfRow *MibIfRow) (errcode error) { } func GetIfEntry2Ex(level uint32, row *MibIfRow2) (errcode error) { - r0, _, _ := syscall.SyscallN(procGetIfEntry2Ex.Addr(), uintptr(level), uintptr(unsafe.Pointer(row))) - if r0 != 0 { - errcode = syscall.Errno(r0) - } - return -} - -func GetIpForwardEntry2(row *MibIpForwardRow2) (errcode error) { - r0, _, _ := syscall.SyscallN(procGetIpForwardEntry2.Addr(), uintptr(unsafe.Pointer(row))) - if r0 != 0 { - errcode = syscall.Errno(r0) - } - return -} - -func GetIpForwardTable2(family uint16, table **MibIpForwardTable2) (errcode error) { - r0, _, _ := syscall.SyscallN(procGetIpForwardTable2.Addr(), uintptr(family), uintptr(unsafe.Pointer(table))) + r0, _, _ := syscall.Syscall(procGetIfEntry2Ex.Addr(), 2, uintptr(level), uintptr(unsafe.Pointer(row)), 0) if r0 != 0 { errcode = syscall.Errno(r0) } @@ -1690,7 +1663,7 @@ func GetIpForwardTable2(family uint16, table **MibIpForwardTable2) (errcode erro } func GetUnicastIpAddressEntry(row *MibUnicastIpAddressRow) (errcode error) { - r0, _, _ := syscall.SyscallN(procGetUnicastIpAddressEntry.Addr(), uintptr(unsafe.Pointer(row))) + r0, _, _ := syscall.Syscall(procGetUnicastIpAddressEntry.Addr(), 1, uintptr(unsafe.Pointer(row)), 0, 0) if r0 != 0 { errcode = syscall.Errno(r0) } @@ -1702,19 +1675,7 @@ func NotifyIpInterfaceChange(family uint16, callback uintptr, callerContext unsa if initialNotification { _p0 = 1 } - r0, _, _ := syscall.SyscallN(procNotifyIpInterfaceChange.Addr(), uintptr(family), uintptr(callback), uintptr(callerContext), uintptr(_p0), uintptr(unsafe.Pointer(notificationHandle))) - if r0 != 0 { - errcode = syscall.Errno(r0) - } - return -} - -func NotifyRouteChange2(family uint16, callback uintptr, callerContext unsafe.Pointer, initialNotification bool, notificationHandle *Handle) (errcode error) { - var _p0 uint32 - if initialNotification { - _p0 = 1 - } - r0, _, _ := syscall.SyscallN(procNotifyRouteChange2.Addr(), uintptr(family), uintptr(callback), uintptr(callerContext), uintptr(_p0), uintptr(unsafe.Pointer(notificationHandle))) + r0, _, _ := syscall.Syscall6(procNotifyIpInterfaceChange.Addr(), 5, uintptr(family), uintptr(callback), uintptr(callerContext), uintptr(_p0), uintptr(unsafe.Pointer(notificationHandle)), 0) if r0 != 0 { errcode = syscall.Errno(r0) } @@ -1726,7 +1687,7 @@ func NotifyUnicastIpAddressChange(family uint16, callback uintptr, callerContext if initialNotification { _p0 = 1 } - r0, _, _ := syscall.SyscallN(procNotifyUnicastIpAddressChange.Addr(), uintptr(family), uintptr(callback), uintptr(callerContext), uintptr(_p0), uintptr(unsafe.Pointer(notificationHandle))) + r0, _, _ := syscall.Syscall6(procNotifyUnicastIpAddressChange.Addr(), 5, uintptr(family), uintptr(callback), uintptr(callerContext), uintptr(_p0), uintptr(unsafe.Pointer(notificationHandle)), 0) if r0 != 0 { errcode = syscall.Errno(r0) } @@ -1734,7 +1695,7 @@ func NotifyUnicastIpAddressChange(family uint16, callback uintptr, callerContext } func AddDllDirectory(path *uint16) (cookie uintptr, err error) { - r0, _, e1 := syscall.SyscallN(procAddDllDirectory.Addr(), uintptr(unsafe.Pointer(path))) + r0, _, e1 := syscall.Syscall(procAddDllDirectory.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) cookie = uintptr(r0) if cookie == 0 { err = errnoErr(e1) @@ -1743,7 +1704,7 @@ func AddDllDirectory(path *uint16) (cookie uintptr, err error) { } func AssignProcessToJobObject(job Handle, process Handle) (err error) { - r1, _, e1 := syscall.SyscallN(procAssignProcessToJobObject.Addr(), uintptr(job), uintptr(process)) + r1, _, e1 := syscall.Syscall(procAssignProcessToJobObject.Addr(), 2, uintptr(job), uintptr(process), 0) if r1 == 0 { err = errnoErr(e1) } @@ -1751,7 +1712,7 @@ func AssignProcessToJobObject(job Handle, process Handle) (err error) { } func CancelIo(s Handle) (err error) { - r1, _, e1 := syscall.SyscallN(procCancelIo.Addr(), uintptr(s)) + r1, _, e1 := syscall.Syscall(procCancelIo.Addr(), 1, uintptr(s), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -1759,7 +1720,7 @@ func CancelIo(s Handle) (err error) { } func CancelIoEx(s Handle, o *Overlapped) (err error) { - r1, _, e1 := syscall.SyscallN(procCancelIoEx.Addr(), uintptr(s), uintptr(unsafe.Pointer(o))) + r1, _, e1 := syscall.Syscall(procCancelIoEx.Addr(), 2, uintptr(s), uintptr(unsafe.Pointer(o)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -1767,7 +1728,7 @@ func CancelIoEx(s Handle, o *Overlapped) (err error) { } func ClearCommBreak(handle Handle) (err error) { - r1, _, e1 := syscall.SyscallN(procClearCommBreak.Addr(), uintptr(handle)) + r1, _, e1 := syscall.Syscall(procClearCommBreak.Addr(), 1, uintptr(handle), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -1775,7 +1736,7 @@ func ClearCommBreak(handle Handle) (err error) { } func ClearCommError(handle Handle, lpErrors *uint32, lpStat *ComStat) (err error) { - r1, _, e1 := syscall.SyscallN(procClearCommError.Addr(), uintptr(handle), uintptr(unsafe.Pointer(lpErrors)), uintptr(unsafe.Pointer(lpStat))) + r1, _, e1 := syscall.Syscall(procClearCommError.Addr(), 3, uintptr(handle), uintptr(unsafe.Pointer(lpErrors)), uintptr(unsafe.Pointer(lpStat))) if r1 == 0 { err = errnoErr(e1) } @@ -1783,7 +1744,7 @@ func ClearCommError(handle Handle, lpErrors *uint32, lpStat *ComStat) (err error } func CloseHandle(handle Handle) (err error) { - r1, _, e1 := syscall.SyscallN(procCloseHandle.Addr(), uintptr(handle)) + r1, _, e1 := syscall.Syscall(procCloseHandle.Addr(), 1, uintptr(handle), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -1791,12 +1752,12 @@ func CloseHandle(handle Handle) (err error) { } func ClosePseudoConsole(console Handle) { - syscall.SyscallN(procClosePseudoConsole.Addr(), uintptr(console)) + syscall.Syscall(procClosePseudoConsole.Addr(), 1, uintptr(console), 0, 0) return } func ConnectNamedPipe(pipe Handle, overlapped *Overlapped) (err error) { - r1, _, e1 := syscall.SyscallN(procConnectNamedPipe.Addr(), uintptr(pipe), uintptr(unsafe.Pointer(overlapped))) + r1, _, e1 := syscall.Syscall(procConnectNamedPipe.Addr(), 2, uintptr(pipe), uintptr(unsafe.Pointer(overlapped)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -1804,7 +1765,7 @@ func ConnectNamedPipe(pipe Handle, overlapped *Overlapped) (err error) { } func CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) { - r1, _, e1 := syscall.SyscallN(procCreateDirectoryW.Addr(), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(sa))) + r1, _, e1 := syscall.Syscall(procCreateDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(sa)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -1812,7 +1773,7 @@ func CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) { } func CreateEventEx(eventAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) { - r0, _, e1 := syscall.SyscallN(procCreateEventExW.Addr(), uintptr(unsafe.Pointer(eventAttrs)), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(desiredAccess)) + r0, _, e1 := syscall.Syscall6(procCreateEventExW.Addr(), 4, uintptr(unsafe.Pointer(eventAttrs)), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(desiredAccess), 0, 0) handle = Handle(r0) if handle == 0 || e1 == ERROR_ALREADY_EXISTS { err = errnoErr(e1) @@ -1821,7 +1782,7 @@ func CreateEventEx(eventAttrs *SecurityAttributes, name *uint16, flags uint32, d } func CreateEvent(eventAttrs *SecurityAttributes, manualReset uint32, initialState uint32, name *uint16) (handle Handle, err error) { - r0, _, e1 := syscall.SyscallN(procCreateEventW.Addr(), uintptr(unsafe.Pointer(eventAttrs)), uintptr(manualReset), uintptr(initialState), uintptr(unsafe.Pointer(name))) + r0, _, e1 := syscall.Syscall6(procCreateEventW.Addr(), 4, uintptr(unsafe.Pointer(eventAttrs)), uintptr(manualReset), uintptr(initialState), uintptr(unsafe.Pointer(name)), 0, 0) handle = Handle(r0) if handle == 0 || e1 == ERROR_ALREADY_EXISTS { err = errnoErr(e1) @@ -1830,7 +1791,7 @@ func CreateEvent(eventAttrs *SecurityAttributes, manualReset uint32, initialStat } func CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxSizeHigh uint32, maxSizeLow uint32, name *uint16) (handle Handle, err error) { - r0, _, e1 := syscall.SyscallN(procCreateFileMappingW.Addr(), uintptr(fhandle), uintptr(unsafe.Pointer(sa)), uintptr(prot), uintptr(maxSizeHigh), uintptr(maxSizeLow), uintptr(unsafe.Pointer(name))) + r0, _, e1 := syscall.Syscall6(procCreateFileMappingW.Addr(), 6, uintptr(fhandle), uintptr(unsafe.Pointer(sa)), uintptr(prot), uintptr(maxSizeHigh), uintptr(maxSizeLow), uintptr(unsafe.Pointer(name))) handle = Handle(r0) if handle == 0 || e1 == ERROR_ALREADY_EXISTS { err = errnoErr(e1) @@ -1839,7 +1800,7 @@ func CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxS } func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile Handle) (handle Handle, err error) { - r0, _, e1 := syscall.SyscallN(procCreateFileW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(access), uintptr(mode), uintptr(unsafe.Pointer(sa)), uintptr(createmode), uintptr(attrs), uintptr(templatefile)) + r0, _, e1 := syscall.Syscall9(procCreateFileW.Addr(), 7, uintptr(unsafe.Pointer(name)), uintptr(access), uintptr(mode), uintptr(unsafe.Pointer(sa)), uintptr(createmode), uintptr(attrs), uintptr(templatefile), 0, 0) handle = Handle(r0) if handle == InvalidHandle { err = errnoErr(e1) @@ -1848,7 +1809,7 @@ func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes } func CreateHardLink(filename *uint16, existingfilename *uint16, reserved uintptr) (err error) { - r1, _, e1 := syscall.SyscallN(procCreateHardLinkW.Addr(), uintptr(unsafe.Pointer(filename)), uintptr(unsafe.Pointer(existingfilename)), uintptr(reserved)) + r1, _, e1 := syscall.Syscall(procCreateHardLinkW.Addr(), 3, uintptr(unsafe.Pointer(filename)), uintptr(unsafe.Pointer(existingfilename)), uintptr(reserved)) if r1&0xff == 0 { err = errnoErr(e1) } @@ -1856,7 +1817,7 @@ func CreateHardLink(filename *uint16, existingfilename *uint16, reserved uintptr } func CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uintptr, threadcnt uint32) (handle Handle, err error) { - r0, _, e1 := syscall.SyscallN(procCreateIoCompletionPort.Addr(), uintptr(filehandle), uintptr(cphandle), uintptr(key), uintptr(threadcnt)) + r0, _, e1 := syscall.Syscall6(procCreateIoCompletionPort.Addr(), 4, uintptr(filehandle), uintptr(cphandle), uintptr(key), uintptr(threadcnt), 0, 0) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -1865,7 +1826,7 @@ func CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uintptr, thr } func CreateJobObject(jobAttr *SecurityAttributes, name *uint16) (handle Handle, err error) { - r0, _, e1 := syscall.SyscallN(procCreateJobObjectW.Addr(), uintptr(unsafe.Pointer(jobAttr)), uintptr(unsafe.Pointer(name))) + r0, _, e1 := syscall.Syscall(procCreateJobObjectW.Addr(), 2, uintptr(unsafe.Pointer(jobAttr)), uintptr(unsafe.Pointer(name)), 0) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -1874,7 +1835,7 @@ func CreateJobObject(jobAttr *SecurityAttributes, name *uint16) (handle Handle, } func CreateMutexEx(mutexAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) { - r0, _, e1 := syscall.SyscallN(procCreateMutexExW.Addr(), uintptr(unsafe.Pointer(mutexAttrs)), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(desiredAccess)) + r0, _, e1 := syscall.Syscall6(procCreateMutexExW.Addr(), 4, uintptr(unsafe.Pointer(mutexAttrs)), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(desiredAccess), 0, 0) handle = Handle(r0) if handle == 0 || e1 == ERROR_ALREADY_EXISTS { err = errnoErr(e1) @@ -1887,7 +1848,7 @@ func CreateMutex(mutexAttrs *SecurityAttributes, initialOwner bool, name *uint16 if initialOwner { _p0 = 1 } - r0, _, e1 := syscall.SyscallN(procCreateMutexW.Addr(), uintptr(unsafe.Pointer(mutexAttrs)), uintptr(_p0), uintptr(unsafe.Pointer(name))) + r0, _, e1 := syscall.Syscall(procCreateMutexW.Addr(), 3, uintptr(unsafe.Pointer(mutexAttrs)), uintptr(_p0), uintptr(unsafe.Pointer(name))) handle = Handle(r0) if handle == 0 || e1 == ERROR_ALREADY_EXISTS { err = errnoErr(e1) @@ -1896,7 +1857,7 @@ func CreateMutex(mutexAttrs *SecurityAttributes, initialOwner bool, name *uint16 } func CreateNamedPipe(name *uint16, flags uint32, pipeMode uint32, maxInstances uint32, outSize uint32, inSize uint32, defaultTimeout uint32, sa *SecurityAttributes) (handle Handle, err error) { - r0, _, e1 := syscall.SyscallN(procCreateNamedPipeW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(pipeMode), uintptr(maxInstances), uintptr(outSize), uintptr(inSize), uintptr(defaultTimeout), uintptr(unsafe.Pointer(sa))) + r0, _, e1 := syscall.Syscall9(procCreateNamedPipeW.Addr(), 8, uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(pipeMode), uintptr(maxInstances), uintptr(outSize), uintptr(inSize), uintptr(defaultTimeout), uintptr(unsafe.Pointer(sa)), 0) handle = Handle(r0) if handle == InvalidHandle { err = errnoErr(e1) @@ -1905,7 +1866,7 @@ func CreateNamedPipe(name *uint16, flags uint32, pipeMode uint32, maxInstances u } func CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes, size uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procCreatePipe.Addr(), uintptr(unsafe.Pointer(readhandle)), uintptr(unsafe.Pointer(writehandle)), uintptr(unsafe.Pointer(sa)), uintptr(size)) + r1, _, e1 := syscall.Syscall6(procCreatePipe.Addr(), 4, uintptr(unsafe.Pointer(readhandle)), uintptr(unsafe.Pointer(writehandle)), uintptr(unsafe.Pointer(sa)), uintptr(size), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -1917,7 +1878,7 @@ func CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityA if inheritHandles { _p0 = 1 } - r1, _, e1 := syscall.SyscallN(procCreateProcessW.Addr(), uintptr(unsafe.Pointer(appName)), uintptr(unsafe.Pointer(commandLine)), uintptr(unsafe.Pointer(procSecurity)), uintptr(unsafe.Pointer(threadSecurity)), uintptr(_p0), uintptr(creationFlags), uintptr(unsafe.Pointer(env)), uintptr(unsafe.Pointer(currentDir)), uintptr(unsafe.Pointer(startupInfo)), uintptr(unsafe.Pointer(outProcInfo))) + r1, _, e1 := syscall.Syscall12(procCreateProcessW.Addr(), 10, uintptr(unsafe.Pointer(appName)), uintptr(unsafe.Pointer(commandLine)), uintptr(unsafe.Pointer(procSecurity)), uintptr(unsafe.Pointer(threadSecurity)), uintptr(_p0), uintptr(creationFlags), uintptr(unsafe.Pointer(env)), uintptr(unsafe.Pointer(currentDir)), uintptr(unsafe.Pointer(startupInfo)), uintptr(unsafe.Pointer(outProcInfo)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -1925,7 +1886,7 @@ func CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityA } func createPseudoConsole(size uint32, in Handle, out Handle, flags uint32, pconsole *Handle) (hr error) { - r0, _, _ := syscall.SyscallN(procCreatePseudoConsole.Addr(), uintptr(size), uintptr(in), uintptr(out), uintptr(flags), uintptr(unsafe.Pointer(pconsole))) + r0, _, _ := syscall.Syscall6(procCreatePseudoConsole.Addr(), 5, uintptr(size), uintptr(in), uintptr(out), uintptr(flags), uintptr(unsafe.Pointer(pconsole)), 0) if r0 != 0 { hr = syscall.Errno(r0) } @@ -1933,7 +1894,7 @@ func createPseudoConsole(size uint32, in Handle, out Handle, flags uint32, pcons } func CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procCreateSymbolicLinkW.Addr(), uintptr(unsafe.Pointer(symlinkfilename)), uintptr(unsafe.Pointer(targetfilename)), uintptr(flags)) + r1, _, e1 := syscall.Syscall(procCreateSymbolicLinkW.Addr(), 3, uintptr(unsafe.Pointer(symlinkfilename)), uintptr(unsafe.Pointer(targetfilename)), uintptr(flags)) if r1&0xff == 0 { err = errnoErr(e1) } @@ -1941,7 +1902,7 @@ func CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags u } func CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, err error) { - r0, _, e1 := syscall.SyscallN(procCreateToolhelp32Snapshot.Addr(), uintptr(flags), uintptr(processId)) + r0, _, e1 := syscall.Syscall(procCreateToolhelp32Snapshot.Addr(), 2, uintptr(flags), uintptr(processId), 0) handle = Handle(r0) if handle == InvalidHandle { err = errnoErr(e1) @@ -1950,7 +1911,7 @@ func CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, er } func DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) { - r1, _, e1 := syscall.SyscallN(procDefineDosDeviceW.Addr(), uintptr(flags), uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath))) + r1, _, e1 := syscall.Syscall(procDefineDosDeviceW.Addr(), 3, uintptr(flags), uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath))) if r1 == 0 { err = errnoErr(e1) } @@ -1958,7 +1919,7 @@ func DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err } func DeleteFile(path *uint16) (err error) { - r1, _, e1 := syscall.SyscallN(procDeleteFileW.Addr(), uintptr(unsafe.Pointer(path))) + r1, _, e1 := syscall.Syscall(procDeleteFileW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -1966,12 +1927,12 @@ func DeleteFile(path *uint16) (err error) { } func deleteProcThreadAttributeList(attrlist *ProcThreadAttributeList) { - syscall.SyscallN(procDeleteProcThreadAttributeList.Addr(), uintptr(unsafe.Pointer(attrlist))) + syscall.Syscall(procDeleteProcThreadAttributeList.Addr(), 1, uintptr(unsafe.Pointer(attrlist)), 0, 0) return } func DeleteVolumeMountPoint(volumeMountPoint *uint16) (err error) { - r1, _, e1 := syscall.SyscallN(procDeleteVolumeMountPointW.Addr(), uintptr(unsafe.Pointer(volumeMountPoint))) + r1, _, e1 := syscall.Syscall(procDeleteVolumeMountPointW.Addr(), 1, uintptr(unsafe.Pointer(volumeMountPoint)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -1979,7 +1940,7 @@ func DeleteVolumeMountPoint(volumeMountPoint *uint16) (err error) { } func DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBufferSize uint32, outBuffer *byte, outBufferSize uint32, bytesReturned *uint32, overlapped *Overlapped) (err error) { - r1, _, e1 := syscall.SyscallN(procDeviceIoControl.Addr(), uintptr(handle), uintptr(ioControlCode), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferSize), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferSize), uintptr(unsafe.Pointer(bytesReturned)), uintptr(unsafe.Pointer(overlapped))) + r1, _, e1 := syscall.Syscall9(procDeviceIoControl.Addr(), 8, uintptr(handle), uintptr(ioControlCode), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferSize), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferSize), uintptr(unsafe.Pointer(bytesReturned)), uintptr(unsafe.Pointer(overlapped)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -1987,7 +1948,7 @@ func DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBuff } func DisconnectNamedPipe(pipe Handle) (err error) { - r1, _, e1 := syscall.SyscallN(procDisconnectNamedPipe.Addr(), uintptr(pipe)) + r1, _, e1 := syscall.Syscall(procDisconnectNamedPipe.Addr(), 1, uintptr(pipe), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -1999,7 +1960,7 @@ func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetP if bInheritHandle { _p0 = 1 } - r1, _, e1 := syscall.SyscallN(procDuplicateHandle.Addr(), uintptr(hSourceProcessHandle), uintptr(hSourceHandle), uintptr(hTargetProcessHandle), uintptr(unsafe.Pointer(lpTargetHandle)), uintptr(dwDesiredAccess), uintptr(_p0), uintptr(dwOptions)) + r1, _, e1 := syscall.Syscall9(procDuplicateHandle.Addr(), 7, uintptr(hSourceProcessHandle), uintptr(hSourceHandle), uintptr(hTargetProcessHandle), uintptr(unsafe.Pointer(lpTargetHandle)), uintptr(dwDesiredAccess), uintptr(_p0), uintptr(dwOptions), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -2007,7 +1968,7 @@ func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetP } func EscapeCommFunction(handle Handle, dwFunc uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procEscapeCommFunction.Addr(), uintptr(handle), uintptr(dwFunc)) + r1, _, e1 := syscall.Syscall(procEscapeCommFunction.Addr(), 2, uintptr(handle), uintptr(dwFunc), 0) if r1 == 0 { err = errnoErr(e1) } @@ -2015,12 +1976,12 @@ func EscapeCommFunction(handle Handle, dwFunc uint32) (err error) { } func ExitProcess(exitcode uint32) { - syscall.SyscallN(procExitProcess.Addr(), uintptr(exitcode)) + syscall.Syscall(procExitProcess.Addr(), 1, uintptr(exitcode), 0, 0) return } func ExpandEnvironmentStrings(src *uint16, dst *uint16, size uint32) (n uint32, err error) { - r0, _, e1 := syscall.SyscallN(procExpandEnvironmentStringsW.Addr(), uintptr(unsafe.Pointer(src)), uintptr(unsafe.Pointer(dst)), uintptr(size)) + r0, _, e1 := syscall.Syscall(procExpandEnvironmentStringsW.Addr(), 3, uintptr(unsafe.Pointer(src)), uintptr(unsafe.Pointer(dst)), uintptr(size)) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -2029,7 +1990,7 @@ func ExpandEnvironmentStrings(src *uint16, dst *uint16, size uint32) (n uint32, } func FindClose(handle Handle) (err error) { - r1, _, e1 := syscall.SyscallN(procFindClose.Addr(), uintptr(handle)) + r1, _, e1 := syscall.Syscall(procFindClose.Addr(), 1, uintptr(handle), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -2037,7 +1998,7 @@ func FindClose(handle Handle) (err error) { } func FindCloseChangeNotification(handle Handle) (err error) { - r1, _, e1 := syscall.SyscallN(procFindCloseChangeNotification.Addr(), uintptr(handle)) + r1, _, e1 := syscall.Syscall(procFindCloseChangeNotification.Addr(), 1, uintptr(handle), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -2058,7 +2019,7 @@ func _FindFirstChangeNotification(path *uint16, watchSubtree bool, notifyFilter if watchSubtree { _p1 = 1 } - r0, _, e1 := syscall.SyscallN(procFindFirstChangeNotificationW.Addr(), uintptr(unsafe.Pointer(path)), uintptr(_p1), uintptr(notifyFilter)) + r0, _, e1 := syscall.Syscall(procFindFirstChangeNotificationW.Addr(), 3, uintptr(unsafe.Pointer(path)), uintptr(_p1), uintptr(notifyFilter)) handle = Handle(r0) if handle == InvalidHandle { err = errnoErr(e1) @@ -2067,7 +2028,7 @@ func _FindFirstChangeNotification(path *uint16, watchSubtree bool, notifyFilter } func findFirstFile1(name *uint16, data *win32finddata1) (handle Handle, err error) { - r0, _, e1 := syscall.SyscallN(procFindFirstFileW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(data))) + r0, _, e1 := syscall.Syscall(procFindFirstFileW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(data)), 0) handle = Handle(r0) if handle == InvalidHandle { err = errnoErr(e1) @@ -2076,7 +2037,7 @@ func findFirstFile1(name *uint16, data *win32finddata1) (handle Handle, err erro } func FindFirstVolumeMountPoint(rootPathName *uint16, volumeMountPoint *uint16, bufferLength uint32) (handle Handle, err error) { - r0, _, e1 := syscall.SyscallN(procFindFirstVolumeMountPointW.Addr(), uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(bufferLength)) + r0, _, e1 := syscall.Syscall(procFindFirstVolumeMountPointW.Addr(), 3, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(bufferLength)) handle = Handle(r0) if handle == InvalidHandle { err = errnoErr(e1) @@ -2085,7 +2046,7 @@ func FindFirstVolumeMountPoint(rootPathName *uint16, volumeMountPoint *uint16, b } func FindFirstVolume(volumeName *uint16, bufferLength uint32) (handle Handle, err error) { - r0, _, e1 := syscall.SyscallN(procFindFirstVolumeW.Addr(), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferLength)) + r0, _, e1 := syscall.Syscall(procFindFirstVolumeW.Addr(), 2, uintptr(unsafe.Pointer(volumeName)), uintptr(bufferLength), 0) handle = Handle(r0) if handle == InvalidHandle { err = errnoErr(e1) @@ -2094,7 +2055,7 @@ func FindFirstVolume(volumeName *uint16, bufferLength uint32) (handle Handle, er } func FindNextChangeNotification(handle Handle) (err error) { - r1, _, e1 := syscall.SyscallN(procFindNextChangeNotification.Addr(), uintptr(handle)) + r1, _, e1 := syscall.Syscall(procFindNextChangeNotification.Addr(), 1, uintptr(handle), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -2102,7 +2063,7 @@ func FindNextChangeNotification(handle Handle) (err error) { } func findNextFile1(handle Handle, data *win32finddata1) (err error) { - r1, _, e1 := syscall.SyscallN(procFindNextFileW.Addr(), uintptr(handle), uintptr(unsafe.Pointer(data))) + r1, _, e1 := syscall.Syscall(procFindNextFileW.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -2110,7 +2071,7 @@ func findNextFile1(handle Handle, data *win32finddata1) (err error) { } func FindNextVolumeMountPoint(findVolumeMountPoint Handle, volumeMountPoint *uint16, bufferLength uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procFindNextVolumeMountPointW.Addr(), uintptr(findVolumeMountPoint), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(bufferLength)) + r1, _, e1 := syscall.Syscall(procFindNextVolumeMountPointW.Addr(), 3, uintptr(findVolumeMountPoint), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(bufferLength)) if r1 == 0 { err = errnoErr(e1) } @@ -2118,7 +2079,7 @@ func FindNextVolumeMountPoint(findVolumeMountPoint Handle, volumeMountPoint *uin } func FindNextVolume(findVolume Handle, volumeName *uint16, bufferLength uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procFindNextVolumeW.Addr(), uintptr(findVolume), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferLength)) + r1, _, e1 := syscall.Syscall(procFindNextVolumeW.Addr(), 3, uintptr(findVolume), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferLength)) if r1 == 0 { err = errnoErr(e1) } @@ -2126,7 +2087,7 @@ func FindNextVolume(findVolume Handle, volumeName *uint16, bufferLength uint32) } func findResource(module Handle, name uintptr, resType uintptr) (resInfo Handle, err error) { - r0, _, e1 := syscall.SyscallN(procFindResourceW.Addr(), uintptr(module), uintptr(name), uintptr(resType)) + r0, _, e1 := syscall.Syscall(procFindResourceW.Addr(), 3, uintptr(module), uintptr(name), uintptr(resType)) resInfo = Handle(r0) if resInfo == 0 { err = errnoErr(e1) @@ -2135,7 +2096,7 @@ func findResource(module Handle, name uintptr, resType uintptr) (resInfo Handle, } func FindVolumeClose(findVolume Handle) (err error) { - r1, _, e1 := syscall.SyscallN(procFindVolumeClose.Addr(), uintptr(findVolume)) + r1, _, e1 := syscall.Syscall(procFindVolumeClose.Addr(), 1, uintptr(findVolume), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -2143,15 +2104,7 @@ func FindVolumeClose(findVolume Handle) (err error) { } func FindVolumeMountPointClose(findVolumeMountPoint Handle) (err error) { - r1, _, e1 := syscall.SyscallN(procFindVolumeMountPointClose.Addr(), uintptr(findVolumeMountPoint)) - if r1 == 0 { - err = errnoErr(e1) - } - return -} - -func FlushConsoleInputBuffer(console Handle) (err error) { - r1, _, e1 := syscall.SyscallN(procFlushConsoleInputBuffer.Addr(), uintptr(console)) + r1, _, e1 := syscall.Syscall(procFindVolumeMountPointClose.Addr(), 1, uintptr(findVolumeMountPoint), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -2159,7 +2112,7 @@ func FlushConsoleInputBuffer(console Handle) (err error) { } func FlushFileBuffers(handle Handle) (err error) { - r1, _, e1 := syscall.SyscallN(procFlushFileBuffers.Addr(), uintptr(handle)) + r1, _, e1 := syscall.Syscall(procFlushFileBuffers.Addr(), 1, uintptr(handle), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -2167,7 +2120,7 @@ func FlushFileBuffers(handle Handle) (err error) { } func FlushViewOfFile(addr uintptr, length uintptr) (err error) { - r1, _, e1 := syscall.SyscallN(procFlushViewOfFile.Addr(), uintptr(addr), uintptr(length)) + r1, _, e1 := syscall.Syscall(procFlushViewOfFile.Addr(), 2, uintptr(addr), uintptr(length), 0) if r1 == 0 { err = errnoErr(e1) } @@ -2179,7 +2132,7 @@ func FormatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, bu if len(buf) > 0 { _p0 = &buf[0] } - r0, _, e1 := syscall.SyscallN(procFormatMessageW.Addr(), uintptr(flags), uintptr(msgsrc), uintptr(msgid), uintptr(langid), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(args))) + r0, _, e1 := syscall.Syscall9(procFormatMessageW.Addr(), 7, uintptr(flags), uintptr(msgsrc), uintptr(msgid), uintptr(langid), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(args)), 0, 0) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -2188,7 +2141,7 @@ func FormatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, bu } func FreeEnvironmentStrings(envs *uint16) (err error) { - r1, _, e1 := syscall.SyscallN(procFreeEnvironmentStringsW.Addr(), uintptr(unsafe.Pointer(envs))) + r1, _, e1 := syscall.Syscall(procFreeEnvironmentStringsW.Addr(), 1, uintptr(unsafe.Pointer(envs)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -2196,7 +2149,7 @@ func FreeEnvironmentStrings(envs *uint16) (err error) { } func FreeLibrary(handle Handle) (err error) { - r1, _, e1 := syscall.SyscallN(procFreeLibrary.Addr(), uintptr(handle)) + r1, _, e1 := syscall.Syscall(procFreeLibrary.Addr(), 1, uintptr(handle), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -2204,7 +2157,7 @@ func FreeLibrary(handle Handle) (err error) { } func GenerateConsoleCtrlEvent(ctrlEvent uint32, processGroupID uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procGenerateConsoleCtrlEvent.Addr(), uintptr(ctrlEvent), uintptr(processGroupID)) + r1, _, e1 := syscall.Syscall(procGenerateConsoleCtrlEvent.Addr(), 2, uintptr(ctrlEvent), uintptr(processGroupID), 0) if r1 == 0 { err = errnoErr(e1) } @@ -2212,19 +2165,19 @@ func GenerateConsoleCtrlEvent(ctrlEvent uint32, processGroupID uint32) (err erro } func GetACP() (acp uint32) { - r0, _, _ := syscall.SyscallN(procGetACP.Addr()) + r0, _, _ := syscall.Syscall(procGetACP.Addr(), 0, 0, 0, 0) acp = uint32(r0) return } func GetActiveProcessorCount(groupNumber uint16) (ret uint32) { - r0, _, _ := syscall.SyscallN(procGetActiveProcessorCount.Addr(), uintptr(groupNumber)) + r0, _, _ := syscall.Syscall(procGetActiveProcessorCount.Addr(), 1, uintptr(groupNumber), 0, 0) ret = uint32(r0) return } func GetCommModemStatus(handle Handle, lpModemStat *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procGetCommModemStatus.Addr(), uintptr(handle), uintptr(unsafe.Pointer(lpModemStat))) + r1, _, e1 := syscall.Syscall(procGetCommModemStatus.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(lpModemStat)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -2232,7 +2185,7 @@ func GetCommModemStatus(handle Handle, lpModemStat *uint32) (err error) { } func GetCommState(handle Handle, lpDCB *DCB) (err error) { - r1, _, e1 := syscall.SyscallN(procGetCommState.Addr(), uintptr(handle), uintptr(unsafe.Pointer(lpDCB))) + r1, _, e1 := syscall.Syscall(procGetCommState.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(lpDCB)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -2240,7 +2193,7 @@ func GetCommState(handle Handle, lpDCB *DCB) (err error) { } func GetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) { - r1, _, e1 := syscall.SyscallN(procGetCommTimeouts.Addr(), uintptr(handle), uintptr(unsafe.Pointer(timeouts))) + r1, _, e1 := syscall.Syscall(procGetCommTimeouts.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(timeouts)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -2248,13 +2201,13 @@ func GetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) { } func GetCommandLine() (cmd *uint16) { - r0, _, _ := syscall.SyscallN(procGetCommandLineW.Addr()) + r0, _, _ := syscall.Syscall(procGetCommandLineW.Addr(), 0, 0, 0, 0) cmd = (*uint16)(unsafe.Pointer(r0)) return } func GetComputerNameEx(nametype uint32, buf *uint16, n *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procGetComputerNameExW.Addr(), uintptr(nametype), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n))) + r1, _, e1 := syscall.Syscall(procGetComputerNameExW.Addr(), 3, uintptr(nametype), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n))) if r1 == 0 { err = errnoErr(e1) } @@ -2262,7 +2215,7 @@ func GetComputerNameEx(nametype uint32, buf *uint16, n *uint32) (err error) { } func GetComputerName(buf *uint16, n *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procGetComputerNameW.Addr(), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n))) + r1, _, e1 := syscall.Syscall(procGetComputerNameW.Addr(), 2, uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -2270,7 +2223,7 @@ func GetComputerName(buf *uint16, n *uint32) (err error) { } func GetConsoleCP() (cp uint32, err error) { - r0, _, e1 := syscall.SyscallN(procGetConsoleCP.Addr()) + r0, _, e1 := syscall.Syscall(procGetConsoleCP.Addr(), 0, 0, 0, 0) cp = uint32(r0) if cp == 0 { err = errnoErr(e1) @@ -2279,7 +2232,7 @@ func GetConsoleCP() (cp uint32, err error) { } func GetConsoleMode(console Handle, mode *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procGetConsoleMode.Addr(), uintptr(console), uintptr(unsafe.Pointer(mode))) + r1, _, e1 := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(mode)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -2287,7 +2240,7 @@ func GetConsoleMode(console Handle, mode *uint32) (err error) { } func GetConsoleOutputCP() (cp uint32, err error) { - r0, _, e1 := syscall.SyscallN(procGetConsoleOutputCP.Addr()) + r0, _, e1 := syscall.Syscall(procGetConsoleOutputCP.Addr(), 0, 0, 0, 0) cp = uint32(r0) if cp == 0 { err = errnoErr(e1) @@ -2296,7 +2249,7 @@ func GetConsoleOutputCP() (cp uint32, err error) { } func GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) { - r1, _, e1 := syscall.SyscallN(procGetConsoleScreenBufferInfo.Addr(), uintptr(console), uintptr(unsafe.Pointer(info))) + r1, _, e1 := syscall.Syscall(procGetConsoleScreenBufferInfo.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(info)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -2304,7 +2257,7 @@ func GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) ( } func GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) { - r0, _, e1 := syscall.SyscallN(procGetCurrentDirectoryW.Addr(), uintptr(buflen), uintptr(unsafe.Pointer(buf))) + r0, _, e1 := syscall.Syscall(procGetCurrentDirectoryW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -2313,19 +2266,19 @@ func GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) { } func GetCurrentProcessId() (pid uint32) { - r0, _, _ := syscall.SyscallN(procGetCurrentProcessId.Addr()) + r0, _, _ := syscall.Syscall(procGetCurrentProcessId.Addr(), 0, 0, 0, 0) pid = uint32(r0) return } func GetCurrentThreadId() (id uint32) { - r0, _, _ := syscall.SyscallN(procGetCurrentThreadId.Addr()) + r0, _, _ := syscall.Syscall(procGetCurrentThreadId.Addr(), 0, 0, 0, 0) id = uint32(r0) return } func GetDiskFreeSpaceEx(directoryName *uint16, freeBytesAvailableToCaller *uint64, totalNumberOfBytes *uint64, totalNumberOfFreeBytes *uint64) (err error) { - r1, _, e1 := syscall.SyscallN(procGetDiskFreeSpaceExW.Addr(), uintptr(unsafe.Pointer(directoryName)), uintptr(unsafe.Pointer(freeBytesAvailableToCaller)), uintptr(unsafe.Pointer(totalNumberOfBytes)), uintptr(unsafe.Pointer(totalNumberOfFreeBytes))) + r1, _, e1 := syscall.Syscall6(procGetDiskFreeSpaceExW.Addr(), 4, uintptr(unsafe.Pointer(directoryName)), uintptr(unsafe.Pointer(freeBytesAvailableToCaller)), uintptr(unsafe.Pointer(totalNumberOfBytes)), uintptr(unsafe.Pointer(totalNumberOfFreeBytes)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -2333,13 +2286,13 @@ func GetDiskFreeSpaceEx(directoryName *uint16, freeBytesAvailableToCaller *uint6 } func GetDriveType(rootPathName *uint16) (driveType uint32) { - r0, _, _ := syscall.SyscallN(procGetDriveTypeW.Addr(), uintptr(unsafe.Pointer(rootPathName))) + r0, _, _ := syscall.Syscall(procGetDriveTypeW.Addr(), 1, uintptr(unsafe.Pointer(rootPathName)), 0, 0) driveType = uint32(r0) return } func GetEnvironmentStrings() (envs *uint16, err error) { - r0, _, e1 := syscall.SyscallN(procGetEnvironmentStringsW.Addr()) + r0, _, e1 := syscall.Syscall(procGetEnvironmentStringsW.Addr(), 0, 0, 0, 0) envs = (*uint16)(unsafe.Pointer(r0)) if envs == nil { err = errnoErr(e1) @@ -2348,7 +2301,7 @@ func GetEnvironmentStrings() (envs *uint16, err error) { } func GetEnvironmentVariable(name *uint16, buffer *uint16, size uint32) (n uint32, err error) { - r0, _, e1 := syscall.SyscallN(procGetEnvironmentVariableW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(buffer)), uintptr(size)) + r0, _, e1 := syscall.Syscall(procGetEnvironmentVariableW.Addr(), 3, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(buffer)), uintptr(size)) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -2357,7 +2310,7 @@ func GetEnvironmentVariable(name *uint16, buffer *uint16, size uint32) (n uint32 } func GetExitCodeProcess(handle Handle, exitcode *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procGetExitCodeProcess.Addr(), uintptr(handle), uintptr(unsafe.Pointer(exitcode))) + r1, _, e1 := syscall.Syscall(procGetExitCodeProcess.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(exitcode)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -2365,7 +2318,7 @@ func GetExitCodeProcess(handle Handle, exitcode *uint32) (err error) { } func GetFileAttributesEx(name *uint16, level uint32, info *byte) (err error) { - r1, _, e1 := syscall.SyscallN(procGetFileAttributesExW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(level), uintptr(unsafe.Pointer(info))) + r1, _, e1 := syscall.Syscall(procGetFileAttributesExW.Addr(), 3, uintptr(unsafe.Pointer(name)), uintptr(level), uintptr(unsafe.Pointer(info))) if r1 == 0 { err = errnoErr(e1) } @@ -2373,7 +2326,7 @@ func GetFileAttributesEx(name *uint16, level uint32, info *byte) (err error) { } func GetFileAttributes(name *uint16) (attrs uint32, err error) { - r0, _, e1 := syscall.SyscallN(procGetFileAttributesW.Addr(), uintptr(unsafe.Pointer(name))) + r0, _, e1 := syscall.Syscall(procGetFileAttributesW.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0) attrs = uint32(r0) if attrs == INVALID_FILE_ATTRIBUTES { err = errnoErr(e1) @@ -2382,7 +2335,7 @@ func GetFileAttributes(name *uint16) (attrs uint32, err error) { } func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (err error) { - r1, _, e1 := syscall.SyscallN(procGetFileInformationByHandle.Addr(), uintptr(handle), uintptr(unsafe.Pointer(data))) + r1, _, e1 := syscall.Syscall(procGetFileInformationByHandle.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -2390,7 +2343,7 @@ func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (e } func GetFileInformationByHandleEx(handle Handle, class uint32, outBuffer *byte, outBufferLen uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procGetFileInformationByHandleEx.Addr(), uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferLen)) + r1, _, e1 := syscall.Syscall6(procGetFileInformationByHandleEx.Addr(), 4, uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferLen), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -2398,7 +2351,7 @@ func GetFileInformationByHandleEx(handle Handle, class uint32, outBuffer *byte, } func GetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) { - r1, _, e1 := syscall.SyscallN(procGetFileTime.Addr(), uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime))) + r1, _, e1 := syscall.Syscall6(procGetFileTime.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -2406,7 +2359,7 @@ func GetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetim } func GetFileType(filehandle Handle) (n uint32, err error) { - r0, _, e1 := syscall.SyscallN(procGetFileType.Addr(), uintptr(filehandle)) + r0, _, e1 := syscall.Syscall(procGetFileType.Addr(), 1, uintptr(filehandle), 0, 0) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -2415,7 +2368,7 @@ func GetFileType(filehandle Handle) (n uint32, err error) { } func GetFinalPathNameByHandle(file Handle, filePath *uint16, filePathSize uint32, flags uint32) (n uint32, err error) { - r0, _, e1 := syscall.SyscallN(procGetFinalPathNameByHandleW.Addr(), uintptr(file), uintptr(unsafe.Pointer(filePath)), uintptr(filePathSize), uintptr(flags)) + r0, _, e1 := syscall.Syscall6(procGetFinalPathNameByHandleW.Addr(), 4, uintptr(file), uintptr(unsafe.Pointer(filePath)), uintptr(filePathSize), uintptr(flags), 0, 0) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -2424,7 +2377,7 @@ func GetFinalPathNameByHandle(file Handle, filePath *uint16, filePathSize uint32 } func GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) (n uint32, err error) { - r0, _, e1 := syscall.SyscallN(procGetFullPathNameW.Addr(), uintptr(unsafe.Pointer(path)), uintptr(buflen), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(fname))) + r0, _, e1 := syscall.Syscall6(procGetFullPathNameW.Addr(), 4, uintptr(unsafe.Pointer(path)), uintptr(buflen), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(fname)), 0, 0) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -2433,13 +2386,13 @@ func GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) ( } func GetLargePageMinimum() (size uintptr) { - r0, _, _ := syscall.SyscallN(procGetLargePageMinimum.Addr()) + r0, _, _ := syscall.Syscall(procGetLargePageMinimum.Addr(), 0, 0, 0, 0) size = uintptr(r0) return } func GetLastError() (lasterr error) { - r0, _, _ := syscall.SyscallN(procGetLastError.Addr()) + r0, _, _ := syscall.Syscall(procGetLastError.Addr(), 0, 0, 0, 0) if r0 != 0 { lasterr = syscall.Errno(r0) } @@ -2447,7 +2400,7 @@ func GetLastError() (lasterr error) { } func GetLogicalDriveStrings(bufferLength uint32, buffer *uint16) (n uint32, err error) { - r0, _, e1 := syscall.SyscallN(procGetLogicalDriveStringsW.Addr(), uintptr(bufferLength), uintptr(unsafe.Pointer(buffer))) + r0, _, e1 := syscall.Syscall(procGetLogicalDriveStringsW.Addr(), 2, uintptr(bufferLength), uintptr(unsafe.Pointer(buffer)), 0) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -2456,7 +2409,7 @@ func GetLogicalDriveStrings(bufferLength uint32, buffer *uint16) (n uint32, err } func GetLogicalDrives() (drivesBitMask uint32, err error) { - r0, _, e1 := syscall.SyscallN(procGetLogicalDrives.Addr()) + r0, _, e1 := syscall.Syscall(procGetLogicalDrives.Addr(), 0, 0, 0, 0) drivesBitMask = uint32(r0) if drivesBitMask == 0 { err = errnoErr(e1) @@ -2465,7 +2418,7 @@ func GetLogicalDrives() (drivesBitMask uint32, err error) { } func GetLongPathName(path *uint16, buf *uint16, buflen uint32) (n uint32, err error) { - r0, _, e1 := syscall.SyscallN(procGetLongPathNameW.Addr(), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(buf)), uintptr(buflen)) + r0, _, e1 := syscall.Syscall(procGetLongPathNameW.Addr(), 3, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(buf)), uintptr(buflen)) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -2474,13 +2427,13 @@ func GetLongPathName(path *uint16, buf *uint16, buflen uint32) (n uint32, err er } func GetMaximumProcessorCount(groupNumber uint16) (ret uint32) { - r0, _, _ := syscall.SyscallN(procGetMaximumProcessorCount.Addr(), uintptr(groupNumber)) + r0, _, _ := syscall.Syscall(procGetMaximumProcessorCount.Addr(), 1, uintptr(groupNumber), 0, 0) ret = uint32(r0) return } func GetModuleFileName(module Handle, filename *uint16, size uint32) (n uint32, err error) { - r0, _, e1 := syscall.SyscallN(procGetModuleFileNameW.Addr(), uintptr(module), uintptr(unsafe.Pointer(filename)), uintptr(size)) + r0, _, e1 := syscall.Syscall(procGetModuleFileNameW.Addr(), 3, uintptr(module), uintptr(unsafe.Pointer(filename)), uintptr(size)) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -2489,7 +2442,7 @@ func GetModuleFileName(module Handle, filename *uint16, size uint32) (n uint32, } func GetModuleHandleEx(flags uint32, moduleName *uint16, module *Handle) (err error) { - r1, _, e1 := syscall.SyscallN(procGetModuleHandleExW.Addr(), uintptr(flags), uintptr(unsafe.Pointer(moduleName)), uintptr(unsafe.Pointer(module))) + r1, _, e1 := syscall.Syscall(procGetModuleHandleExW.Addr(), 3, uintptr(flags), uintptr(unsafe.Pointer(moduleName)), uintptr(unsafe.Pointer(module))) if r1 == 0 { err = errnoErr(e1) } @@ -2497,7 +2450,7 @@ func GetModuleHandleEx(flags uint32, moduleName *uint16, module *Handle) (err er } func GetNamedPipeClientProcessId(pipe Handle, clientProcessID *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procGetNamedPipeClientProcessId.Addr(), uintptr(pipe), uintptr(unsafe.Pointer(clientProcessID))) + r1, _, e1 := syscall.Syscall(procGetNamedPipeClientProcessId.Addr(), 2, uintptr(pipe), uintptr(unsafe.Pointer(clientProcessID)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -2505,7 +2458,7 @@ func GetNamedPipeClientProcessId(pipe Handle, clientProcessID *uint32) (err erro } func GetNamedPipeHandleState(pipe Handle, state *uint32, curInstances *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32, userName *uint16, maxUserNameSize uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procGetNamedPipeHandleStateW.Addr(), uintptr(pipe), uintptr(unsafe.Pointer(state)), uintptr(unsafe.Pointer(curInstances)), uintptr(unsafe.Pointer(maxCollectionCount)), uintptr(unsafe.Pointer(collectDataTimeout)), uintptr(unsafe.Pointer(userName)), uintptr(maxUserNameSize)) + r1, _, e1 := syscall.Syscall9(procGetNamedPipeHandleStateW.Addr(), 7, uintptr(pipe), uintptr(unsafe.Pointer(state)), uintptr(unsafe.Pointer(curInstances)), uintptr(unsafe.Pointer(maxCollectionCount)), uintptr(unsafe.Pointer(collectDataTimeout)), uintptr(unsafe.Pointer(userName)), uintptr(maxUserNameSize), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -2513,7 +2466,7 @@ func GetNamedPipeHandleState(pipe Handle, state *uint32, curInstances *uint32, m } func GetNamedPipeInfo(pipe Handle, flags *uint32, outSize *uint32, inSize *uint32, maxInstances *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procGetNamedPipeInfo.Addr(), uintptr(pipe), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(outSize)), uintptr(unsafe.Pointer(inSize)), uintptr(unsafe.Pointer(maxInstances))) + r1, _, e1 := syscall.Syscall6(procGetNamedPipeInfo.Addr(), 5, uintptr(pipe), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(outSize)), uintptr(unsafe.Pointer(inSize)), uintptr(unsafe.Pointer(maxInstances)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -2521,15 +2474,7 @@ func GetNamedPipeInfo(pipe Handle, flags *uint32, outSize *uint32, inSize *uint3 } func GetNamedPipeServerProcessId(pipe Handle, serverProcessID *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procGetNamedPipeServerProcessId.Addr(), uintptr(pipe), uintptr(unsafe.Pointer(serverProcessID))) - if r1 == 0 { - err = errnoErr(e1) - } - return -} - -func GetNumberOfConsoleInputEvents(console Handle, numevents *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procGetNumberOfConsoleInputEvents.Addr(), uintptr(console), uintptr(unsafe.Pointer(numevents))) + r1, _, e1 := syscall.Syscall(procGetNamedPipeServerProcessId.Addr(), 2, uintptr(pipe), uintptr(unsafe.Pointer(serverProcessID)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -2541,7 +2486,7 @@ func GetOverlappedResult(handle Handle, overlapped *Overlapped, done *uint32, wa if wait { _p0 = 1 } - r1, _, e1 := syscall.SyscallN(procGetOverlappedResult.Addr(), uintptr(handle), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(done)), uintptr(_p0)) + r1, _, e1 := syscall.Syscall6(procGetOverlappedResult.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(done)), uintptr(_p0), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -2549,7 +2494,7 @@ func GetOverlappedResult(handle Handle, overlapped *Overlapped, done *uint32, wa } func GetPriorityClass(process Handle) (ret uint32, err error) { - r0, _, e1 := syscall.SyscallN(procGetPriorityClass.Addr(), uintptr(process)) + r0, _, e1 := syscall.Syscall(procGetPriorityClass.Addr(), 1, uintptr(process), 0, 0) ret = uint32(r0) if ret == 0 { err = errnoErr(e1) @@ -2567,7 +2512,7 @@ func GetProcAddress(module Handle, procname string) (proc uintptr, err error) { } func _GetProcAddress(module Handle, procname *byte) (proc uintptr, err error) { - r0, _, e1 := syscall.SyscallN(procGetProcAddress.Addr(), uintptr(module), uintptr(unsafe.Pointer(procname))) + r0, _, e1 := syscall.Syscall(procGetProcAddress.Addr(), 2, uintptr(module), uintptr(unsafe.Pointer(procname)), 0) proc = uintptr(r0) if proc == 0 { err = errnoErr(e1) @@ -2576,7 +2521,7 @@ func _GetProcAddress(module Handle, procname *byte) (proc uintptr, err error) { } func GetProcessId(process Handle) (id uint32, err error) { - r0, _, e1 := syscall.SyscallN(procGetProcessId.Addr(), uintptr(process)) + r0, _, e1 := syscall.Syscall(procGetProcessId.Addr(), 1, uintptr(process), 0, 0) id = uint32(r0) if id == 0 { err = errnoErr(e1) @@ -2585,7 +2530,7 @@ func GetProcessId(process Handle) (id uint32, err error) { } func getProcessPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procGetProcessPreferredUILanguages.Addr(), uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize))) + r1, _, e1 := syscall.Syscall6(procGetProcessPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -2593,7 +2538,7 @@ func getProcessPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uin } func GetProcessShutdownParameters(level *uint32, flags *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procGetProcessShutdownParameters.Addr(), uintptr(unsafe.Pointer(level)), uintptr(unsafe.Pointer(flags))) + r1, _, e1 := syscall.Syscall(procGetProcessShutdownParameters.Addr(), 2, uintptr(unsafe.Pointer(level)), uintptr(unsafe.Pointer(flags)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -2601,7 +2546,7 @@ func GetProcessShutdownParameters(level *uint32, flags *uint32) (err error) { } func GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error) { - r1, _, e1 := syscall.SyscallN(procGetProcessTimes.Addr(), uintptr(handle), uintptr(unsafe.Pointer(creationTime)), uintptr(unsafe.Pointer(exitTime)), uintptr(unsafe.Pointer(kernelTime)), uintptr(unsafe.Pointer(userTime))) + r1, _, e1 := syscall.Syscall6(procGetProcessTimes.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(creationTime)), uintptr(unsafe.Pointer(exitTime)), uintptr(unsafe.Pointer(kernelTime)), uintptr(unsafe.Pointer(userTime)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -2609,12 +2554,12 @@ func GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, } func GetProcessWorkingSetSizeEx(hProcess Handle, lpMinimumWorkingSetSize *uintptr, lpMaximumWorkingSetSize *uintptr, flags *uint32) { - syscall.SyscallN(procGetProcessWorkingSetSizeEx.Addr(), uintptr(hProcess), uintptr(unsafe.Pointer(lpMinimumWorkingSetSize)), uintptr(unsafe.Pointer(lpMaximumWorkingSetSize)), uintptr(unsafe.Pointer(flags))) + syscall.Syscall6(procGetProcessWorkingSetSizeEx.Addr(), 4, uintptr(hProcess), uintptr(unsafe.Pointer(lpMinimumWorkingSetSize)), uintptr(unsafe.Pointer(lpMaximumWorkingSetSize)), uintptr(unsafe.Pointer(flags)), 0, 0) return } func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uintptr, overlapped **Overlapped, timeout uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procGetQueuedCompletionStatus.Addr(), uintptr(cphandle), uintptr(unsafe.Pointer(qty)), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(overlapped)), uintptr(timeout)) + r1, _, e1 := syscall.Syscall6(procGetQueuedCompletionStatus.Addr(), 5, uintptr(cphandle), uintptr(unsafe.Pointer(qty)), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(overlapped)), uintptr(timeout), 0) if r1 == 0 { err = errnoErr(e1) } @@ -2622,7 +2567,7 @@ func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uintptr, overl } func GetShortPathName(longpath *uint16, shortpath *uint16, buflen uint32) (n uint32, err error) { - r0, _, e1 := syscall.SyscallN(procGetShortPathNameW.Addr(), uintptr(unsafe.Pointer(longpath)), uintptr(unsafe.Pointer(shortpath)), uintptr(buflen)) + r0, _, e1 := syscall.Syscall(procGetShortPathNameW.Addr(), 3, uintptr(unsafe.Pointer(longpath)), uintptr(unsafe.Pointer(shortpath)), uintptr(buflen)) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -2631,12 +2576,12 @@ func GetShortPathName(longpath *uint16, shortpath *uint16, buflen uint32) (n uin } func getStartupInfo(startupInfo *StartupInfo) { - syscall.SyscallN(procGetStartupInfoW.Addr(), uintptr(unsafe.Pointer(startupInfo))) + syscall.Syscall(procGetStartupInfoW.Addr(), 1, uintptr(unsafe.Pointer(startupInfo)), 0, 0) return } func GetStdHandle(stdhandle uint32) (handle Handle, err error) { - r0, _, e1 := syscall.SyscallN(procGetStdHandle.Addr(), uintptr(stdhandle)) + r0, _, e1 := syscall.Syscall(procGetStdHandle.Addr(), 1, uintptr(stdhandle), 0, 0) handle = Handle(r0) if handle == InvalidHandle { err = errnoErr(e1) @@ -2645,7 +2590,7 @@ func GetStdHandle(stdhandle uint32) (handle Handle, err error) { } func getSystemDirectory(dir *uint16, dirLen uint32) (len uint32, err error) { - r0, _, e1 := syscall.SyscallN(procGetSystemDirectoryW.Addr(), uintptr(unsafe.Pointer(dir)), uintptr(dirLen)) + r0, _, e1 := syscall.Syscall(procGetSystemDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0) len = uint32(r0) if len == 0 { err = errnoErr(e1) @@ -2654,7 +2599,7 @@ func getSystemDirectory(dir *uint16, dirLen uint32) (len uint32, err error) { } func getSystemPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procGetSystemPreferredUILanguages.Addr(), uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize))) + r1, _, e1 := syscall.Syscall6(procGetSystemPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -2662,17 +2607,17 @@ func getSystemPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint } func GetSystemTimeAsFileTime(time *Filetime) { - syscall.SyscallN(procGetSystemTimeAsFileTime.Addr(), uintptr(unsafe.Pointer(time))) + syscall.Syscall(procGetSystemTimeAsFileTime.Addr(), 1, uintptr(unsafe.Pointer(time)), 0, 0) return } func GetSystemTimePreciseAsFileTime(time *Filetime) { - syscall.SyscallN(procGetSystemTimePreciseAsFileTime.Addr(), uintptr(unsafe.Pointer(time))) + syscall.Syscall(procGetSystemTimePreciseAsFileTime.Addr(), 1, uintptr(unsafe.Pointer(time)), 0, 0) return } func getSystemWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err error) { - r0, _, e1 := syscall.SyscallN(procGetSystemWindowsDirectoryW.Addr(), uintptr(unsafe.Pointer(dir)), uintptr(dirLen)) + r0, _, e1 := syscall.Syscall(procGetSystemWindowsDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0) len = uint32(r0) if len == 0 { err = errnoErr(e1) @@ -2681,7 +2626,7 @@ func getSystemWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err erro } func GetTempPath(buflen uint32, buf *uint16) (n uint32, err error) { - r0, _, e1 := syscall.SyscallN(procGetTempPathW.Addr(), uintptr(buflen), uintptr(unsafe.Pointer(buf))) + r0, _, e1 := syscall.Syscall(procGetTempPathW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -2690,7 +2635,7 @@ func GetTempPath(buflen uint32, buf *uint16) (n uint32, err error) { } func getThreadPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procGetThreadPreferredUILanguages.Addr(), uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize))) + r1, _, e1 := syscall.Syscall6(procGetThreadPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -2698,13 +2643,13 @@ func getThreadPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint } func getTickCount64() (ms uint64) { - r0, _, _ := syscall.SyscallN(procGetTickCount64.Addr()) + r0, _, _ := syscall.Syscall(procGetTickCount64.Addr(), 0, 0, 0, 0) ms = uint64(r0) return } func GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error) { - r0, _, e1 := syscall.SyscallN(procGetTimeZoneInformation.Addr(), uintptr(unsafe.Pointer(tzi))) + r0, _, e1 := syscall.Syscall(procGetTimeZoneInformation.Addr(), 1, uintptr(unsafe.Pointer(tzi)), 0, 0) rc = uint32(r0) if rc == 0xffffffff { err = errnoErr(e1) @@ -2713,7 +2658,7 @@ func GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error) { } func getUserPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16, bufSize *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procGetUserPreferredUILanguages.Addr(), uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize))) + r1, _, e1 := syscall.Syscall6(procGetUserPreferredUILanguages.Addr(), 4, uintptr(flags), uintptr(unsafe.Pointer(numLanguages)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(bufSize)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -2721,7 +2666,7 @@ func getUserPreferredUILanguages(flags uint32, numLanguages *uint32, buf *uint16 } func GetVersion() (ver uint32, err error) { - r0, _, e1 := syscall.SyscallN(procGetVersion.Addr()) + r0, _, e1 := syscall.Syscall(procGetVersion.Addr(), 0, 0, 0, 0) ver = uint32(r0) if ver == 0 { err = errnoErr(e1) @@ -2730,7 +2675,7 @@ func GetVersion() (ver uint32, err error) { } func GetVolumeInformationByHandle(file Handle, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procGetVolumeInformationByHandleW.Addr(), uintptr(file), uintptr(unsafe.Pointer(volumeNameBuffer)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeNameSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemNameBuffer)), uintptr(fileSystemNameSize)) + r1, _, e1 := syscall.Syscall9(procGetVolumeInformationByHandleW.Addr(), 8, uintptr(file), uintptr(unsafe.Pointer(volumeNameBuffer)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeNameSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemNameBuffer)), uintptr(fileSystemNameSize), 0) if r1 == 0 { err = errnoErr(e1) } @@ -2738,7 +2683,7 @@ func GetVolumeInformationByHandle(file Handle, volumeNameBuffer *uint16, volumeN } func GetVolumeInformation(rootPathName *uint16, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procGetVolumeInformationW.Addr(), uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeNameBuffer)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeNameSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemNameBuffer)), uintptr(fileSystemNameSize)) + r1, _, e1 := syscall.Syscall9(procGetVolumeInformationW.Addr(), 8, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeNameBuffer)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeNameSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemNameBuffer)), uintptr(fileSystemNameSize), 0) if r1 == 0 { err = errnoErr(e1) } @@ -2746,7 +2691,7 @@ func GetVolumeInformation(rootPathName *uint16, volumeNameBuffer *uint16, volume } func GetVolumeNameForVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16, bufferlength uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procGetVolumeNameForVolumeMountPointW.Addr(), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferlength)) + r1, _, e1 := syscall.Syscall(procGetVolumeNameForVolumeMountPointW.Addr(), 3, uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferlength)) if r1 == 0 { err = errnoErr(e1) } @@ -2754,7 +2699,7 @@ func GetVolumeNameForVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint } func GetVolumePathName(fileName *uint16, volumePathName *uint16, bufferLength uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procGetVolumePathNameW.Addr(), uintptr(unsafe.Pointer(fileName)), uintptr(unsafe.Pointer(volumePathName)), uintptr(bufferLength)) + r1, _, e1 := syscall.Syscall(procGetVolumePathNameW.Addr(), 3, uintptr(unsafe.Pointer(fileName)), uintptr(unsafe.Pointer(volumePathName)), uintptr(bufferLength)) if r1 == 0 { err = errnoErr(e1) } @@ -2762,7 +2707,7 @@ func GetVolumePathName(fileName *uint16, volumePathName *uint16, bufferLength ui } func GetVolumePathNamesForVolumeName(volumeName *uint16, volumePathNames *uint16, bufferLength uint32, returnLength *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procGetVolumePathNamesForVolumeNameW.Addr(), uintptr(unsafe.Pointer(volumeName)), uintptr(unsafe.Pointer(volumePathNames)), uintptr(bufferLength), uintptr(unsafe.Pointer(returnLength))) + r1, _, e1 := syscall.Syscall6(procGetVolumePathNamesForVolumeNameW.Addr(), 4, uintptr(unsafe.Pointer(volumeName)), uintptr(unsafe.Pointer(volumePathNames)), uintptr(bufferLength), uintptr(unsafe.Pointer(returnLength)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -2770,7 +2715,7 @@ func GetVolumePathNamesForVolumeName(volumeName *uint16, volumePathNames *uint16 } func getWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err error) { - r0, _, e1 := syscall.SyscallN(procGetWindowsDirectoryW.Addr(), uintptr(unsafe.Pointer(dir)), uintptr(dirLen)) + r0, _, e1 := syscall.Syscall(procGetWindowsDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(dir)), uintptr(dirLen), 0) len = uint32(r0) if len == 0 { err = errnoErr(e1) @@ -2779,7 +2724,7 @@ func getWindowsDirectory(dir *uint16, dirLen uint32) (len uint32, err error) { } func initializeProcThreadAttributeList(attrlist *ProcThreadAttributeList, attrcount uint32, flags uint32, size *uintptr) (err error) { - r1, _, e1 := syscall.SyscallN(procInitializeProcThreadAttributeList.Addr(), uintptr(unsafe.Pointer(attrlist)), uintptr(attrcount), uintptr(flags), uintptr(unsafe.Pointer(size))) + r1, _, e1 := syscall.Syscall6(procInitializeProcThreadAttributeList.Addr(), 4, uintptr(unsafe.Pointer(attrlist)), uintptr(attrcount), uintptr(flags), uintptr(unsafe.Pointer(size)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -2791,7 +2736,7 @@ func IsWow64Process(handle Handle, isWow64 *bool) (err error) { if *isWow64 { _p0 = 1 } - r1, _, e1 := syscall.SyscallN(procIsWow64Process.Addr(), uintptr(handle), uintptr(unsafe.Pointer(&_p0))) + r1, _, e1 := syscall.Syscall(procIsWow64Process.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(&_p0)), 0) *isWow64 = _p0 != 0 if r1 == 0 { err = errnoErr(e1) @@ -2804,7 +2749,7 @@ func IsWow64Process2(handle Handle, processMachine *uint16, nativeMachine *uint1 if err != nil { return } - r1, _, e1 := syscall.SyscallN(procIsWow64Process2.Addr(), uintptr(handle), uintptr(unsafe.Pointer(processMachine)), uintptr(unsafe.Pointer(nativeMachine))) + r1, _, e1 := syscall.Syscall(procIsWow64Process2.Addr(), 3, uintptr(handle), uintptr(unsafe.Pointer(processMachine)), uintptr(unsafe.Pointer(nativeMachine))) if r1 == 0 { err = errnoErr(e1) } @@ -2821,7 +2766,7 @@ func LoadLibraryEx(libname string, zero Handle, flags uintptr) (handle Handle, e } func _LoadLibraryEx(libname *uint16, zero Handle, flags uintptr) (handle Handle, err error) { - r0, _, e1 := syscall.SyscallN(procLoadLibraryExW.Addr(), uintptr(unsafe.Pointer(libname)), uintptr(zero), uintptr(flags)) + r0, _, e1 := syscall.Syscall(procLoadLibraryExW.Addr(), 3, uintptr(unsafe.Pointer(libname)), uintptr(zero), uintptr(flags)) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -2839,7 +2784,7 @@ func LoadLibrary(libname string) (handle Handle, err error) { } func _LoadLibrary(libname *uint16) (handle Handle, err error) { - r0, _, e1 := syscall.SyscallN(procLoadLibraryW.Addr(), uintptr(unsafe.Pointer(libname))) + r0, _, e1 := syscall.Syscall(procLoadLibraryW.Addr(), 1, uintptr(unsafe.Pointer(libname)), 0, 0) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -2848,7 +2793,7 @@ func _LoadLibrary(libname *uint16) (handle Handle, err error) { } func LoadResource(module Handle, resInfo Handle) (resData Handle, err error) { - r0, _, e1 := syscall.SyscallN(procLoadResource.Addr(), uintptr(module), uintptr(resInfo)) + r0, _, e1 := syscall.Syscall(procLoadResource.Addr(), 2, uintptr(module), uintptr(resInfo), 0) resData = Handle(r0) if resData == 0 { err = errnoErr(e1) @@ -2857,7 +2802,7 @@ func LoadResource(module Handle, resInfo Handle) (resData Handle, err error) { } func LocalAlloc(flags uint32, length uint32) (ptr uintptr, err error) { - r0, _, e1 := syscall.SyscallN(procLocalAlloc.Addr(), uintptr(flags), uintptr(length)) + r0, _, e1 := syscall.Syscall(procLocalAlloc.Addr(), 2, uintptr(flags), uintptr(length), 0) ptr = uintptr(r0) if ptr == 0 { err = errnoErr(e1) @@ -2866,7 +2811,7 @@ func LocalAlloc(flags uint32, length uint32) (ptr uintptr, err error) { } func LocalFree(hmem Handle) (handle Handle, err error) { - r0, _, e1 := syscall.SyscallN(procLocalFree.Addr(), uintptr(hmem)) + r0, _, e1 := syscall.Syscall(procLocalFree.Addr(), 1, uintptr(hmem), 0, 0) handle = Handle(r0) if handle != 0 { err = errnoErr(e1) @@ -2875,7 +2820,7 @@ func LocalFree(hmem Handle) (handle Handle, err error) { } func LockFileEx(file Handle, flags uint32, reserved uint32, bytesLow uint32, bytesHigh uint32, overlapped *Overlapped) (err error) { - r1, _, e1 := syscall.SyscallN(procLockFileEx.Addr(), uintptr(file), uintptr(flags), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped))) + r1, _, e1 := syscall.Syscall6(procLockFileEx.Addr(), 6, uintptr(file), uintptr(flags), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped))) if r1 == 0 { err = errnoErr(e1) } @@ -2883,7 +2828,7 @@ func LockFileEx(file Handle, flags uint32, reserved uint32, bytesLow uint32, byt } func LockResource(resData Handle) (addr uintptr, err error) { - r0, _, e1 := syscall.SyscallN(procLockResource.Addr(), uintptr(resData)) + r0, _, e1 := syscall.Syscall(procLockResource.Addr(), 1, uintptr(resData), 0, 0) addr = uintptr(r0) if addr == 0 { err = errnoErr(e1) @@ -2892,7 +2837,7 @@ func LockResource(resData Handle) (addr uintptr, err error) { } func MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow uint32, length uintptr) (addr uintptr, err error) { - r0, _, e1 := syscall.SyscallN(procMapViewOfFile.Addr(), uintptr(handle), uintptr(access), uintptr(offsetHigh), uintptr(offsetLow), uintptr(length)) + r0, _, e1 := syscall.Syscall6(procMapViewOfFile.Addr(), 5, uintptr(handle), uintptr(access), uintptr(offsetHigh), uintptr(offsetLow), uintptr(length), 0) addr = uintptr(r0) if addr == 0 { err = errnoErr(e1) @@ -2901,7 +2846,7 @@ func MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow ui } func Module32First(snapshot Handle, moduleEntry *ModuleEntry32) (err error) { - r1, _, e1 := syscall.SyscallN(procModule32FirstW.Addr(), uintptr(snapshot), uintptr(unsafe.Pointer(moduleEntry))) + r1, _, e1 := syscall.Syscall(procModule32FirstW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(moduleEntry)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -2909,7 +2854,7 @@ func Module32First(snapshot Handle, moduleEntry *ModuleEntry32) (err error) { } func Module32Next(snapshot Handle, moduleEntry *ModuleEntry32) (err error) { - r1, _, e1 := syscall.SyscallN(procModule32NextW.Addr(), uintptr(snapshot), uintptr(unsafe.Pointer(moduleEntry))) + r1, _, e1 := syscall.Syscall(procModule32NextW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(moduleEntry)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -2917,7 +2862,7 @@ func Module32Next(snapshot Handle, moduleEntry *ModuleEntry32) (err error) { } func MoveFileEx(from *uint16, to *uint16, flags uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procMoveFileExW.Addr(), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), uintptr(flags)) + r1, _, e1 := syscall.Syscall(procMoveFileExW.Addr(), 3, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), uintptr(flags)) if r1 == 0 { err = errnoErr(e1) } @@ -2925,7 +2870,7 @@ func MoveFileEx(from *uint16, to *uint16, flags uint32) (err error) { } func MoveFile(from *uint16, to *uint16) (err error) { - r1, _, e1 := syscall.SyscallN(procMoveFileW.Addr(), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to))) + r1, _, e1 := syscall.Syscall(procMoveFileW.Addr(), 2, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -2933,7 +2878,7 @@ func MoveFile(from *uint16, to *uint16) (err error) { } func MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int32, err error) { - r0, _, e1 := syscall.SyscallN(procMultiByteToWideChar.Addr(), uintptr(codePage), uintptr(dwFlags), uintptr(unsafe.Pointer(str)), uintptr(nstr), uintptr(unsafe.Pointer(wchar)), uintptr(nwchar)) + r0, _, e1 := syscall.Syscall6(procMultiByteToWideChar.Addr(), 6, uintptr(codePage), uintptr(dwFlags), uintptr(unsafe.Pointer(str)), uintptr(nstr), uintptr(unsafe.Pointer(wchar)), uintptr(nwchar)) nwrite = int32(r0) if nwrite == 0 { err = errnoErr(e1) @@ -2946,7 +2891,7 @@ func OpenEvent(desiredAccess uint32, inheritHandle bool, name *uint16) (handle H if inheritHandle { _p0 = 1 } - r0, _, e1 := syscall.SyscallN(procOpenEventW.Addr(), uintptr(desiredAccess), uintptr(_p0), uintptr(unsafe.Pointer(name))) + r0, _, e1 := syscall.Syscall(procOpenEventW.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(unsafe.Pointer(name))) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -2959,7 +2904,7 @@ func OpenMutex(desiredAccess uint32, inheritHandle bool, name *uint16) (handle H if inheritHandle { _p0 = 1 } - r0, _, e1 := syscall.SyscallN(procOpenMutexW.Addr(), uintptr(desiredAccess), uintptr(_p0), uintptr(unsafe.Pointer(name))) + r0, _, e1 := syscall.Syscall(procOpenMutexW.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(unsafe.Pointer(name))) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -2972,7 +2917,7 @@ func OpenProcess(desiredAccess uint32, inheritHandle bool, processId uint32) (ha if inheritHandle { _p0 = 1 } - r0, _, e1 := syscall.SyscallN(procOpenProcess.Addr(), uintptr(desiredAccess), uintptr(_p0), uintptr(processId)) + r0, _, e1 := syscall.Syscall(procOpenProcess.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(processId)) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -2985,7 +2930,7 @@ func OpenThread(desiredAccess uint32, inheritHandle bool, threadId uint32) (hand if inheritHandle { _p0 = 1 } - r0, _, e1 := syscall.SyscallN(procOpenThread.Addr(), uintptr(desiredAccess), uintptr(_p0), uintptr(threadId)) + r0, _, e1 := syscall.Syscall(procOpenThread.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(threadId)) handle = Handle(r0) if handle == 0 { err = errnoErr(e1) @@ -2994,7 +2939,7 @@ func OpenThread(desiredAccess uint32, inheritHandle bool, threadId uint32) (hand } func PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uintptr, overlapped *Overlapped) (err error) { - r1, _, e1 := syscall.SyscallN(procPostQueuedCompletionStatus.Addr(), uintptr(cphandle), uintptr(qty), uintptr(key), uintptr(unsafe.Pointer(overlapped))) + r1, _, e1 := syscall.Syscall6(procPostQueuedCompletionStatus.Addr(), 4, uintptr(cphandle), uintptr(qty), uintptr(key), uintptr(unsafe.Pointer(overlapped)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -3002,7 +2947,7 @@ func PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uintptr, overla } func Process32First(snapshot Handle, procEntry *ProcessEntry32) (err error) { - r1, _, e1 := syscall.SyscallN(procProcess32FirstW.Addr(), uintptr(snapshot), uintptr(unsafe.Pointer(procEntry))) + r1, _, e1 := syscall.Syscall(procProcess32FirstW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(procEntry)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3010,7 +2955,7 @@ func Process32First(snapshot Handle, procEntry *ProcessEntry32) (err error) { } func Process32Next(snapshot Handle, procEntry *ProcessEntry32) (err error) { - r1, _, e1 := syscall.SyscallN(procProcess32NextW.Addr(), uintptr(snapshot), uintptr(unsafe.Pointer(procEntry))) + r1, _, e1 := syscall.Syscall(procProcess32NextW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(procEntry)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3018,7 +2963,7 @@ func Process32Next(snapshot Handle, procEntry *ProcessEntry32) (err error) { } func ProcessIdToSessionId(pid uint32, sessionid *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procProcessIdToSessionId.Addr(), uintptr(pid), uintptr(unsafe.Pointer(sessionid))) + r1, _, e1 := syscall.Syscall(procProcessIdToSessionId.Addr(), 2, uintptr(pid), uintptr(unsafe.Pointer(sessionid)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3026,7 +2971,7 @@ func ProcessIdToSessionId(pid uint32, sessionid *uint32) (err error) { } func PulseEvent(event Handle) (err error) { - r1, _, e1 := syscall.SyscallN(procPulseEvent.Addr(), uintptr(event)) + r1, _, e1 := syscall.Syscall(procPulseEvent.Addr(), 1, uintptr(event), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -3034,7 +2979,7 @@ func PulseEvent(event Handle) (err error) { } func PurgeComm(handle Handle, dwFlags uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procPurgeComm.Addr(), uintptr(handle), uintptr(dwFlags)) + r1, _, e1 := syscall.Syscall(procPurgeComm.Addr(), 2, uintptr(handle), uintptr(dwFlags), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3042,7 +2987,7 @@ func PurgeComm(handle Handle, dwFlags uint32) (err error) { } func QueryDosDevice(deviceName *uint16, targetPath *uint16, max uint32) (n uint32, err error) { - r0, _, e1 := syscall.SyscallN(procQueryDosDeviceW.Addr(), uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath)), uintptr(max)) + r0, _, e1 := syscall.Syscall(procQueryDosDeviceW.Addr(), 3, uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath)), uintptr(max)) n = uint32(r0) if n == 0 { err = errnoErr(e1) @@ -3051,7 +2996,7 @@ func QueryDosDevice(deviceName *uint16, targetPath *uint16, max uint32) (n uint3 } func QueryFullProcessImageName(proc Handle, flags uint32, exeName *uint16, size *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procQueryFullProcessImageNameW.Addr(), uintptr(proc), uintptr(flags), uintptr(unsafe.Pointer(exeName)), uintptr(unsafe.Pointer(size))) + r1, _, e1 := syscall.Syscall6(procQueryFullProcessImageNameW.Addr(), 4, uintptr(proc), uintptr(flags), uintptr(unsafe.Pointer(exeName)), uintptr(unsafe.Pointer(size)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -3059,7 +3004,7 @@ func QueryFullProcessImageName(proc Handle, flags uint32, exeName *uint16, size } func QueryInformationJobObject(job Handle, JobObjectInformationClass int32, JobObjectInformation uintptr, JobObjectInformationLength uint32, retlen *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procQueryInformationJobObject.Addr(), uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength), uintptr(unsafe.Pointer(retlen))) + r1, _, e1 := syscall.Syscall6(procQueryInformationJobObject.Addr(), 5, uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength), uintptr(unsafe.Pointer(retlen)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3067,7 +3012,7 @@ func QueryInformationJobObject(job Handle, JobObjectInformationClass int32, JobO } func ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, inputControl *byte) (err error) { - r1, _, e1 := syscall.SyscallN(procReadConsoleW.Addr(), uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(toread), uintptr(unsafe.Pointer(read)), uintptr(unsafe.Pointer(inputControl))) + r1, _, e1 := syscall.Syscall6(procReadConsoleW.Addr(), 5, uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(toread), uintptr(unsafe.Pointer(read)), uintptr(unsafe.Pointer(inputControl)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3079,7 +3024,7 @@ func ReadDirectoryChanges(handle Handle, buf *byte, buflen uint32, watchSubTree if watchSubTree { _p0 = 1 } - r1, _, e1 := syscall.SyscallN(procReadDirectoryChangesW.Addr(), uintptr(handle), uintptr(unsafe.Pointer(buf)), uintptr(buflen), uintptr(_p0), uintptr(mask), uintptr(unsafe.Pointer(retlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine)) + r1, _, e1 := syscall.Syscall9(procReadDirectoryChangesW.Addr(), 8, uintptr(handle), uintptr(unsafe.Pointer(buf)), uintptr(buflen), uintptr(_p0), uintptr(mask), uintptr(unsafe.Pointer(retlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3091,7 +3036,7 @@ func readFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) ( if len(buf) > 0 { _p0 = &buf[0] } - r1, _, e1 := syscall.SyscallN(procReadFile.Addr(), uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped))) + r1, _, e1 := syscall.Syscall6(procReadFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3099,7 +3044,7 @@ func readFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) ( } func ReadProcessMemory(process Handle, baseAddress uintptr, buffer *byte, size uintptr, numberOfBytesRead *uintptr) (err error) { - r1, _, e1 := syscall.SyscallN(procReadProcessMemory.Addr(), uintptr(process), uintptr(baseAddress), uintptr(unsafe.Pointer(buffer)), uintptr(size), uintptr(unsafe.Pointer(numberOfBytesRead))) + r1, _, e1 := syscall.Syscall6(procReadProcessMemory.Addr(), 5, uintptr(process), uintptr(baseAddress), uintptr(unsafe.Pointer(buffer)), uintptr(size), uintptr(unsafe.Pointer(numberOfBytesRead)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3107,7 +3052,7 @@ func ReadProcessMemory(process Handle, baseAddress uintptr, buffer *byte, size u } func ReleaseMutex(mutex Handle) (err error) { - r1, _, e1 := syscall.SyscallN(procReleaseMutex.Addr(), uintptr(mutex)) + r1, _, e1 := syscall.Syscall(procReleaseMutex.Addr(), 1, uintptr(mutex), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -3115,7 +3060,7 @@ func ReleaseMutex(mutex Handle) (err error) { } func RemoveDirectory(path *uint16) (err error) { - r1, _, e1 := syscall.SyscallN(procRemoveDirectoryW.Addr(), uintptr(unsafe.Pointer(path))) + r1, _, e1 := syscall.Syscall(procRemoveDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -3123,7 +3068,7 @@ func RemoveDirectory(path *uint16) (err error) { } func RemoveDllDirectory(cookie uintptr) (err error) { - r1, _, e1 := syscall.SyscallN(procRemoveDllDirectory.Addr(), uintptr(cookie)) + r1, _, e1 := syscall.Syscall(procRemoveDllDirectory.Addr(), 1, uintptr(cookie), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -3131,7 +3076,7 @@ func RemoveDllDirectory(cookie uintptr) (err error) { } func ResetEvent(event Handle) (err error) { - r1, _, e1 := syscall.SyscallN(procResetEvent.Addr(), uintptr(event)) + r1, _, e1 := syscall.Syscall(procResetEvent.Addr(), 1, uintptr(event), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -3139,7 +3084,7 @@ func ResetEvent(event Handle) (err error) { } func resizePseudoConsole(pconsole Handle, size uint32) (hr error) { - r0, _, _ := syscall.SyscallN(procResizePseudoConsole.Addr(), uintptr(pconsole), uintptr(size)) + r0, _, _ := syscall.Syscall(procResizePseudoConsole.Addr(), 2, uintptr(pconsole), uintptr(size), 0) if r0 != 0 { hr = syscall.Errno(r0) } @@ -3147,7 +3092,7 @@ func resizePseudoConsole(pconsole Handle, size uint32) (hr error) { } func ResumeThread(thread Handle) (ret uint32, err error) { - r0, _, e1 := syscall.SyscallN(procResumeThread.Addr(), uintptr(thread)) + r0, _, e1 := syscall.Syscall(procResumeThread.Addr(), 1, uintptr(thread), 0, 0) ret = uint32(r0) if ret == 0xffffffff { err = errnoErr(e1) @@ -3156,7 +3101,7 @@ func ResumeThread(thread Handle) (ret uint32, err error) { } func SetCommBreak(handle Handle) (err error) { - r1, _, e1 := syscall.SyscallN(procSetCommBreak.Addr(), uintptr(handle)) + r1, _, e1 := syscall.Syscall(procSetCommBreak.Addr(), 1, uintptr(handle), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -3164,7 +3109,7 @@ func SetCommBreak(handle Handle) (err error) { } func SetCommMask(handle Handle, dwEvtMask uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procSetCommMask.Addr(), uintptr(handle), uintptr(dwEvtMask)) + r1, _, e1 := syscall.Syscall(procSetCommMask.Addr(), 2, uintptr(handle), uintptr(dwEvtMask), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3172,7 +3117,7 @@ func SetCommMask(handle Handle, dwEvtMask uint32) (err error) { } func SetCommState(handle Handle, lpDCB *DCB) (err error) { - r1, _, e1 := syscall.SyscallN(procSetCommState.Addr(), uintptr(handle), uintptr(unsafe.Pointer(lpDCB))) + r1, _, e1 := syscall.Syscall(procSetCommState.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(lpDCB)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3180,7 +3125,7 @@ func SetCommState(handle Handle, lpDCB *DCB) (err error) { } func SetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) { - r1, _, e1 := syscall.SyscallN(procSetCommTimeouts.Addr(), uintptr(handle), uintptr(unsafe.Pointer(timeouts))) + r1, _, e1 := syscall.Syscall(procSetCommTimeouts.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(timeouts)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3188,7 +3133,7 @@ func SetCommTimeouts(handle Handle, timeouts *CommTimeouts) (err error) { } func SetConsoleCP(cp uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procSetConsoleCP.Addr(), uintptr(cp)) + r1, _, e1 := syscall.Syscall(procSetConsoleCP.Addr(), 1, uintptr(cp), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -3196,7 +3141,7 @@ func SetConsoleCP(cp uint32) (err error) { } func setConsoleCursorPosition(console Handle, position uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procSetConsoleCursorPosition.Addr(), uintptr(console), uintptr(position)) + r1, _, e1 := syscall.Syscall(procSetConsoleCursorPosition.Addr(), 2, uintptr(console), uintptr(position), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3204,7 +3149,7 @@ func setConsoleCursorPosition(console Handle, position uint32) (err error) { } func SetConsoleMode(console Handle, mode uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procSetConsoleMode.Addr(), uintptr(console), uintptr(mode)) + r1, _, e1 := syscall.Syscall(procSetConsoleMode.Addr(), 2, uintptr(console), uintptr(mode), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3212,7 +3157,7 @@ func SetConsoleMode(console Handle, mode uint32) (err error) { } func SetConsoleOutputCP(cp uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procSetConsoleOutputCP.Addr(), uintptr(cp)) + r1, _, e1 := syscall.Syscall(procSetConsoleOutputCP.Addr(), 1, uintptr(cp), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -3220,7 +3165,7 @@ func SetConsoleOutputCP(cp uint32) (err error) { } func SetCurrentDirectory(path *uint16) (err error) { - r1, _, e1 := syscall.SyscallN(procSetCurrentDirectoryW.Addr(), uintptr(unsafe.Pointer(path))) + r1, _, e1 := syscall.Syscall(procSetCurrentDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -3228,7 +3173,7 @@ func SetCurrentDirectory(path *uint16) (err error) { } func SetDefaultDllDirectories(directoryFlags uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procSetDefaultDllDirectories.Addr(), uintptr(directoryFlags)) + r1, _, e1 := syscall.Syscall(procSetDefaultDllDirectories.Addr(), 1, uintptr(directoryFlags), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -3245,7 +3190,7 @@ func SetDllDirectory(path string) (err error) { } func _SetDllDirectory(path *uint16) (err error) { - r1, _, e1 := syscall.SyscallN(procSetDllDirectoryW.Addr(), uintptr(unsafe.Pointer(path))) + r1, _, e1 := syscall.Syscall(procSetDllDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -3253,7 +3198,7 @@ func _SetDllDirectory(path *uint16) (err error) { } func SetEndOfFile(handle Handle) (err error) { - r1, _, e1 := syscall.SyscallN(procSetEndOfFile.Addr(), uintptr(handle)) + r1, _, e1 := syscall.Syscall(procSetEndOfFile.Addr(), 1, uintptr(handle), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -3261,7 +3206,7 @@ func SetEndOfFile(handle Handle) (err error) { } func SetEnvironmentVariable(name *uint16, value *uint16) (err error) { - r1, _, e1 := syscall.SyscallN(procSetEnvironmentVariableW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(value))) + r1, _, e1 := syscall.Syscall(procSetEnvironmentVariableW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(value)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3269,13 +3214,13 @@ func SetEnvironmentVariable(name *uint16, value *uint16) (err error) { } func SetErrorMode(mode uint32) (ret uint32) { - r0, _, _ := syscall.SyscallN(procSetErrorMode.Addr(), uintptr(mode)) + r0, _, _ := syscall.Syscall(procSetErrorMode.Addr(), 1, uintptr(mode), 0, 0) ret = uint32(r0) return } func SetEvent(event Handle) (err error) { - r1, _, e1 := syscall.SyscallN(procSetEvent.Addr(), uintptr(event)) + r1, _, e1 := syscall.Syscall(procSetEvent.Addr(), 1, uintptr(event), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -3283,7 +3228,7 @@ func SetEvent(event Handle) (err error) { } func SetFileAttributes(name *uint16, attrs uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procSetFileAttributesW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(attrs)) + r1, _, e1 := syscall.Syscall(procSetFileAttributesW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(attrs), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3291,7 +3236,7 @@ func SetFileAttributes(name *uint16, attrs uint32) (err error) { } func SetFileCompletionNotificationModes(handle Handle, flags uint8) (err error) { - r1, _, e1 := syscall.SyscallN(procSetFileCompletionNotificationModes.Addr(), uintptr(handle), uintptr(flags)) + r1, _, e1 := syscall.Syscall(procSetFileCompletionNotificationModes.Addr(), 2, uintptr(handle), uintptr(flags), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3299,7 +3244,7 @@ func SetFileCompletionNotificationModes(handle Handle, flags uint8) (err error) } func SetFileInformationByHandle(handle Handle, class uint32, inBuffer *byte, inBufferLen uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procSetFileInformationByHandle.Addr(), uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferLen)) + r1, _, e1 := syscall.Syscall6(procSetFileInformationByHandle.Addr(), 4, uintptr(handle), uintptr(class), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferLen), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -3307,7 +3252,7 @@ func SetFileInformationByHandle(handle Handle, class uint32, inBuffer *byte, inB } func SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence uint32) (newlowoffset uint32, err error) { - r0, _, e1 := syscall.SyscallN(procSetFilePointer.Addr(), uintptr(handle), uintptr(lowoffset), uintptr(unsafe.Pointer(highoffsetptr)), uintptr(whence)) + r0, _, e1 := syscall.Syscall6(procSetFilePointer.Addr(), 4, uintptr(handle), uintptr(lowoffset), uintptr(unsafe.Pointer(highoffsetptr)), uintptr(whence), 0, 0) newlowoffset = uint32(r0) if newlowoffset == 0xffffffff { err = errnoErr(e1) @@ -3316,7 +3261,7 @@ func SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence } func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) { - r1, _, e1 := syscall.SyscallN(procSetFileTime.Addr(), uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime))) + r1, _, e1 := syscall.Syscall6(procSetFileTime.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -3324,7 +3269,7 @@ func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetim } func SetFileValidData(handle Handle, validDataLength int64) (err error) { - r1, _, e1 := syscall.SyscallN(procSetFileValidData.Addr(), uintptr(handle), uintptr(validDataLength)) + r1, _, e1 := syscall.Syscall(procSetFileValidData.Addr(), 2, uintptr(handle), uintptr(validDataLength), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3332,7 +3277,7 @@ func SetFileValidData(handle Handle, validDataLength int64) (err error) { } func SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procSetHandleInformation.Addr(), uintptr(handle), uintptr(mask), uintptr(flags)) + r1, _, e1 := syscall.Syscall(procSetHandleInformation.Addr(), 3, uintptr(handle), uintptr(mask), uintptr(flags)) if r1 == 0 { err = errnoErr(e1) } @@ -3340,7 +3285,7 @@ func SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error) } func SetInformationJobObject(job Handle, JobObjectInformationClass uint32, JobObjectInformation uintptr, JobObjectInformationLength uint32) (ret int, err error) { - r0, _, e1 := syscall.SyscallN(procSetInformationJobObject.Addr(), uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength)) + r0, _, e1 := syscall.Syscall6(procSetInformationJobObject.Addr(), 4, uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength), 0, 0) ret = int(r0) if ret == 0 { err = errnoErr(e1) @@ -3349,7 +3294,7 @@ func SetInformationJobObject(job Handle, JobObjectInformationClass uint32, JobOb } func SetNamedPipeHandleState(pipe Handle, state *uint32, maxCollectionCount *uint32, collectDataTimeout *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procSetNamedPipeHandleState.Addr(), uintptr(pipe), uintptr(unsafe.Pointer(state)), uintptr(unsafe.Pointer(maxCollectionCount)), uintptr(unsafe.Pointer(collectDataTimeout))) + r1, _, e1 := syscall.Syscall6(procSetNamedPipeHandleState.Addr(), 4, uintptr(pipe), uintptr(unsafe.Pointer(state)), uintptr(unsafe.Pointer(maxCollectionCount)), uintptr(unsafe.Pointer(collectDataTimeout)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -3357,7 +3302,7 @@ func SetNamedPipeHandleState(pipe Handle, state *uint32, maxCollectionCount *uin } func SetPriorityClass(process Handle, priorityClass uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procSetPriorityClass.Addr(), uintptr(process), uintptr(priorityClass)) + r1, _, e1 := syscall.Syscall(procSetPriorityClass.Addr(), 2, uintptr(process), uintptr(priorityClass), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3369,7 +3314,7 @@ func SetProcessPriorityBoost(process Handle, disable bool) (err error) { if disable { _p0 = 1 } - r1, _, e1 := syscall.SyscallN(procSetProcessPriorityBoost.Addr(), uintptr(process), uintptr(_p0)) + r1, _, e1 := syscall.Syscall(procSetProcessPriorityBoost.Addr(), 2, uintptr(process), uintptr(_p0), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3377,7 +3322,7 @@ func SetProcessPriorityBoost(process Handle, disable bool) (err error) { } func SetProcessShutdownParameters(level uint32, flags uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procSetProcessShutdownParameters.Addr(), uintptr(level), uintptr(flags)) + r1, _, e1 := syscall.Syscall(procSetProcessShutdownParameters.Addr(), 2, uintptr(level), uintptr(flags), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3385,7 +3330,7 @@ func SetProcessShutdownParameters(level uint32, flags uint32) (err error) { } func SetProcessWorkingSetSizeEx(hProcess Handle, dwMinimumWorkingSetSize uintptr, dwMaximumWorkingSetSize uintptr, flags uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procSetProcessWorkingSetSizeEx.Addr(), uintptr(hProcess), uintptr(dwMinimumWorkingSetSize), uintptr(dwMaximumWorkingSetSize), uintptr(flags)) + r1, _, e1 := syscall.Syscall6(procSetProcessWorkingSetSizeEx.Addr(), 4, uintptr(hProcess), uintptr(dwMinimumWorkingSetSize), uintptr(dwMaximumWorkingSetSize), uintptr(flags), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -3393,7 +3338,7 @@ func SetProcessWorkingSetSizeEx(hProcess Handle, dwMinimumWorkingSetSize uintptr } func SetStdHandle(stdhandle uint32, handle Handle) (err error) { - r1, _, e1 := syscall.SyscallN(procSetStdHandle.Addr(), uintptr(stdhandle), uintptr(handle)) + r1, _, e1 := syscall.Syscall(procSetStdHandle.Addr(), 2, uintptr(stdhandle), uintptr(handle), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3401,7 +3346,7 @@ func SetStdHandle(stdhandle uint32, handle Handle) (err error) { } func SetVolumeLabel(rootPathName *uint16, volumeName *uint16) (err error) { - r1, _, e1 := syscall.SyscallN(procSetVolumeLabelW.Addr(), uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeName))) + r1, _, e1 := syscall.Syscall(procSetVolumeLabelW.Addr(), 2, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeName)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3409,7 +3354,7 @@ func SetVolumeLabel(rootPathName *uint16, volumeName *uint16) (err error) { } func SetVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16) (err error) { - r1, _, e1 := syscall.SyscallN(procSetVolumeMountPointW.Addr(), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName))) + r1, _, e1 := syscall.Syscall(procSetVolumeMountPointW.Addr(), 2, uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3417,7 +3362,7 @@ func SetVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16) (err erro } func SetupComm(handle Handle, dwInQueue uint32, dwOutQueue uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procSetupComm.Addr(), uintptr(handle), uintptr(dwInQueue), uintptr(dwOutQueue)) + r1, _, e1 := syscall.Syscall(procSetupComm.Addr(), 3, uintptr(handle), uintptr(dwInQueue), uintptr(dwOutQueue)) if r1 == 0 { err = errnoErr(e1) } @@ -3425,7 +3370,7 @@ func SetupComm(handle Handle, dwInQueue uint32, dwOutQueue uint32) (err error) { } func SizeofResource(module Handle, resInfo Handle) (size uint32, err error) { - r0, _, e1 := syscall.SyscallN(procSizeofResource.Addr(), uintptr(module), uintptr(resInfo)) + r0, _, e1 := syscall.Syscall(procSizeofResource.Addr(), 2, uintptr(module), uintptr(resInfo), 0) size = uint32(r0) if size == 0 { err = errnoErr(e1) @@ -3438,13 +3383,13 @@ func SleepEx(milliseconds uint32, alertable bool) (ret uint32) { if alertable { _p0 = 1 } - r0, _, _ := syscall.SyscallN(procSleepEx.Addr(), uintptr(milliseconds), uintptr(_p0)) + r0, _, _ := syscall.Syscall(procSleepEx.Addr(), 2, uintptr(milliseconds), uintptr(_p0), 0) ret = uint32(r0) return } func TerminateJobObject(job Handle, exitCode uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procTerminateJobObject.Addr(), uintptr(job), uintptr(exitCode)) + r1, _, e1 := syscall.Syscall(procTerminateJobObject.Addr(), 2, uintptr(job), uintptr(exitCode), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3452,7 +3397,7 @@ func TerminateJobObject(job Handle, exitCode uint32) (err error) { } func TerminateProcess(handle Handle, exitcode uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procTerminateProcess.Addr(), uintptr(handle), uintptr(exitcode)) + r1, _, e1 := syscall.Syscall(procTerminateProcess.Addr(), 2, uintptr(handle), uintptr(exitcode), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3460,7 +3405,7 @@ func TerminateProcess(handle Handle, exitcode uint32) (err error) { } func Thread32First(snapshot Handle, threadEntry *ThreadEntry32) (err error) { - r1, _, e1 := syscall.SyscallN(procThread32First.Addr(), uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry))) + r1, _, e1 := syscall.Syscall(procThread32First.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3468,7 +3413,7 @@ func Thread32First(snapshot Handle, threadEntry *ThreadEntry32) (err error) { } func Thread32Next(snapshot Handle, threadEntry *ThreadEntry32) (err error) { - r1, _, e1 := syscall.SyscallN(procThread32Next.Addr(), uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry))) + r1, _, e1 := syscall.Syscall(procThread32Next.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(threadEntry)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3476,7 +3421,7 @@ func Thread32Next(snapshot Handle, threadEntry *ThreadEntry32) (err error) { } func UnlockFileEx(file Handle, reserved uint32, bytesLow uint32, bytesHigh uint32, overlapped *Overlapped) (err error) { - r1, _, e1 := syscall.SyscallN(procUnlockFileEx.Addr(), uintptr(file), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped))) + r1, _, e1 := syscall.Syscall6(procUnlockFileEx.Addr(), 5, uintptr(file), uintptr(reserved), uintptr(bytesLow), uintptr(bytesHigh), uintptr(unsafe.Pointer(overlapped)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3484,7 +3429,7 @@ func UnlockFileEx(file Handle, reserved uint32, bytesLow uint32, bytesHigh uint3 } func UnmapViewOfFile(addr uintptr) (err error) { - r1, _, e1 := syscall.SyscallN(procUnmapViewOfFile.Addr(), uintptr(addr)) + r1, _, e1 := syscall.Syscall(procUnmapViewOfFile.Addr(), 1, uintptr(addr), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -3492,7 +3437,7 @@ func UnmapViewOfFile(addr uintptr) (err error) { } func updateProcThreadAttribute(attrlist *ProcThreadAttributeList, flags uint32, attr uintptr, value unsafe.Pointer, size uintptr, prevvalue unsafe.Pointer, returnedsize *uintptr) (err error) { - r1, _, e1 := syscall.SyscallN(procUpdateProcThreadAttribute.Addr(), uintptr(unsafe.Pointer(attrlist)), uintptr(flags), uintptr(attr), uintptr(value), uintptr(size), uintptr(prevvalue), uintptr(unsafe.Pointer(returnedsize))) + r1, _, e1 := syscall.Syscall9(procUpdateProcThreadAttribute.Addr(), 7, uintptr(unsafe.Pointer(attrlist)), uintptr(flags), uintptr(attr), uintptr(value), uintptr(size), uintptr(prevvalue), uintptr(unsafe.Pointer(returnedsize)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -3500,7 +3445,7 @@ func updateProcThreadAttribute(attrlist *ProcThreadAttributeList, flags uint32, } func VirtualAlloc(address uintptr, size uintptr, alloctype uint32, protect uint32) (value uintptr, err error) { - r0, _, e1 := syscall.SyscallN(procVirtualAlloc.Addr(), uintptr(address), uintptr(size), uintptr(alloctype), uintptr(protect)) + r0, _, e1 := syscall.Syscall6(procVirtualAlloc.Addr(), 4, uintptr(address), uintptr(size), uintptr(alloctype), uintptr(protect), 0, 0) value = uintptr(r0) if value == 0 { err = errnoErr(e1) @@ -3509,7 +3454,7 @@ func VirtualAlloc(address uintptr, size uintptr, alloctype uint32, protect uint3 } func VirtualFree(address uintptr, size uintptr, freetype uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procVirtualFree.Addr(), uintptr(address), uintptr(size), uintptr(freetype)) + r1, _, e1 := syscall.Syscall(procVirtualFree.Addr(), 3, uintptr(address), uintptr(size), uintptr(freetype)) if r1 == 0 { err = errnoErr(e1) } @@ -3517,7 +3462,7 @@ func VirtualFree(address uintptr, size uintptr, freetype uint32) (err error) { } func VirtualLock(addr uintptr, length uintptr) (err error) { - r1, _, e1 := syscall.SyscallN(procVirtualLock.Addr(), uintptr(addr), uintptr(length)) + r1, _, e1 := syscall.Syscall(procVirtualLock.Addr(), 2, uintptr(addr), uintptr(length), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3525,7 +3470,7 @@ func VirtualLock(addr uintptr, length uintptr) (err error) { } func VirtualProtect(address uintptr, size uintptr, newprotect uint32, oldprotect *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procVirtualProtect.Addr(), uintptr(address), uintptr(size), uintptr(newprotect), uintptr(unsafe.Pointer(oldprotect))) + r1, _, e1 := syscall.Syscall6(procVirtualProtect.Addr(), 4, uintptr(address), uintptr(size), uintptr(newprotect), uintptr(unsafe.Pointer(oldprotect)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -3533,7 +3478,7 @@ func VirtualProtect(address uintptr, size uintptr, newprotect uint32, oldprotect } func VirtualProtectEx(process Handle, address uintptr, size uintptr, newProtect uint32, oldProtect *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procVirtualProtectEx.Addr(), uintptr(process), uintptr(address), uintptr(size), uintptr(newProtect), uintptr(unsafe.Pointer(oldProtect))) + r1, _, e1 := syscall.Syscall6(procVirtualProtectEx.Addr(), 5, uintptr(process), uintptr(address), uintptr(size), uintptr(newProtect), uintptr(unsafe.Pointer(oldProtect)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3541,7 +3486,7 @@ func VirtualProtectEx(process Handle, address uintptr, size uintptr, newProtect } func VirtualQuery(address uintptr, buffer *MemoryBasicInformation, length uintptr) (err error) { - r1, _, e1 := syscall.SyscallN(procVirtualQuery.Addr(), uintptr(address), uintptr(unsafe.Pointer(buffer)), uintptr(length)) + r1, _, e1 := syscall.Syscall(procVirtualQuery.Addr(), 3, uintptr(address), uintptr(unsafe.Pointer(buffer)), uintptr(length)) if r1 == 0 { err = errnoErr(e1) } @@ -3549,7 +3494,7 @@ func VirtualQuery(address uintptr, buffer *MemoryBasicInformation, length uintpt } func VirtualQueryEx(process Handle, address uintptr, buffer *MemoryBasicInformation, length uintptr) (err error) { - r1, _, e1 := syscall.SyscallN(procVirtualQueryEx.Addr(), uintptr(process), uintptr(address), uintptr(unsafe.Pointer(buffer)), uintptr(length)) + r1, _, e1 := syscall.Syscall6(procVirtualQueryEx.Addr(), 4, uintptr(process), uintptr(address), uintptr(unsafe.Pointer(buffer)), uintptr(length), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -3557,7 +3502,7 @@ func VirtualQueryEx(process Handle, address uintptr, buffer *MemoryBasicInformat } func VirtualUnlock(addr uintptr, length uintptr) (err error) { - r1, _, e1 := syscall.SyscallN(procVirtualUnlock.Addr(), uintptr(addr), uintptr(length)) + r1, _, e1 := syscall.Syscall(procVirtualUnlock.Addr(), 2, uintptr(addr), uintptr(length), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3565,13 +3510,13 @@ func VirtualUnlock(addr uintptr, length uintptr) (err error) { } func WTSGetActiveConsoleSessionId() (sessionID uint32) { - r0, _, _ := syscall.SyscallN(procWTSGetActiveConsoleSessionId.Addr()) + r0, _, _ := syscall.Syscall(procWTSGetActiveConsoleSessionId.Addr(), 0, 0, 0, 0) sessionID = uint32(r0) return } func WaitCommEvent(handle Handle, lpEvtMask *uint32, lpOverlapped *Overlapped) (err error) { - r1, _, e1 := syscall.SyscallN(procWaitCommEvent.Addr(), uintptr(handle), uintptr(unsafe.Pointer(lpEvtMask)), uintptr(unsafe.Pointer(lpOverlapped))) + r1, _, e1 := syscall.Syscall(procWaitCommEvent.Addr(), 3, uintptr(handle), uintptr(unsafe.Pointer(lpEvtMask)), uintptr(unsafe.Pointer(lpOverlapped))) if r1 == 0 { err = errnoErr(e1) } @@ -3583,7 +3528,7 @@ func waitForMultipleObjects(count uint32, handles uintptr, waitAll bool, waitMil if waitAll { _p0 = 1 } - r0, _, e1 := syscall.SyscallN(procWaitForMultipleObjects.Addr(), uintptr(count), uintptr(handles), uintptr(_p0), uintptr(waitMilliseconds)) + r0, _, e1 := syscall.Syscall6(procWaitForMultipleObjects.Addr(), 4, uintptr(count), uintptr(handles), uintptr(_p0), uintptr(waitMilliseconds), 0, 0) event = uint32(r0) if event == 0xffffffff { err = errnoErr(e1) @@ -3592,7 +3537,7 @@ func waitForMultipleObjects(count uint32, handles uintptr, waitAll bool, waitMil } func WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, err error) { - r0, _, e1 := syscall.SyscallN(procWaitForSingleObject.Addr(), uintptr(handle), uintptr(waitMilliseconds)) + r0, _, e1 := syscall.Syscall(procWaitForSingleObject.Addr(), 2, uintptr(handle), uintptr(waitMilliseconds), 0) event = uint32(r0) if event == 0xffffffff { err = errnoErr(e1) @@ -3601,7 +3546,7 @@ func WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, } func WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error) { - r1, _, e1 := syscall.SyscallN(procWriteConsoleW.Addr(), uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(towrite), uintptr(unsafe.Pointer(written)), uintptr(unsafe.Pointer(reserved))) + r1, _, e1 := syscall.Syscall6(procWriteConsoleW.Addr(), 5, uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(towrite), uintptr(unsafe.Pointer(written)), uintptr(unsafe.Pointer(reserved)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3613,7 +3558,7 @@ func writeFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) if len(buf) > 0 { _p0 = &buf[0] } - r1, _, e1 := syscall.SyscallN(procWriteFile.Addr(), uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped))) + r1, _, e1 := syscall.Syscall6(procWriteFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3621,7 +3566,7 @@ func writeFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) } func WriteProcessMemory(process Handle, baseAddress uintptr, buffer *byte, size uintptr, numberOfBytesWritten *uintptr) (err error) { - r1, _, e1 := syscall.SyscallN(procWriteProcessMemory.Addr(), uintptr(process), uintptr(baseAddress), uintptr(unsafe.Pointer(buffer)), uintptr(size), uintptr(unsafe.Pointer(numberOfBytesWritten))) + r1, _, e1 := syscall.Syscall6(procWriteProcessMemory.Addr(), 5, uintptr(process), uintptr(baseAddress), uintptr(unsafe.Pointer(buffer)), uintptr(size), uintptr(unsafe.Pointer(numberOfBytesWritten)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3629,7 +3574,7 @@ func WriteProcessMemory(process Handle, baseAddress uintptr, buffer *byte, size } func AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, recvd *uint32, overlapped *Overlapped) (err error) { - r1, _, e1 := syscall.SyscallN(procAcceptEx.Addr(), uintptr(ls), uintptr(as), uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(overlapped))) + r1, _, e1 := syscall.Syscall9(procAcceptEx.Addr(), 8, uintptr(ls), uintptr(as), uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(overlapped)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3637,12 +3582,12 @@ func AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32 } func GetAcceptExSockaddrs(buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, lrsa **RawSockaddrAny, lrsalen *int32, rrsa **RawSockaddrAny, rrsalen *int32) { - syscall.SyscallN(procGetAcceptExSockaddrs.Addr(), uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(lrsa)), uintptr(unsafe.Pointer(lrsalen)), uintptr(unsafe.Pointer(rrsa)), uintptr(unsafe.Pointer(rrsalen))) + syscall.Syscall9(procGetAcceptExSockaddrs.Addr(), 8, uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(lrsa)), uintptr(unsafe.Pointer(lrsalen)), uintptr(unsafe.Pointer(rrsa)), uintptr(unsafe.Pointer(rrsalen)), 0) return } func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procTransmitFile.Addr(), uintptr(s), uintptr(handle), uintptr(bytesToWrite), uintptr(bytsPerSend), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(transmitFileBuf)), uintptr(flags)) + r1, _, e1 := syscall.Syscall9(procTransmitFile.Addr(), 7, uintptr(s), uintptr(handle), uintptr(bytesToWrite), uintptr(bytsPerSend), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(transmitFileBuf)), uintptr(flags), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -3650,7 +3595,7 @@ func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint } func NetApiBufferFree(buf *byte) (neterr error) { - r0, _, _ := syscall.SyscallN(procNetApiBufferFree.Addr(), uintptr(unsafe.Pointer(buf))) + r0, _, _ := syscall.Syscall(procNetApiBufferFree.Addr(), 1, uintptr(unsafe.Pointer(buf)), 0, 0) if r0 != 0 { neterr = syscall.Errno(r0) } @@ -3658,7 +3603,7 @@ func NetApiBufferFree(buf *byte) (neterr error) { } func NetGetJoinInformation(server *uint16, name **uint16, bufType *uint32) (neterr error) { - r0, _, _ := syscall.SyscallN(procNetGetJoinInformation.Addr(), uintptr(unsafe.Pointer(server)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(bufType))) + r0, _, _ := syscall.Syscall(procNetGetJoinInformation.Addr(), 3, uintptr(unsafe.Pointer(server)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(bufType))) if r0 != 0 { neterr = syscall.Errno(r0) } @@ -3666,7 +3611,7 @@ func NetGetJoinInformation(server *uint16, name **uint16, bufType *uint32) (nete } func NetUserEnum(serverName *uint16, level uint32, filter uint32, buf **byte, prefMaxLen uint32, entriesRead *uint32, totalEntries *uint32, resumeHandle *uint32) (neterr error) { - r0, _, _ := syscall.SyscallN(procNetUserEnum.Addr(), uintptr(unsafe.Pointer(serverName)), uintptr(level), uintptr(filter), uintptr(unsafe.Pointer(buf)), uintptr(prefMaxLen), uintptr(unsafe.Pointer(entriesRead)), uintptr(unsafe.Pointer(totalEntries)), uintptr(unsafe.Pointer(resumeHandle))) + r0, _, _ := syscall.Syscall9(procNetUserEnum.Addr(), 8, uintptr(unsafe.Pointer(serverName)), uintptr(level), uintptr(filter), uintptr(unsafe.Pointer(buf)), uintptr(prefMaxLen), uintptr(unsafe.Pointer(entriesRead)), uintptr(unsafe.Pointer(totalEntries)), uintptr(unsafe.Pointer(resumeHandle)), 0) if r0 != 0 { neterr = syscall.Errno(r0) } @@ -3674,7 +3619,7 @@ func NetUserEnum(serverName *uint16, level uint32, filter uint32, buf **byte, pr } func NetUserGetInfo(serverName *uint16, userName *uint16, level uint32, buf **byte) (neterr error) { - r0, _, _ := syscall.SyscallN(procNetUserGetInfo.Addr(), uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(userName)), uintptr(level), uintptr(unsafe.Pointer(buf))) + r0, _, _ := syscall.Syscall6(procNetUserGetInfo.Addr(), 4, uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(userName)), uintptr(level), uintptr(unsafe.Pointer(buf)), 0, 0) if r0 != 0 { neterr = syscall.Errno(r0) } @@ -3682,7 +3627,7 @@ func NetUserGetInfo(serverName *uint16, userName *uint16, level uint32, buf **by } func NtCreateFile(handle *Handle, access uint32, oa *OBJECT_ATTRIBUTES, iosb *IO_STATUS_BLOCK, allocationSize *int64, attributes uint32, share uint32, disposition uint32, options uint32, eabuffer uintptr, ealength uint32) (ntstatus error) { - r0, _, _ := syscall.SyscallN(procNtCreateFile.Addr(), uintptr(unsafe.Pointer(handle)), uintptr(access), uintptr(unsafe.Pointer(oa)), uintptr(unsafe.Pointer(iosb)), uintptr(unsafe.Pointer(allocationSize)), uintptr(attributes), uintptr(share), uintptr(disposition), uintptr(options), uintptr(eabuffer), uintptr(ealength)) + r0, _, _ := syscall.Syscall12(procNtCreateFile.Addr(), 11, uintptr(unsafe.Pointer(handle)), uintptr(access), uintptr(unsafe.Pointer(oa)), uintptr(unsafe.Pointer(iosb)), uintptr(unsafe.Pointer(allocationSize)), uintptr(attributes), uintptr(share), uintptr(disposition), uintptr(options), uintptr(eabuffer), uintptr(ealength), 0) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -3690,7 +3635,7 @@ func NtCreateFile(handle *Handle, access uint32, oa *OBJECT_ATTRIBUTES, iosb *IO } func NtCreateNamedPipeFile(pipe *Handle, access uint32, oa *OBJECT_ATTRIBUTES, iosb *IO_STATUS_BLOCK, share uint32, disposition uint32, options uint32, typ uint32, readMode uint32, completionMode uint32, maxInstances uint32, inboundQuota uint32, outputQuota uint32, timeout *int64) (ntstatus error) { - r0, _, _ := syscall.SyscallN(procNtCreateNamedPipeFile.Addr(), uintptr(unsafe.Pointer(pipe)), uintptr(access), uintptr(unsafe.Pointer(oa)), uintptr(unsafe.Pointer(iosb)), uintptr(share), uintptr(disposition), uintptr(options), uintptr(typ), uintptr(readMode), uintptr(completionMode), uintptr(maxInstances), uintptr(inboundQuota), uintptr(outputQuota), uintptr(unsafe.Pointer(timeout))) + r0, _, _ := syscall.Syscall15(procNtCreateNamedPipeFile.Addr(), 14, uintptr(unsafe.Pointer(pipe)), uintptr(access), uintptr(unsafe.Pointer(oa)), uintptr(unsafe.Pointer(iosb)), uintptr(share), uintptr(disposition), uintptr(options), uintptr(typ), uintptr(readMode), uintptr(completionMode), uintptr(maxInstances), uintptr(inboundQuota), uintptr(outputQuota), uintptr(unsafe.Pointer(timeout)), 0) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -3698,7 +3643,7 @@ func NtCreateNamedPipeFile(pipe *Handle, access uint32, oa *OBJECT_ATTRIBUTES, i } func NtQueryInformationProcess(proc Handle, procInfoClass int32, procInfo unsafe.Pointer, procInfoLen uint32, retLen *uint32) (ntstatus error) { - r0, _, _ := syscall.SyscallN(procNtQueryInformationProcess.Addr(), uintptr(proc), uintptr(procInfoClass), uintptr(procInfo), uintptr(procInfoLen), uintptr(unsafe.Pointer(retLen))) + r0, _, _ := syscall.Syscall6(procNtQueryInformationProcess.Addr(), 5, uintptr(proc), uintptr(procInfoClass), uintptr(procInfo), uintptr(procInfoLen), uintptr(unsafe.Pointer(retLen)), 0) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -3706,7 +3651,7 @@ func NtQueryInformationProcess(proc Handle, procInfoClass int32, procInfo unsafe } func NtQuerySystemInformation(sysInfoClass int32, sysInfo unsafe.Pointer, sysInfoLen uint32, retLen *uint32) (ntstatus error) { - r0, _, _ := syscall.SyscallN(procNtQuerySystemInformation.Addr(), uintptr(sysInfoClass), uintptr(sysInfo), uintptr(sysInfoLen), uintptr(unsafe.Pointer(retLen))) + r0, _, _ := syscall.Syscall6(procNtQuerySystemInformation.Addr(), 4, uintptr(sysInfoClass), uintptr(sysInfo), uintptr(sysInfoLen), uintptr(unsafe.Pointer(retLen)), 0, 0) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -3714,7 +3659,7 @@ func NtQuerySystemInformation(sysInfoClass int32, sysInfo unsafe.Pointer, sysInf } func NtSetInformationFile(handle Handle, iosb *IO_STATUS_BLOCK, inBuffer *byte, inBufferLen uint32, class uint32) (ntstatus error) { - r0, _, _ := syscall.SyscallN(procNtSetInformationFile.Addr(), uintptr(handle), uintptr(unsafe.Pointer(iosb)), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferLen), uintptr(class)) + r0, _, _ := syscall.Syscall6(procNtSetInformationFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(iosb)), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferLen), uintptr(class), 0) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -3722,7 +3667,7 @@ func NtSetInformationFile(handle Handle, iosb *IO_STATUS_BLOCK, inBuffer *byte, } func NtSetInformationProcess(proc Handle, procInfoClass int32, procInfo unsafe.Pointer, procInfoLen uint32) (ntstatus error) { - r0, _, _ := syscall.SyscallN(procNtSetInformationProcess.Addr(), uintptr(proc), uintptr(procInfoClass), uintptr(procInfo), uintptr(procInfoLen)) + r0, _, _ := syscall.Syscall6(procNtSetInformationProcess.Addr(), 4, uintptr(proc), uintptr(procInfoClass), uintptr(procInfo), uintptr(procInfoLen), 0, 0) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -3730,7 +3675,7 @@ func NtSetInformationProcess(proc Handle, procInfoClass int32, procInfo unsafe.P } func NtSetSystemInformation(sysInfoClass int32, sysInfo unsafe.Pointer, sysInfoLen uint32) (ntstatus error) { - r0, _, _ := syscall.SyscallN(procNtSetSystemInformation.Addr(), uintptr(sysInfoClass), uintptr(sysInfo), uintptr(sysInfoLen)) + r0, _, _ := syscall.Syscall(procNtSetSystemInformation.Addr(), 3, uintptr(sysInfoClass), uintptr(sysInfo), uintptr(sysInfoLen)) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -3738,13 +3683,13 @@ func NtSetSystemInformation(sysInfoClass int32, sysInfo unsafe.Pointer, sysInfoL } func RtlAddFunctionTable(functionTable *RUNTIME_FUNCTION, entryCount uint32, baseAddress uintptr) (ret bool) { - r0, _, _ := syscall.SyscallN(procRtlAddFunctionTable.Addr(), uintptr(unsafe.Pointer(functionTable)), uintptr(entryCount), uintptr(baseAddress)) + r0, _, _ := syscall.Syscall(procRtlAddFunctionTable.Addr(), 3, uintptr(unsafe.Pointer(functionTable)), uintptr(entryCount), uintptr(baseAddress)) ret = r0 != 0 return } func RtlDefaultNpAcl(acl **ACL) (ntstatus error) { - r0, _, _ := syscall.SyscallN(procRtlDefaultNpAcl.Addr(), uintptr(unsafe.Pointer(acl))) + r0, _, _ := syscall.Syscall(procRtlDefaultNpAcl.Addr(), 1, uintptr(unsafe.Pointer(acl)), 0, 0) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -3752,13 +3697,13 @@ func RtlDefaultNpAcl(acl **ACL) (ntstatus error) { } func RtlDeleteFunctionTable(functionTable *RUNTIME_FUNCTION) (ret bool) { - r0, _, _ := syscall.SyscallN(procRtlDeleteFunctionTable.Addr(), uintptr(unsafe.Pointer(functionTable))) + r0, _, _ := syscall.Syscall(procRtlDeleteFunctionTable.Addr(), 1, uintptr(unsafe.Pointer(functionTable)), 0, 0) ret = r0 != 0 return } func RtlDosPathNameToNtPathName(dosName *uint16, ntName *NTUnicodeString, ntFileNamePart *uint16, relativeName *RTL_RELATIVE_NAME) (ntstatus error) { - r0, _, _ := syscall.SyscallN(procRtlDosPathNameToNtPathName_U_WithStatus.Addr(), uintptr(unsafe.Pointer(dosName)), uintptr(unsafe.Pointer(ntName)), uintptr(unsafe.Pointer(ntFileNamePart)), uintptr(unsafe.Pointer(relativeName))) + r0, _, _ := syscall.Syscall6(procRtlDosPathNameToNtPathName_U_WithStatus.Addr(), 4, uintptr(unsafe.Pointer(dosName)), uintptr(unsafe.Pointer(ntName)), uintptr(unsafe.Pointer(ntFileNamePart)), uintptr(unsafe.Pointer(relativeName)), 0, 0) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -3766,7 +3711,7 @@ func RtlDosPathNameToNtPathName(dosName *uint16, ntName *NTUnicodeString, ntFile } func RtlDosPathNameToRelativeNtPathName(dosName *uint16, ntName *NTUnicodeString, ntFileNamePart *uint16, relativeName *RTL_RELATIVE_NAME) (ntstatus error) { - r0, _, _ := syscall.SyscallN(procRtlDosPathNameToRelativeNtPathName_U_WithStatus.Addr(), uintptr(unsafe.Pointer(dosName)), uintptr(unsafe.Pointer(ntName)), uintptr(unsafe.Pointer(ntFileNamePart)), uintptr(unsafe.Pointer(relativeName))) + r0, _, _ := syscall.Syscall6(procRtlDosPathNameToRelativeNtPathName_U_WithStatus.Addr(), 4, uintptr(unsafe.Pointer(dosName)), uintptr(unsafe.Pointer(ntName)), uintptr(unsafe.Pointer(ntFileNamePart)), uintptr(unsafe.Pointer(relativeName)), 0, 0) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -3774,18 +3719,18 @@ func RtlDosPathNameToRelativeNtPathName(dosName *uint16, ntName *NTUnicodeString } func RtlGetCurrentPeb() (peb *PEB) { - r0, _, _ := syscall.SyscallN(procRtlGetCurrentPeb.Addr()) + r0, _, _ := syscall.Syscall(procRtlGetCurrentPeb.Addr(), 0, 0, 0, 0) peb = (*PEB)(unsafe.Pointer(r0)) return } func rtlGetNtVersionNumbers(majorVersion *uint32, minorVersion *uint32, buildNumber *uint32) { - syscall.SyscallN(procRtlGetNtVersionNumbers.Addr(), uintptr(unsafe.Pointer(majorVersion)), uintptr(unsafe.Pointer(minorVersion)), uintptr(unsafe.Pointer(buildNumber))) + syscall.Syscall(procRtlGetNtVersionNumbers.Addr(), 3, uintptr(unsafe.Pointer(majorVersion)), uintptr(unsafe.Pointer(minorVersion)), uintptr(unsafe.Pointer(buildNumber))) return } func rtlGetVersion(info *OsVersionInfoEx) (ntstatus error) { - r0, _, _ := syscall.SyscallN(procRtlGetVersion.Addr(), uintptr(unsafe.Pointer(info))) + r0, _, _ := syscall.Syscall(procRtlGetVersion.Addr(), 1, uintptr(unsafe.Pointer(info)), 0, 0) if r0 != 0 { ntstatus = NTStatus(r0) } @@ -3793,23 +3738,23 @@ func rtlGetVersion(info *OsVersionInfoEx) (ntstatus error) { } func RtlInitString(destinationString *NTString, sourceString *byte) { - syscall.SyscallN(procRtlInitString.Addr(), uintptr(unsafe.Pointer(destinationString)), uintptr(unsafe.Pointer(sourceString))) + syscall.Syscall(procRtlInitString.Addr(), 2, uintptr(unsafe.Pointer(destinationString)), uintptr(unsafe.Pointer(sourceString)), 0) return } func RtlInitUnicodeString(destinationString *NTUnicodeString, sourceString *uint16) { - syscall.SyscallN(procRtlInitUnicodeString.Addr(), uintptr(unsafe.Pointer(destinationString)), uintptr(unsafe.Pointer(sourceString))) + syscall.Syscall(procRtlInitUnicodeString.Addr(), 2, uintptr(unsafe.Pointer(destinationString)), uintptr(unsafe.Pointer(sourceString)), 0) return } func rtlNtStatusToDosErrorNoTeb(ntstatus NTStatus) (ret syscall.Errno) { - r0, _, _ := syscall.SyscallN(procRtlNtStatusToDosErrorNoTeb.Addr(), uintptr(ntstatus)) + r0, _, _ := syscall.Syscall(procRtlNtStatusToDosErrorNoTeb.Addr(), 1, uintptr(ntstatus), 0, 0) ret = syscall.Errno(r0) return } func clsidFromString(lpsz *uint16, pclsid *GUID) (ret error) { - r0, _, _ := syscall.SyscallN(procCLSIDFromString.Addr(), uintptr(unsafe.Pointer(lpsz)), uintptr(unsafe.Pointer(pclsid))) + r0, _, _ := syscall.Syscall(procCLSIDFromString.Addr(), 2, uintptr(unsafe.Pointer(lpsz)), uintptr(unsafe.Pointer(pclsid)), 0) if r0 != 0 { ret = syscall.Errno(r0) } @@ -3817,7 +3762,7 @@ func clsidFromString(lpsz *uint16, pclsid *GUID) (ret error) { } func coCreateGuid(pguid *GUID) (ret error) { - r0, _, _ := syscall.SyscallN(procCoCreateGuid.Addr(), uintptr(unsafe.Pointer(pguid))) + r0, _, _ := syscall.Syscall(procCoCreateGuid.Addr(), 1, uintptr(unsafe.Pointer(pguid)), 0, 0) if r0 != 0 { ret = syscall.Errno(r0) } @@ -3825,7 +3770,7 @@ func coCreateGuid(pguid *GUID) (ret error) { } func CoGetObject(name *uint16, bindOpts *BIND_OPTS3, guid *GUID, functionTable **uintptr) (ret error) { - r0, _, _ := syscall.SyscallN(procCoGetObject.Addr(), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(bindOpts)), uintptr(unsafe.Pointer(guid)), uintptr(unsafe.Pointer(functionTable))) + r0, _, _ := syscall.Syscall6(procCoGetObject.Addr(), 4, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(bindOpts)), uintptr(unsafe.Pointer(guid)), uintptr(unsafe.Pointer(functionTable)), 0, 0) if r0 != 0 { ret = syscall.Errno(r0) } @@ -3833,7 +3778,7 @@ func CoGetObject(name *uint16, bindOpts *BIND_OPTS3, guid *GUID, functionTable * } func CoInitializeEx(reserved uintptr, coInit uint32) (ret error) { - r0, _, _ := syscall.SyscallN(procCoInitializeEx.Addr(), uintptr(reserved), uintptr(coInit)) + r0, _, _ := syscall.Syscall(procCoInitializeEx.Addr(), 2, uintptr(reserved), uintptr(coInit), 0) if r0 != 0 { ret = syscall.Errno(r0) } @@ -3841,23 +3786,23 @@ func CoInitializeEx(reserved uintptr, coInit uint32) (ret error) { } func CoTaskMemFree(address unsafe.Pointer) { - syscall.SyscallN(procCoTaskMemFree.Addr(), uintptr(address)) + syscall.Syscall(procCoTaskMemFree.Addr(), 1, uintptr(address), 0, 0) return } func CoUninitialize() { - syscall.SyscallN(procCoUninitialize.Addr()) + syscall.Syscall(procCoUninitialize.Addr(), 0, 0, 0, 0) return } func stringFromGUID2(rguid *GUID, lpsz *uint16, cchMax int32) (chars int32) { - r0, _, _ := syscall.SyscallN(procStringFromGUID2.Addr(), uintptr(unsafe.Pointer(rguid)), uintptr(unsafe.Pointer(lpsz)), uintptr(cchMax)) + r0, _, _ := syscall.Syscall(procStringFromGUID2.Addr(), 3, uintptr(unsafe.Pointer(rguid)), uintptr(unsafe.Pointer(lpsz)), uintptr(cchMax)) chars = int32(r0) return } func EnumProcessModules(process Handle, module *Handle, cb uint32, cbNeeded *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procEnumProcessModules.Addr(), uintptr(process), uintptr(unsafe.Pointer(module)), uintptr(cb), uintptr(unsafe.Pointer(cbNeeded))) + r1, _, e1 := syscall.Syscall6(procEnumProcessModules.Addr(), 4, uintptr(process), uintptr(unsafe.Pointer(module)), uintptr(cb), uintptr(unsafe.Pointer(cbNeeded)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -3865,7 +3810,7 @@ func EnumProcessModules(process Handle, module *Handle, cb uint32, cbNeeded *uin } func EnumProcessModulesEx(process Handle, module *Handle, cb uint32, cbNeeded *uint32, filterFlag uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procEnumProcessModulesEx.Addr(), uintptr(process), uintptr(unsafe.Pointer(module)), uintptr(cb), uintptr(unsafe.Pointer(cbNeeded)), uintptr(filterFlag)) + r1, _, e1 := syscall.Syscall6(procEnumProcessModulesEx.Addr(), 5, uintptr(process), uintptr(unsafe.Pointer(module)), uintptr(cb), uintptr(unsafe.Pointer(cbNeeded)), uintptr(filterFlag), 0) if r1 == 0 { err = errnoErr(e1) } @@ -3873,7 +3818,7 @@ func EnumProcessModulesEx(process Handle, module *Handle, cb uint32, cbNeeded *u } func enumProcesses(processIds *uint32, nSize uint32, bytesReturned *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procEnumProcesses.Addr(), uintptr(unsafe.Pointer(processIds)), uintptr(nSize), uintptr(unsafe.Pointer(bytesReturned))) + r1, _, e1 := syscall.Syscall(procEnumProcesses.Addr(), 3, uintptr(unsafe.Pointer(processIds)), uintptr(nSize), uintptr(unsafe.Pointer(bytesReturned))) if r1 == 0 { err = errnoErr(e1) } @@ -3881,7 +3826,7 @@ func enumProcesses(processIds *uint32, nSize uint32, bytesReturned *uint32) (err } func GetModuleBaseName(process Handle, module Handle, baseName *uint16, size uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procGetModuleBaseNameW.Addr(), uintptr(process), uintptr(module), uintptr(unsafe.Pointer(baseName)), uintptr(size)) + r1, _, e1 := syscall.Syscall6(procGetModuleBaseNameW.Addr(), 4, uintptr(process), uintptr(module), uintptr(unsafe.Pointer(baseName)), uintptr(size), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -3889,7 +3834,7 @@ func GetModuleBaseName(process Handle, module Handle, baseName *uint16, size uin } func GetModuleFileNameEx(process Handle, module Handle, filename *uint16, size uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procGetModuleFileNameExW.Addr(), uintptr(process), uintptr(module), uintptr(unsafe.Pointer(filename)), uintptr(size)) + r1, _, e1 := syscall.Syscall6(procGetModuleFileNameExW.Addr(), 4, uintptr(process), uintptr(module), uintptr(unsafe.Pointer(filename)), uintptr(size), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -3897,7 +3842,7 @@ func GetModuleFileNameEx(process Handle, module Handle, filename *uint16, size u } func GetModuleInformation(process Handle, module Handle, modinfo *ModuleInfo, cb uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procGetModuleInformation.Addr(), uintptr(process), uintptr(module), uintptr(unsafe.Pointer(modinfo)), uintptr(cb)) + r1, _, e1 := syscall.Syscall6(procGetModuleInformation.Addr(), 4, uintptr(process), uintptr(module), uintptr(unsafe.Pointer(modinfo)), uintptr(cb), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -3905,7 +3850,7 @@ func GetModuleInformation(process Handle, module Handle, modinfo *ModuleInfo, cb } func QueryWorkingSetEx(process Handle, pv uintptr, cb uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procQueryWorkingSetEx.Addr(), uintptr(process), uintptr(pv), uintptr(cb)) + r1, _, e1 := syscall.Syscall(procQueryWorkingSetEx.Addr(), 3, uintptr(process), uintptr(pv), uintptr(cb)) if r1 == 0 { err = errnoErr(e1) } @@ -3917,7 +3862,7 @@ func SubscribeServiceChangeNotifications(service Handle, eventType uint32, callb if ret != nil { return } - r0, _, _ := syscall.SyscallN(procSubscribeServiceChangeNotifications.Addr(), uintptr(service), uintptr(eventType), uintptr(callback), uintptr(callbackCtx), uintptr(unsafe.Pointer(subscription))) + r0, _, _ := syscall.Syscall6(procSubscribeServiceChangeNotifications.Addr(), 5, uintptr(service), uintptr(eventType), uintptr(callback), uintptr(callbackCtx), uintptr(unsafe.Pointer(subscription)), 0) if r0 != 0 { ret = syscall.Errno(r0) } @@ -3929,12 +3874,12 @@ func UnsubscribeServiceChangeNotifications(subscription uintptr) (err error) { if err != nil { return } - syscall.SyscallN(procUnsubscribeServiceChangeNotifications.Addr(), uintptr(subscription)) + syscall.Syscall(procUnsubscribeServiceChangeNotifications.Addr(), 1, uintptr(subscription), 0, 0) return } func GetUserNameEx(nameFormat uint32, nameBuffre *uint16, nSize *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procGetUserNameExW.Addr(), uintptr(nameFormat), uintptr(unsafe.Pointer(nameBuffre)), uintptr(unsafe.Pointer(nSize))) + r1, _, e1 := syscall.Syscall(procGetUserNameExW.Addr(), 3, uintptr(nameFormat), uintptr(unsafe.Pointer(nameBuffre)), uintptr(unsafe.Pointer(nSize))) if r1&0xff == 0 { err = errnoErr(e1) } @@ -3942,7 +3887,7 @@ func GetUserNameEx(nameFormat uint32, nameBuffre *uint16, nSize *uint32) (err er } func TranslateName(accName *uint16, accNameFormat uint32, desiredNameFormat uint32, translatedName *uint16, nSize *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procTranslateNameW.Addr(), uintptr(unsafe.Pointer(accName)), uintptr(accNameFormat), uintptr(desiredNameFormat), uintptr(unsafe.Pointer(translatedName)), uintptr(unsafe.Pointer(nSize))) + r1, _, e1 := syscall.Syscall6(procTranslateNameW.Addr(), 5, uintptr(unsafe.Pointer(accName)), uintptr(accNameFormat), uintptr(desiredNameFormat), uintptr(unsafe.Pointer(translatedName)), uintptr(unsafe.Pointer(nSize)), 0) if r1&0xff == 0 { err = errnoErr(e1) } @@ -3950,7 +3895,7 @@ func TranslateName(accName *uint16, accNameFormat uint32, desiredNameFormat uint } func SetupDiBuildDriverInfoList(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverType SPDIT) (err error) { - r1, _, e1 := syscall.SyscallN(procSetupDiBuildDriverInfoList.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(driverType)) + r1, _, e1 := syscall.Syscall(procSetupDiBuildDriverInfoList.Addr(), 3, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(driverType)) if r1 == 0 { err = errnoErr(e1) } @@ -3958,7 +3903,7 @@ func SetupDiBuildDriverInfoList(deviceInfoSet DevInfo, deviceInfoData *DevInfoDa } func SetupDiCallClassInstaller(installFunction DI_FUNCTION, deviceInfoSet DevInfo, deviceInfoData *DevInfoData) (err error) { - r1, _, e1 := syscall.SyscallN(procSetupDiCallClassInstaller.Addr(), uintptr(installFunction), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData))) + r1, _, e1 := syscall.Syscall(procSetupDiCallClassInstaller.Addr(), 3, uintptr(installFunction), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData))) if r1 == 0 { err = errnoErr(e1) } @@ -3966,7 +3911,7 @@ func SetupDiCallClassInstaller(installFunction DI_FUNCTION, deviceInfoSet DevInf } func SetupDiCancelDriverInfoSearch(deviceInfoSet DevInfo) (err error) { - r1, _, e1 := syscall.SyscallN(procSetupDiCancelDriverInfoSearch.Addr(), uintptr(deviceInfoSet)) + r1, _, e1 := syscall.Syscall(procSetupDiCancelDriverInfoSearch.Addr(), 1, uintptr(deviceInfoSet), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -3974,7 +3919,7 @@ func SetupDiCancelDriverInfoSearch(deviceInfoSet DevInfo) (err error) { } func setupDiClassGuidsFromNameEx(className *uint16, classGuidList *GUID, classGuidListSize uint32, requiredSize *uint32, machineName *uint16, reserved uintptr) (err error) { - r1, _, e1 := syscall.SyscallN(procSetupDiClassGuidsFromNameExW.Addr(), uintptr(unsafe.Pointer(className)), uintptr(unsafe.Pointer(classGuidList)), uintptr(classGuidListSize), uintptr(unsafe.Pointer(requiredSize)), uintptr(unsafe.Pointer(machineName)), uintptr(reserved)) + r1, _, e1 := syscall.Syscall6(procSetupDiClassGuidsFromNameExW.Addr(), 6, uintptr(unsafe.Pointer(className)), uintptr(unsafe.Pointer(classGuidList)), uintptr(classGuidListSize), uintptr(unsafe.Pointer(requiredSize)), uintptr(unsafe.Pointer(machineName)), uintptr(reserved)) if r1 == 0 { err = errnoErr(e1) } @@ -3982,7 +3927,7 @@ func setupDiClassGuidsFromNameEx(className *uint16, classGuidList *GUID, classGu } func setupDiClassNameFromGuidEx(classGUID *GUID, className *uint16, classNameSize uint32, requiredSize *uint32, machineName *uint16, reserved uintptr) (err error) { - r1, _, e1 := syscall.SyscallN(procSetupDiClassNameFromGuidExW.Addr(), uintptr(unsafe.Pointer(classGUID)), uintptr(unsafe.Pointer(className)), uintptr(classNameSize), uintptr(unsafe.Pointer(requiredSize)), uintptr(unsafe.Pointer(machineName)), uintptr(reserved)) + r1, _, e1 := syscall.Syscall6(procSetupDiClassNameFromGuidExW.Addr(), 6, uintptr(unsafe.Pointer(classGUID)), uintptr(unsafe.Pointer(className)), uintptr(classNameSize), uintptr(unsafe.Pointer(requiredSize)), uintptr(unsafe.Pointer(machineName)), uintptr(reserved)) if r1 == 0 { err = errnoErr(e1) } @@ -3990,7 +3935,7 @@ func setupDiClassNameFromGuidEx(classGUID *GUID, className *uint16, classNameSiz } func setupDiCreateDeviceInfoListEx(classGUID *GUID, hwndParent uintptr, machineName *uint16, reserved uintptr) (handle DevInfo, err error) { - r0, _, e1 := syscall.SyscallN(procSetupDiCreateDeviceInfoListExW.Addr(), uintptr(unsafe.Pointer(classGUID)), uintptr(hwndParent), uintptr(unsafe.Pointer(machineName)), uintptr(reserved)) + r0, _, e1 := syscall.Syscall6(procSetupDiCreateDeviceInfoListExW.Addr(), 4, uintptr(unsafe.Pointer(classGUID)), uintptr(hwndParent), uintptr(unsafe.Pointer(machineName)), uintptr(reserved), 0, 0) handle = DevInfo(r0) if handle == DevInfo(InvalidHandle) { err = errnoErr(e1) @@ -3999,7 +3944,7 @@ func setupDiCreateDeviceInfoListEx(classGUID *GUID, hwndParent uintptr, machineN } func setupDiCreateDeviceInfo(deviceInfoSet DevInfo, DeviceName *uint16, classGUID *GUID, DeviceDescription *uint16, hwndParent uintptr, CreationFlags DICD, deviceInfoData *DevInfoData) (err error) { - r1, _, e1 := syscall.SyscallN(procSetupDiCreateDeviceInfoW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(DeviceName)), uintptr(unsafe.Pointer(classGUID)), uintptr(unsafe.Pointer(DeviceDescription)), uintptr(hwndParent), uintptr(CreationFlags), uintptr(unsafe.Pointer(deviceInfoData))) + r1, _, e1 := syscall.Syscall9(procSetupDiCreateDeviceInfoW.Addr(), 7, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(DeviceName)), uintptr(unsafe.Pointer(classGUID)), uintptr(unsafe.Pointer(DeviceDescription)), uintptr(hwndParent), uintptr(CreationFlags), uintptr(unsafe.Pointer(deviceInfoData)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -4007,7 +3952,7 @@ func setupDiCreateDeviceInfo(deviceInfoSet DevInfo, DeviceName *uint16, classGUI } func SetupDiDestroyDeviceInfoList(deviceInfoSet DevInfo) (err error) { - r1, _, e1 := syscall.SyscallN(procSetupDiDestroyDeviceInfoList.Addr(), uintptr(deviceInfoSet)) + r1, _, e1 := syscall.Syscall(procSetupDiDestroyDeviceInfoList.Addr(), 1, uintptr(deviceInfoSet), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -4015,7 +3960,7 @@ func SetupDiDestroyDeviceInfoList(deviceInfoSet DevInfo) (err error) { } func SetupDiDestroyDriverInfoList(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverType SPDIT) (err error) { - r1, _, e1 := syscall.SyscallN(procSetupDiDestroyDriverInfoList.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(driverType)) + r1, _, e1 := syscall.Syscall(procSetupDiDestroyDriverInfoList.Addr(), 3, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(driverType)) if r1 == 0 { err = errnoErr(e1) } @@ -4023,7 +3968,7 @@ func SetupDiDestroyDriverInfoList(deviceInfoSet DevInfo, deviceInfoData *DevInfo } func setupDiEnumDeviceInfo(deviceInfoSet DevInfo, memberIndex uint32, deviceInfoData *DevInfoData) (err error) { - r1, _, e1 := syscall.SyscallN(procSetupDiEnumDeviceInfo.Addr(), uintptr(deviceInfoSet), uintptr(memberIndex), uintptr(unsafe.Pointer(deviceInfoData))) + r1, _, e1 := syscall.Syscall(procSetupDiEnumDeviceInfo.Addr(), 3, uintptr(deviceInfoSet), uintptr(memberIndex), uintptr(unsafe.Pointer(deviceInfoData))) if r1 == 0 { err = errnoErr(e1) } @@ -4031,7 +3976,7 @@ func setupDiEnumDeviceInfo(deviceInfoSet DevInfo, memberIndex uint32, deviceInfo } func setupDiEnumDriverInfo(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverType SPDIT, memberIndex uint32, driverInfoData *DrvInfoData) (err error) { - r1, _, e1 := syscall.SyscallN(procSetupDiEnumDriverInfoW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(driverType), uintptr(memberIndex), uintptr(unsafe.Pointer(driverInfoData))) + r1, _, e1 := syscall.Syscall6(procSetupDiEnumDriverInfoW.Addr(), 5, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(driverType), uintptr(memberIndex), uintptr(unsafe.Pointer(driverInfoData)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -4039,7 +3984,7 @@ func setupDiEnumDriverInfo(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, d } func setupDiGetClassDevsEx(classGUID *GUID, Enumerator *uint16, hwndParent uintptr, Flags DIGCF, deviceInfoSet DevInfo, machineName *uint16, reserved uintptr) (handle DevInfo, err error) { - r0, _, e1 := syscall.SyscallN(procSetupDiGetClassDevsExW.Addr(), uintptr(unsafe.Pointer(classGUID)), uintptr(unsafe.Pointer(Enumerator)), uintptr(hwndParent), uintptr(Flags), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(machineName)), uintptr(reserved)) + r0, _, e1 := syscall.Syscall9(procSetupDiGetClassDevsExW.Addr(), 7, uintptr(unsafe.Pointer(classGUID)), uintptr(unsafe.Pointer(Enumerator)), uintptr(hwndParent), uintptr(Flags), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(machineName)), uintptr(reserved), 0, 0) handle = DevInfo(r0) if handle == DevInfo(InvalidHandle) { err = errnoErr(e1) @@ -4048,7 +3993,7 @@ func setupDiGetClassDevsEx(classGUID *GUID, Enumerator *uint16, hwndParent uintp } func SetupDiGetClassInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, classInstallParams *ClassInstallHeader, classInstallParamsSize uint32, requiredSize *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procSetupDiGetClassInstallParamsW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(classInstallParams)), uintptr(classInstallParamsSize), uintptr(unsafe.Pointer(requiredSize))) + r1, _, e1 := syscall.Syscall6(procSetupDiGetClassInstallParamsW.Addr(), 5, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(classInstallParams)), uintptr(classInstallParamsSize), uintptr(unsafe.Pointer(requiredSize)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -4056,7 +4001,7 @@ func SetupDiGetClassInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfo } func setupDiGetDeviceInfoListDetail(deviceInfoSet DevInfo, deviceInfoSetDetailData *DevInfoListDetailData) (err error) { - r1, _, e1 := syscall.SyscallN(procSetupDiGetDeviceInfoListDetailW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoSetDetailData))) + r1, _, e1 := syscall.Syscall(procSetupDiGetDeviceInfoListDetailW.Addr(), 2, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoSetDetailData)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -4064,7 +4009,7 @@ func setupDiGetDeviceInfoListDetail(deviceInfoSet DevInfo, deviceInfoSetDetailDa } func setupDiGetDeviceInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, deviceInstallParams *DevInstallParams) (err error) { - r1, _, e1 := syscall.SyscallN(procSetupDiGetDeviceInstallParamsW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(deviceInstallParams))) + r1, _, e1 := syscall.Syscall(procSetupDiGetDeviceInstallParamsW.Addr(), 3, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(deviceInstallParams))) if r1 == 0 { err = errnoErr(e1) } @@ -4072,7 +4017,7 @@ func setupDiGetDeviceInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInf } func setupDiGetDeviceInstanceId(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, instanceId *uint16, instanceIdSize uint32, instanceIdRequiredSize *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procSetupDiGetDeviceInstanceIdW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(instanceId)), uintptr(instanceIdSize), uintptr(unsafe.Pointer(instanceIdRequiredSize))) + r1, _, e1 := syscall.Syscall6(procSetupDiGetDeviceInstanceIdW.Addr(), 5, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(instanceId)), uintptr(instanceIdSize), uintptr(unsafe.Pointer(instanceIdRequiredSize)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -4080,7 +4025,7 @@ func setupDiGetDeviceInstanceId(deviceInfoSet DevInfo, deviceInfoData *DevInfoDa } func setupDiGetDeviceProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, propertyKey *DEVPROPKEY, propertyType *DEVPROPTYPE, propertyBuffer *byte, propertyBufferSize uint32, requiredSize *uint32, flags uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procSetupDiGetDevicePropertyW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(propertyKey)), uintptr(unsafe.Pointer(propertyType)), uintptr(unsafe.Pointer(propertyBuffer)), uintptr(propertyBufferSize), uintptr(unsafe.Pointer(requiredSize)), uintptr(flags)) + r1, _, e1 := syscall.Syscall9(procSetupDiGetDevicePropertyW.Addr(), 8, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(propertyKey)), uintptr(unsafe.Pointer(propertyType)), uintptr(unsafe.Pointer(propertyBuffer)), uintptr(propertyBufferSize), uintptr(unsafe.Pointer(requiredSize)), uintptr(flags), 0) if r1 == 0 { err = errnoErr(e1) } @@ -4088,7 +4033,7 @@ func setupDiGetDeviceProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData } func setupDiGetDeviceRegistryProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, property SPDRP, propertyRegDataType *uint32, propertyBuffer *byte, propertyBufferSize uint32, requiredSize *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procSetupDiGetDeviceRegistryPropertyW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(property), uintptr(unsafe.Pointer(propertyRegDataType)), uintptr(unsafe.Pointer(propertyBuffer)), uintptr(propertyBufferSize), uintptr(unsafe.Pointer(requiredSize))) + r1, _, e1 := syscall.Syscall9(procSetupDiGetDeviceRegistryPropertyW.Addr(), 7, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(property), uintptr(unsafe.Pointer(propertyRegDataType)), uintptr(unsafe.Pointer(propertyBuffer)), uintptr(propertyBufferSize), uintptr(unsafe.Pointer(requiredSize)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -4096,7 +4041,7 @@ func setupDiGetDeviceRegistryProperty(deviceInfoSet DevInfo, deviceInfoData *Dev } func setupDiGetDriverInfoDetail(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverInfoData *DrvInfoData, driverInfoDetailData *DrvInfoDetailData, driverInfoDetailDataSize uint32, requiredSize *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procSetupDiGetDriverInfoDetailW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(driverInfoData)), uintptr(unsafe.Pointer(driverInfoDetailData)), uintptr(driverInfoDetailDataSize), uintptr(unsafe.Pointer(requiredSize))) + r1, _, e1 := syscall.Syscall6(procSetupDiGetDriverInfoDetailW.Addr(), 6, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(driverInfoData)), uintptr(unsafe.Pointer(driverInfoDetailData)), uintptr(driverInfoDetailDataSize), uintptr(unsafe.Pointer(requiredSize))) if r1 == 0 { err = errnoErr(e1) } @@ -4104,7 +4049,7 @@ func setupDiGetDriverInfoDetail(deviceInfoSet DevInfo, deviceInfoData *DevInfoDa } func setupDiGetSelectedDevice(deviceInfoSet DevInfo, deviceInfoData *DevInfoData) (err error) { - r1, _, e1 := syscall.SyscallN(procSetupDiGetSelectedDevice.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData))) + r1, _, e1 := syscall.Syscall(procSetupDiGetSelectedDevice.Addr(), 2, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -4112,7 +4057,7 @@ func setupDiGetSelectedDevice(deviceInfoSet DevInfo, deviceInfoData *DevInfoData } func setupDiGetSelectedDriver(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverInfoData *DrvInfoData) (err error) { - r1, _, e1 := syscall.SyscallN(procSetupDiGetSelectedDriverW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(driverInfoData))) + r1, _, e1 := syscall.Syscall(procSetupDiGetSelectedDriverW.Addr(), 3, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(driverInfoData))) if r1 == 0 { err = errnoErr(e1) } @@ -4120,7 +4065,7 @@ func setupDiGetSelectedDriver(deviceInfoSet DevInfo, deviceInfoData *DevInfoData } func SetupDiOpenDevRegKey(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, Scope DICS_FLAG, HwProfile uint32, KeyType DIREG, samDesired uint32) (key Handle, err error) { - r0, _, e1 := syscall.SyscallN(procSetupDiOpenDevRegKey.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(Scope), uintptr(HwProfile), uintptr(KeyType), uintptr(samDesired)) + r0, _, e1 := syscall.Syscall6(procSetupDiOpenDevRegKey.Addr(), 6, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(Scope), uintptr(HwProfile), uintptr(KeyType), uintptr(samDesired)) key = Handle(r0) if key == InvalidHandle { err = errnoErr(e1) @@ -4129,7 +4074,7 @@ func SetupDiOpenDevRegKey(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, Sc } func SetupDiSetClassInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, classInstallParams *ClassInstallHeader, classInstallParamsSize uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procSetupDiSetClassInstallParamsW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(classInstallParams)), uintptr(classInstallParamsSize)) + r1, _, e1 := syscall.Syscall6(procSetupDiSetClassInstallParamsW.Addr(), 4, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(classInstallParams)), uintptr(classInstallParamsSize), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -4137,7 +4082,7 @@ func SetupDiSetClassInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfo } func SetupDiSetDeviceInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, deviceInstallParams *DevInstallParams) (err error) { - r1, _, e1 := syscall.SyscallN(procSetupDiSetDeviceInstallParamsW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(deviceInstallParams))) + r1, _, e1 := syscall.Syscall(procSetupDiSetDeviceInstallParamsW.Addr(), 3, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(deviceInstallParams))) if r1 == 0 { err = errnoErr(e1) } @@ -4145,7 +4090,7 @@ func SetupDiSetDeviceInstallParams(deviceInfoSet DevInfo, deviceInfoData *DevInf } func setupDiSetDeviceRegistryProperty(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, property SPDRP, propertyBuffer *byte, propertyBufferSize uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procSetupDiSetDeviceRegistryPropertyW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(property), uintptr(unsafe.Pointer(propertyBuffer)), uintptr(propertyBufferSize)) + r1, _, e1 := syscall.Syscall6(procSetupDiSetDeviceRegistryPropertyW.Addr(), 5, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(property), uintptr(unsafe.Pointer(propertyBuffer)), uintptr(propertyBufferSize), 0) if r1 == 0 { err = errnoErr(e1) } @@ -4153,7 +4098,7 @@ func setupDiSetDeviceRegistryProperty(deviceInfoSet DevInfo, deviceInfoData *Dev } func SetupDiSetSelectedDevice(deviceInfoSet DevInfo, deviceInfoData *DevInfoData) (err error) { - r1, _, e1 := syscall.SyscallN(procSetupDiSetSelectedDevice.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData))) + r1, _, e1 := syscall.Syscall(procSetupDiSetSelectedDevice.Addr(), 2, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -4161,7 +4106,7 @@ func SetupDiSetSelectedDevice(deviceInfoSet DevInfo, deviceInfoData *DevInfoData } func SetupDiSetSelectedDriver(deviceInfoSet DevInfo, deviceInfoData *DevInfoData, driverInfoData *DrvInfoData) (err error) { - r1, _, e1 := syscall.SyscallN(procSetupDiSetSelectedDriverW.Addr(), uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(driverInfoData))) + r1, _, e1 := syscall.Syscall(procSetupDiSetSelectedDriverW.Addr(), 3, uintptr(deviceInfoSet), uintptr(unsafe.Pointer(deviceInfoData)), uintptr(unsafe.Pointer(driverInfoData))) if r1 == 0 { err = errnoErr(e1) } @@ -4169,7 +4114,7 @@ func SetupDiSetSelectedDriver(deviceInfoSet DevInfo, deviceInfoData *DevInfoData } func setupUninstallOEMInf(infFileName *uint16, flags SUOI, reserved uintptr) (err error) { - r1, _, e1 := syscall.SyscallN(procSetupUninstallOEMInfW.Addr(), uintptr(unsafe.Pointer(infFileName)), uintptr(flags), uintptr(reserved)) + r1, _, e1 := syscall.Syscall(procSetupUninstallOEMInfW.Addr(), 3, uintptr(unsafe.Pointer(infFileName)), uintptr(flags), uintptr(reserved)) if r1 == 0 { err = errnoErr(e1) } @@ -4177,7 +4122,7 @@ func setupUninstallOEMInf(infFileName *uint16, flags SUOI, reserved uintptr) (er } func commandLineToArgv(cmd *uint16, argc *int32) (argv **uint16, err error) { - r0, _, e1 := syscall.SyscallN(procCommandLineToArgvW.Addr(), uintptr(unsafe.Pointer(cmd)), uintptr(unsafe.Pointer(argc))) + r0, _, e1 := syscall.Syscall(procCommandLineToArgvW.Addr(), 2, uintptr(unsafe.Pointer(cmd)), uintptr(unsafe.Pointer(argc)), 0) argv = (**uint16)(unsafe.Pointer(r0)) if argv == nil { err = errnoErr(e1) @@ -4186,7 +4131,7 @@ func commandLineToArgv(cmd *uint16, argc *int32) (argv **uint16, err error) { } func shGetKnownFolderPath(id *KNOWNFOLDERID, flags uint32, token Token, path **uint16) (ret error) { - r0, _, _ := syscall.SyscallN(procSHGetKnownFolderPath.Addr(), uintptr(unsafe.Pointer(id)), uintptr(flags), uintptr(token), uintptr(unsafe.Pointer(path))) + r0, _, _ := syscall.Syscall6(procSHGetKnownFolderPath.Addr(), 4, uintptr(unsafe.Pointer(id)), uintptr(flags), uintptr(token), uintptr(unsafe.Pointer(path)), 0, 0) if r0 != 0 { ret = syscall.Errno(r0) } @@ -4194,7 +4139,7 @@ func shGetKnownFolderPath(id *KNOWNFOLDERID, flags uint32, token Token, path **u } func ShellExecute(hwnd Handle, verb *uint16, file *uint16, args *uint16, cwd *uint16, showCmd int32) (err error) { - r1, _, e1 := syscall.SyscallN(procShellExecuteW.Addr(), uintptr(hwnd), uintptr(unsafe.Pointer(verb)), uintptr(unsafe.Pointer(file)), uintptr(unsafe.Pointer(args)), uintptr(unsafe.Pointer(cwd)), uintptr(showCmd)) + r1, _, e1 := syscall.Syscall6(procShellExecuteW.Addr(), 6, uintptr(hwnd), uintptr(unsafe.Pointer(verb)), uintptr(unsafe.Pointer(file)), uintptr(unsafe.Pointer(args)), uintptr(unsafe.Pointer(cwd)), uintptr(showCmd)) if r1 <= 32 { err = errnoErr(e1) } @@ -4202,12 +4147,12 @@ func ShellExecute(hwnd Handle, verb *uint16, file *uint16, args *uint16, cwd *ui } func EnumChildWindows(hwnd HWND, enumFunc uintptr, param unsafe.Pointer) { - syscall.SyscallN(procEnumChildWindows.Addr(), uintptr(hwnd), uintptr(enumFunc), uintptr(param)) + syscall.Syscall(procEnumChildWindows.Addr(), 3, uintptr(hwnd), uintptr(enumFunc), uintptr(param)) return } func EnumWindows(enumFunc uintptr, param unsafe.Pointer) (err error) { - r1, _, e1 := syscall.SyscallN(procEnumWindows.Addr(), uintptr(enumFunc), uintptr(param)) + r1, _, e1 := syscall.Syscall(procEnumWindows.Addr(), 2, uintptr(enumFunc), uintptr(param), 0) if r1 == 0 { err = errnoErr(e1) } @@ -4215,7 +4160,7 @@ func EnumWindows(enumFunc uintptr, param unsafe.Pointer) (err error) { } func ExitWindowsEx(flags uint32, reason uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procExitWindowsEx.Addr(), uintptr(flags), uintptr(reason)) + r1, _, e1 := syscall.Syscall(procExitWindowsEx.Addr(), 2, uintptr(flags), uintptr(reason), 0) if r1 == 0 { err = errnoErr(e1) } @@ -4223,7 +4168,7 @@ func ExitWindowsEx(flags uint32, reason uint32) (err error) { } func GetClassName(hwnd HWND, className *uint16, maxCount int32) (copied int32, err error) { - r0, _, e1 := syscall.SyscallN(procGetClassNameW.Addr(), uintptr(hwnd), uintptr(unsafe.Pointer(className)), uintptr(maxCount)) + r0, _, e1 := syscall.Syscall(procGetClassNameW.Addr(), 3, uintptr(hwnd), uintptr(unsafe.Pointer(className)), uintptr(maxCount)) copied = int32(r0) if copied == 0 { err = errnoErr(e1) @@ -4232,19 +4177,19 @@ func GetClassName(hwnd HWND, className *uint16, maxCount int32) (copied int32, e } func GetDesktopWindow() (hwnd HWND) { - r0, _, _ := syscall.SyscallN(procGetDesktopWindow.Addr()) + r0, _, _ := syscall.Syscall(procGetDesktopWindow.Addr(), 0, 0, 0, 0) hwnd = HWND(r0) return } func GetForegroundWindow() (hwnd HWND) { - r0, _, _ := syscall.SyscallN(procGetForegroundWindow.Addr()) + r0, _, _ := syscall.Syscall(procGetForegroundWindow.Addr(), 0, 0, 0, 0) hwnd = HWND(r0) return } func GetGUIThreadInfo(thread uint32, info *GUIThreadInfo) (err error) { - r1, _, e1 := syscall.SyscallN(procGetGUIThreadInfo.Addr(), uintptr(thread), uintptr(unsafe.Pointer(info))) + r1, _, e1 := syscall.Syscall(procGetGUIThreadInfo.Addr(), 2, uintptr(thread), uintptr(unsafe.Pointer(info)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -4252,19 +4197,19 @@ func GetGUIThreadInfo(thread uint32, info *GUIThreadInfo) (err error) { } func GetKeyboardLayout(tid uint32) (hkl Handle) { - r0, _, _ := syscall.SyscallN(procGetKeyboardLayout.Addr(), uintptr(tid)) + r0, _, _ := syscall.Syscall(procGetKeyboardLayout.Addr(), 1, uintptr(tid), 0, 0) hkl = Handle(r0) return } func GetShellWindow() (shellWindow HWND) { - r0, _, _ := syscall.SyscallN(procGetShellWindow.Addr()) + r0, _, _ := syscall.Syscall(procGetShellWindow.Addr(), 0, 0, 0, 0) shellWindow = HWND(r0) return } func GetWindowThreadProcessId(hwnd HWND, pid *uint32) (tid uint32, err error) { - r0, _, e1 := syscall.SyscallN(procGetWindowThreadProcessId.Addr(), uintptr(hwnd), uintptr(unsafe.Pointer(pid))) + r0, _, e1 := syscall.Syscall(procGetWindowThreadProcessId.Addr(), 2, uintptr(hwnd), uintptr(unsafe.Pointer(pid)), 0) tid = uint32(r0) if tid == 0 { err = errnoErr(e1) @@ -4273,25 +4218,25 @@ func GetWindowThreadProcessId(hwnd HWND, pid *uint32) (tid uint32, err error) { } func IsWindow(hwnd HWND) (isWindow bool) { - r0, _, _ := syscall.SyscallN(procIsWindow.Addr(), uintptr(hwnd)) + r0, _, _ := syscall.Syscall(procIsWindow.Addr(), 1, uintptr(hwnd), 0, 0) isWindow = r0 != 0 return } func IsWindowUnicode(hwnd HWND) (isUnicode bool) { - r0, _, _ := syscall.SyscallN(procIsWindowUnicode.Addr(), uintptr(hwnd)) + r0, _, _ := syscall.Syscall(procIsWindowUnicode.Addr(), 1, uintptr(hwnd), 0, 0) isUnicode = r0 != 0 return } func IsWindowVisible(hwnd HWND) (isVisible bool) { - r0, _, _ := syscall.SyscallN(procIsWindowVisible.Addr(), uintptr(hwnd)) + r0, _, _ := syscall.Syscall(procIsWindowVisible.Addr(), 1, uintptr(hwnd), 0, 0) isVisible = r0 != 0 return } func LoadKeyboardLayout(name *uint16, flags uint32) (hkl Handle, err error) { - r0, _, e1 := syscall.SyscallN(procLoadKeyboardLayoutW.Addr(), uintptr(unsafe.Pointer(name)), uintptr(flags)) + r0, _, e1 := syscall.Syscall(procLoadKeyboardLayoutW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(flags), 0) hkl = Handle(r0) if hkl == 0 { err = errnoErr(e1) @@ -4300,7 +4245,7 @@ func LoadKeyboardLayout(name *uint16, flags uint32) (hkl Handle, err error) { } func MessageBox(hwnd HWND, text *uint16, caption *uint16, boxtype uint32) (ret int32, err error) { - r0, _, e1 := syscall.SyscallN(procMessageBoxW.Addr(), uintptr(hwnd), uintptr(unsafe.Pointer(text)), uintptr(unsafe.Pointer(caption)), uintptr(boxtype)) + r0, _, e1 := syscall.Syscall6(procMessageBoxW.Addr(), 4, uintptr(hwnd), uintptr(unsafe.Pointer(text)), uintptr(unsafe.Pointer(caption)), uintptr(boxtype), 0, 0) ret = int32(r0) if ret == 0 { err = errnoErr(e1) @@ -4309,13 +4254,13 @@ func MessageBox(hwnd HWND, text *uint16, caption *uint16, boxtype uint32) (ret i } func ToUnicodeEx(vkey uint32, scancode uint32, keystate *byte, pwszBuff *uint16, cchBuff int32, flags uint32, hkl Handle) (ret int32) { - r0, _, _ := syscall.SyscallN(procToUnicodeEx.Addr(), uintptr(vkey), uintptr(scancode), uintptr(unsafe.Pointer(keystate)), uintptr(unsafe.Pointer(pwszBuff)), uintptr(cchBuff), uintptr(flags), uintptr(hkl)) + r0, _, _ := syscall.Syscall9(procToUnicodeEx.Addr(), 7, uintptr(vkey), uintptr(scancode), uintptr(unsafe.Pointer(keystate)), uintptr(unsafe.Pointer(pwszBuff)), uintptr(cchBuff), uintptr(flags), uintptr(hkl), 0, 0) ret = int32(r0) return } func UnloadKeyboardLayout(hkl Handle) (err error) { - r1, _, e1 := syscall.SyscallN(procUnloadKeyboardLayout.Addr(), uintptr(hkl)) + r1, _, e1 := syscall.Syscall(procUnloadKeyboardLayout.Addr(), 1, uintptr(hkl), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -4327,7 +4272,7 @@ func CreateEnvironmentBlock(block **uint16, token Token, inheritExisting bool) ( if inheritExisting { _p0 = 1 } - r1, _, e1 := syscall.SyscallN(procCreateEnvironmentBlock.Addr(), uintptr(unsafe.Pointer(block)), uintptr(token), uintptr(_p0)) + r1, _, e1 := syscall.Syscall(procCreateEnvironmentBlock.Addr(), 3, uintptr(unsafe.Pointer(block)), uintptr(token), uintptr(_p0)) if r1 == 0 { err = errnoErr(e1) } @@ -4335,7 +4280,7 @@ func CreateEnvironmentBlock(block **uint16, token Token, inheritExisting bool) ( } func DestroyEnvironmentBlock(block *uint16) (err error) { - r1, _, e1 := syscall.SyscallN(procDestroyEnvironmentBlock.Addr(), uintptr(unsafe.Pointer(block))) + r1, _, e1 := syscall.Syscall(procDestroyEnvironmentBlock.Addr(), 1, uintptr(unsafe.Pointer(block)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -4343,7 +4288,7 @@ func DestroyEnvironmentBlock(block *uint16) (err error) { } func GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procGetUserProfileDirectoryW.Addr(), uintptr(t), uintptr(unsafe.Pointer(dir)), uintptr(unsafe.Pointer(dirLen))) + r1, _, e1 := syscall.Syscall(procGetUserProfileDirectoryW.Addr(), 3, uintptr(t), uintptr(unsafe.Pointer(dir)), uintptr(unsafe.Pointer(dirLen))) if r1 == 0 { err = errnoErr(e1) } @@ -4360,7 +4305,7 @@ func GetFileVersionInfoSize(filename string, zeroHandle *Handle) (bufSize uint32 } func _GetFileVersionInfoSize(filename *uint16, zeroHandle *Handle) (bufSize uint32, err error) { - r0, _, e1 := syscall.SyscallN(procGetFileVersionInfoSizeW.Addr(), uintptr(unsafe.Pointer(filename)), uintptr(unsafe.Pointer(zeroHandle))) + r0, _, e1 := syscall.Syscall(procGetFileVersionInfoSizeW.Addr(), 2, uintptr(unsafe.Pointer(filename)), uintptr(unsafe.Pointer(zeroHandle)), 0) bufSize = uint32(r0) if bufSize == 0 { err = errnoErr(e1) @@ -4378,7 +4323,7 @@ func GetFileVersionInfo(filename string, handle uint32, bufSize uint32, buffer u } func _GetFileVersionInfo(filename *uint16, handle uint32, bufSize uint32, buffer unsafe.Pointer) (err error) { - r1, _, e1 := syscall.SyscallN(procGetFileVersionInfoW.Addr(), uintptr(unsafe.Pointer(filename)), uintptr(handle), uintptr(bufSize), uintptr(buffer)) + r1, _, e1 := syscall.Syscall6(procGetFileVersionInfoW.Addr(), 4, uintptr(unsafe.Pointer(filename)), uintptr(handle), uintptr(bufSize), uintptr(buffer), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -4395,7 +4340,7 @@ func VerQueryValue(block unsafe.Pointer, subBlock string, pointerToBufferPointer } func _VerQueryValue(block unsafe.Pointer, subBlock *uint16, pointerToBufferPointer unsafe.Pointer, bufSize *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procVerQueryValueW.Addr(), uintptr(block), uintptr(unsafe.Pointer(subBlock)), uintptr(pointerToBufferPointer), uintptr(unsafe.Pointer(bufSize))) + r1, _, e1 := syscall.Syscall6(procVerQueryValueW.Addr(), 4, uintptr(block), uintptr(unsafe.Pointer(subBlock)), uintptr(pointerToBufferPointer), uintptr(unsafe.Pointer(bufSize)), 0, 0) if r1 == 0 { err = errnoErr(e1) } @@ -4403,7 +4348,7 @@ func _VerQueryValue(block unsafe.Pointer, subBlock *uint16, pointerToBufferPoint } func TimeBeginPeriod(period uint32) (err error) { - r1, _, e1 := syscall.SyscallN(proctimeBeginPeriod.Addr(), uintptr(period)) + r1, _, e1 := syscall.Syscall(proctimeBeginPeriod.Addr(), 1, uintptr(period), 0, 0) if r1 != 0 { err = errnoErr(e1) } @@ -4411,7 +4356,7 @@ func TimeBeginPeriod(period uint32) (err error) { } func TimeEndPeriod(period uint32) (err error) { - r1, _, e1 := syscall.SyscallN(proctimeEndPeriod.Addr(), uintptr(period)) + r1, _, e1 := syscall.Syscall(proctimeEndPeriod.Addr(), 1, uintptr(period), 0, 0) if r1 != 0 { err = errnoErr(e1) } @@ -4419,7 +4364,7 @@ func TimeEndPeriod(period uint32) (err error) { } func WinVerifyTrustEx(hwnd HWND, actionId *GUID, data *WinTrustData) (ret error) { - r0, _, _ := syscall.SyscallN(procWinVerifyTrustEx.Addr(), uintptr(hwnd), uintptr(unsafe.Pointer(actionId)), uintptr(unsafe.Pointer(data))) + r0, _, _ := syscall.Syscall(procWinVerifyTrustEx.Addr(), 3, uintptr(hwnd), uintptr(unsafe.Pointer(actionId)), uintptr(unsafe.Pointer(data))) if r0 != 0 { ret = syscall.Errno(r0) } @@ -4427,12 +4372,12 @@ func WinVerifyTrustEx(hwnd HWND, actionId *GUID, data *WinTrustData) (ret error) } func FreeAddrInfoW(addrinfo *AddrinfoW) { - syscall.SyscallN(procFreeAddrInfoW.Addr(), uintptr(unsafe.Pointer(addrinfo))) + syscall.Syscall(procFreeAddrInfoW.Addr(), 1, uintptr(unsafe.Pointer(addrinfo)), 0, 0) return } func GetAddrInfoW(nodename *uint16, servicename *uint16, hints *AddrinfoW, result **AddrinfoW) (sockerr error) { - r0, _, _ := syscall.SyscallN(procGetAddrInfoW.Addr(), uintptr(unsafe.Pointer(nodename)), uintptr(unsafe.Pointer(servicename)), uintptr(unsafe.Pointer(hints)), uintptr(unsafe.Pointer(result))) + r0, _, _ := syscall.Syscall6(procGetAddrInfoW.Addr(), 4, uintptr(unsafe.Pointer(nodename)), uintptr(unsafe.Pointer(servicename)), uintptr(unsafe.Pointer(hints)), uintptr(unsafe.Pointer(result)), 0, 0) if r0 != 0 { sockerr = syscall.Errno(r0) } @@ -4440,7 +4385,7 @@ func GetAddrInfoW(nodename *uint16, servicename *uint16, hints *AddrinfoW, resul } func WSACleanup() (err error) { - r1, _, e1 := syscall.SyscallN(procWSACleanup.Addr()) + r1, _, e1 := syscall.Syscall(procWSACleanup.Addr(), 0, 0, 0, 0) if r1 == socket_error { err = errnoErr(e1) } @@ -4448,7 +4393,7 @@ func WSACleanup() (err error) { } func WSADuplicateSocket(s Handle, processID uint32, info *WSAProtocolInfo) (err error) { - r1, _, e1 := syscall.SyscallN(procWSADuplicateSocketW.Addr(), uintptr(s), uintptr(processID), uintptr(unsafe.Pointer(info))) + r1, _, e1 := syscall.Syscall(procWSADuplicateSocketW.Addr(), 3, uintptr(s), uintptr(processID), uintptr(unsafe.Pointer(info))) if r1 != 0 { err = errnoErr(e1) } @@ -4456,7 +4401,7 @@ func WSADuplicateSocket(s Handle, processID uint32, info *WSAProtocolInfo) (err } func WSAEnumProtocols(protocols *int32, protocolBuffer *WSAProtocolInfo, bufferLength *uint32) (n int32, err error) { - r0, _, e1 := syscall.SyscallN(procWSAEnumProtocolsW.Addr(), uintptr(unsafe.Pointer(protocols)), uintptr(unsafe.Pointer(protocolBuffer)), uintptr(unsafe.Pointer(bufferLength))) + r0, _, e1 := syscall.Syscall(procWSAEnumProtocolsW.Addr(), 3, uintptr(unsafe.Pointer(protocols)), uintptr(unsafe.Pointer(protocolBuffer)), uintptr(unsafe.Pointer(bufferLength))) n = int32(r0) if n == -1 { err = errnoErr(e1) @@ -4469,7 +4414,7 @@ func WSAGetOverlappedResult(h Handle, o *Overlapped, bytes *uint32, wait bool, f if wait { _p0 = 1 } - r1, _, e1 := syscall.SyscallN(procWSAGetOverlappedResult.Addr(), uintptr(h), uintptr(unsafe.Pointer(o)), uintptr(unsafe.Pointer(bytes)), uintptr(_p0), uintptr(unsafe.Pointer(flags))) + r1, _, e1 := syscall.Syscall6(procWSAGetOverlappedResult.Addr(), 5, uintptr(h), uintptr(unsafe.Pointer(o)), uintptr(unsafe.Pointer(bytes)), uintptr(_p0), uintptr(unsafe.Pointer(flags)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -4477,7 +4422,7 @@ func WSAGetOverlappedResult(h Handle, o *Overlapped, bytes *uint32, wait bool, f } func WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbob uint32, cbbr *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) { - r1, _, e1 := syscall.SyscallN(procWSAIoctl.Addr(), uintptr(s), uintptr(iocc), uintptr(unsafe.Pointer(inbuf)), uintptr(cbif), uintptr(unsafe.Pointer(outbuf)), uintptr(cbob), uintptr(unsafe.Pointer(cbbr)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine)) + r1, _, e1 := syscall.Syscall9(procWSAIoctl.Addr(), 9, uintptr(s), uintptr(iocc), uintptr(unsafe.Pointer(inbuf)), uintptr(cbif), uintptr(unsafe.Pointer(outbuf)), uintptr(cbob), uintptr(unsafe.Pointer(cbbr)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine)) if r1 == socket_error { err = errnoErr(e1) } @@ -4485,7 +4430,7 @@ func WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbo } func WSALookupServiceBegin(querySet *WSAQUERYSET, flags uint32, handle *Handle) (err error) { - r1, _, e1 := syscall.SyscallN(procWSALookupServiceBeginW.Addr(), uintptr(unsafe.Pointer(querySet)), uintptr(flags), uintptr(unsafe.Pointer(handle))) + r1, _, e1 := syscall.Syscall(procWSALookupServiceBeginW.Addr(), 3, uintptr(unsafe.Pointer(querySet)), uintptr(flags), uintptr(unsafe.Pointer(handle))) if r1 == socket_error { err = errnoErr(e1) } @@ -4493,7 +4438,7 @@ func WSALookupServiceBegin(querySet *WSAQUERYSET, flags uint32, handle *Handle) } func WSALookupServiceEnd(handle Handle) (err error) { - r1, _, e1 := syscall.SyscallN(procWSALookupServiceEnd.Addr(), uintptr(handle)) + r1, _, e1 := syscall.Syscall(procWSALookupServiceEnd.Addr(), 1, uintptr(handle), 0, 0) if r1 == socket_error { err = errnoErr(e1) } @@ -4501,7 +4446,7 @@ func WSALookupServiceEnd(handle Handle) (err error) { } func WSALookupServiceNext(handle Handle, flags uint32, size *int32, querySet *WSAQUERYSET) (err error) { - r1, _, e1 := syscall.SyscallN(procWSALookupServiceNextW.Addr(), uintptr(handle), uintptr(flags), uintptr(unsafe.Pointer(size)), uintptr(unsafe.Pointer(querySet))) + r1, _, e1 := syscall.Syscall6(procWSALookupServiceNextW.Addr(), 4, uintptr(handle), uintptr(flags), uintptr(unsafe.Pointer(size)), uintptr(unsafe.Pointer(querySet)), 0, 0) if r1 == socket_error { err = errnoErr(e1) } @@ -4509,7 +4454,7 @@ func WSALookupServiceNext(handle Handle, flags uint32, size *int32, querySet *WS } func WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, overlapped *Overlapped, croutine *byte) (err error) { - r1, _, e1 := syscall.SyscallN(procWSARecv.Addr(), uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) + r1, _, e1 := syscall.Syscall9(procWSARecv.Addr(), 7, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0, 0) if r1 == socket_error { err = errnoErr(e1) } @@ -4517,7 +4462,7 @@ func WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32 } func WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (err error) { - r1, _, e1 := syscall.SyscallN(procWSARecvFrom.Addr(), uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) + r1, _, e1 := syscall.Syscall9(procWSARecvFrom.Addr(), 9, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) if r1 == socket_error { err = errnoErr(e1) } @@ -4525,7 +4470,7 @@ func WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *ui } func WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (err error) { - r1, _, e1 := syscall.SyscallN(procWSASend.Addr(), uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) + r1, _, e1 := syscall.Syscall9(procWSASend.Addr(), 7, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0, 0) if r1 == socket_error { err = errnoErr(e1) } @@ -4533,7 +4478,7 @@ func WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, } func WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (err error) { - r1, _, e1 := syscall.SyscallN(procWSASendTo.Addr(), uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(to)), uintptr(tolen), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) + r1, _, e1 := syscall.Syscall9(procWSASendTo.Addr(), 9, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(to)), uintptr(tolen), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) if r1 == socket_error { err = errnoErr(e1) } @@ -4541,7 +4486,7 @@ func WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32 } func WSASocket(af int32, typ int32, protocol int32, protoInfo *WSAProtocolInfo, group uint32, flags uint32) (handle Handle, err error) { - r0, _, e1 := syscall.SyscallN(procWSASocketW.Addr(), uintptr(af), uintptr(typ), uintptr(protocol), uintptr(unsafe.Pointer(protoInfo)), uintptr(group), uintptr(flags)) + r0, _, e1 := syscall.Syscall6(procWSASocketW.Addr(), 6, uintptr(af), uintptr(typ), uintptr(protocol), uintptr(unsafe.Pointer(protoInfo)), uintptr(group), uintptr(flags)) handle = Handle(r0) if handle == InvalidHandle { err = errnoErr(e1) @@ -4550,7 +4495,7 @@ func WSASocket(af int32, typ int32, protocol int32, protoInfo *WSAProtocolInfo, } func WSAStartup(verreq uint32, data *WSAData) (sockerr error) { - r0, _, _ := syscall.SyscallN(procWSAStartup.Addr(), uintptr(verreq), uintptr(unsafe.Pointer(data))) + r0, _, _ := syscall.Syscall(procWSAStartup.Addr(), 2, uintptr(verreq), uintptr(unsafe.Pointer(data)), 0) if r0 != 0 { sockerr = syscall.Errno(r0) } @@ -4558,7 +4503,7 @@ func WSAStartup(verreq uint32, data *WSAData) (sockerr error) { } func bind(s Handle, name unsafe.Pointer, namelen int32) (err error) { - r1, _, e1 := syscall.SyscallN(procbind.Addr(), uintptr(s), uintptr(name), uintptr(namelen)) + r1, _, e1 := syscall.Syscall(procbind.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen)) if r1 == socket_error { err = errnoErr(e1) } @@ -4566,7 +4511,7 @@ func bind(s Handle, name unsafe.Pointer, namelen int32) (err error) { } func Closesocket(s Handle) (err error) { - r1, _, e1 := syscall.SyscallN(procclosesocket.Addr(), uintptr(s)) + r1, _, e1 := syscall.Syscall(procclosesocket.Addr(), 1, uintptr(s), 0, 0) if r1 == socket_error { err = errnoErr(e1) } @@ -4574,7 +4519,7 @@ func Closesocket(s Handle) (err error) { } func connect(s Handle, name unsafe.Pointer, namelen int32) (err error) { - r1, _, e1 := syscall.SyscallN(procconnect.Addr(), uintptr(s), uintptr(name), uintptr(namelen)) + r1, _, e1 := syscall.Syscall(procconnect.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen)) if r1 == socket_error { err = errnoErr(e1) } @@ -4591,7 +4536,7 @@ func GetHostByName(name string) (h *Hostent, err error) { } func _GetHostByName(name *byte) (h *Hostent, err error) { - r0, _, e1 := syscall.SyscallN(procgethostbyname.Addr(), uintptr(unsafe.Pointer(name))) + r0, _, e1 := syscall.Syscall(procgethostbyname.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0) h = (*Hostent)(unsafe.Pointer(r0)) if h == nil { err = errnoErr(e1) @@ -4600,7 +4545,7 @@ func _GetHostByName(name *byte) (h *Hostent, err error) { } func getpeername(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) { - r1, _, e1 := syscall.SyscallN(procgetpeername.Addr(), uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + r1, _, e1 := syscall.Syscall(procgetpeername.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if r1 == socket_error { err = errnoErr(e1) } @@ -4617,7 +4562,7 @@ func GetProtoByName(name string) (p *Protoent, err error) { } func _GetProtoByName(name *byte) (p *Protoent, err error) { - r0, _, e1 := syscall.SyscallN(procgetprotobyname.Addr(), uintptr(unsafe.Pointer(name))) + r0, _, e1 := syscall.Syscall(procgetprotobyname.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0) p = (*Protoent)(unsafe.Pointer(r0)) if p == nil { err = errnoErr(e1) @@ -4640,7 +4585,7 @@ func GetServByName(name string, proto string) (s *Servent, err error) { } func _GetServByName(name *byte, proto *byte) (s *Servent, err error) { - r0, _, e1 := syscall.SyscallN(procgetservbyname.Addr(), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(proto))) + r0, _, e1 := syscall.Syscall(procgetservbyname.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(proto)), 0) s = (*Servent)(unsafe.Pointer(r0)) if s == nil { err = errnoErr(e1) @@ -4649,7 +4594,7 @@ func _GetServByName(name *byte, proto *byte) (s *Servent, err error) { } func getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) { - r1, _, e1 := syscall.SyscallN(procgetsockname.Addr(), uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + r1, _, e1 := syscall.Syscall(procgetsockname.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if r1 == socket_error { err = errnoErr(e1) } @@ -4657,7 +4602,7 @@ func getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) { } func Getsockopt(s Handle, level int32, optname int32, optval *byte, optlen *int32) (err error) { - r1, _, e1 := syscall.SyscallN(procgetsockopt.Addr(), uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(unsafe.Pointer(optlen))) + r1, _, e1 := syscall.Syscall6(procgetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(unsafe.Pointer(optlen)), 0) if r1 == socket_error { err = errnoErr(e1) } @@ -4665,7 +4610,7 @@ func Getsockopt(s Handle, level int32, optname int32, optval *byte, optlen *int3 } func listen(s Handle, backlog int32) (err error) { - r1, _, e1 := syscall.SyscallN(proclisten.Addr(), uintptr(s), uintptr(backlog)) + r1, _, e1 := syscall.Syscall(proclisten.Addr(), 2, uintptr(s), uintptr(backlog), 0) if r1 == socket_error { err = errnoErr(e1) } @@ -4673,7 +4618,7 @@ func listen(s Handle, backlog int32) (err error) { } func Ntohs(netshort uint16) (u uint16) { - r0, _, _ := syscall.SyscallN(procntohs.Addr(), uintptr(netshort)) + r0, _, _ := syscall.Syscall(procntohs.Addr(), 1, uintptr(netshort), 0, 0) u = uint16(r0) return } @@ -4683,7 +4628,7 @@ func recvfrom(s Handle, buf []byte, flags int32, from *RawSockaddrAny, fromlen * if len(buf) > 0 { _p0 = &buf[0] } - r0, _, e1 := syscall.SyscallN(procrecvfrom.Addr(), uintptr(s), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) + r0, _, e1 := syscall.Syscall6(procrecvfrom.Addr(), 6, uintptr(s), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen))) n = int32(r0) if n == -1 { err = errnoErr(e1) @@ -4696,7 +4641,7 @@ func sendto(s Handle, buf []byte, flags int32, to unsafe.Pointer, tolen int32) ( if len(buf) > 0 { _p0 = &buf[0] } - r1, _, e1 := syscall.SyscallN(procsendto.Addr(), uintptr(s), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(tolen)) + r1, _, e1 := syscall.Syscall6(procsendto.Addr(), 6, uintptr(s), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(flags), uintptr(to), uintptr(tolen)) if r1 == socket_error { err = errnoErr(e1) } @@ -4704,7 +4649,7 @@ func sendto(s Handle, buf []byte, flags int32, to unsafe.Pointer, tolen int32) ( } func Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32) (err error) { - r1, _, e1 := syscall.SyscallN(procsetsockopt.Addr(), uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(optlen)) + r1, _, e1 := syscall.Syscall6(procsetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(optlen), 0) if r1 == socket_error { err = errnoErr(e1) } @@ -4712,7 +4657,7 @@ func Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32 } func shutdown(s Handle, how int32) (err error) { - r1, _, e1 := syscall.SyscallN(procshutdown.Addr(), uintptr(s), uintptr(how)) + r1, _, e1 := syscall.Syscall(procshutdown.Addr(), 2, uintptr(s), uintptr(how), 0) if r1 == socket_error { err = errnoErr(e1) } @@ -4720,7 +4665,7 @@ func shutdown(s Handle, how int32) (err error) { } func socket(af int32, typ int32, protocol int32) (handle Handle, err error) { - r0, _, e1 := syscall.SyscallN(procsocket.Addr(), uintptr(af), uintptr(typ), uintptr(protocol)) + r0, _, e1 := syscall.Syscall(procsocket.Addr(), 3, uintptr(af), uintptr(typ), uintptr(protocol)) handle = Handle(r0) if handle == InvalidHandle { err = errnoErr(e1) @@ -4729,7 +4674,7 @@ func socket(af int32, typ int32, protocol int32) (handle Handle, err error) { } func WTSEnumerateSessions(handle Handle, reserved uint32, version uint32, sessions **WTS_SESSION_INFO, count *uint32) (err error) { - r1, _, e1 := syscall.SyscallN(procWTSEnumerateSessionsW.Addr(), uintptr(handle), uintptr(reserved), uintptr(version), uintptr(unsafe.Pointer(sessions)), uintptr(unsafe.Pointer(count))) + r1, _, e1 := syscall.Syscall6(procWTSEnumerateSessionsW.Addr(), 5, uintptr(handle), uintptr(reserved), uintptr(version), uintptr(unsafe.Pointer(sessions)), uintptr(unsafe.Pointer(count)), 0) if r1 == 0 { err = errnoErr(e1) } @@ -4737,12 +4682,12 @@ func WTSEnumerateSessions(handle Handle, reserved uint32, version uint32, sessio } func WTSFreeMemory(ptr uintptr) { - syscall.SyscallN(procWTSFreeMemory.Addr(), uintptr(ptr)) + syscall.Syscall(procWTSFreeMemory.Addr(), 1, uintptr(ptr), 0, 0) return } func WTSQueryUserToken(session uint32, token *Token) (err error) { - r1, _, e1 := syscall.SyscallN(procWTSQueryUserToken.Addr(), uintptr(session), uintptr(unsafe.Pointer(token))) + r1, _, e1 := syscall.Syscall(procWTSQueryUserToken.Addr(), 2, uintptr(session), uintptr(unsafe.Pointer(token)), 0) if r1 == 0 { err = errnoErr(e1) } diff --git a/kubewatch/vendor/golang.org/x/term/term_windows.go b/kubewatch/vendor/golang.org/x/term/term_windows.go index 0ddd81c02..df6bf948e 100644 --- a/kubewatch/vendor/golang.org/x/term/term_windows.go +++ b/kubewatch/vendor/golang.org/x/term/term_windows.go @@ -20,14 +20,12 @@ func isTerminal(fd int) bool { return err == nil } -// This is intended to be used on a console input handle. -// See https://learn.microsoft.com/en-us/windows/console/setconsolemode func makeRaw(fd int) (*State, error) { var st uint32 if err := windows.GetConsoleMode(windows.Handle(fd), &st); err != nil { return nil, err } - raw := st &^ (windows.ENABLE_ECHO_INPUT | windows.ENABLE_PROCESSED_INPUT | windows.ENABLE_LINE_INPUT) + 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 diff --git a/kubewatch/vendor/golang.org/x/term/terminal.go b/kubewatch/vendor/golang.org/x/term/terminal.go index 9255449b9..13e9a64ad 100644 --- a/kubewatch/vendor/golang.org/x/term/terminal.go +++ b/kubewatch/vendor/golang.org/x/term/terminal.go @@ -146,7 +146,6 @@ const ( keyCtrlD = 4 keyCtrlU = 21 keyEnter = '\r' - keyLF = '\n' keyEscape = 27 keyBackspace = 127 keyUnknown = 0xd800 /* UTF-16 surrogate area */ + iota @@ -413,7 +412,7 @@ func (t *Terminal) eraseNPreviousChars(n int) { } } -// countToLeftWord returns the number of characters from the cursor to the +// countToLeftWord returns then number of characters from the cursor to the // start of the previous word. func (t *Terminal) countToLeftWord() int { if t.pos == 0 { @@ -438,7 +437,7 @@ func (t *Terminal) countToLeftWord() int { return t.pos - pos } -// countToRightWord returns the number of characters from the cursor to the +// countToRightWord returns then number of characters from the cursor to the // start of the next word. func (t *Terminal) countToRightWord() int { pos := t.pos @@ -478,7 +477,7 @@ func visualLength(runes []rune) int { return length } -// historyAt unlocks the terminal and relocks it while calling History.At. +// histroryAt unlocks the terminal and relocks it while calling History.At. func (t *Terminal) historyAt(idx int) (string, bool) { t.lock.Unlock() // Unlock to avoid deadlock if History methods use the output writer. defer t.lock.Lock() // panic in At (or Len) protection. @@ -498,7 +497,7 @@ func (t *Terminal) historyAdd(entry string) { // handleKey processes the given key and, optionally, returns a line of text // that the user has entered. func (t *Terminal) handleKey(key rune) (line string, ok bool) { - if t.pasteActive && key != keyEnter && key != keyLF { + if t.pasteActive && key != keyEnter { t.addKeyToLine(key) return } @@ -568,7 +567,7 @@ func (t *Terminal) handleKey(key rune) (line string, ok bool) { t.setLine(runes, len(runes)) } } - case keyEnter, keyLF: + case keyEnter: t.moveCursorToPos(len(t.line)) t.queue([]rune("\r\n")) line = string(t.line) @@ -813,10 +812,6 @@ func (t *Terminal) readLine() (line string, err error) { if !t.pasteActive { lineIsPasted = false } - // If we have CR, consume LF if present (CRLF sequence) to avoid returning an extra empty line. - if key == keyEnter && len(rest) > 0 && rest[0] == keyLF { - rest = rest[1:] - } line, lineOk = t.handleKey(key) } if len(rest) > 0 { diff --git a/kubewatch/vendor/golang.org/x/text/unicode/bidi/core.go b/kubewatch/vendor/golang.org/x/text/unicode/bidi/core.go index fb8273236..9d2ae547b 100644 --- a/kubewatch/vendor/golang.org/x/text/unicode/bidi/core.go +++ b/kubewatch/vendor/golang.org/x/text/unicode/bidi/core.go @@ -427,6 +427,13 @@ type isolatingRunSequence struct { func (i *isolatingRunSequence) Len() int { return len(i.indexes) } +func maxLevel(a, b level) level { + if a > b { + return a + } + return b +} + // Rule X10, second bullet: Determine the start-of-sequence (sos) and end-of-sequence (eos) types, // either L or R, for each isolating run sequence. func (p *paragraph) isolatingRunSequence(indexes []int) *isolatingRunSequence { @@ -467,8 +474,8 @@ func (p *paragraph) isolatingRunSequence(indexes []int) *isolatingRunSequence { indexes: indexes, types: types, level: level, - sos: typeForLevel(max(prevLevel, level)), - eos: typeForLevel(max(succLevel, level)), + sos: typeForLevel(maxLevel(prevLevel, level)), + eos: typeForLevel(maxLevel(succLevel, level)), } } diff --git a/kubewatch/vendor/golang.org/x/time/rate/sometimes.go b/kubewatch/vendor/golang.org/x/time/rate/sometimes.go index 6ba99ddb6..9b8393269 100644 --- a/kubewatch/vendor/golang.org/x/time/rate/sometimes.go +++ b/kubewatch/vendor/golang.org/x/time/rate/sometimes.go @@ -61,7 +61,9 @@ func (s *Sometimes) Do(f func()) { (s.Every > 0 && s.count%s.Every == 0) || (s.Interval > 0 && time.Since(s.last) >= s.Interval) { f() - s.last = time.Now() + if s.Interval > 0 { + s.last = time.Now() + } } s.count++ } diff --git a/kubewatch/vendor/modules.txt b/kubewatch/vendor/modules.txt index 983311452..2724e9bb1 100644 --- a/kubewatch/vendor/modules.txt +++ b/kubewatch/vendor/modules.txt @@ -251,7 +251,7 @@ github.com/cyphar/filepath-securejoin # github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc ## explicit github.com/davecgh/go-spew/spew -# github.com/devtron-labs/common-lib v0.0.0 => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072256-6c8429c6cc72 +# github.com/devtron-labs/common-lib v0.0.0 => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260227055702-7fe9d47354a0 ## explicit; go 1.24.0 github.com/devtron-labs/common-lib/async github.com/devtron-labs/common-lib/constants @@ -1023,7 +1023,7 @@ golang.org/x/crypto/ssh/knownhosts # golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 ## explicit; go 1.23.0 golang.org/x/exp/maps -# golang.org/x/net v0.41.0 +# golang.org/x/net v0.42.0 ## explicit; go 1.23.0 golang.org/x/net/context golang.org/x/net/html @@ -1088,7 +1088,7 @@ golang.org/x/text/transform golang.org/x/text/unicode/bidi golang.org/x/text/unicode/norm golang.org/x/text/width -# golang.org/x/time v0.11.0 +# golang.org/x/time v0.12.0 ## explicit; go 1.23.0 golang.org/x/time/rate # google.golang.org/genproto v0.0.0-20250519155744-55703ea1f237 @@ -1754,7 +1754,7 @@ k8s.io/kubectl/pkg/util/storage k8s.io/kubectl/pkg/util/templates k8s.io/kubectl/pkg/util/term k8s.io/kubectl/pkg/validation -# k8s.io/kubernetes v1.33.1 +# k8s.io/kubernetes v1.33.4 ## explicit; go 1.24.0 k8s.io/kubernetes/pkg/api/legacyscheme k8s.io/kubernetes/pkg/api/v1/service @@ -2002,4 +2002,4 @@ sigs.k8s.io/structured-merge-diff/v4/value sigs.k8s.io/yaml sigs.k8s.io/yaml/goyaml.v2 sigs.k8s.io/yaml/goyaml.v3 -# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072256-6c8429c6cc72 +# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260227055702-7fe9d47354a0 diff --git a/lens/go.mod b/lens/go.mod index 6ae1d36d9..ca637a4a1 100644 --- a/lens/go.mod +++ b/lens/go.mod @@ -46,7 +46,7 @@ require ( go.opentelemetry.io/otel/trace v1.36.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.40.0 // indirect - golang.org/x/net v0.41.0 // indirect + golang.org/x/net v0.42.0 // indirect golang.org/x/sys v0.34.0 // indirect golang.org/x/text v0.27.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20250519155744-55703ea1f237 // indirect @@ -60,6 +60,6 @@ require ( ) replace ( - github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072256-6c8429c6cc72 + github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260227055702-7fe9d47354a0 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0 => go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 ) diff --git a/lens/go.sum b/lens/go.sum index cf34d1945..923099a1a 100644 --- a/lens/go.sum +++ b/lens/go.sum @@ -17,8 +17,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072256-6c8429c6cc72 h1:L1XupZ+tdjzcMjtzncAszzTeDZKUm7h9HThDIFYkTz4= -github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072256-6c8429c6cc72/go.mod h1:CqHnvltrng2O40hNGVl56qcAhv7tiXK3SKx47LKyE/A= +github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260227055702-7fe9d47354a0 h1:KnmMU3qEy/QRtEJaUQNnXvCrintij+BYhOJtw+OjxYw= +github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260227055702-7fe9d47354a0/go.mod h1:d6awSGcXQc57s4PJlwcyACovJ4PgBmR9jZJ7h6CScUM= github.com/devtron-labs/protos v0.0.3-0.20240912111807-605886d90b8d h1:IV6FWU6eWSfKq67Fs2DBx3LjkX/wtjMj9QB3ufZgga4= github.com/devtron-labs/protos v0.0.3-0.20240912111807-605886d90b8d/go.mod h1:1TqULGlTey+VNhAu/ag7NJuUvByJemkqodsc9L5PHJk= github.com/docker/cli v28.1.1+incompatible h1:eyUemzeI45DY7eDPuwUcmDyDj1pM98oD5MdSpiItp8k= @@ -177,8 +177,8 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= -golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw= -golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA= +golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= +golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI= golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/lens/vendor/modules.txt b/lens/vendor/modules.txt index 8d433a1ee..c1e59eaec 100644 --- a/lens/vendor/modules.txt +++ b/lens/vendor/modules.txt @@ -7,7 +7,7 @@ github.com/caarlos0/env # github.com/cespare/xxhash/v2 v2.3.0 ## explicit; go 1.11 github.com/cespare/xxhash/v2 -# github.com/devtron-labs/common-lib v0.19.1 => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072256-6c8429c6cc72 +# github.com/devtron-labs/common-lib v0.19.1 => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260227055702-7fe9d47354a0 ## explicit; go 1.24.0 github.com/devtron-labs/common-lib/constants github.com/devtron-labs/common-lib/fetchAllEnv @@ -180,7 +180,7 @@ golang.org/x/crypto/nacl/box golang.org/x/crypto/nacl/secretbox golang.org/x/crypto/pbkdf2 golang.org/x/crypto/salsa20/salsa -# golang.org/x/net v0.41.0 +# golang.org/x/net v0.42.0 ## explicit; go 1.23.0 golang.org/x/net/http/httpguts golang.org/x/net/http2 @@ -304,4 +304,4 @@ google.golang.org/protobuf/types/known/timestamppb # mellium.im/sasl v0.3.2 ## explicit; go 1.20 mellium.im/sasl -# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20251217072256-6c8429c6cc72 +# github.com/devtron-labs/common-lib => github.com/devtron-labs/devtron-services/common-lib v0.0.0-20260227055702-7fe9d47354a0