mirror of
https://github.com/umputun/reproxy.git
synced 2024-08-16 12:10:31 +03:00
update deps, switch to go 1.19
This commit is contained in:
parent
a4b82174c9
commit
0ce326dbaa
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
@ -11,10 +11,10 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: set up go 1.17
|
||||
- name: set up go 1.19
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.17
|
||||
go-version: 1.19
|
||||
id: go
|
||||
|
||||
- name: checkout
|
||||
@ -31,7 +31,7 @@ jobs:
|
||||
|
||||
- name: install golangci-lint and goveralls
|
||||
run: |
|
||||
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $GITHUB_WORKSPACE v1.43.0
|
||||
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $GITHUB_WORKSPACE v1.48.0
|
||||
GO111MODULE=off go get -u github.com/mattn/goveralls
|
||||
|
||||
- name: run linters
|
||||
|
@ -38,17 +38,14 @@ linters:
|
||||
- govet
|
||||
- unconvert
|
||||
- megacheck
|
||||
- structcheck
|
||||
- unused
|
||||
- gas
|
||||
- gocyclo
|
||||
- dupl
|
||||
- misspell
|
||||
- unparam
|
||||
- varcheck
|
||||
- deadcode
|
||||
- typecheck
|
||||
- ineffassign
|
||||
- varcheck
|
||||
- stylecheck
|
||||
- gochecknoinits
|
||||
- exportloopref
|
||||
@ -64,9 +61,9 @@ issues:
|
||||
- text: "at least one file in a package should have a package comment"
|
||||
linters:
|
||||
- stylecheck
|
||||
- text: "should have a package comment, unless it's in another file for this package"
|
||||
- text: "should have a package comment"
|
||||
linters:
|
||||
- golint
|
||||
- revive
|
||||
- path: _test\.go
|
||||
linters:
|
||||
- gosec
|
||||
|
@ -1,4 +1,4 @@
|
||||
FROM golang:1.16-alpine as backend
|
||||
FROM golang:1.19-alpine as backend
|
||||
|
||||
ARG GIT_BRANCH
|
||||
ARG GITHUB_SHA
|
||||
|
@ -2,7 +2,6 @@ package provider
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"sync"
|
||||
"testing"
|
||||
@ -18,7 +17,7 @@ func TestFile_Events(t *testing.T) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
|
||||
defer cancel()
|
||||
|
||||
tmp, err := ioutil.TempFile(os.TempDir(), "reproxy-events")
|
||||
tmp, err := os.CreateTemp(os.TempDir(), "reproxy-events")
|
||||
require.NoError(t, err)
|
||||
_ = tmp.Close()
|
||||
defer os.Remove(tmp.Name())
|
||||
@ -59,7 +58,7 @@ func TestFile_Events_BusyListener(t *testing.T) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 200*time.Millisecond)
|
||||
defer cancel()
|
||||
|
||||
tmp, err := ioutil.TempFile(os.TempDir(), "reproxy-events-busy")
|
||||
tmp, err := os.CreateTemp(os.TempDir(), "reproxy-events-busy")
|
||||
require.NoError(t, err)
|
||||
_ = tmp.Close()
|
||||
defer os.Remove(tmp.Name())
|
||||
|
22
go.mod
22
go.mod
@ -1,35 +1,35 @@
|
||||
module github.com/umputun/reproxy
|
||||
|
||||
go 1.17
|
||||
go 1.19
|
||||
|
||||
require (
|
||||
github.com/cespare/xxhash/v2 v2.1.2 // indirect
|
||||
github.com/didip/tollbooth/v6 v6.1.2
|
||||
github.com/felixge/httpsnoop v1.0.2 // indirect
|
||||
github.com/felixge/httpsnoop v1.0.3 // indirect
|
||||
github.com/go-pkgz/lgr v0.10.4
|
||||
github.com/go-pkgz/repeater v1.1.3
|
||||
github.com/go-pkgz/rest v1.14.0
|
||||
github.com/go-pkgz/rest v1.15.6
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/gorilla/handlers v1.5.1
|
||||
github.com/prometheus/client_golang v1.12.1
|
||||
github.com/prometheus/common v0.33.0 // indirect
|
||||
github.com/prometheus/procfs v0.7.3 // indirect
|
||||
github.com/stretchr/testify v1.7.0
|
||||
github.com/prometheus/common v0.37.0 // indirect
|
||||
github.com/prometheus/procfs v0.8.0 // indirect
|
||||
github.com/stretchr/testify v1.7.1
|
||||
github.com/umputun/go-flags v1.5.1
|
||||
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4
|
||||
golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect
|
||||
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
|
||||
golang.org/x/text v0.3.7 // indirect
|
||||
golang.org/x/time v0.0.0-20220411224347-583f2d630306 // indirect
|
||||
google.golang.org/protobuf v1.28.0 // indirect
|
||||
golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9 // indirect
|
||||
google.golang.org/protobuf v1.28.1 // indirect
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.0.0
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/go-pkgz/expirable-cache v0.0.3 // indirect
|
||||
github.com/go-pkgz/expirable-cache v1.0.0 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
|
41
go.sum
41
go.sum
@ -62,8 +62,8 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m
|
||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
|
||||
github.com/felixge/httpsnoop v1.0.2 h1:+nS9g82KMXccJ/wp0zyRW9ZBHFETmMGtkk+2CTTrW4o=
|
||||
github.com/felixge/httpsnoop v1.0.2/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
|
||||
github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk=
|
||||
github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
|
||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
@ -75,14 +75,15 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9
|
||||
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
||||
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
|
||||
github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
|
||||
github.com/go-pkgz/expirable-cache v0.0.3 h1:rTh6qNPp78z0bQE6HDhXBHUwqnV9i09Vm6dksJLXQDc=
|
||||
github.com/go-pkgz/expirable-cache v0.0.3/go.mod h1:+IauqN00R2FqNRLCLA+X5YljQJrwB179PfiAoMPlTlQ=
|
||||
github.com/go-pkgz/expirable-cache v1.0.0 h1:ns5+1hjY8hntGv8bPaQd9Gr7Jyo+Uw5SLyII40aQdtA=
|
||||
github.com/go-pkgz/expirable-cache v1.0.0/go.mod h1:GTrEl0X+q0mPNqN6dtcQXksACnzCBQ5k/k1SwXJsZKs=
|
||||
github.com/go-pkgz/lgr v0.10.4 h1:l7qyFjqEZgwRgaQQSEp6tve4A3OU80VrfzpvtEX8ngw=
|
||||
github.com/go-pkgz/lgr v0.10.4/go.mod h1:CD0s1z6EFpIUplV067gitF77tn25JItzwHNKAPqeCF0=
|
||||
github.com/go-pkgz/repeater v1.1.3 h1:q6+JQF14ESSy28Dd7F+wRelY4F+41HJ0LEy/szNnMiE=
|
||||
github.com/go-pkgz/repeater v1.1.3/go.mod h1:hVTavuO5x3Gxnu8zW7d6sQBfAneKV8X2FjU48kGfpKw=
|
||||
github.com/go-pkgz/rest v1.14.0 h1:brDLCzIGoe0IiUZqRFpsiCVM9m3L88A7z62qS0V9Yfk=
|
||||
github.com/go-pkgz/rest v1.14.0/go.mod h1:KUWAqbDteYGS/CiXftomQsKjtEOifXsJ36Ka0skYbmk=
|
||||
github.com/go-pkgz/rest v1.15.6 h1:8RgOuY/c00CD0el8KdmscOCgDH+ML0ZsK2qa1Rcxal4=
|
||||
github.com/go-pkgz/rest v1.15.6/go.mod h1:KUWAqbDteYGS/CiXftomQsKjtEOifXsJ36Ka0skYbmk=
|
||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
@ -123,8 +124,8 @@ github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
|
||||
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
|
||||
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
|
||||
@ -191,14 +192,15 @@ github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8
|
||||
github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
|
||||
github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc=
|
||||
github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls=
|
||||
github.com/prometheus/common v0.33.0 h1:rHgav/0a6+uYgGdNt3jwz8FNSesO/Hsang3O0T9A5SE=
|
||||
github.com/prometheus/common v0.33.0/go.mod h1:gB3sOl7P0TvJabZpLY5uQMpUqRCPPCyRLCZYc7JZTNE=
|
||||
github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE=
|
||||
github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA=
|
||||
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
||||
github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
|
||||
github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
|
||||
github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU=
|
||||
github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
|
||||
github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo=
|
||||
github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4=
|
||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||
@ -210,8 +212,9 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/umputun/go-flags v1.5.1 h1:vRauoXV3Ultt1HrxivSxowbintgZLJE+EcBy5ta3/mY=
|
||||
github.com/umputun/go-flags v1.5.1/go.mod h1:nTbvsO/hKqe7Utri/NoyN18GR3+EWf+9RrmsdwdhrEc=
|
||||
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
@ -289,7 +292,6 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R
|
||||
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||
golang.org/x/net v0.0.0-20220412020605-290c469a71a5 h1:bRb386wvrE+oBNdF1d/Xh9mQrfQ4ecYhW5qJ5GvTGT4=
|
||||
@ -348,8 +350,8 @@ golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad h1:ntjMns5wyP/fN65tdBD4g8J5w8n015+iIIs9rtjXkY0=
|
||||
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k=
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
@ -364,8 +366,8 @@ golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxb
|
||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20220411224347-583f2d630306 h1:+gHMid33q6pen7kv9xvT+JRinntgeXO2AeZVd0AWD3w=
|
||||
golang.org/x/time v0.0.0-20220411224347-583f2d630306/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9 h1:ftMN5LMiBFjbzleLqtoBZk7KdJwhuybIU+FckUHgoyQ=
|
||||
golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
@ -409,7 +411,6 @@ golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
|
||||
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
|
||||
@ -486,8 +487,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj
|
||||
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=
|
||||
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
|
||||
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
@ -504,8 +505,8 @@ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
|
13
vendor/github.com/felixge/httpsnoop/capture_metrics.go
generated
vendored
13
vendor/github.com/felixge/httpsnoop/capture_metrics.go
generated
vendored
@ -35,9 +35,17 @@ func CaptureMetrics(hnd http.Handler, w http.ResponseWriter, r *http.Request) Me
|
||||
// sugar on top of this func), but is a more usable interface if your
|
||||
// application doesn't use the Go http.Handler interface.
|
||||
func CaptureMetricsFn(w http.ResponseWriter, fn func(http.ResponseWriter)) Metrics {
|
||||
m := Metrics{Code: http.StatusOK}
|
||||
m.CaptureMetrics(w, fn)
|
||||
return m
|
||||
}
|
||||
|
||||
// CaptureMetrics wraps w and calls fn with the wrapped w and updates
|
||||
// Metrics m with the resulting metrics. This is similar to CaptureMetricsFn,
|
||||
// but allows one to customize starting Metrics object.
|
||||
func (m *Metrics) CaptureMetrics(w http.ResponseWriter, fn func(http.ResponseWriter)) {
|
||||
var (
|
||||
start = time.Now()
|
||||
m = Metrics{Code: http.StatusOK}
|
||||
headerWritten bool
|
||||
hooks = Hooks{
|
||||
WriteHeader: func(next WriteHeaderFunc) WriteHeaderFunc {
|
||||
@ -74,6 +82,5 @@ func CaptureMetricsFn(w http.ResponseWriter, fn func(http.ResponseWriter)) Metri
|
||||
)
|
||||
|
||||
fn(Wrap(w, hooks))
|
||||
m.Duration = time.Since(start)
|
||||
return m
|
||||
m.Duration += time.Since(start)
|
||||
}
|
||||
|
10
vendor/github.com/go-pkgz/expirable-cache/.golangci.yml
generated
vendored
10
vendor/github.com/go-pkgz/expirable-cache/.golangci.yml
generated
vendored
@ -1,8 +1,6 @@
|
||||
linters-settings:
|
||||
govet:
|
||||
check-shadowing: true
|
||||
golint:
|
||||
min-confidence: 0
|
||||
gocyclo:
|
||||
min-complexity: 15
|
||||
maligned:
|
||||
@ -25,7 +23,7 @@ linters-settings:
|
||||
linters:
|
||||
enable:
|
||||
- megacheck
|
||||
- golint
|
||||
- revive
|
||||
- govet
|
||||
- unconvert
|
||||
- megacheck
|
||||
@ -42,7 +40,7 @@ linters:
|
||||
- varcheck
|
||||
- stylecheck
|
||||
- gochecknoinits
|
||||
- scopelint
|
||||
- exportloopref
|
||||
- gocritic
|
||||
- nakedret
|
||||
- gosimple
|
||||
@ -57,8 +55,4 @@ run:
|
||||
- vendor
|
||||
|
||||
issues:
|
||||
exclude-rules:
|
||||
- text: "should have a package comment, unless it's in another file for this package"
|
||||
linters:
|
||||
- golint
|
||||
exclude-use-default: false
|
||||
|
4
vendor/github.com/go-pkgz/expirable-cache/README.md
generated
vendored
4
vendor/github.com/go-pkgz/expirable-cache/README.md
generated
vendored
@ -29,12 +29,12 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/go-pkgz/expirable-cache"
|
||||
"github.com/go-pkgz/expirable-cache/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// make cache with short TTL and 3 max keys
|
||||
c, _ := cache.NewCache(cache.MaxKeys(3), cache.TTL(time.Millisecond*10))
|
||||
c := cache.NewCache[string, string]().WithMaxKeys(3).WithTTL(time.Millisecond * 10)
|
||||
|
||||
// set value under key1.
|
||||
// with 0 ttl (last parameter) will use cache-wide setting instead (10ms).
|
||||
|
4
vendor/github.com/go-pkgz/expirable-cache/cache.go
generated
vendored
4
vendor/github.com/go-pkgz/expirable-cache/cache.go
generated
vendored
@ -17,8 +17,6 @@ import (
|
||||
"fmt"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// Cache defines cache interface
|
||||
@ -73,7 +71,7 @@ func NewCache(options ...Option) (Cache, error) {
|
||||
|
||||
for _, opt := range options {
|
||||
if err := opt(&res); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to set cache option")
|
||||
return nil, fmt.Errorf("failed to set cache option: %w", err)
|
||||
}
|
||||
}
|
||||
return &res, nil
|
||||
|
27
vendor/github.com/go-pkgz/rest/README.md
generated
vendored
27
vendor/github.com/go-pkgz/rest/README.md
generated
vendored
@ -119,6 +119,33 @@ Maybe middleware will allow you to change the flow of the middleware stack execu
|
||||
value of maybeFn(request). This is useful for example if you'd like to skip a middleware handler if
|
||||
a request does not satisfy the maybeFn logic.
|
||||
|
||||
### Benchmarks middleware
|
||||
|
||||
Benchmarks middleware allows to measure the time of request handling, number of request per second and report aggregated metrics. This middleware keeps track of the request in the memory and keep up to 900 points (15 minutes, data-point per second).
|
||||
|
||||
In order to retrieve the data user should call `Stats(d duration)` method. duration is the time window for which the benchmark data should be returned. It can be any duration from 1s to 15m. Note: all the time data is in microseconds.
|
||||
|
||||
example with chi router:
|
||||
|
||||
```go
|
||||
router := chi.NewRouter()
|
||||
bench = rest.NewBenchmarks()
|
||||
router.Use(bench.Middleware)
|
||||
...
|
||||
router.Get("/bench", func(w http.ResponseWriter, r *http.Request) {
|
||||
resp := struct {
|
||||
OneMin rest.BenchmarkStats `json:"1min"`
|
||||
FiveMin rest.BenchmarkStats `json:"5min"`
|
||||
FifteenMin rest.BenchmarkStats `json:"15min"`
|
||||
}{
|
||||
bench.Stats(time.Minute),
|
||||
bench.Stats(time.Minute * 5),
|
||||
bench.Stats(time.Minute * 15),
|
||||
}
|
||||
render.JSON(w, r, resp)
|
||||
})
|
||||
```
|
||||
|
||||
## Helpers
|
||||
|
||||
- `rest.Wrap` - converts a list of middlewares to nested handlers calls (in reverse order)
|
||||
|
159
vendor/github.com/go-pkgz/rest/benchmarks.go
generated
vendored
Normal file
159
vendor/github.com/go-pkgz/rest/benchmarks.go
generated
vendored
Normal file
@ -0,0 +1,159 @@
|
||||
package rest
|
||||
|
||||
import (
|
||||
"container/list"
|
||||
"net/http"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
var maxTimeRangeDefault = time.Duration(15) * time.Minute
|
||||
|
||||
// Benchmarks is a basic benchmarking middleware collecting and reporting performance metrics
|
||||
// It keeps track of the requests speeds and counts in 1s benchData buckets ,limiting the number of buckets
|
||||
// to maxTimeRange. User can request the benchmark for any time duration. This is intended to be used
|
||||
// for retrieving the benchmark data for the last minute, 5 minutes and up to maxTimeRange.
|
||||
type Benchmarks struct {
|
||||
st time.Time
|
||||
data *list.List
|
||||
lock sync.RWMutex
|
||||
maxTimeRange time.Duration
|
||||
|
||||
nowFn func() time.Time // for testing only
|
||||
}
|
||||
|
||||
type benchData struct {
|
||||
// 1s aggregates
|
||||
requests int
|
||||
respTime time.Duration
|
||||
minRespTime time.Duration
|
||||
maxRespTime time.Duration
|
||||
ts time.Time
|
||||
}
|
||||
|
||||
// BenchmarkStats holds the stats for a given interval
|
||||
type BenchmarkStats struct {
|
||||
Requests int `json:"requests"`
|
||||
RequestsSec float64 `json:"requests_sec"`
|
||||
AverageRespTime int64 `json:"average_resp_time"`
|
||||
MinRespTime int64 `json:"min_resp_time"`
|
||||
MaxRespTime int64 `json:"max_resp_time"`
|
||||
}
|
||||
|
||||
// NewBenchmarks creates a new benchmark middleware
|
||||
func NewBenchmarks() *Benchmarks {
|
||||
res := &Benchmarks{
|
||||
st: time.Now(),
|
||||
data: list.New(),
|
||||
nowFn: time.Now,
|
||||
maxTimeRange: maxTimeRangeDefault,
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
// WithTimeRange sets the maximum time range for the benchmark to keep data for.
|
||||
// Default is 15 minutes. The increase of this range will change memory utilization as each second of the range
|
||||
// kept as benchData aggregate. The default means 15*60 = 900 seconds of data aggregate.
|
||||
// Larger range allows for longer time periods to be benchmarked.
|
||||
func (b *Benchmarks) WithTimeRange(max time.Duration) *Benchmarks {
|
||||
b.lock.Lock()
|
||||
defer b.lock.Unlock()
|
||||
b.maxTimeRange = max
|
||||
return b
|
||||
}
|
||||
|
||||
// Handler calculates 1/5/10m request per second and allows to access those values
|
||||
func (b *Benchmarks) Handler(next http.Handler) http.Handler {
|
||||
|
||||
fn := func(w http.ResponseWriter, r *http.Request) {
|
||||
st := b.nowFn()
|
||||
defer func() {
|
||||
b.update(time.Since(st))
|
||||
}()
|
||||
next.ServeHTTP(w, r)
|
||||
}
|
||||
return http.HandlerFunc(fn)
|
||||
}
|
||||
|
||||
func (b *Benchmarks) update(reqDuration time.Duration) {
|
||||
now := b.nowFn().Truncate(time.Second)
|
||||
|
||||
b.lock.Lock()
|
||||
defer b.lock.Unlock()
|
||||
|
||||
// keep maxTimeRange in the list, drop the rest
|
||||
for e := b.data.Front(); e != nil; e = e.Next() {
|
||||
if b.data.Front().Value.(benchData).ts.After(b.nowFn().Add(-b.maxTimeRange)) {
|
||||
break
|
||||
}
|
||||
b.data.Remove(b.data.Front())
|
||||
}
|
||||
|
||||
last := b.data.Back()
|
||||
if last == nil || last.Value.(benchData).ts.Before(now) {
|
||||
b.data.PushBack(benchData{requests: 1, respTime: reqDuration, ts: now,
|
||||
minRespTime: reqDuration, maxRespTime: reqDuration})
|
||||
return
|
||||
}
|
||||
|
||||
bd := last.Value.(benchData)
|
||||
bd.requests++
|
||||
bd.respTime += reqDuration
|
||||
|
||||
if bd.minRespTime == 0 || reqDuration < bd.minRespTime {
|
||||
bd.minRespTime = reqDuration
|
||||
}
|
||||
if bd.maxRespTime == 0 || reqDuration > bd.maxRespTime {
|
||||
bd.maxRespTime = reqDuration
|
||||
}
|
||||
|
||||
last.Value = bd
|
||||
}
|
||||
|
||||
// Stats returns the current benchmark stats for the given duration
|
||||
func (b *Benchmarks) Stats(interval time.Duration) BenchmarkStats {
|
||||
if interval < time.Second { // minimum interval is 1s due to the bucket size
|
||||
return BenchmarkStats{}
|
||||
}
|
||||
|
||||
b.lock.RLock()
|
||||
defer b.lock.RUnlock()
|
||||
|
||||
var (
|
||||
requests int
|
||||
respTime time.Duration
|
||||
)
|
||||
|
||||
stInterval, fnInterval := time.Time{}, time.Time{}
|
||||
var minRespTime, maxRespTime time.Duration
|
||||
for e := b.data.Back(); e != nil; e = e.Prev() { // reverse order
|
||||
bd := e.Value.(benchData)
|
||||
if bd.ts.Before(b.nowFn().Add(-interval)) {
|
||||
break
|
||||
}
|
||||
if minRespTime == 0 || bd.minRespTime < minRespTime {
|
||||
minRespTime = bd.minRespTime
|
||||
}
|
||||
if maxRespTime == 0 || bd.maxRespTime > maxRespTime {
|
||||
maxRespTime = bd.maxRespTime
|
||||
}
|
||||
requests += bd.requests
|
||||
respTime += bd.respTime
|
||||
if fnInterval.IsZero() {
|
||||
fnInterval = bd.ts.Add(time.Second)
|
||||
}
|
||||
stInterval = bd.ts
|
||||
}
|
||||
|
||||
if requests == 0 {
|
||||
return BenchmarkStats{}
|
||||
}
|
||||
|
||||
return BenchmarkStats{
|
||||
Requests: requests,
|
||||
RequestsSec: float64(requests) / (fnInterval.Sub(stInterval).Seconds()),
|
||||
AverageRespTime: respTime.Microseconds() / int64(requests),
|
||||
MinRespTime: minRespTime.Microseconds(),
|
||||
MaxRespTime: maxRespTime.Microseconds(),
|
||||
}
|
||||
}
|
3
vendor/github.com/prometheus/procfs/.gitignore
generated
vendored
3
vendor/github.com/prometheus/procfs/.gitignore
generated
vendored
@ -1 +1,2 @@
|
||||
/fixtures/
|
||||
/testdata/fixtures/
|
||||
/fixtures
|
||||
|
10
vendor/github.com/prometheus/procfs/.golangci.yml
generated
vendored
10
vendor/github.com/prometheus/procfs/.golangci.yml
generated
vendored
@ -1,4 +1,12 @@
|
||||
---
|
||||
linters:
|
||||
enable:
|
||||
- golint
|
||||
- godot
|
||||
- revive
|
||||
|
||||
linter-settings:
|
||||
godot:
|
||||
capital: true
|
||||
exclude:
|
||||
# Ignore "See: URL"
|
||||
- 'See:'
|
||||
|
4
vendor/github.com/prometheus/procfs/CODE_OF_CONDUCT.md
generated
vendored
4
vendor/github.com/prometheus/procfs/CODE_OF_CONDUCT.md
generated
vendored
@ -1,3 +1,3 @@
|
||||
## Prometheus Community Code of Conduct
|
||||
# Prometheus Community Code of Conduct
|
||||
|
||||
Prometheus follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md).
|
||||
Prometheus follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/main/code-of-conduct.md).
|
||||
|
4
vendor/github.com/prometheus/procfs/CONTRIBUTING.md
generated
vendored
4
vendor/github.com/prometheus/procfs/CONTRIBUTING.md
generated
vendored
@ -97,7 +97,7 @@ Many of the files are changing continuously and the data being read can in some
|
||||
reads in the same file. Also, most of the files are relatively small (less than a few KBs), and system calls
|
||||
to the `stat` function will often return the wrong size. Therefore, for most files it's recommended to read the
|
||||
full file in a single operation using an internal utility function called `util.ReadFileNoStat`.
|
||||
This function is similar to `ioutil.ReadFile`, but it avoids the system call to `stat` to get the current size of
|
||||
This function is similar to `os.ReadFile`, but it avoids the system call to `stat` to get the current size of
|
||||
the file.
|
||||
|
||||
Note that parsing the file's contents can still be performed one line at a time. This is done by first reading
|
||||
@ -113,7 +113,7 @@ the full file, and then using a scanner on the `[]byte` or `string` containing t
|
||||
```
|
||||
|
||||
The `/sys` filesystem contains many very small files which contain only a single numeric or text value. These files
|
||||
can be read using an internal function called `util.SysReadFile` which is similar to `ioutil.ReadFile` but does
|
||||
can be read using an internal function called `util.SysReadFile` which is similar to `os.ReadFile` but does
|
||||
not bother to check the size of the file before reading.
|
||||
```
|
||||
data, err := util.SysReadFile("/sys/class/power_supply/BAT0/capacity")
|
||||
|
10
vendor/github.com/prometheus/procfs/Makefile
generated
vendored
10
vendor/github.com/prometheus/procfs/Makefile
generated
vendored
@ -14,18 +14,18 @@
|
||||
include Makefile.common
|
||||
|
||||
%/.unpacked: %.ttar
|
||||
@echo ">> extracting fixtures"
|
||||
@echo ">> extracting fixtures $*"
|
||||
./ttar -C $(dir $*) -x -f $*.ttar
|
||||
touch $@
|
||||
|
||||
fixtures: fixtures/.unpacked
|
||||
fixtures: testdata/fixtures/.unpacked
|
||||
|
||||
update_fixtures:
|
||||
rm -vf fixtures/.unpacked
|
||||
./ttar -c -f fixtures.ttar fixtures/
|
||||
rm -vf testdata/fixtures/.unpacked
|
||||
./ttar -c -f testdata/fixtures.ttar -C testdata/ fixtures/
|
||||
|
||||
.PHONY: build
|
||||
build:
|
||||
|
||||
.PHONY: test
|
||||
test: fixtures/.unpacked common-test
|
||||
test: testdata/fixtures/.unpacked common-test
|
||||
|
89
vendor/github.com/prometheus/procfs/Makefile.common
generated
vendored
89
vendor/github.com/prometheus/procfs/Makefile.common
generated
vendored
@ -36,29 +36,6 @@ GO_VERSION ?= $(shell $(GO) version)
|
||||
GO_VERSION_NUMBER ?= $(word 3, $(GO_VERSION))
|
||||
PRE_GO_111 ?= $(shell echo $(GO_VERSION_NUMBER) | grep -E 'go1\.(10|[0-9])\.')
|
||||
|
||||
GOVENDOR :=
|
||||
GO111MODULE :=
|
||||
ifeq (, $(PRE_GO_111))
|
||||
ifneq (,$(wildcard go.mod))
|
||||
# Enforce Go modules support just in case the directory is inside GOPATH (and for Travis CI).
|
||||
GO111MODULE := on
|
||||
|
||||
ifneq (,$(wildcard vendor))
|
||||
# Always use the local vendor/ directory to satisfy the dependencies.
|
||||
GOOPTS := $(GOOPTS) -mod=vendor
|
||||
endif
|
||||
endif
|
||||
else
|
||||
ifneq (,$(wildcard go.mod))
|
||||
ifneq (,$(wildcard vendor))
|
||||
$(warning This repository requires Go >= 1.11 because of Go modules)
|
||||
$(warning Some recipes may not work as expected as the current Go runtime is '$(GO_VERSION_NUMBER)')
|
||||
endif
|
||||
else
|
||||
# This repository isn't using Go modules (yet).
|
||||
GOVENDOR := $(FIRST_GOPATH)/bin/govendor
|
||||
endif
|
||||
endif
|
||||
PROMU := $(FIRST_GOPATH)/bin/promu
|
||||
pkgs = ./...
|
||||
|
||||
@ -78,17 +55,23 @@ ifneq ($(shell which gotestsum),)
|
||||
endif
|
||||
endif
|
||||
|
||||
PROMU_VERSION ?= 0.12.0
|
||||
PROMU_VERSION ?= 0.13.0
|
||||
PROMU_URL := https://github.com/prometheus/promu/releases/download/v$(PROMU_VERSION)/promu-$(PROMU_VERSION).$(GO_BUILD_PLATFORM).tar.gz
|
||||
|
||||
GOLANGCI_LINT :=
|
||||
GOLANGCI_LINT_OPTS ?=
|
||||
GOLANGCI_LINT_VERSION ?= v1.39.0
|
||||
GOLANGCI_LINT_VERSION ?= v1.45.2
|
||||
# golangci-lint only supports linux, darwin and windows platforms on i386/amd64.
|
||||
# windows isn't included here because of the path separator being different.
|
||||
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin))
|
||||
ifeq ($(GOHOSTARCH),$(filter $(GOHOSTARCH),amd64 i386))
|
||||
GOLANGCI_LINT := $(FIRST_GOPATH)/bin/golangci-lint
|
||||
# If we're in CI and there is an Actions file, that means the linter
|
||||
# is being run in Actions, so we don't need to run it here.
|
||||
ifeq (,$(CIRCLE_JOB))
|
||||
GOLANGCI_LINT := $(FIRST_GOPATH)/bin/golangci-lint
|
||||
else ifeq (,$(wildcard .github/workflows/golangci-lint.yml))
|
||||
GOLANGCI_LINT := $(FIRST_GOPATH)/bin/golangci-lint
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
@ -144,32 +127,25 @@ common-check_license:
|
||||
.PHONY: common-deps
|
||||
common-deps:
|
||||
@echo ">> getting dependencies"
|
||||
ifdef GO111MODULE
|
||||
GO111MODULE=$(GO111MODULE) $(GO) mod download
|
||||
else
|
||||
$(GO) get $(GOOPTS) -t ./...
|
||||
endif
|
||||
$(GO) mod download
|
||||
|
||||
.PHONY: update-go-deps
|
||||
update-go-deps:
|
||||
@echo ">> updating Go dependencies"
|
||||
@for m in $$($(GO) list -mod=readonly -m -f '{{ if and (not .Indirect) (not .Main)}}{{.Path}}{{end}}' all); do \
|
||||
$(GO) get $$m; \
|
||||
$(GO) get -d $$m; \
|
||||
done
|
||||
GO111MODULE=$(GO111MODULE) $(GO) mod tidy
|
||||
ifneq (,$(wildcard vendor))
|
||||
GO111MODULE=$(GO111MODULE) $(GO) mod vendor
|
||||
endif
|
||||
$(GO) mod tidy
|
||||
|
||||
.PHONY: common-test-short
|
||||
common-test-short: $(GOTEST_DIR)
|
||||
@echo ">> running short tests"
|
||||
GO111MODULE=$(GO111MODULE) $(GOTEST) -short $(GOOPTS) $(pkgs)
|
||||
$(GOTEST) -short $(GOOPTS) $(pkgs)
|
||||
|
||||
.PHONY: common-test
|
||||
common-test: $(GOTEST_DIR)
|
||||
@echo ">> running all tests"
|
||||
GO111MODULE=$(GO111MODULE) $(GOTEST) $(test-flags) $(GOOPTS) $(pkgs)
|
||||
$(GOTEST) $(test-flags) $(GOOPTS) $(pkgs)
|
||||
|
||||
$(GOTEST_DIR):
|
||||
@mkdir -p $@
|
||||
@ -177,25 +153,21 @@ $(GOTEST_DIR):
|
||||
.PHONY: common-format
|
||||
common-format:
|
||||
@echo ">> formatting code"
|
||||
GO111MODULE=$(GO111MODULE) $(GO) fmt $(pkgs)
|
||||
$(GO) fmt $(pkgs)
|
||||
|
||||
.PHONY: common-vet
|
||||
common-vet:
|
||||
@echo ">> vetting code"
|
||||
GO111MODULE=$(GO111MODULE) $(GO) vet $(GOOPTS) $(pkgs)
|
||||
$(GO) vet $(GOOPTS) $(pkgs)
|
||||
|
||||
.PHONY: common-lint
|
||||
common-lint: $(GOLANGCI_LINT)
|
||||
ifdef GOLANGCI_LINT
|
||||
@echo ">> running golangci-lint"
|
||||
ifdef GO111MODULE
|
||||
# 'go list' needs to be executed before staticcheck to prepopulate the modules cache.
|
||||
# Otherwise staticcheck might fail randomly for some reason not yet explained.
|
||||
GO111MODULE=$(GO111MODULE) $(GO) list -e -compiled -test=true -export=false -deps=true -find=false -tags= -- ./... > /dev/null
|
||||
GO111MODULE=$(GO111MODULE) $(GOLANGCI_LINT) run $(GOLANGCI_LINT_OPTS) $(pkgs)
|
||||
else
|
||||
$(GOLANGCI_LINT) run $(pkgs)
|
||||
endif
|
||||
$(GO) list -e -compiled -test=true -export=false -deps=true -find=false -tags= -- ./... > /dev/null
|
||||
$(GOLANGCI_LINT) run $(GOLANGCI_LINT_OPTS) $(pkgs)
|
||||
endif
|
||||
|
||||
.PHONY: common-yamllint
|
||||
@ -212,28 +184,15 @@ endif
|
||||
common-staticcheck: lint
|
||||
|
||||
.PHONY: common-unused
|
||||
common-unused: $(GOVENDOR)
|
||||
ifdef GOVENDOR
|
||||
@echo ">> running check for unused packages"
|
||||
@$(GOVENDOR) list +unused | grep . && exit 1 || echo 'No unused packages'
|
||||
else
|
||||
ifdef GO111MODULE
|
||||
common-unused:
|
||||
@echo ">> running check for unused/missing packages in go.mod"
|
||||
GO111MODULE=$(GO111MODULE) $(GO) mod tidy
|
||||
ifeq (,$(wildcard vendor))
|
||||
$(GO) mod tidy
|
||||
@git diff --exit-code -- go.sum go.mod
|
||||
else
|
||||
@echo ">> running check for unused packages in vendor/"
|
||||
GO111MODULE=$(GO111MODULE) $(GO) mod vendor
|
||||
@git diff --exit-code -- go.sum go.mod vendor/
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
.PHONY: common-build
|
||||
common-build: promu
|
||||
@echo ">> building binaries"
|
||||
GO111MODULE=$(GO111MODULE) $(PROMU) build --prefix $(PREFIX) $(PROMU_BINARIES)
|
||||
$(PROMU) build --prefix $(PREFIX) $(PROMU_BINARIES)
|
||||
|
||||
.PHONY: common-tarball
|
||||
common-tarball: promu
|
||||
@ -289,12 +248,6 @@ $(GOLANGCI_LINT):
|
||||
| sh -s -- -b $(FIRST_GOPATH)/bin $(GOLANGCI_LINT_VERSION)
|
||||
endif
|
||||
|
||||
ifdef GOVENDOR
|
||||
.PHONY: $(GOVENDOR)
|
||||
$(GOVENDOR):
|
||||
GOOS= GOARCH= $(GO) get -u github.com/kardianos/govendor
|
||||
endif
|
||||
|
||||
.PHONY: precheck
|
||||
precheck::
|
||||
|
||||
|
2
vendor/github.com/prometheus/procfs/SECURITY.md
generated
vendored
2
vendor/github.com/prometheus/procfs/SECURITY.md
generated
vendored
@ -3,4 +3,4 @@
|
||||
The Prometheus security policy, including how to report vulnerabilities, can be
|
||||
found here:
|
||||
|
||||
https://prometheus.io/docs/operating/security/
|
||||
<https://prometheus.io/docs/operating/security/>
|
||||
|
45
vendor/github.com/prometheus/procfs/arp.go
generated
vendored
45
vendor/github.com/prometheus/procfs/arp.go
generated
vendored
@ -15,11 +15,28 @@ package procfs
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Learned from include/uapi/linux/if_arp.h.
|
||||
const (
|
||||
// completed entry (ha valid).
|
||||
ATFComplete = 0x02
|
||||
// permanent entry.
|
||||
ATFPermanent = 0x04
|
||||
// Publish entry.
|
||||
ATFPublish = 0x08
|
||||
// Has requested trailers.
|
||||
ATFUseTrailers = 0x10
|
||||
// Obsoleted: Want to use a netmask (only for proxy entries).
|
||||
ATFNetmask = 0x20
|
||||
// Don't answer this addresses.
|
||||
ATFDontPublish = 0x40
|
||||
)
|
||||
|
||||
// ARPEntry contains a single row of the columnar data represented in
|
||||
// /proc/net/arp.
|
||||
type ARPEntry struct {
|
||||
@ -29,12 +46,14 @@ type ARPEntry struct {
|
||||
HWAddr net.HardwareAddr
|
||||
// Name of the device
|
||||
Device string
|
||||
// Flags
|
||||
Flags byte
|
||||
}
|
||||
|
||||
// GatherARPEntries retrieves all the ARP entries, parse the relevant columns,
|
||||
// and then return a slice of ARPEntry's.
|
||||
func (fs FS) GatherARPEntries() ([]ARPEntry, error) {
|
||||
data, err := ioutil.ReadFile(fs.proc.Path("net/arp"))
|
||||
data, err := os.ReadFile(fs.proc.Path("net/arp"))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error reading arp %q: %w", fs.proc.Path("net/arp"), err)
|
||||
}
|
||||
@ -72,14 +91,26 @@ func parseARPEntries(data []byte) ([]ARPEntry, error) {
|
||||
}
|
||||
|
||||
func parseARPEntry(columns []string) (ARPEntry, error) {
|
||||
entry := ARPEntry{Device: columns[5]}
|
||||
ip := net.ParseIP(columns[0])
|
||||
mac := net.HardwareAddr(columns[3])
|
||||
entry.IPAddr = ip
|
||||
|
||||
entry := ARPEntry{
|
||||
IPAddr: ip,
|
||||
HWAddr: mac,
|
||||
Device: columns[5],
|
||||
if mac, err := net.ParseMAC(columns[3]); err == nil {
|
||||
entry.HWAddr = mac
|
||||
} else {
|
||||
return ARPEntry{}, err
|
||||
}
|
||||
|
||||
if flags, err := strconv.ParseUint(columns[2], 0, 8); err == nil {
|
||||
entry.Flags = byte(flags)
|
||||
} else {
|
||||
return ARPEntry{}, err
|
||||
}
|
||||
|
||||
return entry, nil
|
||||
}
|
||||
|
||||
// IsComplete returns true if ARP entry is marked with complete flag.
|
||||
func (entry *ARPEntry) IsComplete() bool {
|
||||
return entry.Flags&ATFComplete != 0
|
||||
}
|
||||
|
5
vendor/github.com/prometheus/procfs/cpuinfo.go
generated
vendored
5
vendor/github.com/prometheus/procfs/cpuinfo.go
generated
vendored
@ -11,6 +11,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build linux
|
||||
// +build linux
|
||||
|
||||
package procfs
|
||||
@ -27,7 +28,7 @@ import (
|
||||
"github.com/prometheus/procfs/internal/util"
|
||||
)
|
||||
|
||||
// CPUInfo contains general information about a system CPU found in /proc/cpuinfo
|
||||
// CPUInfo contains general information about a system CPU found in /proc/cpuinfo.
|
||||
type CPUInfo struct {
|
||||
Processor uint
|
||||
VendorID string
|
||||
@ -469,7 +470,7 @@ func parseCPUInfoDummy(_ []byte) ([]CPUInfo, error) { // nolint:unused,deadcode
|
||||
}
|
||||
|
||||
// firstNonEmptyLine advances the scanner to the first non-empty line
|
||||
// and returns the contents of that line
|
||||
// and returns the contents of that line.
|
||||
func firstNonEmptyLine(scanner *bufio.Scanner) string {
|
||||
for scanner.Scan() {
|
||||
line := scanner.Text()
|
||||
|
1
vendor/github.com/prometheus/procfs/cpuinfo_armx.go
generated
vendored
1
vendor/github.com/prometheus/procfs/cpuinfo_armx.go
generated
vendored
@ -11,6 +11,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build linux && (arm || arm64)
|
||||
// +build linux
|
||||
// +build arm arm64
|
||||
|
||||
|
1
vendor/github.com/prometheus/procfs/cpuinfo_mipsx.go
generated
vendored
1
vendor/github.com/prometheus/procfs/cpuinfo_mipsx.go
generated
vendored
@ -11,6 +11,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build linux && (mips || mipsle || mips64 || mips64le)
|
||||
// +build linux
|
||||
// +build mips mipsle mips64 mips64le
|
||||
|
||||
|
4
vendor/github.com/prometheus/procfs/cpuinfo_others.go
generated
vendored
4
vendor/github.com/prometheus/procfs/cpuinfo_others.go
generated
vendored
@ -11,8 +11,8 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// +build linux
|
||||
// +build !386,!amd64,!arm,!arm64,!mips,!mips64,!mips64le,!mipsle,!ppc64,!ppc64le,!riscv64,!s390x
|
||||
//go:build linux && !386 && !amd64 && !arm && !arm64 && !mips && !mips64 && !mips64le && !mipsle && !ppc64 && !ppc64le && !riscv64 && !s390x
|
||||
// +build linux,!386,!amd64,!arm,!arm64,!mips,!mips64,!mips64le,!mipsle,!ppc64,!ppc64le,!riscv64,!s390x
|
||||
|
||||
package procfs
|
||||
|
||||
|
1
vendor/github.com/prometheus/procfs/cpuinfo_ppcx.go
generated
vendored
1
vendor/github.com/prometheus/procfs/cpuinfo_ppcx.go
generated
vendored
@ -11,6 +11,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build linux && (ppc64 || ppc64le)
|
||||
// +build linux
|
||||
// +build ppc64 ppc64le
|
||||
|
||||
|
1
vendor/github.com/prometheus/procfs/cpuinfo_riscvx.go
generated
vendored
1
vendor/github.com/prometheus/procfs/cpuinfo_riscvx.go
generated
vendored
@ -11,6 +11,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build linux && (riscv || riscv64)
|
||||
// +build linux
|
||||
// +build riscv riscv64
|
||||
|
||||
|
1
vendor/github.com/prometheus/procfs/cpuinfo_s390x.go
generated
vendored
1
vendor/github.com/prometheus/procfs/cpuinfo_s390x.go
generated
vendored
@ -11,6 +11,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build linux
|
||||
// +build linux
|
||||
|
||||
package procfs
|
||||
|
1
vendor/github.com/prometheus/procfs/cpuinfo_x86.go
generated
vendored
1
vendor/github.com/prometheus/procfs/cpuinfo_x86.go
generated
vendored
@ -11,6 +11,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build linux && (386 || amd64)
|
||||
// +build linux
|
||||
// +build 386 amd64
|
||||
|
||||
|
7673
vendor/github.com/prometheus/procfs/fixtures.ttar
generated
vendored
7673
vendor/github.com/prometheus/procfs/fixtures.ttar
generated
vendored
File diff suppressed because it is too large
Load Diff
2
vendor/github.com/prometheus/procfs/internal/fs/fs.go
generated
vendored
2
vendor/github.com/prometheus/procfs/internal/fs/fs.go
generated
vendored
@ -26,7 +26,7 @@ const (
|
||||
// DefaultSysMountPoint is the common mount point of the sys filesystem.
|
||||
DefaultSysMountPoint = "/sys"
|
||||
|
||||
// DefaultConfigfsMountPoint is the common mount point of the configfs
|
||||
// DefaultConfigfsMountPoint is the common mount point of the configfs.
|
||||
DefaultConfigfsMountPoint = "/sys/kernel/config"
|
||||
)
|
||||
|
||||
|
6
vendor/github.com/prometheus/procfs/internal/util/parse.go
generated
vendored
6
vendor/github.com/prometheus/procfs/internal/util/parse.go
generated
vendored
@ -14,7 +14,7 @@
|
||||
package util
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
@ -66,7 +66,7 @@ func ParsePInt64s(ss []string) ([]*int64, error) {
|
||||
|
||||
// ReadUintFromFile reads a file and attempts to parse a uint64 from it.
|
||||
func ReadUintFromFile(path string) (uint64, error) {
|
||||
data, err := ioutil.ReadFile(path)
|
||||
data, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
@ -75,7 +75,7 @@ func ReadUintFromFile(path string) (uint64, error) {
|
||||
|
||||
// ReadIntFromFile reads a file and attempts to parse a int64 from it.
|
||||
func ReadIntFromFile(path string) (int64, error) {
|
||||
data, err := ioutil.ReadFile(path)
|
||||
data, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
11
vendor/github.com/prometheus/procfs/internal/util/readfile.go
generated
vendored
11
vendor/github.com/prometheus/procfs/internal/util/readfile.go
generated
vendored
@ -15,17 +15,16 @@ package util
|
||||
|
||||
import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
)
|
||||
|
||||
// ReadFileNoStat uses ioutil.ReadAll to read contents of entire file.
|
||||
// This is similar to ioutil.ReadFile but without the call to os.Stat, because
|
||||
// ReadFileNoStat uses io.ReadAll to read contents of entire file.
|
||||
// This is similar to os.ReadFile but without the call to os.Stat, because
|
||||
// many files in /proc and /sys report incorrect file sizes (either 0 or 4096).
|
||||
// Reads a max file size of 512kB. For files larger than this, a scanner
|
||||
// Reads a max file size of 1024kB. For files larger than this, a scanner
|
||||
// should be used.
|
||||
func ReadFileNoStat(filename string) ([]byte, error) {
|
||||
const maxBufferSize = 1024 * 512
|
||||
const maxBufferSize = 1024 * 1024
|
||||
|
||||
f, err := os.Open(filename)
|
||||
if err != nil {
|
||||
@ -34,5 +33,5 @@ func ReadFileNoStat(filename string) ([]byte, error) {
|
||||
defer f.Close()
|
||||
|
||||
reader := io.LimitReader(f, maxBufferSize)
|
||||
return ioutil.ReadAll(reader)
|
||||
return io.ReadAll(reader)
|
||||
}
|
||||
|
8
vendor/github.com/prometheus/procfs/internal/util/sysreadfile.go
generated
vendored
8
vendor/github.com/prometheus/procfs/internal/util/sysreadfile.go
generated
vendored
@ -11,7 +11,9 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// +build linux,!appengine
|
||||
//go:build (linux || darwin) && !appengine
|
||||
// +build linux darwin
|
||||
// +build !appengine
|
||||
|
||||
package util
|
||||
|
||||
@ -21,7 +23,7 @@ import (
|
||||
"syscall"
|
||||
)
|
||||
|
||||
// SysReadFile is a simplified ioutil.ReadFile that invokes syscall.Read directly.
|
||||
// SysReadFile is a simplified os.ReadFile that invokes syscall.Read directly.
|
||||
// https://github.com/prometheus/node_exporter/pull/728/files
|
||||
//
|
||||
// Note that this function will not read files larger than 128 bytes.
|
||||
@ -33,7 +35,7 @@ func SysReadFile(file string) (string, error) {
|
||||
defer f.Close()
|
||||
|
||||
// On some machines, hwmon drivers are broken and return EAGAIN. This causes
|
||||
// Go's ioutil.ReadFile implementation to poll forever.
|
||||
// Go's os.ReadFile implementation to poll forever.
|
||||
//
|
||||
// Since we either want to read data or bail immediately, do the simplest
|
||||
// possible read using syscall directly.
|
||||
|
3
vendor/github.com/prometheus/procfs/internal/util/sysreadfile_compat.go
generated
vendored
3
vendor/github.com/prometheus/procfs/internal/util/sysreadfile_compat.go
generated
vendored
@ -11,7 +11,8 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// +build linux,appengine !linux
|
||||
//go:build (linux && appengine) || (!linux && !darwin)
|
||||
// +build linux,appengine !linux,!darwin
|
||||
|
||||
package util
|
||||
|
||||
|
3
vendor/github.com/prometheus/procfs/ipvs.go
generated
vendored
3
vendor/github.com/prometheus/procfs/ipvs.go
generated
vendored
@ -20,7 +20,6 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"os"
|
||||
"strconv"
|
||||
@ -84,7 +83,7 @@ func parseIPVSStats(r io.Reader) (IPVSStats, error) {
|
||||
stats IPVSStats
|
||||
)
|
||||
|
||||
statContent, err := ioutil.ReadAll(r)
|
||||
statContent, err := io.ReadAll(r)
|
||||
if err != nil {
|
||||
return IPVSStats{}, err
|
||||
}
|
||||
|
1
vendor/github.com/prometheus/procfs/kernel_random.go
generated
vendored
1
vendor/github.com/prometheus/procfs/kernel_random.go
generated
vendored
@ -11,6 +11,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package procfs
|
||||
|
2
vendor/github.com/prometheus/procfs/loadavg.go
generated
vendored
2
vendor/github.com/prometheus/procfs/loadavg.go
generated
vendored
@ -21,7 +21,7 @@ import (
|
||||
"github.com/prometheus/procfs/internal/util"
|
||||
)
|
||||
|
||||
// LoadAvg represents an entry in /proc/loadavg
|
||||
// LoadAvg represents an entry in /proc/loadavg.
|
||||
type LoadAvg struct {
|
||||
Load1 float64
|
||||
Load5 float64
|
||||
|
10
vendor/github.com/prometheus/procfs/mdstat.go
generated
vendored
10
vendor/github.com/prometheus/procfs/mdstat.go
generated
vendored
@ -15,7 +15,7 @@ package procfs
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
@ -64,7 +64,7 @@ type MDStat struct {
|
||||
// structs containing the relevant info. More information available here:
|
||||
// https://raid.wiki.kernel.org/index.php/Mdstat
|
||||
func (fs FS) MDStat() ([]MDStat, error) {
|
||||
data, err := ioutil.ReadFile(fs.proc.Path("mdstat"))
|
||||
data, err := os.ReadFile(fs.proc.Path("mdstat"))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -166,8 +166,12 @@ func parseMDStat(mdStatData []byte) ([]MDStat, error) {
|
||||
}
|
||||
|
||||
func evalStatusLine(deviceLine, statusLine string) (active, total, down, size int64, err error) {
|
||||
statusFields := strings.Fields(statusLine)
|
||||
if len(statusFields) < 1 {
|
||||
return 0, 0, 0, 0, fmt.Errorf("unexpected statusLine %q", statusLine)
|
||||
}
|
||||
|
||||
sizeStr := strings.Fields(statusLine)[0]
|
||||
sizeStr := statusFields[0]
|
||||
size, err = strconv.ParseInt(sizeStr, 10, 64)
|
||||
if err != nil {
|
||||
return 0, 0, 0, 0, fmt.Errorf("unexpected statusLine %q: %w", statusLine, err)
|
||||
|
12
vendor/github.com/prometheus/procfs/net_conntrackstat.go
generated
vendored
12
vendor/github.com/prometheus/procfs/net_conntrackstat.go
generated
vendored
@ -25,7 +25,7 @@ import (
|
||||
)
|
||||
|
||||
// A ConntrackStatEntry represents one line from net/stat/nf_conntrack
|
||||
// and contains netfilter conntrack statistics at one CPU core
|
||||
// and contains netfilter conntrack statistics at one CPU core.
|
||||
type ConntrackStatEntry struct {
|
||||
Entries uint64
|
||||
Found uint64
|
||||
@ -38,12 +38,12 @@ type ConntrackStatEntry struct {
|
||||
SearchRestart uint64
|
||||
}
|
||||
|
||||
// ConntrackStat retrieves netfilter's conntrack statistics, split by CPU cores
|
||||
// ConntrackStat retrieves netfilter's conntrack statistics, split by CPU cores.
|
||||
func (fs FS) ConntrackStat() ([]ConntrackStatEntry, error) {
|
||||
return readConntrackStat(fs.proc.Path("net", "stat", "nf_conntrack"))
|
||||
}
|
||||
|
||||
// Parses a slice of ConntrackStatEntries from the given filepath
|
||||
// Parses a slice of ConntrackStatEntries from the given filepath.
|
||||
func readConntrackStat(path string) ([]ConntrackStatEntry, error) {
|
||||
// This file is small and can be read with one syscall.
|
||||
b, err := util.ReadFileNoStat(path)
|
||||
@ -61,7 +61,7 @@ func readConntrackStat(path string) ([]ConntrackStatEntry, error) {
|
||||
return stat, nil
|
||||
}
|
||||
|
||||
// Reads the contents of a conntrack statistics file and parses a slice of ConntrackStatEntries
|
||||
// Reads the contents of a conntrack statistics file and parses a slice of ConntrackStatEntries.
|
||||
func parseConntrackStat(r io.Reader) ([]ConntrackStatEntry, error) {
|
||||
var entries []ConntrackStatEntry
|
||||
|
||||
@ -79,7 +79,7 @@ func parseConntrackStat(r io.Reader) ([]ConntrackStatEntry, error) {
|
||||
return entries, nil
|
||||
}
|
||||
|
||||
// Parses a ConntrackStatEntry from given array of fields
|
||||
// Parses a ConntrackStatEntry from given array of fields.
|
||||
func parseConntrackStatEntry(fields []string) (*ConntrackStatEntry, error) {
|
||||
if len(fields) != 17 {
|
||||
return nil, fmt.Errorf("invalid conntrackstat entry, missing fields")
|
||||
@ -143,7 +143,7 @@ func parseConntrackStatEntry(fields []string) (*ConntrackStatEntry, error) {
|
||||
return entry, nil
|
||||
}
|
||||
|
||||
// Parses a uint64 from given hex in string
|
||||
// Parses a uint64 from given hex in string.
|
||||
func parseConntrackStatField(field string) (uint64, error) {
|
||||
val, err := strconv.ParseUint(field, 16, 64)
|
||||
if err != nil {
|
||||
|
8
vendor/github.com/prometheus/procfs/net_dev.go
generated
vendored
8
vendor/github.com/prometheus/procfs/net_dev.go
generated
vendored
@ -87,17 +87,17 @@ func newNetDev(file string) (NetDev, error) {
|
||||
// parseLine parses a single line from the /proc/net/dev file. Header lines
|
||||
// must be filtered prior to calling this method.
|
||||
func (netDev NetDev) parseLine(rawLine string) (*NetDevLine, error) {
|
||||
parts := strings.SplitN(rawLine, ":", 2)
|
||||
if len(parts) != 2 {
|
||||
idx := strings.LastIndex(rawLine, ":")
|
||||
if idx == -1 {
|
||||
return nil, errors.New("invalid net/dev line, missing colon")
|
||||
}
|
||||
fields := strings.Fields(strings.TrimSpace(parts[1]))
|
||||
fields := strings.Fields(strings.TrimSpace(rawLine[idx+1:]))
|
||||
|
||||
var err error
|
||||
line := &NetDevLine{}
|
||||
|
||||
// Interface Name
|
||||
line.Name = strings.TrimSpace(parts[0])
|
||||
line.Name = strings.TrimSpace(rawLine[:idx])
|
||||
if line.Name == "" {
|
||||
return nil, errors.New("invalid net/dev line, empty interface name")
|
||||
}
|
||||
|
2
vendor/github.com/prometheus/procfs/net_ip_socket.go
generated
vendored
2
vendor/github.com/prometheus/procfs/net_ip_socket.go
generated
vendored
@ -34,7 +34,7 @@ const (
|
||||
readLimit = 4294967296 // Byte -> 4 GiB
|
||||
)
|
||||
|
||||
// this contains generic data structures for both udp and tcp sockets
|
||||
// This contains generic data structures for both udp and tcp sockets.
|
||||
type (
|
||||
// NetIPSocket represents the contents of /proc/net/{t,u}dp{,6} file without the header.
|
||||
NetIPSocket []*netIPSocketLine
|
||||
|
4
vendor/github.com/prometheus/procfs/net_protocols.go
generated
vendored
4
vendor/github.com/prometheus/procfs/net_protocols.go
generated
vendored
@ -23,7 +23,7 @@ import (
|
||||
"github.com/prometheus/procfs/internal/util"
|
||||
)
|
||||
|
||||
// NetProtocolStats stores the contents from /proc/net/protocols
|
||||
// NetProtocolStats stores the contents from /proc/net/protocols.
|
||||
type NetProtocolStats map[string]NetProtocolStatLine
|
||||
|
||||
// NetProtocolStatLine contains a single line parsed from /proc/net/protocols. We
|
||||
@ -41,7 +41,7 @@ type NetProtocolStatLine struct {
|
||||
Capabilities NetProtocolCapabilities
|
||||
}
|
||||
|
||||
// NetProtocolCapabilities contains a list of capabilities for each protocol
|
||||
// NetProtocolCapabilities contains a list of capabilities for each protocol.
|
||||
type NetProtocolCapabilities struct {
|
||||
Close bool // 8
|
||||
Connect bool // 9
|
||||
|
8
vendor/github.com/prometheus/procfs/net_softnet.go
generated
vendored
8
vendor/github.com/prometheus/procfs/net_softnet.go
generated
vendored
@ -30,13 +30,13 @@ import (
|
||||
// * Linux 4.17 https://elixir.bootlin.com/linux/v4.17/source/net/core/net-procfs.c#L162
|
||||
// and https://elixir.bootlin.com/linux/v4.17/source/include/linux/netdevice.h#L2810.
|
||||
|
||||
// SoftnetStat contains a single row of data from /proc/net/softnet_stat
|
||||
// SoftnetStat contains a single row of data from /proc/net/softnet_stat.
|
||||
type SoftnetStat struct {
|
||||
// Number of processed packets
|
||||
// Number of processed packets.
|
||||
Processed uint32
|
||||
// Number of dropped packets
|
||||
// Number of dropped packets.
|
||||
Dropped uint32
|
||||
// Number of times processing packets ran out of quota
|
||||
// Number of times processing packets ran out of quota.
|
||||
TimeSqueezed uint32
|
||||
}
|
||||
|
||||
|
@ -79,10 +79,13 @@ type XfrmStat struct {
|
||||
// Policy is dead
|
||||
XfrmOutPolDead int
|
||||
// Policy Error
|
||||
XfrmOutPolError int
|
||||
XfrmFwdHdrError int
|
||||
XfrmOutPolError int
|
||||
// Forward routing of a packet is not allowed
|
||||
XfrmFwdHdrError int
|
||||
// State is invalid, perhaps expired
|
||||
XfrmOutStateInvalid int
|
||||
XfrmAcquireError int
|
||||
// State hasn’t been fully acquired before use
|
||||
XfrmAcquireError int
|
||||
}
|
||||
|
||||
// NewXfrmStat reads the xfrm_stat statistics.
|
8
vendor/github.com/prometheus/procfs/netstat.go
generated
vendored
8
vendor/github.com/prometheus/procfs/netstat.go
generated
vendored
@ -21,13 +21,13 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// NetStat contains statistics for all the counters from one file
|
||||
// NetStat contains statistics for all the counters from one file.
|
||||
type NetStat struct {
|
||||
Filename string
|
||||
Stats map[string][]uint64
|
||||
Filename string
|
||||
}
|
||||
|
||||
// NetStat retrieves stats from /proc/net/stat/
|
||||
// NetStat retrieves stats from `/proc/net/stat/`.
|
||||
func (fs FS) NetStat() ([]NetStat, error) {
|
||||
statFiles, err := filepath.Glob(fs.proc.Path("net/stat/*"))
|
||||
if err != nil {
|
||||
@ -55,7 +55,7 @@ func (fs FS) NetStat() ([]NetStat, error) {
|
||||
// Other strings represent per-CPU counters
|
||||
for scanner.Scan() {
|
||||
for num, counter := range strings.Fields(scanner.Text()) {
|
||||
value, err := strconv.ParseUint(counter, 16, 32)
|
||||
value, err := strconv.ParseUint(counter, 16, 64)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
10
vendor/github.com/prometheus/procfs/proc.go
generated
vendored
10
vendor/github.com/prometheus/procfs/proc.go
generated
vendored
@ -16,7 +16,7 @@ package procfs
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
@ -82,7 +82,7 @@ func (fs FS) Self() (Proc, error) {
|
||||
|
||||
// NewProc returns a process for the given pid.
|
||||
//
|
||||
// Deprecated: use fs.Proc() instead
|
||||
// Deprecated: Use fs.Proc() instead.
|
||||
func (fs FS) NewProc(pid int) (Proc, error) {
|
||||
return fs.Proc(pid)
|
||||
}
|
||||
@ -142,7 +142,7 @@ func (p Proc) Wchan() (string, error) {
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
data, err := ioutil.ReadAll(f)
|
||||
data, err := io.ReadAll(f)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
@ -185,7 +185,7 @@ func (p Proc) Cwd() (string, error) {
|
||||
return wd, err
|
||||
}
|
||||
|
||||
// RootDir returns the absolute path to the process's root directory (as set by chroot)
|
||||
// RootDir returns the absolute path to the process's root directory (as set by chroot).
|
||||
func (p Proc) RootDir() (string, error) {
|
||||
rdir, err := os.Readlink(p.path("root"))
|
||||
if os.IsNotExist(err) {
|
||||
@ -311,7 +311,7 @@ func (p Proc) FileDescriptorsInfo() (ProcFDInfos, error) {
|
||||
|
||||
// Schedstat returns task scheduling information for the process.
|
||||
func (p Proc) Schedstat() (ProcSchedstat, error) {
|
||||
contents, err := ioutil.ReadFile(p.path("schedstat"))
|
||||
contents, err := os.ReadFile(p.path("schedstat"))
|
||||
if err != nil {
|
||||
return ProcSchedstat{}, err
|
||||
}
|
||||
|
6
vendor/github.com/prometheus/procfs/proc_cgroup.go
generated
vendored
6
vendor/github.com/prometheus/procfs/proc_cgroup.go
generated
vendored
@ -45,7 +45,7 @@ type Cgroup struct {
|
||||
}
|
||||
|
||||
// parseCgroupString parses each line of the /proc/[pid]/cgroup file
|
||||
// Line format is hierarchyID:[controller1,controller2]:path
|
||||
// Line format is hierarchyID:[controller1,controller2]:path.
|
||||
func parseCgroupString(cgroupStr string) (*Cgroup, error) {
|
||||
var err error
|
||||
|
||||
@ -69,7 +69,7 @@ func parseCgroupString(cgroupStr string) (*Cgroup, error) {
|
||||
return cgroup, nil
|
||||
}
|
||||
|
||||
// parseCgroups reads each line of the /proc/[pid]/cgroup file
|
||||
// parseCgroups reads each line of the /proc/[pid]/cgroup file.
|
||||
func parseCgroups(data []byte) ([]Cgroup, error) {
|
||||
var cgroups []Cgroup
|
||||
scanner := bufio.NewScanner(bytes.NewReader(data))
|
||||
@ -88,7 +88,7 @@ func parseCgroups(data []byte) ([]Cgroup, error) {
|
||||
|
||||
// Cgroups reads from /proc/<pid>/cgroups and returns a []*Cgroup struct locating this PID in each process
|
||||
// control hierarchy running on this system. On every system (v1 and v2), all hierarchies contain all processes,
|
||||
// so the len of the returned struct is equal to the number of active hierarchies on this system
|
||||
// so the len of the returned struct is equal to the number of active hierarchies on this system.
|
||||
func (p Proc) Cgroups() ([]Cgroup, error) {
|
||||
data, err := util.ReadFileNoStat(p.path("cgroup"))
|
||||
if err != nil {
|
||||
|
98
vendor/github.com/prometheus/procfs/proc_cgroups.go
generated
vendored
Normal file
98
vendor/github.com/prometheus/procfs/proc_cgroups.go
generated
vendored
Normal file
@ -0,0 +1,98 @@
|
||||
// Copyright 2021 The Prometheus Authors
|
||||
// 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 procfs
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/prometheus/procfs/internal/util"
|
||||
)
|
||||
|
||||
// CgroupSummary models one line from /proc/cgroups.
|
||||
// This file contains information about the controllers that are compiled into the kernel.
|
||||
//
|
||||
// Also see http://man7.org/linux/man-pages/man7/cgroups.7.html
|
||||
type CgroupSummary struct {
|
||||
// The name of the controller. controller is also known as subsystem.
|
||||
SubsysName string
|
||||
// The unique ID of the cgroup hierarchy on which this controller is mounted.
|
||||
Hierarchy int
|
||||
// The number of control groups in this hierarchy using this controller.
|
||||
Cgroups int
|
||||
// This field contains the value 1 if this controller is enabled, or 0 if it has been disabled
|
||||
Enabled int
|
||||
}
|
||||
|
||||
// parseCgroupSummary parses each line of the /proc/cgroup file
|
||||
// Line format is `subsys_name hierarchy num_cgroups enabled`.
|
||||
func parseCgroupSummaryString(CgroupSummaryStr string) (*CgroupSummary, error) {
|
||||
var err error
|
||||
|
||||
fields := strings.Fields(CgroupSummaryStr)
|
||||
// require at least 4 fields
|
||||
if len(fields) < 4 {
|
||||
return nil, fmt.Errorf("at least 4 fields required, found %d fields in cgroup info string: %s", len(fields), CgroupSummaryStr)
|
||||
}
|
||||
|
||||
CgroupSummary := &CgroupSummary{
|
||||
SubsysName: fields[0],
|
||||
}
|
||||
CgroupSummary.Hierarchy, err = strconv.Atoi(fields[1])
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to parse hierarchy ID")
|
||||
}
|
||||
CgroupSummary.Cgroups, err = strconv.Atoi(fields[2])
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to parse Cgroup Num")
|
||||
}
|
||||
CgroupSummary.Enabled, err = strconv.Atoi(fields[3])
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to parse Enabled")
|
||||
}
|
||||
return CgroupSummary, nil
|
||||
}
|
||||
|
||||
// parseCgroupSummary reads each line of the /proc/cgroup file.
|
||||
func parseCgroupSummary(data []byte) ([]CgroupSummary, error) {
|
||||
var CgroupSummarys []CgroupSummary
|
||||
scanner := bufio.NewScanner(bytes.NewReader(data))
|
||||
for scanner.Scan() {
|
||||
CgroupSummaryString := scanner.Text()
|
||||
// ignore comment lines
|
||||
if strings.HasPrefix(CgroupSummaryString, "#") {
|
||||
continue
|
||||
}
|
||||
CgroupSummary, err := parseCgroupSummaryString(CgroupSummaryString)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
CgroupSummarys = append(CgroupSummarys, *CgroupSummary)
|
||||
}
|
||||
|
||||
err := scanner.Err()
|
||||
return CgroupSummarys, err
|
||||
}
|
||||
|
||||
// CgroupSummarys returns information about current /proc/cgroups.
|
||||
func (fs FS) CgroupSummarys() ([]CgroupSummary, error) {
|
||||
data, err := util.ReadFileNoStat(fs.proc.Path("cgroups"))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return parseCgroupSummary(data)
|
||||
}
|
2
vendor/github.com/prometheus/procfs/proc_environ.go
generated
vendored
2
vendor/github.com/prometheus/procfs/proc_environ.go
generated
vendored
@ -19,7 +19,7 @@ import (
|
||||
"github.com/prometheus/procfs/internal/util"
|
||||
)
|
||||
|
||||
// Environ reads process environments from /proc/<pid>/environ
|
||||
// Environ reads process environments from `/proc/<pid>/environ`.
|
||||
func (p Proc) Environ() ([]string, error) {
|
||||
environments := make([]string, 0)
|
||||
|
||||
|
3
vendor/github.com/prometheus/procfs/proc_fdinfo.go
generated
vendored
3
vendor/github.com/prometheus/procfs/proc_fdinfo.go
generated
vendored
@ -22,7 +22,6 @@ import (
|
||||
"github.com/prometheus/procfs/internal/util"
|
||||
)
|
||||
|
||||
// Regexp variables
|
||||
var (
|
||||
rPos = regexp.MustCompile(`^pos:\s+(\d+)$`)
|
||||
rFlags = regexp.MustCompile(`^flags:\s+(\d+)$`)
|
||||
@ -122,7 +121,7 @@ func (p ProcFDInfos) Len() int { return len(p) }
|
||||
func (p ProcFDInfos) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
|
||||
func (p ProcFDInfos) Less(i, j int) bool { return p[i].FD < p[j].FD }
|
||||
|
||||
// InotifyWatchLen returns the total number of inotify watches
|
||||
// InotifyWatchLen returns the total number of inotify watches.
|
||||
func (p ProcFDInfos) InotifyWatchLen() (int, error) {
|
||||
length := 0
|
||||
for _, f := range p {
|
||||
|
2
vendor/github.com/prometheus/procfs/proc_limits.go
generated
vendored
2
vendor/github.com/prometheus/procfs/proc_limits.go
generated
vendored
@ -79,7 +79,7 @@ var (
|
||||
|
||||
// NewLimits returns the current soft limits of the process.
|
||||
//
|
||||
// Deprecated: use p.Limits() instead
|
||||
// Deprecated: Use p.Limits() instead.
|
||||
func (p Proc) NewLimits() (ProcLimits, error) {
|
||||
return p.Limits()
|
||||
}
|
||||
|
12
vendor/github.com/prometheus/procfs/proc_maps.go
generated
vendored
12
vendor/github.com/prometheus/procfs/proc_maps.go
generated
vendored
@ -11,7 +11,9 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris) && !js
|
||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||
// +build !js
|
||||
|
||||
package procfs
|
||||
|
||||
@ -25,7 +27,7 @@ import (
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
// ProcMapPermissions contains permission settings read from /proc/[pid]/maps
|
||||
// ProcMapPermissions contains permission settings read from `/proc/[pid]/maps`.
|
||||
type ProcMapPermissions struct {
|
||||
// mapping has the [R]ead flag set
|
||||
Read bool
|
||||
@ -39,8 +41,8 @@ type ProcMapPermissions struct {
|
||||
Private bool
|
||||
}
|
||||
|
||||
// ProcMap contains the process memory-mappings of the process,
|
||||
// read from /proc/[pid]/maps
|
||||
// ProcMap contains the process memory-mappings of the process
|
||||
// read from `/proc/[pid]/maps`.
|
||||
type ProcMap struct {
|
||||
// The start address of current mapping.
|
||||
StartAddr uintptr
|
||||
@ -79,7 +81,7 @@ func parseDevice(s string) (uint64, error) {
|
||||
return unix.Mkdev(uint32(major), uint32(minor)), nil
|
||||
}
|
||||
|
||||
// parseAddress just converts a hex-string to a uintptr
|
||||
// parseAddress converts a hex-string to a uintptr.
|
||||
func parseAddress(s string) (uintptr, error) {
|
||||
a, err := strconv.ParseUint(s, 16, 0)
|
||||
if err != nil {
|
||||
@ -89,7 +91,7 @@ func parseAddress(s string) (uintptr, error) {
|
||||
return uintptr(a), nil
|
||||
}
|
||||
|
||||
// parseAddresses parses the start-end address
|
||||
// parseAddresses parses the start-end address.
|
||||
func parseAddresses(s string) (uintptr, uintptr, error) {
|
||||
toks := strings.Split(s, "-")
|
||||
if len(toks) < 2 {
|
||||
|
440
vendor/github.com/prometheus/procfs/proc_netstat.go
generated
vendored
Normal file
440
vendor/github.com/prometheus/procfs/proc_netstat.go
generated
vendored
Normal file
@ -0,0 +1,440 @@
|
||||
// Copyright 2022 The Prometheus Authors
|
||||
// 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 procfs
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/prometheus/procfs/internal/util"
|
||||
)
|
||||
|
||||
// ProcNetstat models the content of /proc/<pid>/net/netstat.
|
||||
type ProcNetstat struct {
|
||||
// The process ID.
|
||||
PID int
|
||||
TcpExt
|
||||
IpExt
|
||||
}
|
||||
|
||||
type TcpExt struct { // nolint:revive
|
||||
SyncookiesSent float64
|
||||
SyncookiesRecv float64
|
||||
SyncookiesFailed float64
|
||||
EmbryonicRsts float64
|
||||
PruneCalled float64
|
||||
RcvPruned float64
|
||||
OfoPruned float64
|
||||
OutOfWindowIcmps float64
|
||||
LockDroppedIcmps float64
|
||||
ArpFilter float64
|
||||
TW float64
|
||||
TWRecycled float64
|
||||
TWKilled float64
|
||||
PAWSActive float64
|
||||
PAWSEstab float64
|
||||
DelayedACKs float64
|
||||
DelayedACKLocked float64
|
||||
DelayedACKLost float64
|
||||
ListenOverflows float64
|
||||
ListenDrops float64
|
||||
TCPHPHits float64
|
||||
TCPPureAcks float64
|
||||
TCPHPAcks float64
|
||||
TCPRenoRecovery float64
|
||||
TCPSackRecovery float64
|
||||
TCPSACKReneging float64
|
||||
TCPSACKReorder float64
|
||||
TCPRenoReorder float64
|
||||
TCPTSReorder float64
|
||||
TCPFullUndo float64
|
||||
TCPPartialUndo float64
|
||||
TCPDSACKUndo float64
|
||||
TCPLossUndo float64
|
||||
TCPLostRetransmit float64
|
||||
TCPRenoFailures float64
|
||||
TCPSackFailures float64
|
||||
TCPLossFailures float64
|
||||
TCPFastRetrans float64
|
||||
TCPSlowStartRetrans float64
|
||||
TCPTimeouts float64
|
||||
TCPLossProbes float64
|
||||
TCPLossProbeRecovery float64
|
||||
TCPRenoRecoveryFail float64
|
||||
TCPSackRecoveryFail float64
|
||||
TCPRcvCollapsed float64
|
||||
TCPDSACKOldSent float64
|
||||
TCPDSACKOfoSent float64
|
||||
TCPDSACKRecv float64
|
||||
TCPDSACKOfoRecv float64
|
||||
TCPAbortOnData float64
|
||||
TCPAbortOnClose float64
|
||||
TCPAbortOnMemory float64
|
||||
TCPAbortOnTimeout float64
|
||||
TCPAbortOnLinger float64
|
||||
TCPAbortFailed float64
|
||||
TCPMemoryPressures float64
|
||||
TCPMemoryPressuresChrono float64
|
||||
TCPSACKDiscard float64
|
||||
TCPDSACKIgnoredOld float64
|
||||
TCPDSACKIgnoredNoUndo float64
|
||||
TCPSpuriousRTOs float64
|
||||
TCPMD5NotFound float64
|
||||
TCPMD5Unexpected float64
|
||||
TCPMD5Failure float64
|
||||
TCPSackShifted float64
|
||||
TCPSackMerged float64
|
||||
TCPSackShiftFallback float64
|
||||
TCPBacklogDrop float64
|
||||
PFMemallocDrop float64
|
||||
TCPMinTTLDrop float64
|
||||
TCPDeferAcceptDrop float64
|
||||
IPReversePathFilter float64
|
||||
TCPTimeWaitOverflow float64
|
||||
TCPReqQFullDoCookies float64
|
||||
TCPReqQFullDrop float64
|
||||
TCPRetransFail float64
|
||||
TCPRcvCoalesce float64
|
||||
TCPOFOQueue float64
|
||||
TCPOFODrop float64
|
||||
TCPOFOMerge float64
|
||||
TCPChallengeACK float64
|
||||
TCPSYNChallenge float64
|
||||
TCPFastOpenActive float64
|
||||
TCPFastOpenActiveFail float64
|
||||
TCPFastOpenPassive float64
|
||||
TCPFastOpenPassiveFail float64
|
||||
TCPFastOpenListenOverflow float64
|
||||
TCPFastOpenCookieReqd float64
|
||||
TCPFastOpenBlackhole float64
|
||||
TCPSpuriousRtxHostQueues float64
|
||||
BusyPollRxPackets float64
|
||||
TCPAutoCorking float64
|
||||
TCPFromZeroWindowAdv float64
|
||||
TCPToZeroWindowAdv float64
|
||||
TCPWantZeroWindowAdv float64
|
||||
TCPSynRetrans float64
|
||||
TCPOrigDataSent float64
|
||||
TCPHystartTrainDetect float64
|
||||
TCPHystartTrainCwnd float64
|
||||
TCPHystartDelayDetect float64
|
||||
TCPHystartDelayCwnd float64
|
||||
TCPACKSkippedSynRecv float64
|
||||
TCPACKSkippedPAWS float64
|
||||
TCPACKSkippedSeq float64
|
||||
TCPACKSkippedFinWait2 float64
|
||||
TCPACKSkippedTimeWait float64
|
||||
TCPACKSkippedChallenge float64
|
||||
TCPWinProbe float64
|
||||
TCPKeepAlive float64
|
||||
TCPMTUPFail float64
|
||||
TCPMTUPSuccess float64
|
||||
TCPWqueueTooBig float64
|
||||
}
|
||||
|
||||
type IpExt struct { // nolint:revive
|
||||
InNoRoutes float64
|
||||
InTruncatedPkts float64
|
||||
InMcastPkts float64
|
||||
OutMcastPkts float64
|
||||
InBcastPkts float64
|
||||
OutBcastPkts float64
|
||||
InOctets float64
|
||||
OutOctets float64
|
||||
InMcastOctets float64
|
||||
OutMcastOctets float64
|
||||
InBcastOctets float64
|
||||
OutBcastOctets float64
|
||||
InCsumErrors float64
|
||||
InNoECTPkts float64
|
||||
InECT1Pkts float64
|
||||
InECT0Pkts float64
|
||||
InCEPkts float64
|
||||
ReasmOverlaps float64
|
||||
}
|
||||
|
||||
func (p Proc) Netstat() (ProcNetstat, error) {
|
||||
filename := p.path("net/netstat")
|
||||
data, err := util.ReadFileNoStat(filename)
|
||||
if err != nil {
|
||||
return ProcNetstat{PID: p.PID}, err
|
||||
}
|
||||
procNetstat, err := parseNetstat(bytes.NewReader(data), filename)
|
||||
procNetstat.PID = p.PID
|
||||
return procNetstat, err
|
||||
}
|
||||
|
||||
// parseNetstat parses the metrics from proc/<pid>/net/netstat file
|
||||
// and returns a ProcNetstat structure.
|
||||
func parseNetstat(r io.Reader, fileName string) (ProcNetstat, error) {
|
||||
var (
|
||||
scanner = bufio.NewScanner(r)
|
||||
procNetstat = ProcNetstat{}
|
||||
)
|
||||
|
||||
for scanner.Scan() {
|
||||
nameParts := strings.Split(scanner.Text(), " ")
|
||||
scanner.Scan()
|
||||
valueParts := strings.Split(scanner.Text(), " ")
|
||||
// Remove trailing :.
|
||||
protocol := strings.TrimSuffix(nameParts[0], ":")
|
||||
if len(nameParts) != len(valueParts) {
|
||||
return procNetstat, fmt.Errorf("mismatch field count mismatch in %s: %s",
|
||||
fileName, protocol)
|
||||
}
|
||||
for i := 1; i < len(nameParts); i++ {
|
||||
value, err := strconv.ParseFloat(valueParts[i], 64)
|
||||
if err != nil {
|
||||
return procNetstat, err
|
||||
}
|
||||
key := nameParts[i]
|
||||
|
||||
switch protocol {
|
||||
case "TcpExt":
|
||||
switch key {
|
||||
case "SyncookiesSent":
|
||||
procNetstat.TcpExt.SyncookiesSent = value
|
||||
case "SyncookiesRecv":
|
||||
procNetstat.TcpExt.SyncookiesRecv = value
|
||||
case "SyncookiesFailed":
|
||||
procNetstat.TcpExt.SyncookiesFailed = value
|
||||
case "EmbryonicRsts":
|
||||
procNetstat.TcpExt.EmbryonicRsts = value
|
||||
case "PruneCalled":
|
||||
procNetstat.TcpExt.PruneCalled = value
|
||||
case "RcvPruned":
|
||||
procNetstat.TcpExt.RcvPruned = value
|
||||
case "OfoPruned":
|
||||
procNetstat.TcpExt.OfoPruned = value
|
||||
case "OutOfWindowIcmps":
|
||||
procNetstat.TcpExt.OutOfWindowIcmps = value
|
||||
case "LockDroppedIcmps":
|
||||
procNetstat.TcpExt.LockDroppedIcmps = value
|
||||
case "ArpFilter":
|
||||
procNetstat.TcpExt.ArpFilter = value
|
||||
case "TW":
|
||||
procNetstat.TcpExt.TW = value
|
||||
case "TWRecycled":
|
||||
procNetstat.TcpExt.TWRecycled = value
|
||||
case "TWKilled":
|
||||
procNetstat.TcpExt.TWKilled = value
|
||||
case "PAWSActive":
|
||||
procNetstat.TcpExt.PAWSActive = value
|
||||
case "PAWSEstab":
|
||||
procNetstat.TcpExt.PAWSEstab = value
|
||||
case "DelayedACKs":
|
||||
procNetstat.TcpExt.DelayedACKs = value
|
||||
case "DelayedACKLocked":
|
||||
procNetstat.TcpExt.DelayedACKLocked = value
|
||||
case "DelayedACKLost":
|
||||
procNetstat.TcpExt.DelayedACKLost = value
|
||||
case "ListenOverflows":
|
||||
procNetstat.TcpExt.ListenOverflows = value
|
||||
case "ListenDrops":
|
||||
procNetstat.TcpExt.ListenDrops = value
|
||||
case "TCPHPHits":
|
||||
procNetstat.TcpExt.TCPHPHits = value
|
||||
case "TCPPureAcks":
|
||||
procNetstat.TcpExt.TCPPureAcks = value
|
||||
case "TCPHPAcks":
|
||||
procNetstat.TcpExt.TCPHPAcks = value
|
||||
case "TCPRenoRecovery":
|
||||
procNetstat.TcpExt.TCPRenoRecovery = value
|
||||
case "TCPSackRecovery":
|
||||
procNetstat.TcpExt.TCPSackRecovery = value
|
||||
case "TCPSACKReneging":
|
||||
procNetstat.TcpExt.TCPSACKReneging = value
|
||||
case "TCPSACKReorder":
|
||||
procNetstat.TcpExt.TCPSACKReorder = value
|
||||
case "TCPRenoReorder":
|
||||
procNetstat.TcpExt.TCPRenoReorder = value
|
||||
case "TCPTSReorder":
|
||||
procNetstat.TcpExt.TCPTSReorder = value
|
||||
case "TCPFullUndo":
|
||||
procNetstat.TcpExt.TCPFullUndo = value
|
||||
case "TCPPartialUndo":
|
||||
procNetstat.TcpExt.TCPPartialUndo = value
|
||||
case "TCPDSACKUndo":
|
||||
procNetstat.TcpExt.TCPDSACKUndo = value
|
||||
case "TCPLossUndo":
|
||||
procNetstat.TcpExt.TCPLossUndo = value
|
||||
case "TCPLostRetransmit":
|
||||
procNetstat.TcpExt.TCPLostRetransmit = value
|
||||
case "TCPRenoFailures":
|
||||
procNetstat.TcpExt.TCPRenoFailures = value
|
||||
case "TCPSackFailures":
|
||||
procNetstat.TcpExt.TCPSackFailures = value
|
||||
case "TCPLossFailures":
|
||||
procNetstat.TcpExt.TCPLossFailures = value
|
||||
case "TCPFastRetrans":
|
||||
procNetstat.TcpExt.TCPFastRetrans = value
|
||||
case "TCPSlowStartRetrans":
|
||||
procNetstat.TcpExt.TCPSlowStartRetrans = value
|
||||
case "TCPTimeouts":
|
||||
procNetstat.TcpExt.TCPTimeouts = value
|
||||
case "TCPLossProbes":
|
||||
procNetstat.TcpExt.TCPLossProbes = value
|
||||
case "TCPLossProbeRecovery":
|
||||
procNetstat.TcpExt.TCPLossProbeRecovery = value
|
||||
case "TCPRenoRecoveryFail":
|
||||
procNetstat.TcpExt.TCPRenoRecoveryFail = value
|
||||
case "TCPSackRecoveryFail":
|
||||
procNetstat.TcpExt.TCPSackRecoveryFail = value
|
||||
case "TCPRcvCollapsed":
|
||||
procNetstat.TcpExt.TCPRcvCollapsed = value
|
||||
case "TCPDSACKOldSent":
|
||||
procNetstat.TcpExt.TCPDSACKOldSent = value
|
||||
case "TCPDSACKOfoSent":
|
||||
procNetstat.TcpExt.TCPDSACKOfoSent = value
|
||||
case "TCPDSACKRecv":
|
||||
procNetstat.TcpExt.TCPDSACKRecv = value
|
||||
case "TCPDSACKOfoRecv":
|
||||
procNetstat.TcpExt.TCPDSACKOfoRecv = value
|
||||
case "TCPAbortOnData":
|
||||
procNetstat.TcpExt.TCPAbortOnData = value
|
||||
case "TCPAbortOnClose":
|
||||
procNetstat.TcpExt.TCPAbortOnClose = value
|
||||
case "TCPDeferAcceptDrop":
|
||||
procNetstat.TcpExt.TCPDeferAcceptDrop = value
|
||||
case "IPReversePathFilter":
|
||||
procNetstat.TcpExt.IPReversePathFilter = value
|
||||
case "TCPTimeWaitOverflow":
|
||||
procNetstat.TcpExt.TCPTimeWaitOverflow = value
|
||||
case "TCPReqQFullDoCookies":
|
||||
procNetstat.TcpExt.TCPReqQFullDoCookies = value
|
||||
case "TCPReqQFullDrop":
|
||||
procNetstat.TcpExt.TCPReqQFullDrop = value
|
||||
case "TCPRetransFail":
|
||||
procNetstat.TcpExt.TCPRetransFail = value
|
||||
case "TCPRcvCoalesce":
|
||||
procNetstat.TcpExt.TCPRcvCoalesce = value
|
||||
case "TCPOFOQueue":
|
||||
procNetstat.TcpExt.TCPOFOQueue = value
|
||||
case "TCPOFODrop":
|
||||
procNetstat.TcpExt.TCPOFODrop = value
|
||||
case "TCPOFOMerge":
|
||||
procNetstat.TcpExt.TCPOFOMerge = value
|
||||
case "TCPChallengeACK":
|
||||
procNetstat.TcpExt.TCPChallengeACK = value
|
||||
case "TCPSYNChallenge":
|
||||
procNetstat.TcpExt.TCPSYNChallenge = value
|
||||
case "TCPFastOpenActive":
|
||||
procNetstat.TcpExt.TCPFastOpenActive = value
|
||||
case "TCPFastOpenActiveFail":
|
||||
procNetstat.TcpExt.TCPFastOpenActiveFail = value
|
||||
case "TCPFastOpenPassive":
|
||||
procNetstat.TcpExt.TCPFastOpenPassive = value
|
||||
case "TCPFastOpenPassiveFail":
|
||||
procNetstat.TcpExt.TCPFastOpenPassiveFail = value
|
||||
case "TCPFastOpenListenOverflow":
|
||||
procNetstat.TcpExt.TCPFastOpenListenOverflow = value
|
||||
case "TCPFastOpenCookieReqd":
|
||||
procNetstat.TcpExt.TCPFastOpenCookieReqd = value
|
||||
case "TCPFastOpenBlackhole":
|
||||
procNetstat.TcpExt.TCPFastOpenBlackhole = value
|
||||
case "TCPSpuriousRtxHostQueues":
|
||||
procNetstat.TcpExt.TCPSpuriousRtxHostQueues = value
|
||||
case "BusyPollRxPackets":
|
||||
procNetstat.TcpExt.BusyPollRxPackets = value
|
||||
case "TCPAutoCorking":
|
||||
procNetstat.TcpExt.TCPAutoCorking = value
|
||||
case "TCPFromZeroWindowAdv":
|
||||
procNetstat.TcpExt.TCPFromZeroWindowAdv = value
|
||||
case "TCPToZeroWindowAdv":
|
||||
procNetstat.TcpExt.TCPToZeroWindowAdv = value
|
||||
case "TCPWantZeroWindowAdv":
|
||||
procNetstat.TcpExt.TCPWantZeroWindowAdv = value
|
||||
case "TCPSynRetrans":
|
||||
procNetstat.TcpExt.TCPSynRetrans = value
|
||||
case "TCPOrigDataSent":
|
||||
procNetstat.TcpExt.TCPOrigDataSent = value
|
||||
case "TCPHystartTrainDetect":
|
||||
procNetstat.TcpExt.TCPHystartTrainDetect = value
|
||||
case "TCPHystartTrainCwnd":
|
||||
procNetstat.TcpExt.TCPHystartTrainCwnd = value
|
||||
case "TCPHystartDelayDetect":
|
||||
procNetstat.TcpExt.TCPHystartDelayDetect = value
|
||||
case "TCPHystartDelayCwnd":
|
||||
procNetstat.TcpExt.TCPHystartDelayCwnd = value
|
||||
case "TCPACKSkippedSynRecv":
|
||||
procNetstat.TcpExt.TCPACKSkippedSynRecv = value
|
||||
case "TCPACKSkippedPAWS":
|
||||
procNetstat.TcpExt.TCPACKSkippedPAWS = value
|
||||
case "TCPACKSkippedSeq":
|
||||
procNetstat.TcpExt.TCPACKSkippedSeq = value
|
||||
case "TCPACKSkippedFinWait2":
|
||||
procNetstat.TcpExt.TCPACKSkippedFinWait2 = value
|
||||
case "TCPACKSkippedTimeWait":
|
||||
procNetstat.TcpExt.TCPACKSkippedTimeWait = value
|
||||
case "TCPACKSkippedChallenge":
|
||||
procNetstat.TcpExt.TCPACKSkippedChallenge = value
|
||||
case "TCPWinProbe":
|
||||
procNetstat.TcpExt.TCPWinProbe = value
|
||||
case "TCPKeepAlive":
|
||||
procNetstat.TcpExt.TCPKeepAlive = value
|
||||
case "TCPMTUPFail":
|
||||
procNetstat.TcpExt.TCPMTUPFail = value
|
||||
case "TCPMTUPSuccess":
|
||||
procNetstat.TcpExt.TCPMTUPSuccess = value
|
||||
case "TCPWqueueTooBig":
|
||||
procNetstat.TcpExt.TCPWqueueTooBig = value
|
||||
}
|
||||
case "IpExt":
|
||||
switch key {
|
||||
case "InNoRoutes":
|
||||
procNetstat.IpExt.InNoRoutes = value
|
||||
case "InTruncatedPkts":
|
||||
procNetstat.IpExt.InTruncatedPkts = value
|
||||
case "InMcastPkts":
|
||||
procNetstat.IpExt.InMcastPkts = value
|
||||
case "OutMcastPkts":
|
||||
procNetstat.IpExt.OutMcastPkts = value
|
||||
case "InBcastPkts":
|
||||
procNetstat.IpExt.InBcastPkts = value
|
||||
case "OutBcastPkts":
|
||||
procNetstat.IpExt.OutBcastPkts = value
|
||||
case "InOctets":
|
||||
procNetstat.IpExt.InOctets = value
|
||||
case "OutOctets":
|
||||
procNetstat.IpExt.OutOctets = value
|
||||
case "InMcastOctets":
|
||||
procNetstat.IpExt.InMcastOctets = value
|
||||
case "OutMcastOctets":
|
||||
procNetstat.IpExt.OutMcastOctets = value
|
||||
case "InBcastOctets":
|
||||
procNetstat.IpExt.InBcastOctets = value
|
||||
case "OutBcastOctets":
|
||||
procNetstat.IpExt.OutBcastOctets = value
|
||||
case "InCsumErrors":
|
||||
procNetstat.IpExt.InCsumErrors = value
|
||||
case "InNoECTPkts":
|
||||
procNetstat.IpExt.InNoECTPkts = value
|
||||
case "InECT1Pkts":
|
||||
procNetstat.IpExt.InECT1Pkts = value
|
||||
case "InECT0Pkts":
|
||||
procNetstat.IpExt.InECT0Pkts = value
|
||||
case "InCEPkts":
|
||||
procNetstat.IpExt.InCEPkts = value
|
||||
case "ReasmOverlaps":
|
||||
procNetstat.IpExt.ReasmOverlaps = value
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return procNetstat, scanner.Err()
|
||||
}
|
14
vendor/github.com/prometheus/procfs/proc_psi.go
generated
vendored
14
vendor/github.com/prometheus/procfs/proc_psi.go
generated
vendored
@ -35,9 +35,10 @@ import (
|
||||
|
||||
const lineFormat = "avg10=%f avg60=%f avg300=%f total=%d"
|
||||
|
||||
// PSILine is a single line of values as returned by /proc/pressure/*
|
||||
// The Avg entries are averages over n seconds, as a percentage
|
||||
// The Total line is in microseconds
|
||||
// PSILine is a single line of values as returned by `/proc/pressure/*`.
|
||||
//
|
||||
// The Avg entries are averages over n seconds, as a percentage.
|
||||
// The Total line is in microseconds.
|
||||
type PSILine struct {
|
||||
Avg10 float64
|
||||
Avg60 float64
|
||||
@ -46,8 +47,9 @@ type PSILine struct {
|
||||
}
|
||||
|
||||
// PSIStats represent pressure stall information from /proc/pressure/*
|
||||
// Some indicates the share of time in which at least some tasks are stalled
|
||||
// Full indicates the share of time in which all non-idle tasks are stalled simultaneously
|
||||
//
|
||||
// "Some" indicates the share of time in which at least some tasks are stalled.
|
||||
// "Full" indicates the share of time in which all non-idle tasks are stalled simultaneously.
|
||||
type PSIStats struct {
|
||||
Some *PSILine
|
||||
Full *PSILine
|
||||
@ -65,7 +67,7 @@ func (fs FS) PSIStatsForResource(resource string) (PSIStats, error) {
|
||||
return parsePSIStats(resource, bytes.NewReader(data))
|
||||
}
|
||||
|
||||
// parsePSIStats parses the specified file for pressure stall information
|
||||
// parsePSIStats parses the specified file for pressure stall information.
|
||||
func parsePSIStats(resource string, r io.Reader) (PSIStats, error) {
|
||||
psiStats := PSIStats{}
|
||||
|
||||
|
23
vendor/github.com/prometheus/procfs/proc_smaps.go
generated
vendored
23
vendor/github.com/prometheus/procfs/proc_smaps.go
generated
vendored
@ -11,6 +11,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package procfs
|
||||
@ -28,30 +29,30 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
// match the header line before each mapped zone in /proc/pid/smaps
|
||||
// match the header line before each mapped zone in `/proc/pid/smaps`.
|
||||
procSMapsHeaderLine = regexp.MustCompile(`^[a-f0-9].*$`)
|
||||
)
|
||||
|
||||
type ProcSMapsRollup struct {
|
||||
// Amount of the mapping that is currently resident in RAM
|
||||
// Amount of the mapping that is currently resident in RAM.
|
||||
Rss uint64
|
||||
// Process's proportional share of this mapping
|
||||
// Process's proportional share of this mapping.
|
||||
Pss uint64
|
||||
// Size in bytes of clean shared pages
|
||||
// Size in bytes of clean shared pages.
|
||||
SharedClean uint64
|
||||
// Size in bytes of dirty shared pages
|
||||
// Size in bytes of dirty shared pages.
|
||||
SharedDirty uint64
|
||||
// Size in bytes of clean private pages
|
||||
// Size in bytes of clean private pages.
|
||||
PrivateClean uint64
|
||||
// Size in bytes of dirty private pages
|
||||
// Size in bytes of dirty private pages.
|
||||
PrivateDirty uint64
|
||||
// Amount of memory currently marked as referenced or accessed
|
||||
// Amount of memory currently marked as referenced or accessed.
|
||||
Referenced uint64
|
||||
// Amount of memory that does not belong to any file
|
||||
// Amount of memory that does not belong to any file.
|
||||
Anonymous uint64
|
||||
// Amount would-be-anonymous memory currently on swap
|
||||
// Amount would-be-anonymous memory currently on swap.
|
||||
Swap uint64
|
||||
// Process's proportional memory on swap
|
||||
// Process's proportional memory on swap.
|
||||
SwapPss uint64
|
||||
}
|
||||
|
||||
|
353
vendor/github.com/prometheus/procfs/proc_snmp.go
generated
vendored
Normal file
353
vendor/github.com/prometheus/procfs/proc_snmp.go
generated
vendored
Normal file
@ -0,0 +1,353 @@
|
||||
// Copyright 2022 The Prometheus Authors
|
||||
// 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 procfs
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/prometheus/procfs/internal/util"
|
||||
)
|
||||
|
||||
// ProcSnmp models the content of /proc/<pid>/net/snmp.
|
||||
type ProcSnmp struct {
|
||||
// The process ID.
|
||||
PID int
|
||||
Ip
|
||||
Icmp
|
||||
IcmpMsg
|
||||
Tcp
|
||||
Udp
|
||||
UdpLite
|
||||
}
|
||||
|
||||
type Ip struct { // nolint:revive
|
||||
Forwarding float64
|
||||
DefaultTTL float64
|
||||
InReceives float64
|
||||
InHdrErrors float64
|
||||
InAddrErrors float64
|
||||
ForwDatagrams float64
|
||||
InUnknownProtos float64
|
||||
InDiscards float64
|
||||
InDelivers float64
|
||||
OutRequests float64
|
||||
OutDiscards float64
|
||||
OutNoRoutes float64
|
||||
ReasmTimeout float64
|
||||
ReasmReqds float64
|
||||
ReasmOKs float64
|
||||
ReasmFails float64
|
||||
FragOKs float64
|
||||
FragFails float64
|
||||
FragCreates float64
|
||||
}
|
||||
|
||||
type Icmp struct {
|
||||
InMsgs float64
|
||||
InErrors float64
|
||||
InCsumErrors float64
|
||||
InDestUnreachs float64
|
||||
InTimeExcds float64
|
||||
InParmProbs float64
|
||||
InSrcQuenchs float64
|
||||
InRedirects float64
|
||||
InEchos float64
|
||||
InEchoReps float64
|
||||
InTimestamps float64
|
||||
InTimestampReps float64
|
||||
InAddrMasks float64
|
||||
InAddrMaskReps float64
|
||||
OutMsgs float64
|
||||
OutErrors float64
|
||||
OutDestUnreachs float64
|
||||
OutTimeExcds float64
|
||||
OutParmProbs float64
|
||||
OutSrcQuenchs float64
|
||||
OutRedirects float64
|
||||
OutEchos float64
|
||||
OutEchoReps float64
|
||||
OutTimestamps float64
|
||||
OutTimestampReps float64
|
||||
OutAddrMasks float64
|
||||
OutAddrMaskReps float64
|
||||
}
|
||||
|
||||
type IcmpMsg struct {
|
||||
InType3 float64
|
||||
OutType3 float64
|
||||
}
|
||||
|
||||
type Tcp struct { // nolint:revive
|
||||
RtoAlgorithm float64
|
||||
RtoMin float64
|
||||
RtoMax float64
|
||||
MaxConn float64
|
||||
ActiveOpens float64
|
||||
PassiveOpens float64
|
||||
AttemptFails float64
|
||||
EstabResets float64
|
||||
CurrEstab float64
|
||||
InSegs float64
|
||||
OutSegs float64
|
||||
RetransSegs float64
|
||||
InErrs float64
|
||||
OutRsts float64
|
||||
InCsumErrors float64
|
||||
}
|
||||
|
||||
type Udp struct { // nolint:revive
|
||||
InDatagrams float64
|
||||
NoPorts float64
|
||||
InErrors float64
|
||||
OutDatagrams float64
|
||||
RcvbufErrors float64
|
||||
SndbufErrors float64
|
||||
InCsumErrors float64
|
||||
IgnoredMulti float64
|
||||
}
|
||||
|
||||
type UdpLite struct { // nolint:revive
|
||||
InDatagrams float64
|
||||
NoPorts float64
|
||||
InErrors float64
|
||||
OutDatagrams float64
|
||||
RcvbufErrors float64
|
||||
SndbufErrors float64
|
||||
InCsumErrors float64
|
||||
IgnoredMulti float64
|
||||
}
|
||||
|
||||
func (p Proc) Snmp() (ProcSnmp, error) {
|
||||
filename := p.path("net/snmp")
|
||||
data, err := util.ReadFileNoStat(filename)
|
||||
if err != nil {
|
||||
return ProcSnmp{PID: p.PID}, err
|
||||
}
|
||||
procSnmp, err := parseSnmp(bytes.NewReader(data), filename)
|
||||
procSnmp.PID = p.PID
|
||||
return procSnmp, err
|
||||
}
|
||||
|
||||
// parseSnmp parses the metrics from proc/<pid>/net/snmp file
|
||||
// and returns a map contains those metrics (e.g. {"Ip": {"Forwarding": 2}}).
|
||||
func parseSnmp(r io.Reader, fileName string) (ProcSnmp, error) {
|
||||
var (
|
||||
scanner = bufio.NewScanner(r)
|
||||
procSnmp = ProcSnmp{}
|
||||
)
|
||||
|
||||
for scanner.Scan() {
|
||||
nameParts := strings.Split(scanner.Text(), " ")
|
||||
scanner.Scan()
|
||||
valueParts := strings.Split(scanner.Text(), " ")
|
||||
// Remove trailing :.
|
||||
protocol := strings.TrimSuffix(nameParts[0], ":")
|
||||
if len(nameParts) != len(valueParts) {
|
||||
return procSnmp, fmt.Errorf("mismatch field count mismatch in %s: %s",
|
||||
fileName, protocol)
|
||||
}
|
||||
for i := 1; i < len(nameParts); i++ {
|
||||
value, err := strconv.ParseFloat(valueParts[i], 64)
|
||||
if err != nil {
|
||||
return procSnmp, err
|
||||
}
|
||||
key := nameParts[i]
|
||||
|
||||
switch protocol {
|
||||
case "Ip":
|
||||
switch key {
|
||||
case "Forwarding":
|
||||
procSnmp.Ip.Forwarding = value
|
||||
case "DefaultTTL":
|
||||
procSnmp.Ip.DefaultTTL = value
|
||||
case "InReceives":
|
||||
procSnmp.Ip.InReceives = value
|
||||
case "InHdrErrors":
|
||||
procSnmp.Ip.InHdrErrors = value
|
||||
case "InAddrErrors":
|
||||
procSnmp.Ip.InAddrErrors = value
|
||||
case "ForwDatagrams":
|
||||
procSnmp.Ip.ForwDatagrams = value
|
||||
case "InUnknownProtos":
|
||||
procSnmp.Ip.InUnknownProtos = value
|
||||
case "InDiscards":
|
||||
procSnmp.Ip.InDiscards = value
|
||||
case "InDelivers":
|
||||
procSnmp.Ip.InDelivers = value
|
||||
case "OutRequests":
|
||||
procSnmp.Ip.OutRequests = value
|
||||
case "OutDiscards":
|
||||
procSnmp.Ip.OutDiscards = value
|
||||
case "OutNoRoutes":
|
||||
procSnmp.Ip.OutNoRoutes = value
|
||||
case "ReasmTimeout":
|
||||
procSnmp.Ip.ReasmTimeout = value
|
||||
case "ReasmReqds":
|
||||
procSnmp.Ip.ReasmReqds = value
|
||||
case "ReasmOKs":
|
||||
procSnmp.Ip.ReasmOKs = value
|
||||
case "ReasmFails":
|
||||
procSnmp.Ip.ReasmFails = value
|
||||
case "FragOKs":
|
||||
procSnmp.Ip.FragOKs = value
|
||||
case "FragFails":
|
||||
procSnmp.Ip.FragFails = value
|
||||
case "FragCreates":
|
||||
procSnmp.Ip.FragCreates = value
|
||||
}
|
||||
case "Icmp":
|
||||
switch key {
|
||||
case "InMsgs":
|
||||
procSnmp.Icmp.InMsgs = value
|
||||
case "InErrors":
|
||||
procSnmp.Icmp.InErrors = value
|
||||
case "InCsumErrors":
|
||||
procSnmp.Icmp.InCsumErrors = value
|
||||
case "InDestUnreachs":
|
||||
procSnmp.Icmp.InDestUnreachs = value
|
||||
case "InTimeExcds":
|
||||
procSnmp.Icmp.InTimeExcds = value
|
||||
case "InParmProbs":
|
||||
procSnmp.Icmp.InParmProbs = value
|
||||
case "InSrcQuenchs":
|
||||
procSnmp.Icmp.InSrcQuenchs = value
|
||||
case "InRedirects":
|
||||
procSnmp.Icmp.InRedirects = value
|
||||
case "InEchos":
|
||||
procSnmp.Icmp.InEchos = value
|
||||
case "InEchoReps":
|
||||
procSnmp.Icmp.InEchoReps = value
|
||||
case "InTimestamps":
|
||||
procSnmp.Icmp.InTimestamps = value
|
||||
case "InTimestampReps":
|
||||
procSnmp.Icmp.InTimestampReps = value
|
||||
case "InAddrMasks":
|
||||
procSnmp.Icmp.InAddrMasks = value
|
||||
case "InAddrMaskReps":
|
||||
procSnmp.Icmp.InAddrMaskReps = value
|
||||
case "OutMsgs":
|
||||
procSnmp.Icmp.OutMsgs = value
|
||||
case "OutErrors":
|
||||
procSnmp.Icmp.OutErrors = value
|
||||
case "OutDestUnreachs":
|
||||
procSnmp.Icmp.OutDestUnreachs = value
|
||||
case "OutTimeExcds":
|
||||
procSnmp.Icmp.OutTimeExcds = value
|
||||
case "OutParmProbs":
|
||||
procSnmp.Icmp.OutParmProbs = value
|
||||
case "OutSrcQuenchs":
|
||||
procSnmp.Icmp.OutSrcQuenchs = value
|
||||
case "OutRedirects":
|
||||
procSnmp.Icmp.OutRedirects = value
|
||||
case "OutEchos":
|
||||
procSnmp.Icmp.OutEchos = value
|
||||
case "OutEchoReps":
|
||||
procSnmp.Icmp.OutEchoReps = value
|
||||
case "OutTimestamps":
|
||||
procSnmp.Icmp.OutTimestamps = value
|
||||
case "OutTimestampReps":
|
||||
procSnmp.Icmp.OutTimestampReps = value
|
||||
case "OutAddrMasks":
|
||||
procSnmp.Icmp.OutAddrMasks = value
|
||||
case "OutAddrMaskReps":
|
||||
procSnmp.Icmp.OutAddrMaskReps = value
|
||||
}
|
||||
case "IcmpMsg":
|
||||
switch key {
|
||||
case "InType3":
|
||||
procSnmp.IcmpMsg.InType3 = value
|
||||
case "OutType3":
|
||||
procSnmp.IcmpMsg.OutType3 = value
|
||||
}
|
||||
case "Tcp":
|
||||
switch key {
|
||||
case "RtoAlgorithm":
|
||||
procSnmp.Tcp.RtoAlgorithm = value
|
||||
case "RtoMin":
|
||||
procSnmp.Tcp.RtoMin = value
|
||||
case "RtoMax":
|
||||
procSnmp.Tcp.RtoMax = value
|
||||
case "MaxConn":
|
||||
procSnmp.Tcp.MaxConn = value
|
||||
case "ActiveOpens":
|
||||
procSnmp.Tcp.ActiveOpens = value
|
||||
case "PassiveOpens":
|
||||
procSnmp.Tcp.PassiveOpens = value
|
||||
case "AttemptFails":
|
||||
procSnmp.Tcp.AttemptFails = value
|
||||
case "EstabResets":
|
||||
procSnmp.Tcp.EstabResets = value
|
||||
case "CurrEstab":
|
||||
procSnmp.Tcp.CurrEstab = value
|
||||
case "InSegs":
|
||||
procSnmp.Tcp.InSegs = value
|
||||
case "OutSegs":
|
||||
procSnmp.Tcp.OutSegs = value
|
||||
case "RetransSegs":
|
||||
procSnmp.Tcp.RetransSegs = value
|
||||
case "InErrs":
|
||||
procSnmp.Tcp.InErrs = value
|
||||
case "OutRsts":
|
||||
procSnmp.Tcp.OutRsts = value
|
||||
case "InCsumErrors":
|
||||
procSnmp.Tcp.InCsumErrors = value
|
||||
}
|
||||
case "Udp":
|
||||
switch key {
|
||||
case "InDatagrams":
|
||||
procSnmp.Udp.InDatagrams = value
|
||||
case "NoPorts":
|
||||
procSnmp.Udp.NoPorts = value
|
||||
case "InErrors":
|
||||
procSnmp.Udp.InErrors = value
|
||||
case "OutDatagrams":
|
||||
procSnmp.Udp.OutDatagrams = value
|
||||
case "RcvbufErrors":
|
||||
procSnmp.Udp.RcvbufErrors = value
|
||||
case "SndbufErrors":
|
||||
procSnmp.Udp.SndbufErrors = value
|
||||
case "InCsumErrors":
|
||||
procSnmp.Udp.InCsumErrors = value
|
||||
case "IgnoredMulti":
|
||||
procSnmp.Udp.IgnoredMulti = value
|
||||
}
|
||||
case "UdpLite":
|
||||
switch key {
|
||||
case "InDatagrams":
|
||||
procSnmp.UdpLite.InDatagrams = value
|
||||
case "NoPorts":
|
||||
procSnmp.UdpLite.NoPorts = value
|
||||
case "InErrors":
|
||||
procSnmp.UdpLite.InErrors = value
|
||||
case "OutDatagrams":
|
||||
procSnmp.UdpLite.OutDatagrams = value
|
||||
case "RcvbufErrors":
|
||||
procSnmp.UdpLite.RcvbufErrors = value
|
||||
case "SndbufErrors":
|
||||
procSnmp.UdpLite.SndbufErrors = value
|
||||
case "InCsumErrors":
|
||||
procSnmp.UdpLite.InCsumErrors = value
|
||||
case "IgnoredMulti":
|
||||
procSnmp.UdpLite.IgnoredMulti = value
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return procSnmp, scanner.Err()
|
||||
}
|
381
vendor/github.com/prometheus/procfs/proc_snmp6.go
generated
vendored
Normal file
381
vendor/github.com/prometheus/procfs/proc_snmp6.go
generated
vendored
Normal file
@ -0,0 +1,381 @@
|
||||
// Copyright 2022 The Prometheus Authors
|
||||
// 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 procfs
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"errors"
|
||||
"io"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/prometheus/procfs/internal/util"
|
||||
)
|
||||
|
||||
// ProcSnmp6 models the content of /proc/<pid>/net/snmp6.
|
||||
type ProcSnmp6 struct {
|
||||
// The process ID.
|
||||
PID int
|
||||
Ip6
|
||||
Icmp6
|
||||
Udp6
|
||||
UdpLite6
|
||||
}
|
||||
|
||||
type Ip6 struct { // nolint:revive
|
||||
InReceives float64
|
||||
InHdrErrors float64
|
||||
InTooBigErrors float64
|
||||
InNoRoutes float64
|
||||
InAddrErrors float64
|
||||
InUnknownProtos float64
|
||||
InTruncatedPkts float64
|
||||
InDiscards float64
|
||||
InDelivers float64
|
||||
OutForwDatagrams float64
|
||||
OutRequests float64
|
||||
OutDiscards float64
|
||||
OutNoRoutes float64
|
||||
ReasmTimeout float64
|
||||
ReasmReqds float64
|
||||
ReasmOKs float64
|
||||
ReasmFails float64
|
||||
FragOKs float64
|
||||
FragFails float64
|
||||
FragCreates float64
|
||||
InMcastPkts float64
|
||||
OutMcastPkts float64
|
||||
InOctets float64
|
||||
OutOctets float64
|
||||
InMcastOctets float64
|
||||
OutMcastOctets float64
|
||||
InBcastOctets float64
|
||||
OutBcastOctets float64
|
||||
InNoECTPkts float64
|
||||
InECT1Pkts float64
|
||||
InECT0Pkts float64
|
||||
InCEPkts float64
|
||||
}
|
||||
|
||||
type Icmp6 struct {
|
||||
InMsgs float64
|
||||
InErrors float64
|
||||
OutMsgs float64
|
||||
OutErrors float64
|
||||
InCsumErrors float64
|
||||
InDestUnreachs float64
|
||||
InPktTooBigs float64
|
||||
InTimeExcds float64
|
||||
InParmProblems float64
|
||||
InEchos float64
|
||||
InEchoReplies float64
|
||||
InGroupMembQueries float64
|
||||
InGroupMembResponses float64
|
||||
InGroupMembReductions float64
|
||||
InRouterSolicits float64
|
||||
InRouterAdvertisements float64
|
||||
InNeighborSolicits float64
|
||||
InNeighborAdvertisements float64
|
||||
InRedirects float64
|
||||
InMLDv2Reports float64
|
||||
OutDestUnreachs float64
|
||||
OutPktTooBigs float64
|
||||
OutTimeExcds float64
|
||||
OutParmProblems float64
|
||||
OutEchos float64
|
||||
OutEchoReplies float64
|
||||
OutGroupMembQueries float64
|
||||
OutGroupMembResponses float64
|
||||
OutGroupMembReductions float64
|
||||
OutRouterSolicits float64
|
||||
OutRouterAdvertisements float64
|
||||
OutNeighborSolicits float64
|
||||
OutNeighborAdvertisements float64
|
||||
OutRedirects float64
|
||||
OutMLDv2Reports float64
|
||||
InType1 float64
|
||||
InType134 float64
|
||||
InType135 float64
|
||||
InType136 float64
|
||||
InType143 float64
|
||||
OutType133 float64
|
||||
OutType135 float64
|
||||
OutType136 float64
|
||||
OutType143 float64
|
||||
}
|
||||
|
||||
type Udp6 struct { // nolint:revive
|
||||
InDatagrams float64
|
||||
NoPorts float64
|
||||
InErrors float64
|
||||
OutDatagrams float64
|
||||
RcvbufErrors float64
|
||||
SndbufErrors float64
|
||||
InCsumErrors float64
|
||||
IgnoredMulti float64
|
||||
}
|
||||
|
||||
type UdpLite6 struct { // nolint:revive
|
||||
InDatagrams float64
|
||||
NoPorts float64
|
||||
InErrors float64
|
||||
OutDatagrams float64
|
||||
RcvbufErrors float64
|
||||
SndbufErrors float64
|
||||
InCsumErrors float64
|
||||
}
|
||||
|
||||
func (p Proc) Snmp6() (ProcSnmp6, error) {
|
||||
filename := p.path("net/snmp6")
|
||||
data, err := util.ReadFileNoStat(filename)
|
||||
if err != nil {
|
||||
// On systems with IPv6 disabled, this file won't exist.
|
||||
// Do nothing.
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
return ProcSnmp6{PID: p.PID}, nil
|
||||
}
|
||||
|
||||
return ProcSnmp6{PID: p.PID}, err
|
||||
}
|
||||
|
||||
procSnmp6, err := parseSNMP6Stats(bytes.NewReader(data))
|
||||
procSnmp6.PID = p.PID
|
||||
return procSnmp6, err
|
||||
}
|
||||
|
||||
// parseSnmp6 parses the metrics from proc/<pid>/net/snmp6 file
|
||||
// and returns a map contains those metrics.
|
||||
func parseSNMP6Stats(r io.Reader) (ProcSnmp6, error) {
|
||||
var (
|
||||
scanner = bufio.NewScanner(r)
|
||||
procSnmp6 = ProcSnmp6{}
|
||||
)
|
||||
|
||||
for scanner.Scan() {
|
||||
stat := strings.Fields(scanner.Text())
|
||||
if len(stat) < 2 {
|
||||
continue
|
||||
}
|
||||
// Expect to have "6" in metric name, skip line otherwise
|
||||
if sixIndex := strings.Index(stat[0], "6"); sixIndex != -1 {
|
||||
protocol := stat[0][:sixIndex+1]
|
||||
key := stat[0][sixIndex+1:]
|
||||
value, err := strconv.ParseFloat(stat[1], 64)
|
||||
if err != nil {
|
||||
return procSnmp6, err
|
||||
}
|
||||
|
||||
switch protocol {
|
||||
case "Ip6":
|
||||
switch key {
|
||||
case "InReceives":
|
||||
procSnmp6.Ip6.InReceives = value
|
||||
case "InHdrErrors":
|
||||
procSnmp6.Ip6.InHdrErrors = value
|
||||
case "InTooBigErrors":
|
||||
procSnmp6.Ip6.InTooBigErrors = value
|
||||
case "InNoRoutes":
|
||||
procSnmp6.Ip6.InNoRoutes = value
|
||||
case "InAddrErrors":
|
||||
procSnmp6.Ip6.InAddrErrors = value
|
||||
case "InUnknownProtos":
|
||||
procSnmp6.Ip6.InUnknownProtos = value
|
||||
case "InTruncatedPkts":
|
||||
procSnmp6.Ip6.InTruncatedPkts = value
|
||||
case "InDiscards":
|
||||
procSnmp6.Ip6.InDiscards = value
|
||||
case "InDelivers":
|
||||
procSnmp6.Ip6.InDelivers = value
|
||||
case "OutForwDatagrams":
|
||||
procSnmp6.Ip6.OutForwDatagrams = value
|
||||
case "OutRequests":
|
||||
procSnmp6.Ip6.OutRequests = value
|
||||
case "OutDiscards":
|
||||
procSnmp6.Ip6.OutDiscards = value
|
||||
case "OutNoRoutes":
|
||||
procSnmp6.Ip6.OutNoRoutes = value
|
||||
case "ReasmTimeout":
|
||||
procSnmp6.Ip6.ReasmTimeout = value
|
||||
case "ReasmReqds":
|
||||
procSnmp6.Ip6.ReasmReqds = value
|
||||
case "ReasmOKs":
|
||||
procSnmp6.Ip6.ReasmOKs = value
|
||||
case "ReasmFails":
|
||||
procSnmp6.Ip6.ReasmFails = value
|
||||
case "FragOKs":
|
||||
procSnmp6.Ip6.FragOKs = value
|
||||
case "FragFails":
|
||||
procSnmp6.Ip6.FragFails = value
|
||||
case "FragCreates":
|
||||
procSnmp6.Ip6.FragCreates = value
|
||||
case "InMcastPkts":
|
||||
procSnmp6.Ip6.InMcastPkts = value
|
||||
case "OutMcastPkts":
|
||||
procSnmp6.Ip6.OutMcastPkts = value
|
||||
case "InOctets":
|
||||
procSnmp6.Ip6.InOctets = value
|
||||
case "OutOctets":
|
||||
procSnmp6.Ip6.OutOctets = value
|
||||
case "InMcastOctets":
|
||||
procSnmp6.Ip6.InMcastOctets = value
|
||||
case "OutMcastOctets":
|
||||
procSnmp6.Ip6.OutMcastOctets = value
|
||||
case "InBcastOctets":
|
||||
procSnmp6.Ip6.InBcastOctets = value
|
||||
case "OutBcastOctets":
|
||||
procSnmp6.Ip6.OutBcastOctets = value
|
||||
case "InNoECTPkts":
|
||||
procSnmp6.Ip6.InNoECTPkts = value
|
||||
case "InECT1Pkts":
|
||||
procSnmp6.Ip6.InECT1Pkts = value
|
||||
case "InECT0Pkts":
|
||||
procSnmp6.Ip6.InECT0Pkts = value
|
||||
case "InCEPkts":
|
||||
procSnmp6.Ip6.InCEPkts = value
|
||||
|
||||
}
|
||||
case "Icmp6":
|
||||
switch key {
|
||||
case "InMsgs":
|
||||
procSnmp6.Icmp6.InMsgs = value
|
||||
case "InErrors":
|
||||
procSnmp6.Icmp6.InErrors = value
|
||||
case "OutMsgs":
|
||||
procSnmp6.Icmp6.OutMsgs = value
|
||||
case "OutErrors":
|
||||
procSnmp6.Icmp6.OutErrors = value
|
||||
case "InCsumErrors":
|
||||
procSnmp6.Icmp6.InCsumErrors = value
|
||||
case "InDestUnreachs":
|
||||
procSnmp6.Icmp6.InDestUnreachs = value
|
||||
case "InPktTooBigs":
|
||||
procSnmp6.Icmp6.InPktTooBigs = value
|
||||
case "InTimeExcds":
|
||||
procSnmp6.Icmp6.InTimeExcds = value
|
||||
case "InParmProblems":
|
||||
procSnmp6.Icmp6.InParmProblems = value
|
||||
case "InEchos":
|
||||
procSnmp6.Icmp6.InEchos = value
|
||||
case "InEchoReplies":
|
||||
procSnmp6.Icmp6.InEchoReplies = value
|
||||
case "InGroupMembQueries":
|
||||
procSnmp6.Icmp6.InGroupMembQueries = value
|
||||
case "InGroupMembResponses":
|
||||
procSnmp6.Icmp6.InGroupMembResponses = value
|
||||
case "InGroupMembReductions":
|
||||
procSnmp6.Icmp6.InGroupMembReductions = value
|
||||
case "InRouterSolicits":
|
||||
procSnmp6.Icmp6.InRouterSolicits = value
|
||||
case "InRouterAdvertisements":
|
||||
procSnmp6.Icmp6.InRouterAdvertisements = value
|
||||
case "InNeighborSolicits":
|
||||
procSnmp6.Icmp6.InNeighborSolicits = value
|
||||
case "InNeighborAdvertisements":
|
||||
procSnmp6.Icmp6.InNeighborAdvertisements = value
|
||||
case "InRedirects":
|
||||
procSnmp6.Icmp6.InRedirects = value
|
||||
case "InMLDv2Reports":
|
||||
procSnmp6.Icmp6.InMLDv2Reports = value
|
||||
case "OutDestUnreachs":
|
||||
procSnmp6.Icmp6.OutDestUnreachs = value
|
||||
case "OutPktTooBigs":
|
||||
procSnmp6.Icmp6.OutPktTooBigs = value
|
||||
case "OutTimeExcds":
|
||||
procSnmp6.Icmp6.OutTimeExcds = value
|
||||
case "OutParmProblems":
|
||||
procSnmp6.Icmp6.OutParmProblems = value
|
||||
case "OutEchos":
|
||||
procSnmp6.Icmp6.OutEchos = value
|
||||
case "OutEchoReplies":
|
||||
procSnmp6.Icmp6.OutEchoReplies = value
|
||||
case "OutGroupMembQueries":
|
||||
procSnmp6.Icmp6.OutGroupMembQueries = value
|
||||
case "OutGroupMembResponses":
|
||||
procSnmp6.Icmp6.OutGroupMembResponses = value
|
||||
case "OutGroupMembReductions":
|
||||
procSnmp6.Icmp6.OutGroupMembReductions = value
|
||||
case "OutRouterSolicits":
|
||||
procSnmp6.Icmp6.OutRouterSolicits = value
|
||||
case "OutRouterAdvertisements":
|
||||
procSnmp6.Icmp6.OutRouterAdvertisements = value
|
||||
case "OutNeighborSolicits":
|
||||
procSnmp6.Icmp6.OutNeighborSolicits = value
|
||||
case "OutNeighborAdvertisements":
|
||||
procSnmp6.Icmp6.OutNeighborAdvertisements = value
|
||||
case "OutRedirects":
|
||||
procSnmp6.Icmp6.OutRedirects = value
|
||||
case "OutMLDv2Reports":
|
||||
procSnmp6.Icmp6.OutMLDv2Reports = value
|
||||
case "InType1":
|
||||
procSnmp6.Icmp6.InType1 = value
|
||||
case "InType134":
|
||||
procSnmp6.Icmp6.InType134 = value
|
||||
case "InType135":
|
||||
procSnmp6.Icmp6.InType135 = value
|
||||
case "InType136":
|
||||
procSnmp6.Icmp6.InType136 = value
|
||||
case "InType143":
|
||||
procSnmp6.Icmp6.InType143 = value
|
||||
case "OutType133":
|
||||
procSnmp6.Icmp6.OutType133 = value
|
||||
case "OutType135":
|
||||
procSnmp6.Icmp6.OutType135 = value
|
||||
case "OutType136":
|
||||
procSnmp6.Icmp6.OutType136 = value
|
||||
case "OutType143":
|
||||
procSnmp6.Icmp6.OutType143 = value
|
||||
}
|
||||
case "Udp6":
|
||||
switch key {
|
||||
case "InDatagrams":
|
||||
procSnmp6.Udp6.InDatagrams = value
|
||||
case "NoPorts":
|
||||
procSnmp6.Udp6.NoPorts = value
|
||||
case "InErrors":
|
||||
procSnmp6.Udp6.InErrors = value
|
||||
case "OutDatagrams":
|
||||
procSnmp6.Udp6.OutDatagrams = value
|
||||
case "RcvbufErrors":
|
||||
procSnmp6.Udp6.RcvbufErrors = value
|
||||
case "SndbufErrors":
|
||||
procSnmp6.Udp6.SndbufErrors = value
|
||||
case "InCsumErrors":
|
||||
procSnmp6.Udp6.InCsumErrors = value
|
||||
case "IgnoredMulti":
|
||||
procSnmp6.Udp6.IgnoredMulti = value
|
||||
}
|
||||
case "UdpLite6":
|
||||
switch key {
|
||||
case "InDatagrams":
|
||||
procSnmp6.UdpLite6.InDatagrams = value
|
||||
case "NoPorts":
|
||||
procSnmp6.UdpLite6.NoPorts = value
|
||||
case "InErrors":
|
||||
procSnmp6.UdpLite6.InErrors = value
|
||||
case "OutDatagrams":
|
||||
procSnmp6.UdpLite6.OutDatagrams = value
|
||||
case "RcvbufErrors":
|
||||
procSnmp6.UdpLite6.RcvbufErrors = value
|
||||
case "SndbufErrors":
|
||||
procSnmp6.UdpLite6.SndbufErrors = value
|
||||
case "InCsumErrors":
|
||||
procSnmp6.UdpLite6.InCsumErrors = value
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return procSnmp6, scanner.Err()
|
||||
}
|
11
vendor/github.com/prometheus/procfs/proc_stat.go
generated
vendored
11
vendor/github.com/prometheus/procfs/proc_stat.go
generated
vendored
@ -81,10 +81,10 @@ type ProcStat struct {
|
||||
STime uint
|
||||
// Amount of time that this process's waited-for children have been
|
||||
// scheduled in user mode, measured in clock ticks.
|
||||
CUTime uint
|
||||
CUTime int
|
||||
// Amount of time that this process's waited-for children have been
|
||||
// scheduled in kernel mode, measured in clock ticks.
|
||||
CSTime uint
|
||||
CSTime int
|
||||
// For processes running a real-time scheduling policy, this is the negated
|
||||
// scheduling priority, minus one.
|
||||
Priority int
|
||||
@ -115,7 +115,7 @@ type ProcStat struct {
|
||||
|
||||
// NewStat returns the current status information of the process.
|
||||
//
|
||||
// Deprecated: use p.Stat() instead
|
||||
// Deprecated: Use p.Stat() instead.
|
||||
func (p Proc) NewStat() (ProcStat, error) {
|
||||
return p.Stat()
|
||||
}
|
||||
@ -141,6 +141,11 @@ func (p Proc) Stat() (ProcStat, error) {
|
||||
}
|
||||
|
||||
s.Comm = string(data[l+1 : r])
|
||||
|
||||
// Check the following resources for the details about the particular stat
|
||||
// fields and their data types:
|
||||
// * https://man7.org/linux/man-pages/man5/proc.5.html
|
||||
// * https://man7.org/linux/man-pages/man3/scanf.3.html
|
||||
_, err = fmt.Fscan(
|
||||
bytes.NewBuffer(data[r+2:]),
|
||||
&s.State,
|
||||
|
32
vendor/github.com/prometheus/procfs/proc_status.go
generated
vendored
32
vendor/github.com/prometheus/procfs/proc_status.go
generated
vendored
@ -33,37 +33,37 @@ type ProcStatus struct {
|
||||
TGID int
|
||||
|
||||
// Peak virtual memory size.
|
||||
VmPeak uint64 // nolint:golint
|
||||
VmPeak uint64 // nolint:revive
|
||||
// Virtual memory size.
|
||||
VmSize uint64 // nolint:golint
|
||||
VmSize uint64 // nolint:revive
|
||||
// Locked memory size.
|
||||
VmLck uint64 // nolint:golint
|
||||
VmLck uint64 // nolint:revive
|
||||
// Pinned memory size.
|
||||
VmPin uint64 // nolint:golint
|
||||
VmPin uint64 // nolint:revive
|
||||
// Peak resident set size.
|
||||
VmHWM uint64 // nolint:golint
|
||||
VmHWM uint64 // nolint:revive
|
||||
// Resident set size (sum of RssAnnon RssFile and RssShmem).
|
||||
VmRSS uint64 // nolint:golint
|
||||
VmRSS uint64 // nolint:revive
|
||||
// Size of resident anonymous memory.
|
||||
RssAnon uint64 // nolint:golint
|
||||
RssAnon uint64 // nolint:revive
|
||||
// Size of resident file mappings.
|
||||
RssFile uint64 // nolint:golint
|
||||
RssFile uint64 // nolint:revive
|
||||
// Size of resident shared memory.
|
||||
RssShmem uint64 // nolint:golint
|
||||
RssShmem uint64 // nolint:revive
|
||||
// Size of data segments.
|
||||
VmData uint64 // nolint:golint
|
||||
VmData uint64 // nolint:revive
|
||||
// Size of stack segments.
|
||||
VmStk uint64 // nolint:golint
|
||||
VmStk uint64 // nolint:revive
|
||||
// Size of text segments.
|
||||
VmExe uint64 // nolint:golint
|
||||
VmExe uint64 // nolint:revive
|
||||
// Shared library code size.
|
||||
VmLib uint64 // nolint:golint
|
||||
VmLib uint64 // nolint:revive
|
||||
// Page table entries size.
|
||||
VmPTE uint64 // nolint:golint
|
||||
VmPTE uint64 // nolint:revive
|
||||
// Size of second-level page tables.
|
||||
VmPMD uint64 // nolint:golint
|
||||
VmPMD uint64 // nolint:revive
|
||||
// Swapped-out virtual memory size by anonymous private.
|
||||
VmSwap uint64 // nolint:golint
|
||||
VmSwap uint64 // nolint:revive
|
||||
// Size of hugetlb memory portions
|
||||
HugetlbPages uint64
|
||||
|
||||
|
51
vendor/github.com/prometheus/procfs/proc_sys.go
generated
vendored
Normal file
51
vendor/github.com/prometheus/procfs/proc_sys.go
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
// Copyright 2022 The Prometheus Authors
|
||||
// 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 procfs
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/prometheus/procfs/internal/util"
|
||||
)
|
||||
|
||||
func sysctlToPath(sysctl string) string {
|
||||
return strings.Replace(sysctl, ".", "/", -1)
|
||||
}
|
||||
|
||||
func (fs FS) SysctlStrings(sysctl string) ([]string, error) {
|
||||
value, err := util.SysReadFile(fs.proc.Path("sys", sysctlToPath(sysctl)))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return strings.Fields(value), nil
|
||||
|
||||
}
|
||||
|
||||
func (fs FS) SysctlInts(sysctl string) ([]int, error) {
|
||||
fields, err := fs.SysctlStrings(sysctl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
values := make([]int, len(fields))
|
||||
for i, f := range fields {
|
||||
vp := util.NewValueParser(f)
|
||||
values[i] = vp.Int()
|
||||
if err := vp.Err(); err != nil {
|
||||
return nil, fmt.Errorf("field %d in sysctl %s is not a valid int: %w", i, sysctl, err)
|
||||
}
|
||||
}
|
||||
return values, nil
|
||||
}
|
6
vendor/github.com/prometheus/procfs/schedstat.go
generated
vendored
6
vendor/github.com/prometheus/procfs/schedstat.go
generated
vendored
@ -40,7 +40,7 @@ type Schedstat struct {
|
||||
CPUs []*SchedstatCPU
|
||||
}
|
||||
|
||||
// SchedstatCPU contains the values from one "cpu<N>" line
|
||||
// SchedstatCPU contains the values from one "cpu<N>" line.
|
||||
type SchedstatCPU struct {
|
||||
CPUNum string
|
||||
|
||||
@ -49,14 +49,14 @@ type SchedstatCPU struct {
|
||||
RunTimeslices uint64
|
||||
}
|
||||
|
||||
// ProcSchedstat contains the values from /proc/<pid>/schedstat
|
||||
// ProcSchedstat contains the values from `/proc/<pid>/schedstat`.
|
||||
type ProcSchedstat struct {
|
||||
RunningNanoseconds uint64
|
||||
WaitingNanoseconds uint64
|
||||
RunTimeslices uint64
|
||||
}
|
||||
|
||||
// Schedstat reads data from /proc/schedstat
|
||||
// Schedstat reads data from `/proc/schedstat`.
|
||||
func (fs FS) Schedstat() (*Schedstat, error) {
|
||||
file, err := os.Open(fs.proc.Path("schedstat"))
|
||||
if err != nil {
|
||||
|
2
vendor/github.com/prometheus/procfs/slab.go
generated
vendored
2
vendor/github.com/prometheus/procfs/slab.go
generated
vendored
@ -137,7 +137,7 @@ func parseSlabInfo21(r *bytes.Reader) (SlabInfo, error) {
|
||||
return s, nil
|
||||
}
|
||||
|
||||
// SlabInfo reads data from /proc/slabinfo
|
||||
// SlabInfo reads data from `/proc/slabinfo`.
|
||||
func (fs FS) SlabInfo() (SlabInfo, error) {
|
||||
// TODO: Consider passing options to allow for parsing different
|
||||
// slabinfo versions. However, slabinfo 2.1 has been stable since
|
||||
|
160
vendor/github.com/prometheus/procfs/softirqs.go
generated
vendored
Normal file
160
vendor/github.com/prometheus/procfs/softirqs.go
generated
vendored
Normal file
@ -0,0 +1,160 @@
|
||||
// Copyright 2022 The Prometheus Authors
|
||||
// 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 procfs
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/prometheus/procfs/internal/util"
|
||||
)
|
||||
|
||||
// Softirqs represents the softirq statistics.
|
||||
type Softirqs struct {
|
||||
Hi []uint64
|
||||
Timer []uint64
|
||||
NetTx []uint64
|
||||
NetRx []uint64
|
||||
Block []uint64
|
||||
IRQPoll []uint64
|
||||
Tasklet []uint64
|
||||
Sched []uint64
|
||||
HRTimer []uint64
|
||||
RCU []uint64
|
||||
}
|
||||
|
||||
func (fs FS) Softirqs() (Softirqs, error) {
|
||||
fileName := fs.proc.Path("softirqs")
|
||||
data, err := util.ReadFileNoStat(fileName)
|
||||
if err != nil {
|
||||
return Softirqs{}, err
|
||||
}
|
||||
|
||||
reader := bytes.NewReader(data)
|
||||
|
||||
return parseSoftirqs(reader)
|
||||
}
|
||||
|
||||
func parseSoftirqs(r io.Reader) (Softirqs, error) {
|
||||
var (
|
||||
softirqs = Softirqs{}
|
||||
scanner = bufio.NewScanner(r)
|
||||
)
|
||||
|
||||
if !scanner.Scan() {
|
||||
return Softirqs{}, fmt.Errorf("softirqs empty")
|
||||
}
|
||||
|
||||
for scanner.Scan() {
|
||||
parts := strings.Fields(scanner.Text())
|
||||
var err error
|
||||
|
||||
// require at least one cpu
|
||||
if len(parts) < 2 {
|
||||
continue
|
||||
}
|
||||
switch {
|
||||
case parts[0] == "HI:":
|
||||
perCPU := parts[1:]
|
||||
softirqs.Hi = make([]uint64, len(perCPU))
|
||||
for i, count := range perCPU {
|
||||
if softirqs.Hi[i], err = strconv.ParseUint(count, 10, 64); err != nil {
|
||||
return Softirqs{}, fmt.Errorf("couldn't parse %q (HI%d): %w", count, i, err)
|
||||
}
|
||||
}
|
||||
case parts[0] == "TIMER:":
|
||||
perCPU := parts[1:]
|
||||
softirqs.Timer = make([]uint64, len(perCPU))
|
||||
for i, count := range perCPU {
|
||||
if softirqs.Timer[i], err = strconv.ParseUint(count, 10, 64); err != nil {
|
||||
return Softirqs{}, fmt.Errorf("couldn't parse %q (TIMER%d): %w", count, i, err)
|
||||
}
|
||||
}
|
||||
case parts[0] == "NET_TX:":
|
||||
perCPU := parts[1:]
|
||||
softirqs.NetTx = make([]uint64, len(perCPU))
|
||||
for i, count := range perCPU {
|
||||
if softirqs.NetTx[i], err = strconv.ParseUint(count, 10, 64); err != nil {
|
||||
return Softirqs{}, fmt.Errorf("couldn't parse %q (NET_TX%d): %w", count, i, err)
|
||||
}
|
||||
}
|
||||
case parts[0] == "NET_RX:":
|
||||
perCPU := parts[1:]
|
||||
softirqs.NetRx = make([]uint64, len(perCPU))
|
||||
for i, count := range perCPU {
|
||||
if softirqs.NetRx[i], err = strconv.ParseUint(count, 10, 64); err != nil {
|
||||
return Softirqs{}, fmt.Errorf("couldn't parse %q (NET_RX%d): %w", count, i, err)
|
||||
}
|
||||
}
|
||||
case parts[0] == "BLOCK:":
|
||||
perCPU := parts[1:]
|
||||
softirqs.Block = make([]uint64, len(perCPU))
|
||||
for i, count := range perCPU {
|
||||
if softirqs.Block[i], err = strconv.ParseUint(count, 10, 64); err != nil {
|
||||
return Softirqs{}, fmt.Errorf("couldn't parse %q (BLOCK%d): %w", count, i, err)
|
||||
}
|
||||
}
|
||||
case parts[0] == "IRQ_POLL:":
|
||||
perCPU := parts[1:]
|
||||
softirqs.IRQPoll = make([]uint64, len(perCPU))
|
||||
for i, count := range perCPU {
|
||||
if softirqs.IRQPoll[i], err = strconv.ParseUint(count, 10, 64); err != nil {
|
||||
return Softirqs{}, fmt.Errorf("couldn't parse %q (IRQ_POLL%d): %w", count, i, err)
|
||||
}
|
||||
}
|
||||
case parts[0] == "TASKLET:":
|
||||
perCPU := parts[1:]
|
||||
softirqs.Tasklet = make([]uint64, len(perCPU))
|
||||
for i, count := range perCPU {
|
||||
if softirqs.Tasklet[i], err = strconv.ParseUint(count, 10, 64); err != nil {
|
||||
return Softirqs{}, fmt.Errorf("couldn't parse %q (TASKLET%d): %w", count, i, err)
|
||||
}
|
||||
}
|
||||
case parts[0] == "SCHED:":
|
||||
perCPU := parts[1:]
|
||||
softirqs.Sched = make([]uint64, len(perCPU))
|
||||
for i, count := range perCPU {
|
||||
if softirqs.Sched[i], err = strconv.ParseUint(count, 10, 64); err != nil {
|
||||
return Softirqs{}, fmt.Errorf("couldn't parse %q (SCHED%d): %w", count, i, err)
|
||||
}
|
||||
}
|
||||
case parts[0] == "HRTIMER:":
|
||||
perCPU := parts[1:]
|
||||
softirqs.HRTimer = make([]uint64, len(perCPU))
|
||||
for i, count := range perCPU {
|
||||
if softirqs.HRTimer[i], err = strconv.ParseUint(count, 10, 64); err != nil {
|
||||
return Softirqs{}, fmt.Errorf("couldn't parse %q (HRTIMER%d): %w", count, i, err)
|
||||
}
|
||||
}
|
||||
case parts[0] == "RCU:":
|
||||
perCPU := parts[1:]
|
||||
softirqs.RCU = make([]uint64, len(perCPU))
|
||||
for i, count := range perCPU {
|
||||
if softirqs.RCU[i], err = strconv.ParseUint(count, 10, 64); err != nil {
|
||||
return Softirqs{}, fmt.Errorf("couldn't parse %q (RCU%d): %w", count, i, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if err := scanner.Err(); err != nil {
|
||||
return Softirqs{}, fmt.Errorf("couldn't parse softirqs: %w", err)
|
||||
}
|
||||
|
||||
return softirqs, scanner.Err()
|
||||
}
|
10
vendor/github.com/prometheus/procfs/stat.go
generated
vendored
10
vendor/github.com/prometheus/procfs/stat.go
generated
vendored
@ -41,7 +41,7 @@ type CPUStat struct {
|
||||
|
||||
// SoftIRQStat represent the softirq statistics as exported in the procfs stat file.
|
||||
// A nice introduction can be found at https://0xax.gitbooks.io/linux-insides/content/interrupts/interrupts-9.html
|
||||
// It is possible to get per-cpu stats by reading /proc/softirqs
|
||||
// It is possible to get per-cpu stats by reading `/proc/softirqs`.
|
||||
type SoftIRQStat struct {
|
||||
Hi uint64
|
||||
Timer uint64
|
||||
@ -145,7 +145,7 @@ func parseSoftIRQStat(line string) (SoftIRQStat, uint64, error) {
|
||||
// NewStat returns information about current cpu/process statistics.
|
||||
// See https://www.kernel.org/doc/Documentation/filesystems/proc.txt
|
||||
//
|
||||
// Deprecated: use fs.Stat() instead
|
||||
// Deprecated: Use fs.Stat() instead.
|
||||
func NewStat() (Stat, error) {
|
||||
fs, err := NewFS(fs.DefaultProcMountPoint)
|
||||
if err != nil {
|
||||
@ -155,15 +155,15 @@ func NewStat() (Stat, error) {
|
||||
}
|
||||
|
||||
// NewStat returns information about current cpu/process statistics.
|
||||
// See https://www.kernel.org/doc/Documentation/filesystems/proc.txt
|
||||
// See: https://www.kernel.org/doc/Documentation/filesystems/proc.txt
|
||||
//
|
||||
// Deprecated: use fs.Stat() instead
|
||||
// Deprecated: Use fs.Stat() instead.
|
||||
func (fs FS) NewStat() (Stat, error) {
|
||||
return fs.Stat()
|
||||
}
|
||||
|
||||
// Stat returns information about current cpu/process statistics.
|
||||
// See https://www.kernel.org/doc/Documentation/filesystems/proc.txt
|
||||
// See: https://www.kernel.org/doc/Documentation/filesystems/proc.txt
|
||||
func (fs FS) Stat() (Stat, error) {
|
||||
fileName := fs.proc.Path("stat")
|
||||
data, err := util.ReadFileNoStat(fileName)
|
||||
|
6
vendor/github.com/prometheus/procfs/vm.go
generated
vendored
6
vendor/github.com/prometheus/procfs/vm.go
generated
vendored
@ -11,13 +11,13 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package procfs
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@ -29,7 +29,7 @@ import (
|
||||
// https://www.kernel.org/doc/Documentation/sysctl/vm.txt
|
||||
// Each setting is exposed as a single file.
|
||||
// Each file contains one line with a single numerical value, except lowmem_reserve_ratio which holds an array
|
||||
// and numa_zonelist_order (deprecated) which is a string
|
||||
// and numa_zonelist_order (deprecated) which is a string.
|
||||
type VM struct {
|
||||
AdminReserveKbytes *int64 // /proc/sys/vm/admin_reserve_kbytes
|
||||
BlockDump *int64 // /proc/sys/vm/block_dump
|
||||
@ -87,7 +87,7 @@ func (fs FS) VM() (*VM, error) {
|
||||
return nil, fmt.Errorf("%s is not a directory", path)
|
||||
}
|
||||
|
||||
files, err := ioutil.ReadDir(path)
|
||||
files, err := os.ReadDir(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
5
vendor/github.com/prometheus/procfs/zoneinfo.go
generated
vendored
5
vendor/github.com/prometheus/procfs/zoneinfo.go
generated
vendored
@ -11,6 +11,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build !windows
|
||||
// +build !windows
|
||||
|
||||
package procfs
|
||||
@ -18,7 +19,7 @@ package procfs
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
@ -72,7 +73,7 @@ var nodeZoneRE = regexp.MustCompile(`(\d+), zone\s+(\w+)`)
|
||||
// structs containing the relevant info. More information available here:
|
||||
// https://www.kernel.org/doc/Documentation/sysctl/vm.txt
|
||||
func (fs FS) Zoneinfo() ([]Zoneinfo, error) {
|
||||
data, err := ioutil.ReadFile(fs.proc.Path("zoneinfo"))
|
||||
data, err := os.ReadFile(fs.proc.Path("zoneinfo"))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error reading zoneinfo %q: %w", fs.proc.Path("zoneinfo"), err)
|
||||
}
|
||||
|
54
vendor/github.com/stretchr/testify/assert/assertion_compare.go
generated
vendored
54
vendor/github.com/stretchr/testify/assert/assertion_compare.go
generated
vendored
@ -3,6 +3,7 @@ package assert
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"time"
|
||||
)
|
||||
|
||||
type CompareType int
|
||||
@ -30,6 +31,8 @@ var (
|
||||
float64Type = reflect.TypeOf(float64(1))
|
||||
|
||||
stringType = reflect.TypeOf("")
|
||||
|
||||
timeType = reflect.TypeOf(time.Time{})
|
||||
)
|
||||
|
||||
func compare(obj1, obj2 interface{}, kind reflect.Kind) (CompareType, bool) {
|
||||
@ -299,6 +302,27 @@ func compare(obj1, obj2 interface{}, kind reflect.Kind) (CompareType, bool) {
|
||||
return compareLess, true
|
||||
}
|
||||
}
|
||||
// Check for known struct types we can check for compare results.
|
||||
case reflect.Struct:
|
||||
{
|
||||
// All structs enter here. We're not interested in most types.
|
||||
if !canConvert(obj1Value, timeType) {
|
||||
break
|
||||
}
|
||||
|
||||
// time.Time can compared!
|
||||
timeObj1, ok := obj1.(time.Time)
|
||||
if !ok {
|
||||
timeObj1 = obj1Value.Convert(timeType).Interface().(time.Time)
|
||||
}
|
||||
|
||||
timeObj2, ok := obj2.(time.Time)
|
||||
if !ok {
|
||||
timeObj2 = obj2Value.Convert(timeType).Interface().(time.Time)
|
||||
}
|
||||
|
||||
return compare(timeObj1.UnixNano(), timeObj2.UnixNano(), reflect.Int64)
|
||||
}
|
||||
}
|
||||
|
||||
return compareEqual, false
|
||||
@ -310,7 +334,10 @@ func compare(obj1, obj2 interface{}, kind reflect.Kind) (CompareType, bool) {
|
||||
// assert.Greater(t, float64(2), float64(1))
|
||||
// assert.Greater(t, "b", "a")
|
||||
func Greater(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool {
|
||||
return compareTwoValues(t, e1, e2, []CompareType{compareGreater}, "\"%v\" is not greater than \"%v\"", msgAndArgs)
|
||||
if h, ok := t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
return compareTwoValues(t, e1, e2, []CompareType{compareGreater}, "\"%v\" is not greater than \"%v\"", msgAndArgs...)
|
||||
}
|
||||
|
||||
// GreaterOrEqual asserts that the first element is greater than or equal to the second
|
||||
@ -320,7 +347,10 @@ func Greater(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface
|
||||
// assert.GreaterOrEqual(t, "b", "a")
|
||||
// assert.GreaterOrEqual(t, "b", "b")
|
||||
func GreaterOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool {
|
||||
return compareTwoValues(t, e1, e2, []CompareType{compareGreater, compareEqual}, "\"%v\" is not greater than or equal to \"%v\"", msgAndArgs)
|
||||
if h, ok := t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
return compareTwoValues(t, e1, e2, []CompareType{compareGreater, compareEqual}, "\"%v\" is not greater than or equal to \"%v\"", msgAndArgs...)
|
||||
}
|
||||
|
||||
// Less asserts that the first element is less than the second
|
||||
@ -329,7 +359,10 @@ func GreaterOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...in
|
||||
// assert.Less(t, float64(1), float64(2))
|
||||
// assert.Less(t, "a", "b")
|
||||
func Less(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool {
|
||||
return compareTwoValues(t, e1, e2, []CompareType{compareLess}, "\"%v\" is not less than \"%v\"", msgAndArgs)
|
||||
if h, ok := t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
return compareTwoValues(t, e1, e2, []CompareType{compareLess}, "\"%v\" is not less than \"%v\"", msgAndArgs...)
|
||||
}
|
||||
|
||||
// LessOrEqual asserts that the first element is less than or equal to the second
|
||||
@ -339,7 +372,10 @@ func Less(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{})
|
||||
// assert.LessOrEqual(t, "a", "b")
|
||||
// assert.LessOrEqual(t, "b", "b")
|
||||
func LessOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool {
|
||||
return compareTwoValues(t, e1, e2, []CompareType{compareLess, compareEqual}, "\"%v\" is not less than or equal to \"%v\"", msgAndArgs)
|
||||
if h, ok := t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
return compareTwoValues(t, e1, e2, []CompareType{compareLess, compareEqual}, "\"%v\" is not less than or equal to \"%v\"", msgAndArgs...)
|
||||
}
|
||||
|
||||
// Positive asserts that the specified element is positive
|
||||
@ -347,8 +383,11 @@ func LessOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...inter
|
||||
// assert.Positive(t, 1)
|
||||
// assert.Positive(t, 1.23)
|
||||
func Positive(t TestingT, e interface{}, msgAndArgs ...interface{}) bool {
|
||||
if h, ok := t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
zero := reflect.Zero(reflect.TypeOf(e))
|
||||
return compareTwoValues(t, e, zero.Interface(), []CompareType{compareGreater}, "\"%v\" is not positive", msgAndArgs)
|
||||
return compareTwoValues(t, e, zero.Interface(), []CompareType{compareGreater}, "\"%v\" is not positive", msgAndArgs...)
|
||||
}
|
||||
|
||||
// Negative asserts that the specified element is negative
|
||||
@ -356,8 +395,11 @@ func Positive(t TestingT, e interface{}, msgAndArgs ...interface{}) bool {
|
||||
// assert.Negative(t, -1)
|
||||
// assert.Negative(t, -1.23)
|
||||
func Negative(t TestingT, e interface{}, msgAndArgs ...interface{}) bool {
|
||||
if h, ok := t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
zero := reflect.Zero(reflect.TypeOf(e))
|
||||
return compareTwoValues(t, e, zero.Interface(), []CompareType{compareLess}, "\"%v\" is not negative", msgAndArgs)
|
||||
return compareTwoValues(t, e, zero.Interface(), []CompareType{compareLess}, "\"%v\" is not negative", msgAndArgs...)
|
||||
}
|
||||
|
||||
func compareTwoValues(t TestingT, e1 interface{}, e2 interface{}, allowedComparesResults []CompareType, failMessage string, msgAndArgs ...interface{}) bool {
|
||||
|
16
vendor/github.com/stretchr/testify/assert/assertion_compare_can_convert.go
generated
vendored
Normal file
16
vendor/github.com/stretchr/testify/assert/assertion_compare_can_convert.go
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
//go:build go1.17
|
||||
// +build go1.17
|
||||
|
||||
// TODO: once support for Go 1.16 is dropped, this file can be
|
||||
// merged/removed with assertion_compare_go1.17_test.go and
|
||||
// assertion_compare_legacy.go
|
||||
|
||||
package assert
|
||||
|
||||
import "reflect"
|
||||
|
||||
// Wrapper around reflect.Value.CanConvert, for compatability
|
||||
// reasons.
|
||||
func canConvert(value reflect.Value, to reflect.Type) bool {
|
||||
return value.CanConvert(to)
|
||||
}
|
16
vendor/github.com/stretchr/testify/assert/assertion_compare_legacy.go
generated
vendored
Normal file
16
vendor/github.com/stretchr/testify/assert/assertion_compare_legacy.go
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
//go:build !go1.17
|
||||
// +build !go1.17
|
||||
|
||||
// TODO: once support for Go 1.16 is dropped, this file can be
|
||||
// merged/removed with assertion_compare_go1.17_test.go and
|
||||
// assertion_compare_can_convert.go
|
||||
|
||||
package assert
|
||||
|
||||
import "reflect"
|
||||
|
||||
// Older versions of Go does not have the reflect.Value.CanConvert
|
||||
// method.
|
||||
func canConvert(value reflect.Value, to reflect.Type) bool {
|
||||
return false
|
||||
}
|
12
vendor/github.com/stretchr/testify/assert/assertion_format.go
generated
vendored
12
vendor/github.com/stretchr/testify/assert/assertion_format.go
generated
vendored
@ -123,6 +123,18 @@ func ErrorAsf(t TestingT, err error, target interface{}, msg string, args ...int
|
||||
return ErrorAs(t, err, target, append([]interface{}{msg}, args...)...)
|
||||
}
|
||||
|
||||
// ErrorContainsf asserts that a function returned an error (i.e. not `nil`)
|
||||
// and that the error contains the specified substring.
|
||||
//
|
||||
// actualObj, err := SomeFunction()
|
||||
// assert.ErrorContainsf(t, err, expectedErrorSubString, "error message %s", "formatted")
|
||||
func ErrorContainsf(t TestingT, theError error, contains string, msg string, args ...interface{}) bool {
|
||||
if h, ok := t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
return ErrorContains(t, theError, contains, append([]interface{}{msg}, args...)...)
|
||||
}
|
||||
|
||||
// ErrorIsf asserts that at least one of the errors in err's chain matches target.
|
||||
// This is a wrapper for errors.Is.
|
||||
func ErrorIsf(t TestingT, err error, target error, msg string, args ...interface{}) bool {
|
||||
|
24
vendor/github.com/stretchr/testify/assert/assertion_forward.go
generated
vendored
24
vendor/github.com/stretchr/testify/assert/assertion_forward.go
generated
vendored
@ -222,6 +222,30 @@ func (a *Assertions) ErrorAsf(err error, target interface{}, msg string, args ..
|
||||
return ErrorAsf(a.t, err, target, msg, args...)
|
||||
}
|
||||
|
||||
// ErrorContains asserts that a function returned an error (i.e. not `nil`)
|
||||
// and that the error contains the specified substring.
|
||||
//
|
||||
// actualObj, err := SomeFunction()
|
||||
// a.ErrorContains(err, expectedErrorSubString)
|
||||
func (a *Assertions) ErrorContains(theError error, contains string, msgAndArgs ...interface{}) bool {
|
||||
if h, ok := a.t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
return ErrorContains(a.t, theError, contains, msgAndArgs...)
|
||||
}
|
||||
|
||||
// ErrorContainsf asserts that a function returned an error (i.e. not `nil`)
|
||||
// and that the error contains the specified substring.
|
||||
//
|
||||
// actualObj, err := SomeFunction()
|
||||
// a.ErrorContainsf(err, expectedErrorSubString, "error message %s", "formatted")
|
||||
func (a *Assertions) ErrorContainsf(theError error, contains string, msg string, args ...interface{}) bool {
|
||||
if h, ok := a.t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
return ErrorContainsf(a.t, theError, contains, msg, args...)
|
||||
}
|
||||
|
||||
// ErrorIs asserts that at least one of the errors in err's chain matches target.
|
||||
// This is a wrapper for errors.Is.
|
||||
func (a *Assertions) ErrorIs(err error, target error, msgAndArgs ...interface{}) bool {
|
||||
|
8
vendor/github.com/stretchr/testify/assert/assertion_order.go
generated
vendored
8
vendor/github.com/stretchr/testify/assert/assertion_order.go
generated
vendored
@ -50,7 +50,7 @@ func isOrdered(t TestingT, object interface{}, allowedComparesResults []CompareT
|
||||
// assert.IsIncreasing(t, []float{1, 2})
|
||||
// assert.IsIncreasing(t, []string{"a", "b"})
|
||||
func IsIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
|
||||
return isOrdered(t, object, []CompareType{compareLess}, "\"%v\" is not less than \"%v\"", msgAndArgs)
|
||||
return isOrdered(t, object, []CompareType{compareLess}, "\"%v\" is not less than \"%v\"", msgAndArgs...)
|
||||
}
|
||||
|
||||
// IsNonIncreasing asserts that the collection is not increasing
|
||||
@ -59,7 +59,7 @@ func IsIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) boo
|
||||
// assert.IsNonIncreasing(t, []float{2, 1})
|
||||
// assert.IsNonIncreasing(t, []string{"b", "a"})
|
||||
func IsNonIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
|
||||
return isOrdered(t, object, []CompareType{compareEqual, compareGreater}, "\"%v\" is not greater than or equal to \"%v\"", msgAndArgs)
|
||||
return isOrdered(t, object, []CompareType{compareEqual, compareGreater}, "\"%v\" is not greater than or equal to \"%v\"", msgAndArgs...)
|
||||
}
|
||||
|
||||
// IsDecreasing asserts that the collection is decreasing
|
||||
@ -68,7 +68,7 @@ func IsNonIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{})
|
||||
// assert.IsDecreasing(t, []float{2, 1})
|
||||
// assert.IsDecreasing(t, []string{"b", "a"})
|
||||
func IsDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
|
||||
return isOrdered(t, object, []CompareType{compareGreater}, "\"%v\" is not greater than \"%v\"", msgAndArgs)
|
||||
return isOrdered(t, object, []CompareType{compareGreater}, "\"%v\" is not greater than \"%v\"", msgAndArgs...)
|
||||
}
|
||||
|
||||
// IsNonDecreasing asserts that the collection is not decreasing
|
||||
@ -77,5 +77,5 @@ func IsDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) boo
|
||||
// assert.IsNonDecreasing(t, []float{1, 2})
|
||||
// assert.IsNonDecreasing(t, []string{"a", "b"})
|
||||
func IsNonDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
|
||||
return isOrdered(t, object, []CompareType{compareLess, compareEqual}, "\"%v\" is not less than or equal to \"%v\"", msgAndArgs)
|
||||
return isOrdered(t, object, []CompareType{compareLess, compareEqual}, "\"%v\" is not less than or equal to \"%v\"", msgAndArgs...)
|
||||
}
|
||||
|
112
vendor/github.com/stretchr/testify/assert/assertions.go
generated
vendored
112
vendor/github.com/stretchr/testify/assert/assertions.go
generated
vendored
@ -718,10 +718,14 @@ func NotEqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...inte
|
||||
// return (false, false) if impossible.
|
||||
// return (true, false) if element was not found.
|
||||
// return (true, true) if element was found.
|
||||
func includeElement(list interface{}, element interface{}) (ok, found bool) {
|
||||
func containsElement(list interface{}, element interface{}) (ok, found bool) {
|
||||
|
||||
listValue := reflect.ValueOf(list)
|
||||
listKind := reflect.TypeOf(list).Kind()
|
||||
listType := reflect.TypeOf(list)
|
||||
if listType == nil {
|
||||
return false, false
|
||||
}
|
||||
listKind := listType.Kind()
|
||||
defer func() {
|
||||
if e := recover(); e != nil {
|
||||
ok = false
|
||||
@ -764,7 +768,7 @@ func Contains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bo
|
||||
h.Helper()
|
||||
}
|
||||
|
||||
ok, found := includeElement(s, contains)
|
||||
ok, found := containsElement(s, contains)
|
||||
if !ok {
|
||||
return Fail(t, fmt.Sprintf("%#v could not be applied builtin len()", s), msgAndArgs...)
|
||||
}
|
||||
@ -787,7 +791,7 @@ func NotContains(t TestingT, s, contains interface{}, msgAndArgs ...interface{})
|
||||
h.Helper()
|
||||
}
|
||||
|
||||
ok, found := includeElement(s, contains)
|
||||
ok, found := containsElement(s, contains)
|
||||
if !ok {
|
||||
return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", s), msgAndArgs...)
|
||||
}
|
||||
@ -831,7 +835,7 @@ func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok
|
||||
|
||||
for i := 0; i < subsetValue.Len(); i++ {
|
||||
element := subsetValue.Index(i).Interface()
|
||||
ok, found := includeElement(list, element)
|
||||
ok, found := containsElement(list, element)
|
||||
if !ok {
|
||||
return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", list), msgAndArgs...)
|
||||
}
|
||||
@ -852,7 +856,7 @@ func NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...interface{})
|
||||
h.Helper()
|
||||
}
|
||||
if subset == nil {
|
||||
return Fail(t, fmt.Sprintf("nil is the empty set which is a subset of every set"), msgAndArgs...)
|
||||
return Fail(t, "nil is the empty set which is a subset of every set", msgAndArgs...)
|
||||
}
|
||||
|
||||
subsetValue := reflect.ValueOf(subset)
|
||||
@ -875,7 +879,7 @@ func NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...interface{})
|
||||
|
||||
for i := 0; i < subsetValue.Len(); i++ {
|
||||
element := subsetValue.Index(i).Interface()
|
||||
ok, found := includeElement(list, element)
|
||||
ok, found := containsElement(list, element)
|
||||
if !ok {
|
||||
return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", list), msgAndArgs...)
|
||||
}
|
||||
@ -1000,27 +1004,21 @@ func Condition(t TestingT, comp Comparison, msgAndArgs ...interface{}) bool {
|
||||
type PanicTestFunc func()
|
||||
|
||||
// didPanic returns true if the function passed to it panics. Otherwise, it returns false.
|
||||
func didPanic(f PanicTestFunc) (bool, interface{}, string) {
|
||||
|
||||
didPanic := false
|
||||
var message interface{}
|
||||
var stack string
|
||||
func() {
|
||||
|
||||
defer func() {
|
||||
if message = recover(); message != nil {
|
||||
didPanic = true
|
||||
stack = string(debug.Stack())
|
||||
}
|
||||
}()
|
||||
|
||||
// call the target function
|
||||
f()
|
||||
func didPanic(f PanicTestFunc) (didPanic bool, message interface{}, stack string) {
|
||||
didPanic = true
|
||||
|
||||
defer func() {
|
||||
message = recover()
|
||||
if didPanic {
|
||||
stack = string(debug.Stack())
|
||||
}
|
||||
}()
|
||||
|
||||
return didPanic, message, stack
|
||||
// call the target function
|
||||
f()
|
||||
didPanic = false
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// Panics asserts that the code inside the specified PanicTestFunc panics.
|
||||
@ -1161,11 +1159,15 @@ func InDelta(t TestingT, expected, actual interface{}, delta float64, msgAndArgs
|
||||
bf, bok := toFloat(actual)
|
||||
|
||||
if !aok || !bok {
|
||||
return Fail(t, fmt.Sprintf("Parameters must be numerical"), msgAndArgs...)
|
||||
return Fail(t, "Parameters must be numerical", msgAndArgs...)
|
||||
}
|
||||
|
||||
if math.IsNaN(af) && math.IsNaN(bf) {
|
||||
return true
|
||||
}
|
||||
|
||||
if math.IsNaN(af) {
|
||||
return Fail(t, fmt.Sprintf("Expected must not be NaN"), msgAndArgs...)
|
||||
return Fail(t, "Expected must not be NaN", msgAndArgs...)
|
||||
}
|
||||
|
||||
if math.IsNaN(bf) {
|
||||
@ -1188,7 +1190,7 @@ func InDeltaSlice(t TestingT, expected, actual interface{}, delta float64, msgAn
|
||||
if expected == nil || actual == nil ||
|
||||
reflect.TypeOf(actual).Kind() != reflect.Slice ||
|
||||
reflect.TypeOf(expected).Kind() != reflect.Slice {
|
||||
return Fail(t, fmt.Sprintf("Parameters must be slice"), msgAndArgs...)
|
||||
return Fail(t, "Parameters must be slice", msgAndArgs...)
|
||||
}
|
||||
|
||||
actualSlice := reflect.ValueOf(actual)
|
||||
@ -1250,8 +1252,12 @@ func InDeltaMapValues(t TestingT, expected, actual interface{}, delta float64, m
|
||||
|
||||
func calcRelativeError(expected, actual interface{}) (float64, error) {
|
||||
af, aok := toFloat(expected)
|
||||
if !aok {
|
||||
return 0, fmt.Errorf("expected value %q cannot be converted to float", expected)
|
||||
bf, bok := toFloat(actual)
|
||||
if !aok || !bok {
|
||||
return 0, fmt.Errorf("Parameters must be numerical")
|
||||
}
|
||||
if math.IsNaN(af) && math.IsNaN(bf) {
|
||||
return 0, nil
|
||||
}
|
||||
if math.IsNaN(af) {
|
||||
return 0, errors.New("expected value must not be NaN")
|
||||
@ -1259,10 +1265,6 @@ func calcRelativeError(expected, actual interface{}) (float64, error) {
|
||||
if af == 0 {
|
||||
return 0, fmt.Errorf("expected value must have a value other than zero to calculate the relative error")
|
||||
}
|
||||
bf, bok := toFloat(actual)
|
||||
if !bok {
|
||||
return 0, fmt.Errorf("actual value %q cannot be converted to float", actual)
|
||||
}
|
||||
if math.IsNaN(bf) {
|
||||
return 0, errors.New("actual value must not be NaN")
|
||||
}
|
||||
@ -1298,7 +1300,7 @@ func InEpsilonSlice(t TestingT, expected, actual interface{}, epsilon float64, m
|
||||
if expected == nil || actual == nil ||
|
||||
reflect.TypeOf(actual).Kind() != reflect.Slice ||
|
||||
reflect.TypeOf(expected).Kind() != reflect.Slice {
|
||||
return Fail(t, fmt.Sprintf("Parameters must be slice"), msgAndArgs...)
|
||||
return Fail(t, "Parameters must be slice", msgAndArgs...)
|
||||
}
|
||||
|
||||
actualSlice := reflect.ValueOf(actual)
|
||||
@ -1375,6 +1377,27 @@ func EqualError(t TestingT, theError error, errString string, msgAndArgs ...inte
|
||||
return true
|
||||
}
|
||||
|
||||
// ErrorContains asserts that a function returned an error (i.e. not `nil`)
|
||||
// and that the error contains the specified substring.
|
||||
//
|
||||
// actualObj, err := SomeFunction()
|
||||
// assert.ErrorContains(t, err, expectedErrorSubString)
|
||||
func ErrorContains(t TestingT, theError error, contains string, msgAndArgs ...interface{}) bool {
|
||||
if h, ok := t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
if !Error(t, theError, msgAndArgs...) {
|
||||
return false
|
||||
}
|
||||
|
||||
actual := theError.Error()
|
||||
if !strings.Contains(actual, contains) {
|
||||
return Fail(t, fmt.Sprintf("Error %#v does not contain %#v", actual, contains), msgAndArgs...)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// matchRegexp return true if a specified regexp matches a string.
|
||||
func matchRegexp(rx interface{}, str interface{}) bool {
|
||||
|
||||
@ -1588,12 +1611,17 @@ func diff(expected interface{}, actual interface{}) string {
|
||||
}
|
||||
|
||||
var e, a string
|
||||
if et != reflect.TypeOf("") {
|
||||
e = spewConfig.Sdump(expected)
|
||||
a = spewConfig.Sdump(actual)
|
||||
} else {
|
||||
|
||||
switch et {
|
||||
case reflect.TypeOf(""):
|
||||
e = reflect.ValueOf(expected).String()
|
||||
a = reflect.ValueOf(actual).String()
|
||||
case reflect.TypeOf(time.Time{}):
|
||||
e = spewConfigStringerEnabled.Sdump(expected)
|
||||
a = spewConfigStringerEnabled.Sdump(actual)
|
||||
default:
|
||||
e = spewConfig.Sdump(expected)
|
||||
a = spewConfig.Sdump(actual)
|
||||
}
|
||||
|
||||
diff, _ := difflib.GetUnifiedDiffString(difflib.UnifiedDiff{
|
||||
@ -1625,6 +1653,14 @@ var spewConfig = spew.ConfigState{
|
||||
MaxDepth: 10,
|
||||
}
|
||||
|
||||
var spewConfigStringerEnabled = spew.ConfigState{
|
||||
Indent: " ",
|
||||
DisablePointerAddresses: true,
|
||||
DisableCapacities: true,
|
||||
SortKeys: true,
|
||||
MaxDepth: 10,
|
||||
}
|
||||
|
||||
type tHelper interface {
|
||||
Helper()
|
||||
}
|
||||
|
30
vendor/github.com/stretchr/testify/require/require.go
generated
vendored
30
vendor/github.com/stretchr/testify/require/require.go
generated
vendored
@ -280,6 +280,36 @@ func ErrorAsf(t TestingT, err error, target interface{}, msg string, args ...int
|
||||
t.FailNow()
|
||||
}
|
||||
|
||||
// ErrorContains asserts that a function returned an error (i.e. not `nil`)
|
||||
// and that the error contains the specified substring.
|
||||
//
|
||||
// actualObj, err := SomeFunction()
|
||||
// assert.ErrorContains(t, err, expectedErrorSubString)
|
||||
func ErrorContains(t TestingT, theError error, contains string, msgAndArgs ...interface{}) {
|
||||
if h, ok := t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
if assert.ErrorContains(t, theError, contains, msgAndArgs...) {
|
||||
return
|
||||
}
|
||||
t.FailNow()
|
||||
}
|
||||
|
||||
// ErrorContainsf asserts that a function returned an error (i.e. not `nil`)
|
||||
// and that the error contains the specified substring.
|
||||
//
|
||||
// actualObj, err := SomeFunction()
|
||||
// assert.ErrorContainsf(t, err, expectedErrorSubString, "error message %s", "formatted")
|
||||
func ErrorContainsf(t TestingT, theError error, contains string, msg string, args ...interface{}) {
|
||||
if h, ok := t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
if assert.ErrorContainsf(t, theError, contains, msg, args...) {
|
||||
return
|
||||
}
|
||||
t.FailNow()
|
||||
}
|
||||
|
||||
// ErrorIs asserts that at least one of the errors in err's chain matches target.
|
||||
// This is a wrapper for errors.Is.
|
||||
func ErrorIs(t TestingT, err error, target error, msgAndArgs ...interface{}) {
|
||||
|
24
vendor/github.com/stretchr/testify/require/require_forward.go
generated
vendored
24
vendor/github.com/stretchr/testify/require/require_forward.go
generated
vendored
@ -223,6 +223,30 @@ func (a *Assertions) ErrorAsf(err error, target interface{}, msg string, args ..
|
||||
ErrorAsf(a.t, err, target, msg, args...)
|
||||
}
|
||||
|
||||
// ErrorContains asserts that a function returned an error (i.e. not `nil`)
|
||||
// and that the error contains the specified substring.
|
||||
//
|
||||
// actualObj, err := SomeFunction()
|
||||
// a.ErrorContains(err, expectedErrorSubString)
|
||||
func (a *Assertions) ErrorContains(theError error, contains string, msgAndArgs ...interface{}) {
|
||||
if h, ok := a.t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
ErrorContains(a.t, theError, contains, msgAndArgs...)
|
||||
}
|
||||
|
||||
// ErrorContainsf asserts that a function returned an error (i.e. not `nil`)
|
||||
// and that the error contains the specified substring.
|
||||
//
|
||||
// actualObj, err := SomeFunction()
|
||||
// a.ErrorContainsf(err, expectedErrorSubString, "error message %s", "formatted")
|
||||
func (a *Assertions) ErrorContainsf(theError error, contains string, msg string, args ...interface{}) {
|
||||
if h, ok := a.t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
ErrorContainsf(a.t, theError, contains, msg, args...)
|
||||
}
|
||||
|
||||
// ErrorIs asserts that at least one of the errors in err's chain matches target.
|
||||
// This is a wrapper for errors.Is.
|
||||
func (a *Assertions) ErrorIs(err error, target error, msgAndArgs ...interface{}) {
|
||||
|
4
vendor/golang.org/x/sys/unix/endian_little.go
generated
vendored
4
vendor/golang.org/x/sys/unix/endian_little.go
generated
vendored
@ -2,8 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
//
|
||||
//go:build 386 || amd64 || amd64p32 || alpha || arm || arm64 || mipsle || mips64le || mips64p32le || nios2 || ppc64le || riscv || riscv64 || sh
|
||||
// +build 386 amd64 amd64p32 alpha arm arm64 mipsle mips64le mips64p32le nios2 ppc64le riscv riscv64 sh
|
||||
//go:build 386 || amd64 || amd64p32 || alpha || arm || arm64 || loong64 || mipsle || mips64le || mips64p32le || nios2 || ppc64le || riscv || riscv64 || sh
|
||||
// +build 386 amd64 amd64p32 alpha arm arm64 loong64 mipsle mips64le mips64p32le nios2 ppc64le riscv riscv64 sh
|
||||
|
||||
package unix
|
||||
|
||||
|
9
vendor/golang.org/x/sys/unix/ifreq_linux.go
generated
vendored
9
vendor/golang.org/x/sys/unix/ifreq_linux.go
generated
vendored
@ -8,7 +8,6 @@
|
||||
package unix
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
@ -45,13 +44,7 @@ func NewIfreq(name string) (*Ifreq, error) {
|
||||
|
||||
// Name returns the interface name associated with the Ifreq.
|
||||
func (ifr *Ifreq) Name() string {
|
||||
// BytePtrToString requires a NULL terminator or the program may crash. If
|
||||
// one is not present, just return the empty string.
|
||||
if !bytes.Contains(ifr.raw.Ifrn[:], []byte{0x00}) {
|
||||
return ""
|
||||
}
|
||||
|
||||
return BytePtrToString(&ifr.raw.Ifrn[0])
|
||||
return ByteSliceToString(ifr.raw.Ifrn[:])
|
||||
}
|
||||
|
||||
// According to netdevice(7), only AF_INET addresses are returned for numerous
|
||||
|
6
vendor/golang.org/x/sys/unix/syscall_aix.go
generated
vendored
6
vendor/golang.org/x/sys/unix/syscall_aix.go
generated
vendored
@ -37,6 +37,7 @@ func Creat(path string, mode uint32) (fd int, err error) {
|
||||
}
|
||||
|
||||
//sys utimes(path string, times *[2]Timeval) (err error)
|
||||
|
||||
func Utimes(path string, tv []Timeval) error {
|
||||
if len(tv) != 2 {
|
||||
return EINVAL
|
||||
@ -45,6 +46,7 @@ func Utimes(path string, tv []Timeval) error {
|
||||
}
|
||||
|
||||
//sys utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error)
|
||||
|
||||
func UtimesNano(path string, ts []Timespec) error {
|
||||
if len(ts) != 2 {
|
||||
return EINVAL
|
||||
@ -300,11 +302,13 @@ func direntNamlen(buf []byte) (uint64, bool) {
|
||||
}
|
||||
|
||||
//sys getdirent(fd int, buf []byte) (n int, err error)
|
||||
|
||||
func Getdents(fd int, buf []byte) (n int, err error) {
|
||||
return getdirent(fd, buf)
|
||||
}
|
||||
|
||||
//sys wait4(pid Pid_t, status *_C_int, options int, rusage *Rusage) (wpid Pid_t, err error)
|
||||
|
||||
func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, err error) {
|
||||
var status _C_int
|
||||
var r Pid_t
|
||||
@ -372,6 +376,7 @@ func (w WaitStatus) TrapCause() int { return -1 }
|
||||
//sys fcntl(fd int, cmd int, arg int) (val int, err error)
|
||||
|
||||
//sys fsyncRange(fd int, how int, start int64, length int64) (err error) = fsync_range
|
||||
|
||||
func Fsync(fd int) error {
|
||||
return fsyncRange(fd, O_SYNC, 0, 0)
|
||||
}
|
||||
@ -536,6 +541,7 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||
//sys Getsystemcfg(label int) (n uint64)
|
||||
|
||||
//sys umount(target string) (err error)
|
||||
|
||||
func Unmount(target string, flags int) (err error) {
|
||||
if flags != 0 {
|
||||
// AIX doesn't have any flags for umount.
|
||||
|
2
vendor/golang.org/x/sys/unix/syscall_darwin.go
generated
vendored
2
vendor/golang.org/x/sys/unix/syscall_darwin.go
generated
vendored
@ -504,6 +504,7 @@ func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, error) {
|
||||
//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
|
||||
//sys Mkfifo(path string, mode uint32) (err error)
|
||||
//sys Mknod(path string, mode uint32, dev int) (err error)
|
||||
//sys Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error)
|
||||
//sys Open(path string, mode int, perm uint32) (fd int, err error)
|
||||
//sys Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error)
|
||||
//sys Pathconf(path string, name int) (val int, err error)
|
||||
@ -572,7 +573,6 @@ func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, error) {
|
||||
// Nfssvc
|
||||
// Getfh
|
||||
// Quotactl
|
||||
// Mount
|
||||
// Csops
|
||||
// Waitid
|
||||
// Add_profil
|
||||
|
2
vendor/golang.org/x/sys/unix/syscall_dragonfly.go
generated
vendored
2
vendor/golang.org/x/sys/unix/syscall_dragonfly.go
generated
vendored
@ -125,11 +125,13 @@ func Pipe2(p []int, flags int) (err error) {
|
||||
}
|
||||
|
||||
//sys extpread(fd int, p []byte, flags int, offset int64) (n int, err error)
|
||||
|
||||
func pread(fd int, p []byte, offset int64) (n int, err error) {
|
||||
return extpread(fd, p, 0, offset)
|
||||
}
|
||||
|
||||
//sys extpwrite(fd int, p []byte, flags int, offset int64) (n int, err error)
|
||||
|
||||
func pwrite(fd int, p []byte, offset int64) (n int, err error) {
|
||||
return extpwrite(fd, p, 0, offset)
|
||||
}
|
||||
|
112
vendor/golang.org/x/sys/unix/syscall_linux.go
generated
vendored
112
vendor/golang.org/x/sys/unix/syscall_linux.go
generated
vendored
@ -512,24 +512,24 @@ func (sa *SockaddrL2) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||
//
|
||||
// Server example:
|
||||
//
|
||||
// fd, _ := Socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM)
|
||||
// _ = unix.Bind(fd, &unix.SockaddrRFCOMM{
|
||||
// Channel: 1,
|
||||
// Addr: [6]uint8{0, 0, 0, 0, 0, 0}, // BDADDR_ANY or 00:00:00:00:00:00
|
||||
// })
|
||||
// _ = Listen(fd, 1)
|
||||
// nfd, sa, _ := Accept(fd)
|
||||
// fmt.Printf("conn addr=%v fd=%d", sa.(*unix.SockaddrRFCOMM).Addr, nfd)
|
||||
// Read(nfd, buf)
|
||||
// fd, _ := Socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM)
|
||||
// _ = unix.Bind(fd, &unix.SockaddrRFCOMM{
|
||||
// Channel: 1,
|
||||
// Addr: [6]uint8{0, 0, 0, 0, 0, 0}, // BDADDR_ANY or 00:00:00:00:00:00
|
||||
// })
|
||||
// _ = Listen(fd, 1)
|
||||
// nfd, sa, _ := Accept(fd)
|
||||
// fmt.Printf("conn addr=%v fd=%d", sa.(*unix.SockaddrRFCOMM).Addr, nfd)
|
||||
// Read(nfd, buf)
|
||||
//
|
||||
// Client example:
|
||||
//
|
||||
// fd, _ := Socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM)
|
||||
// _ = Connect(fd, &SockaddrRFCOMM{
|
||||
// Channel: 1,
|
||||
// Addr: [6]byte{0x11, 0x22, 0x33, 0xaa, 0xbb, 0xcc}, // CC:BB:AA:33:22:11
|
||||
// })
|
||||
// Write(fd, []byte(`hello`))
|
||||
// fd, _ := Socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM)
|
||||
// _ = Connect(fd, &SockaddrRFCOMM{
|
||||
// Channel: 1,
|
||||
// Addr: [6]byte{0x11, 0x22, 0x33, 0xaa, 0xbb, 0xcc}, // CC:BB:AA:33:22:11
|
||||
// })
|
||||
// Write(fd, []byte(`hello`))
|
||||
type SockaddrRFCOMM struct {
|
||||
// Addr represents a bluetooth address, byte ordering is little-endian.
|
||||
Addr [6]uint8
|
||||
@ -556,12 +556,12 @@ func (sa *SockaddrRFCOMM) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||
// The SockaddrCAN struct must be bound to the socket file descriptor
|
||||
// using Bind before the CAN socket can be used.
|
||||
//
|
||||
// // Read one raw CAN frame
|
||||
// fd, _ := Socket(AF_CAN, SOCK_RAW, CAN_RAW)
|
||||
// addr := &SockaddrCAN{Ifindex: index}
|
||||
// Bind(fd, addr)
|
||||
// frame := make([]byte, 16)
|
||||
// Read(fd, frame)
|
||||
// // Read one raw CAN frame
|
||||
// fd, _ := Socket(AF_CAN, SOCK_RAW, CAN_RAW)
|
||||
// addr := &SockaddrCAN{Ifindex: index}
|
||||
// Bind(fd, addr)
|
||||
// frame := make([]byte, 16)
|
||||
// Read(fd, frame)
|
||||
//
|
||||
// The full SocketCAN documentation can be found in the linux kernel
|
||||
// archives at: https://www.kernel.org/doc/Documentation/networking/can.txt
|
||||
@ -632,13 +632,13 @@ func (sa *SockaddrCANJ1939) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||
// Here is an example of using an AF_ALG socket with SHA1 hashing.
|
||||
// The initial socket setup process is as follows:
|
||||
//
|
||||
// // Open a socket to perform SHA1 hashing.
|
||||
// fd, _ := unix.Socket(unix.AF_ALG, unix.SOCK_SEQPACKET, 0)
|
||||
// addr := &unix.SockaddrALG{Type: "hash", Name: "sha1"}
|
||||
// unix.Bind(fd, addr)
|
||||
// // Note: unix.Accept does not work at this time; must invoke accept()
|
||||
// // manually using unix.Syscall.
|
||||
// hashfd, _, _ := unix.Syscall(unix.SYS_ACCEPT, uintptr(fd), 0, 0)
|
||||
// // Open a socket to perform SHA1 hashing.
|
||||
// fd, _ := unix.Socket(unix.AF_ALG, unix.SOCK_SEQPACKET, 0)
|
||||
// addr := &unix.SockaddrALG{Type: "hash", Name: "sha1"}
|
||||
// unix.Bind(fd, addr)
|
||||
// // Note: unix.Accept does not work at this time; must invoke accept()
|
||||
// // manually using unix.Syscall.
|
||||
// hashfd, _, _ := unix.Syscall(unix.SYS_ACCEPT, uintptr(fd), 0, 0)
|
||||
//
|
||||
// Once a file descriptor has been returned from Accept, it may be used to
|
||||
// perform SHA1 hashing. The descriptor is not safe for concurrent use, but
|
||||
@ -647,39 +647,39 @@ func (sa *SockaddrCANJ1939) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||
// When hashing a small byte slice or string, a single Write and Read may
|
||||
// be used:
|
||||
//
|
||||
// // Assume hashfd is already configured using the setup process.
|
||||
// hash := os.NewFile(hashfd, "sha1")
|
||||
// // Hash an input string and read the results. Each Write discards
|
||||
// // previous hash state. Read always reads the current state.
|
||||
// b := make([]byte, 20)
|
||||
// for i := 0; i < 2; i++ {
|
||||
// io.WriteString(hash, "Hello, world.")
|
||||
// hash.Read(b)
|
||||
// fmt.Println(hex.EncodeToString(b))
|
||||
// }
|
||||
// // Output:
|
||||
// // 2ae01472317d1935a84797ec1983ae243fc6aa28
|
||||
// // 2ae01472317d1935a84797ec1983ae243fc6aa28
|
||||
// // Assume hashfd is already configured using the setup process.
|
||||
// hash := os.NewFile(hashfd, "sha1")
|
||||
// // Hash an input string and read the results. Each Write discards
|
||||
// // previous hash state. Read always reads the current state.
|
||||
// b := make([]byte, 20)
|
||||
// for i := 0; i < 2; i++ {
|
||||
// io.WriteString(hash, "Hello, world.")
|
||||
// hash.Read(b)
|
||||
// fmt.Println(hex.EncodeToString(b))
|
||||
// }
|
||||
// // Output:
|
||||
// // 2ae01472317d1935a84797ec1983ae243fc6aa28
|
||||
// // 2ae01472317d1935a84797ec1983ae243fc6aa28
|
||||
//
|
||||
// For hashing larger byte slices, or byte streams such as those read from
|
||||
// a file or socket, use Sendto with MSG_MORE to instruct the kernel to update
|
||||
// the hash digest instead of creating a new one for a given chunk and finalizing it.
|
||||
//
|
||||
// // Assume hashfd and addr are already configured using the setup process.
|
||||
// hash := os.NewFile(hashfd, "sha1")
|
||||
// // Hash the contents of a file.
|
||||
// f, _ := os.Open("/tmp/linux-4.10-rc7.tar.xz")
|
||||
// b := make([]byte, 4096)
|
||||
// for {
|
||||
// n, err := f.Read(b)
|
||||
// if err == io.EOF {
|
||||
// break
|
||||
// }
|
||||
// unix.Sendto(hashfd, b[:n], unix.MSG_MORE, addr)
|
||||
// }
|
||||
// hash.Read(b)
|
||||
// fmt.Println(hex.EncodeToString(b))
|
||||
// // Output: 85cdcad0c06eef66f805ecce353bec9accbeecc5
|
||||
// // Assume hashfd and addr are already configured using the setup process.
|
||||
// hash := os.NewFile(hashfd, "sha1")
|
||||
// // Hash the contents of a file.
|
||||
// f, _ := os.Open("/tmp/linux-4.10-rc7.tar.xz")
|
||||
// b := make([]byte, 4096)
|
||||
// for {
|
||||
// n, err := f.Read(b)
|
||||
// if err == io.EOF {
|
||||
// break
|
||||
// }
|
||||
// unix.Sendto(hashfd, b[:n], unix.MSG_MORE, addr)
|
||||
// }
|
||||
// hash.Read(b)
|
||||
// fmt.Println(hex.EncodeToString(b))
|
||||
// // Output: 85cdcad0c06eef66f805ecce353bec9accbeecc5
|
||||
//
|
||||
// For more information, see: http://www.chronox.de/crypto-API/crypto/userspace-if.html.
|
||||
type SockaddrALG struct {
|
||||
|
191
vendor/golang.org/x/sys/unix/syscall_linux_loong64.go
generated
vendored
Normal file
191
vendor/golang.org/x/sys/unix/syscall_linux_loong64.go
generated
vendored
Normal file
@ -0,0 +1,191 @@
|
||||
// Copyright 2022 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build loong64 && linux
|
||||
// +build loong64,linux
|
||||
|
||||
package unix
|
||||
|
||||
import "unsafe"
|
||||
|
||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) = SYS_EPOLL_PWAIT
|
||||
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
|
||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
||||
//sys Fstat(fd int, stat *Stat_t) (err error)
|
||||
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
|
||||
//sys Fstatfs(fd int, buf *Statfs_t) (err error)
|
||||
//sys Ftruncate(fd int, length int64) (err error)
|
||||
//sysnb Getegid() (egid int)
|
||||
//sysnb Geteuid() (euid int)
|
||||
//sysnb Getgid() (gid int)
|
||||
//sysnb Getuid() (uid int)
|
||||
//sys Listen(s int, n int) (err error)
|
||||
//sys pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
||||
//sys pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
||||
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
||||
|
||||
func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {
|
||||
var ts *Timespec
|
||||
if timeout != nil {
|
||||
ts = &Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000}
|
||||
}
|
||||
return Pselect(nfd, r, w, e, ts, nil)
|
||||
}
|
||||
|
||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
||||
//sys setfsgid(gid int) (prev int, err error)
|
||||
//sys setfsuid(uid int) (prev int, err error)
|
||||
//sysnb Setregid(rgid int, egid int) (err error)
|
||||
//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
|
||||
//sysnb Setresuid(ruid int, euid int, suid int) (err error)
|
||||
//sysnb Setreuid(ruid int, euid int) (err error)
|
||||
//sys Shutdown(fd int, how int) (err error)
|
||||
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
|
||||
|
||||
func Stat(path string, stat *Stat_t) (err error) {
|
||||
return Fstatat(AT_FDCWD, path, stat, 0)
|
||||
}
|
||||
|
||||
func Lchown(path string, uid int, gid int) (err error) {
|
||||
return Fchownat(AT_FDCWD, path, uid, gid, AT_SYMLINK_NOFOLLOW)
|
||||
}
|
||||
|
||||
func Lstat(path string, stat *Stat_t) (err error) {
|
||||
return Fstatat(AT_FDCWD, path, stat, AT_SYMLINK_NOFOLLOW)
|
||||
}
|
||||
|
||||
//sys Statfs(path string, buf *Statfs_t) (err error)
|
||||
//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error)
|
||||
//sys Truncate(path string, length int64) (err error)
|
||||
|
||||
func Ustat(dev int, ubuf *Ustat_t) (err error) {
|
||||
return ENOSYS
|
||||
}
|
||||
|
||||
//sys accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error)
|
||||
//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
|
||||
//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error)
|
||||
//sysnb getgroups(n int, list *_Gid_t) (nn int, err error)
|
||||
//sysnb setgroups(n int, list *_Gid_t) (err error)
|
||||
//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error)
|
||||
//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error)
|
||||
//sysnb socket(domain int, typ int, proto int) (fd int, err error)
|
||||
//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error)
|
||||
//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
|
||||
//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
|
||||
//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
|
||||
//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
|
||||
//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
|
||||
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
|
||||
//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
|
||||
|
||||
//sysnb Gettimeofday(tv *Timeval) (err error)
|
||||
|
||||
func setTimespec(sec, nsec int64) Timespec {
|
||||
return Timespec{Sec: sec, Nsec: nsec}
|
||||
}
|
||||
|
||||
func setTimeval(sec, usec int64) Timeval {
|
||||
return Timeval{Sec: sec, Usec: usec}
|
||||
}
|
||||
|
||||
func Getrlimit(resource int, rlim *Rlimit) (err error) {
|
||||
err = Prlimit(0, resource, nil, rlim)
|
||||
return
|
||||
}
|
||||
|
||||
func Setrlimit(resource int, rlim *Rlimit) (err error) {
|
||||
err = Prlimit(0, resource, rlim, nil)
|
||||
return
|
||||
}
|
||||
|
||||
func futimesat(dirfd int, path string, tv *[2]Timeval) (err error) {
|
||||
if tv == nil {
|
||||
return utimensat(dirfd, path, nil, 0)
|
||||
}
|
||||
|
||||
ts := []Timespec{
|
||||
NsecToTimespec(TimevalToNsec(tv[0])),
|
||||
NsecToTimespec(TimevalToNsec(tv[1])),
|
||||
}
|
||||
return utimensat(dirfd, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
|
||||
}
|
||||
|
||||
func Time(t *Time_t) (Time_t, error) {
|
||||
var tv Timeval
|
||||
err := Gettimeofday(&tv)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if t != nil {
|
||||
*t = Time_t(tv.Sec)
|
||||
}
|
||||
return Time_t(tv.Sec), nil
|
||||
}
|
||||
|
||||
func Utime(path string, buf *Utimbuf) error {
|
||||
tv := []Timeval{
|
||||
{Sec: buf.Actime},
|
||||
{Sec: buf.Modtime},
|
||||
}
|
||||
return Utimes(path, tv)
|
||||
}
|
||||
|
||||
func utimes(path string, tv *[2]Timeval) (err error) {
|
||||
if tv == nil {
|
||||
return utimensat(AT_FDCWD, path, nil, 0)
|
||||
}
|
||||
|
||||
ts := []Timespec{
|
||||
NsecToTimespec(TimevalToNsec(tv[0])),
|
||||
NsecToTimespec(TimevalToNsec(tv[1])),
|
||||
}
|
||||
return utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
|
||||
}
|
||||
|
||||
func (r *PtraceRegs) PC() uint64 { return r.Era }
|
||||
|
||||
func (r *PtraceRegs) SetPC(era uint64) { r.Era = era }
|
||||
|
||||
func (iov *Iovec) SetLen(length int) {
|
||||
iov.Len = uint64(length)
|
||||
}
|
||||
|
||||
func (msghdr *Msghdr) SetControllen(length int) {
|
||||
msghdr.Controllen = uint64(length)
|
||||
}
|
||||
|
||||
func (msghdr *Msghdr) SetIovlen(length int) {
|
||||
msghdr.Iovlen = uint64(length)
|
||||
}
|
||||
|
||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
||||
cmsg.Len = uint64(length)
|
||||
}
|
||||
|
||||
func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) {
|
||||
rsa.Service_name_len = uint64(length)
|
||||
}
|
||||
|
||||
func Pause() error {
|
||||
_, err := ppoll(nil, 0, nil, nil)
|
||||
return err
|
||||
}
|
||||
|
||||
func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) {
|
||||
return Renameat2(olddirfd, oldpath, newdirfd, newpath, 0)
|
||||
}
|
||||
|
||||
//sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error)
|
||||
|
||||
func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error {
|
||||
cmdlineLen := len(cmdline)
|
||||
if cmdlineLen > 0 {
|
||||
// Account for the additional NULL byte added by
|
||||
// BytePtrFromString in kexecFileLoad. The kexec_file_load
|
||||
// syscall expects a NULL-terminated string.
|
||||
cmdlineLen++
|
||||
}
|
||||
return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags)
|
||||
}
|
2
vendor/golang.org/x/sys/unix/syscall_openbsd.go
generated
vendored
2
vendor/golang.org/x/sys/unix/syscall_openbsd.go
generated
vendored
@ -81,6 +81,7 @@ func Pipe(p []int) (err error) {
|
||||
}
|
||||
|
||||
//sysnb pipe2(p *[2]_C_int, flags int) (err error)
|
||||
|
||||
func Pipe2(p []int, flags int) error {
|
||||
if len(p) != 2 {
|
||||
return EINVAL
|
||||
@ -95,6 +96,7 @@ func Pipe2(p []int, flags int) error {
|
||||
}
|
||||
|
||||
//sys Getdents(fd int, buf []byte) (n int, err error)
|
||||
|
||||
func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
|
||||
n, err = Getdents(fd, buf)
|
||||
if err != nil || basep == nil {
|
||||
|
1
vendor/golang.org/x/sys/unix/zerrors_linux.go
generated
vendored
1
vendor/golang.org/x/sys/unix/zerrors_linux.go
generated
vendored
@ -1310,6 +1310,7 @@ const (
|
||||
KEXEC_ARCH_ARM = 0x280000
|
||||
KEXEC_ARCH_DEFAULT = 0x0
|
||||
KEXEC_ARCH_IA_64 = 0x320000
|
||||
KEXEC_ARCH_LOONGARCH = 0x1020000
|
||||
KEXEC_ARCH_MASK = 0xffff0000
|
||||
KEXEC_ARCH_MIPS = 0x80000
|
||||
KEXEC_ARCH_MIPS_LE = 0xa0000
|
||||
|
2
vendor/golang.org/x/sys/unix/zerrors_linux_386.go
generated
vendored
2
vendor/golang.org/x/sys/unix/zerrors_linux_386.go
generated
vendored
@ -5,7 +5,7 @@
|
||||
// +build 386,linux
|
||||
|
||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m32 /build/unix/_const.go
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m32 _const.go
|
||||
|
||||
package unix
|
||||
|
||||
|
2
vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go
generated
vendored
2
vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go
generated
vendored
@ -5,7 +5,7 @@
|
||||
// +build amd64,linux
|
||||
|
||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m64 /build/unix/_const.go
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include -m64 _const.go
|
||||
|
||||
package unix
|
||||
|
||||
|
2
vendor/golang.org/x/sys/unix/zerrors_linux_arm.go
generated
vendored
2
vendor/golang.org/x/sys/unix/zerrors_linux_arm.go
generated
vendored
@ -5,7 +5,7 @@
|
||||
// +build arm,linux
|
||||
|
||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go
|
||||
|
||||
package unix
|
||||
|
||||
|
2
vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go
generated
vendored
2
vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go
generated
vendored
@ -5,7 +5,7 @@
|
||||
// +build arm64,linux
|
||||
|
||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char /build/unix/_const.go
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char _const.go
|
||||
|
||||
package unix
|
||||
|
||||
|
818
vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go
generated
vendored
Normal file
818
vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go
generated
vendored
Normal file
@ -0,0 +1,818 @@
|
||||
// mkerrors.sh -Wall -Werror -static -I/tmp/include
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
//go:build loong64 && linux
|
||||
// +build loong64,linux
|
||||
|
||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go
|
||||
|
||||
package unix
|
||||
|
||||
import "syscall"
|
||||
|
||||
const (
|
||||
B1000000 = 0x1008
|
||||
B115200 = 0x1002
|
||||
B1152000 = 0x1009
|
||||
B1500000 = 0x100a
|
||||
B2000000 = 0x100b
|
||||
B230400 = 0x1003
|
||||
B2500000 = 0x100c
|
||||
B3000000 = 0x100d
|
||||
B3500000 = 0x100e
|
||||
B4000000 = 0x100f
|
||||
B460800 = 0x1004
|
||||
B500000 = 0x1005
|
||||
B57600 = 0x1001
|
||||
B576000 = 0x1006
|
||||
B921600 = 0x1007
|
||||
BLKBSZGET = 0x80081270
|
||||
BLKBSZSET = 0x40081271
|
||||
BLKFLSBUF = 0x1261
|
||||
BLKFRAGET = 0x1265
|
||||
BLKFRASET = 0x1264
|
||||
BLKGETSIZE = 0x1260
|
||||
BLKGETSIZE64 = 0x80081272
|
||||
BLKPBSZGET = 0x127b
|
||||
BLKRAGET = 0x1263
|
||||
BLKRASET = 0x1262
|
||||
BLKROGET = 0x125e
|
||||
BLKROSET = 0x125d
|
||||
BLKRRPART = 0x125f
|
||||
BLKSECTGET = 0x1267
|
||||
BLKSECTSET = 0x1266
|
||||
BLKSSZGET = 0x1268
|
||||
BOTHER = 0x1000
|
||||
BS1 = 0x2000
|
||||
BSDLY = 0x2000
|
||||
CBAUD = 0x100f
|
||||
CBAUDEX = 0x1000
|
||||
CIBAUD = 0x100f0000
|
||||
CLOCAL = 0x800
|
||||
CR1 = 0x200
|
||||
CR2 = 0x400
|
||||
CR3 = 0x600
|
||||
CRDLY = 0x600
|
||||
CREAD = 0x80
|
||||
CS6 = 0x10
|
||||
CS7 = 0x20
|
||||
CS8 = 0x30
|
||||
CSIZE = 0x30
|
||||
CSTOPB = 0x40
|
||||
ECCGETLAYOUT = 0x81484d11
|
||||
ECCGETSTATS = 0x80104d12
|
||||
ECHOCTL = 0x200
|
||||
ECHOE = 0x10
|
||||
ECHOK = 0x20
|
||||
ECHOKE = 0x800
|
||||
ECHONL = 0x40
|
||||
ECHOPRT = 0x400
|
||||
EFD_CLOEXEC = 0x80000
|
||||
EFD_NONBLOCK = 0x800
|
||||
EPOLL_CLOEXEC = 0x80000
|
||||
EXTPROC = 0x10000
|
||||
FF1 = 0x8000
|
||||
FFDLY = 0x8000
|
||||
FICLONE = 0x40049409
|
||||
FICLONERANGE = 0x4020940d
|
||||
FLUSHO = 0x1000
|
||||
FPU_CTX_MAGIC = 0x46505501
|
||||
FS_IOC_ENABLE_VERITY = 0x40806685
|
||||
FS_IOC_GETFLAGS = 0x80086601
|
||||
FS_IOC_GET_ENCRYPTION_NONCE = 0x8010661b
|
||||
FS_IOC_GET_ENCRYPTION_POLICY = 0x400c6615
|
||||
FS_IOC_GET_ENCRYPTION_PWSALT = 0x40106614
|
||||
FS_IOC_SETFLAGS = 0x40086602
|
||||
FS_IOC_SET_ENCRYPTION_POLICY = 0x800c6613
|
||||
F_GETLK = 0x5
|
||||
F_GETLK64 = 0x5
|
||||
F_GETOWN = 0x9
|
||||
F_RDLCK = 0x0
|
||||
F_SETLK = 0x6
|
||||
F_SETLK64 = 0x6
|
||||
F_SETLKW = 0x7
|
||||
F_SETLKW64 = 0x7
|
||||
F_SETOWN = 0x8
|
||||
F_UNLCK = 0x2
|
||||
F_WRLCK = 0x1
|
||||
HIDIOCGRAWINFO = 0x80084803
|
||||
HIDIOCGRDESC = 0x90044802
|
||||
HIDIOCGRDESCSIZE = 0x80044801
|
||||
HUPCL = 0x400
|
||||
ICANON = 0x2
|
||||
IEXTEN = 0x8000
|
||||
IN_CLOEXEC = 0x80000
|
||||
IN_NONBLOCK = 0x800
|
||||
IOCTL_VM_SOCKETS_GET_LOCAL_CID = 0x7b9
|
||||
ISIG = 0x1
|
||||
IUCLC = 0x200
|
||||
IXOFF = 0x1000
|
||||
IXON = 0x400
|
||||
LASX_CTX_MAGIC = 0x41535801
|
||||
LSX_CTX_MAGIC = 0x53580001
|
||||
MAP_ANON = 0x20
|
||||
MAP_ANONYMOUS = 0x20
|
||||
MAP_DENYWRITE = 0x800
|
||||
MAP_EXECUTABLE = 0x1000
|
||||
MAP_GROWSDOWN = 0x100
|
||||
MAP_HUGETLB = 0x40000
|
||||
MAP_LOCKED = 0x2000
|
||||
MAP_NONBLOCK = 0x10000
|
||||
MAP_NORESERVE = 0x4000
|
||||
MAP_POPULATE = 0x8000
|
||||
MAP_STACK = 0x20000
|
||||
MAP_SYNC = 0x80000
|
||||
MCL_CURRENT = 0x1
|
||||
MCL_FUTURE = 0x2
|
||||
MCL_ONFAULT = 0x4
|
||||
MEMERASE = 0x40084d02
|
||||
MEMERASE64 = 0x40104d14
|
||||
MEMGETBADBLOCK = 0x40084d0b
|
||||
MEMGETINFO = 0x80204d01
|
||||
MEMGETOOBSEL = 0x80c84d0a
|
||||
MEMGETREGIONCOUNT = 0x80044d07
|
||||
MEMISLOCKED = 0x80084d17
|
||||
MEMLOCK = 0x40084d05
|
||||
MEMREADOOB = 0xc0104d04
|
||||
MEMSETBADBLOCK = 0x40084d0c
|
||||
MEMUNLOCK = 0x40084d06
|
||||
MEMWRITEOOB = 0xc0104d03
|
||||
MTDFILEMODE = 0x4d13
|
||||
NFDBITS = 0x40
|
||||
NLDLY = 0x100
|
||||
NOFLSH = 0x80
|
||||
NS_GET_NSTYPE = 0xb703
|
||||
NS_GET_OWNER_UID = 0xb704
|
||||
NS_GET_PARENT = 0xb702
|
||||
NS_GET_USERNS = 0xb701
|
||||
OLCUC = 0x2
|
||||
ONLCR = 0x4
|
||||
OTPERASE = 0x400c4d19
|
||||
OTPGETREGIONCOUNT = 0x40044d0e
|
||||
OTPGETREGIONINFO = 0x400c4d0f
|
||||
OTPLOCK = 0x800c4d10
|
||||
OTPSELECT = 0x80044d0d
|
||||
O_APPEND = 0x400
|
||||
O_ASYNC = 0x2000
|
||||
O_CLOEXEC = 0x80000
|
||||
O_CREAT = 0x40
|
||||
O_DIRECT = 0x4000
|
||||
O_DIRECTORY = 0x10000
|
||||
O_DSYNC = 0x1000
|
||||
O_EXCL = 0x80
|
||||
O_FSYNC = 0x101000
|
||||
O_LARGEFILE = 0x0
|
||||
O_NDELAY = 0x800
|
||||
O_NOATIME = 0x40000
|
||||
O_NOCTTY = 0x100
|
||||
O_NOFOLLOW = 0x20000
|
||||
O_NONBLOCK = 0x800
|
||||
O_PATH = 0x200000
|
||||
O_RSYNC = 0x101000
|
||||
O_SYNC = 0x101000
|
||||
O_TMPFILE = 0x410000
|
||||
O_TRUNC = 0x200
|
||||
PARENB = 0x100
|
||||
PARODD = 0x200
|
||||
PENDIN = 0x4000
|
||||
PERF_EVENT_IOC_DISABLE = 0x2401
|
||||
PERF_EVENT_IOC_ENABLE = 0x2400
|
||||
PERF_EVENT_IOC_ID = 0x80082407
|
||||
PERF_EVENT_IOC_MODIFY_ATTRIBUTES = 0x4008240b
|
||||
PERF_EVENT_IOC_PAUSE_OUTPUT = 0x40042409
|
||||
PERF_EVENT_IOC_PERIOD = 0x40082404
|
||||
PERF_EVENT_IOC_QUERY_BPF = 0xc008240a
|
||||
PERF_EVENT_IOC_REFRESH = 0x2402
|
||||
PERF_EVENT_IOC_RESET = 0x2403
|
||||
PERF_EVENT_IOC_SET_BPF = 0x40042408
|
||||
PERF_EVENT_IOC_SET_FILTER = 0x40082406
|
||||
PERF_EVENT_IOC_SET_OUTPUT = 0x2405
|
||||
PPPIOCATTACH = 0x4004743d
|
||||
PPPIOCATTCHAN = 0x40047438
|
||||
PPPIOCBRIDGECHAN = 0x40047435
|
||||
PPPIOCCONNECT = 0x4004743a
|
||||
PPPIOCDETACH = 0x4004743c
|
||||
PPPIOCDISCONN = 0x7439
|
||||
PPPIOCGASYNCMAP = 0x80047458
|
||||
PPPIOCGCHAN = 0x80047437
|
||||
PPPIOCGDEBUG = 0x80047441
|
||||
PPPIOCGFLAGS = 0x8004745a
|
||||
PPPIOCGIDLE = 0x8010743f
|
||||
PPPIOCGIDLE32 = 0x8008743f
|
||||
PPPIOCGIDLE64 = 0x8010743f
|
||||
PPPIOCGL2TPSTATS = 0x80487436
|
||||
PPPIOCGMRU = 0x80047453
|
||||
PPPIOCGRASYNCMAP = 0x80047455
|
||||
PPPIOCGUNIT = 0x80047456
|
||||
PPPIOCGXASYNCMAP = 0x80207450
|
||||
PPPIOCSACTIVE = 0x40107446
|
||||
PPPIOCSASYNCMAP = 0x40047457
|
||||
PPPIOCSCOMPRESS = 0x4010744d
|
||||
PPPIOCSDEBUG = 0x40047440
|
||||
PPPIOCSFLAGS = 0x40047459
|
||||
PPPIOCSMAXCID = 0x40047451
|
||||
PPPIOCSMRRU = 0x4004743b
|
||||
PPPIOCSMRU = 0x40047452
|
||||
PPPIOCSNPMODE = 0x4008744b
|
||||
PPPIOCSPASS = 0x40107447
|
||||
PPPIOCSRASYNCMAP = 0x40047454
|
||||
PPPIOCSXASYNCMAP = 0x4020744f
|
||||
PPPIOCUNBRIDGECHAN = 0x7434
|
||||
PPPIOCXFERUNIT = 0x744e
|
||||
PR_SET_PTRACER_ANY = 0xffffffffffffffff
|
||||
PTRACE_SYSEMU = 0x1f
|
||||
PTRACE_SYSEMU_SINGLESTEP = 0x20
|
||||
RLIMIT_AS = 0x9
|
||||
RLIMIT_MEMLOCK = 0x8
|
||||
RLIMIT_NOFILE = 0x7
|
||||
RLIMIT_NPROC = 0x6
|
||||
RLIMIT_RSS = 0x5
|
||||
RNDADDENTROPY = 0x40085203
|
||||
RNDADDTOENTCNT = 0x40045201
|
||||
RNDCLEARPOOL = 0x5206
|
||||
RNDGETENTCNT = 0x80045200
|
||||
RNDGETPOOL = 0x80085202
|
||||
RNDRESEEDCRNG = 0x5207
|
||||
RNDZAPENTCNT = 0x5204
|
||||
RTC_AIE_OFF = 0x7002
|
||||
RTC_AIE_ON = 0x7001
|
||||
RTC_ALM_READ = 0x80247008
|
||||
RTC_ALM_SET = 0x40247007
|
||||
RTC_EPOCH_READ = 0x8008700d
|
||||
RTC_EPOCH_SET = 0x4008700e
|
||||
RTC_IRQP_READ = 0x8008700b
|
||||
RTC_IRQP_SET = 0x4008700c
|
||||
RTC_PARAM_GET = 0x40187013
|
||||
RTC_PARAM_SET = 0x40187014
|
||||
RTC_PIE_OFF = 0x7006
|
||||
RTC_PIE_ON = 0x7005
|
||||
RTC_PLL_GET = 0x80207011
|
||||
RTC_PLL_SET = 0x40207012
|
||||
RTC_RD_TIME = 0x80247009
|
||||
RTC_SET_TIME = 0x4024700a
|
||||
RTC_UIE_OFF = 0x7004
|
||||
RTC_UIE_ON = 0x7003
|
||||
RTC_VL_CLR = 0x7014
|
||||
RTC_VL_READ = 0x80047013
|
||||
RTC_WIE_OFF = 0x7010
|
||||
RTC_WIE_ON = 0x700f
|
||||
RTC_WKALM_RD = 0x80287010
|
||||
RTC_WKALM_SET = 0x4028700f
|
||||
SCM_TIMESTAMPING = 0x25
|
||||
SCM_TIMESTAMPING_OPT_STATS = 0x36
|
||||
SCM_TIMESTAMPING_PKTINFO = 0x3a
|
||||
SCM_TIMESTAMPNS = 0x23
|
||||
SCM_TXTIME = 0x3d
|
||||
SCM_WIFI_STATUS = 0x29
|
||||
SFD_CLOEXEC = 0x80000
|
||||
SFD_NONBLOCK = 0x800
|
||||
SIOCATMARK = 0x8905
|
||||
SIOCGPGRP = 0x8904
|
||||
SIOCGSTAMPNS_NEW = 0x80108907
|
||||
SIOCGSTAMP_NEW = 0x80108906
|
||||
SIOCINQ = 0x541b
|
||||
SIOCOUTQ = 0x5411
|
||||
SIOCSPGRP = 0x8902
|
||||
SOCK_CLOEXEC = 0x80000
|
||||
SOCK_DGRAM = 0x2
|
||||
SOCK_NONBLOCK = 0x800
|
||||
SOCK_STREAM = 0x1
|
||||
SOL_SOCKET = 0x1
|
||||
SO_ACCEPTCONN = 0x1e
|
||||
SO_ATTACH_BPF = 0x32
|
||||
SO_ATTACH_REUSEPORT_CBPF = 0x33
|
||||
SO_ATTACH_REUSEPORT_EBPF = 0x34
|
||||
SO_BINDTODEVICE = 0x19
|
||||
SO_BINDTOIFINDEX = 0x3e
|
||||
SO_BPF_EXTENSIONS = 0x30
|
||||
SO_BROADCAST = 0x6
|
||||
SO_BSDCOMPAT = 0xe
|
||||
SO_BUF_LOCK = 0x48
|
||||
SO_BUSY_POLL = 0x2e
|
||||
SO_BUSY_POLL_BUDGET = 0x46
|
||||
SO_CNX_ADVICE = 0x35
|
||||
SO_COOKIE = 0x39
|
||||
SO_DETACH_REUSEPORT_BPF = 0x44
|
||||
SO_DOMAIN = 0x27
|
||||
SO_DONTROUTE = 0x5
|
||||
SO_ERROR = 0x4
|
||||
SO_INCOMING_CPU = 0x31
|
||||
SO_INCOMING_NAPI_ID = 0x38
|
||||
SO_KEEPALIVE = 0x9
|
||||
SO_LINGER = 0xd
|
||||
SO_LOCK_FILTER = 0x2c
|
||||
SO_MARK = 0x24
|
||||
SO_MAX_PACING_RATE = 0x2f
|
||||
SO_MEMINFO = 0x37
|
||||
SO_NETNS_COOKIE = 0x47
|
||||
SO_NOFCS = 0x2b
|
||||
SO_OOBINLINE = 0xa
|
||||
SO_PASSCRED = 0x10
|
||||
SO_PASSSEC = 0x22
|
||||
SO_PEEK_OFF = 0x2a
|
||||
SO_PEERCRED = 0x11
|
||||
SO_PEERGROUPS = 0x3b
|
||||
SO_PEERSEC = 0x1f
|
||||
SO_PREFER_BUSY_POLL = 0x45
|
||||
SO_PROTOCOL = 0x26
|
||||
SO_RCVBUF = 0x8
|
||||
SO_RCVBUFFORCE = 0x21
|
||||
SO_RCVLOWAT = 0x12
|
||||
SO_RCVTIMEO = 0x14
|
||||
SO_RCVTIMEO_NEW = 0x42
|
||||
SO_RCVTIMEO_OLD = 0x14
|
||||
SO_RESERVE_MEM = 0x49
|
||||
SO_REUSEADDR = 0x2
|
||||
SO_REUSEPORT = 0xf
|
||||
SO_RXQ_OVFL = 0x28
|
||||
SO_SECURITY_AUTHENTICATION = 0x16
|
||||
SO_SECURITY_ENCRYPTION_NETWORK = 0x18
|
||||
SO_SECURITY_ENCRYPTION_TRANSPORT = 0x17
|
||||
SO_SELECT_ERR_QUEUE = 0x2d
|
||||
SO_SNDBUF = 0x7
|
||||
SO_SNDBUFFORCE = 0x20
|
||||
SO_SNDLOWAT = 0x13
|
||||
SO_SNDTIMEO = 0x15
|
||||
SO_SNDTIMEO_NEW = 0x43
|
||||
SO_SNDTIMEO_OLD = 0x15
|
||||
SO_TIMESTAMPING = 0x25
|
||||
SO_TIMESTAMPING_NEW = 0x41
|
||||
SO_TIMESTAMPING_OLD = 0x25
|
||||
SO_TIMESTAMPNS = 0x23
|
||||
SO_TIMESTAMPNS_NEW = 0x40
|
||||
SO_TIMESTAMPNS_OLD = 0x23
|
||||
SO_TIMESTAMP_NEW = 0x3f
|
||||
SO_TXTIME = 0x3d
|
||||
SO_TYPE = 0x3
|
||||
SO_WIFI_STATUS = 0x29
|
||||
SO_ZEROCOPY = 0x3c
|
||||
TAB1 = 0x800
|
||||
TAB2 = 0x1000
|
||||
TAB3 = 0x1800
|
||||
TABDLY = 0x1800
|
||||
TCFLSH = 0x540b
|
||||
TCGETA = 0x5405
|
||||
TCGETS = 0x5401
|
||||
TCGETS2 = 0x802c542a
|
||||
TCGETX = 0x5432
|
||||
TCSAFLUSH = 0x2
|
||||
TCSBRK = 0x5409
|
||||
TCSBRKP = 0x5425
|
||||
TCSETA = 0x5406
|
||||
TCSETAF = 0x5408
|
||||
TCSETAW = 0x5407
|
||||
TCSETS = 0x5402
|
||||
TCSETS2 = 0x402c542b
|
||||
TCSETSF = 0x5404
|
||||
TCSETSF2 = 0x402c542d
|
||||
TCSETSW = 0x5403
|
||||
TCSETSW2 = 0x402c542c
|
||||
TCSETX = 0x5433
|
||||
TCSETXF = 0x5434
|
||||
TCSETXW = 0x5435
|
||||
TCXONC = 0x540a
|
||||
TFD_CLOEXEC = 0x80000
|
||||
TFD_NONBLOCK = 0x800
|
||||
TIOCCBRK = 0x5428
|
||||
TIOCCONS = 0x541d
|
||||
TIOCEXCL = 0x540c
|
||||
TIOCGDEV = 0x80045432
|
||||
TIOCGETD = 0x5424
|
||||
TIOCGEXCL = 0x80045440
|
||||
TIOCGICOUNT = 0x545d
|
||||
TIOCGISO7816 = 0x80285442
|
||||
TIOCGLCKTRMIOS = 0x5456
|
||||
TIOCGPGRP = 0x540f
|
||||
TIOCGPKT = 0x80045438
|
||||
TIOCGPTLCK = 0x80045439
|
||||
TIOCGPTN = 0x80045430
|
||||
TIOCGPTPEER = 0x5441
|
||||
TIOCGRS485 = 0x542e
|
||||
TIOCGSERIAL = 0x541e
|
||||
TIOCGSID = 0x5429
|
||||
TIOCGSOFTCAR = 0x5419
|
||||
TIOCGWINSZ = 0x5413
|
||||
TIOCINQ = 0x541b
|
||||
TIOCLINUX = 0x541c
|
||||
TIOCMBIC = 0x5417
|
||||
TIOCMBIS = 0x5416
|
||||
TIOCMGET = 0x5415
|
||||
TIOCMIWAIT = 0x545c
|
||||
TIOCMSET = 0x5418
|
||||
TIOCM_CAR = 0x40
|
||||
TIOCM_CD = 0x40
|
||||
TIOCM_CTS = 0x20
|
||||
TIOCM_DSR = 0x100
|
||||
TIOCM_RI = 0x80
|
||||
TIOCM_RNG = 0x80
|
||||
TIOCM_SR = 0x10
|
||||
TIOCM_ST = 0x8
|
||||
TIOCNOTTY = 0x5422
|
||||
TIOCNXCL = 0x540d
|
||||
TIOCOUTQ = 0x5411
|
||||
TIOCPKT = 0x5420
|
||||
TIOCSBRK = 0x5427
|
||||
TIOCSCTTY = 0x540e
|
||||
TIOCSERCONFIG = 0x5453
|
||||
TIOCSERGETLSR = 0x5459
|
||||
TIOCSERGETMULTI = 0x545a
|
||||
TIOCSERGSTRUCT = 0x5458
|
||||
TIOCSERGWILD = 0x5454
|
||||
TIOCSERSETMULTI = 0x545b
|
||||
TIOCSERSWILD = 0x5455
|
||||
TIOCSER_TEMT = 0x1
|
||||
TIOCSETD = 0x5423
|
||||
TIOCSIG = 0x40045436
|
||||
TIOCSISO7816 = 0xc0285443
|
||||
TIOCSLCKTRMIOS = 0x5457
|
||||
TIOCSPGRP = 0x5410
|
||||
TIOCSPTLCK = 0x40045431
|
||||
TIOCSRS485 = 0x542f
|
||||
TIOCSSERIAL = 0x541f
|
||||
TIOCSSOFTCAR = 0x541a
|
||||
TIOCSTI = 0x5412
|
||||
TIOCSWINSZ = 0x5414
|
||||
TIOCVHANGUP = 0x5437
|
||||
TOSTOP = 0x100
|
||||
TUNATTACHFILTER = 0x401054d5
|
||||
TUNDETACHFILTER = 0x401054d6
|
||||
TUNGETDEVNETNS = 0x54e3
|
||||
TUNGETFEATURES = 0x800454cf
|
||||
TUNGETFILTER = 0x801054db
|
||||
TUNGETIFF = 0x800454d2
|
||||
TUNGETSNDBUF = 0x800454d3
|
||||
TUNGETVNETBE = 0x800454df
|
||||
TUNGETVNETHDRSZ = 0x800454d7
|
||||
TUNGETVNETLE = 0x800454dd
|
||||
TUNSETCARRIER = 0x400454e2
|
||||
TUNSETDEBUG = 0x400454c9
|
||||
TUNSETFILTEREBPF = 0x800454e1
|
||||
TUNSETGROUP = 0x400454ce
|
||||
TUNSETIFF = 0x400454ca
|
||||
TUNSETIFINDEX = 0x400454da
|
||||
TUNSETLINK = 0x400454cd
|
||||
TUNSETNOCSUM = 0x400454c8
|
||||
TUNSETOFFLOAD = 0x400454d0
|
||||
TUNSETOWNER = 0x400454cc
|
||||
TUNSETPERSIST = 0x400454cb
|
||||
TUNSETQUEUE = 0x400454d9
|
||||
TUNSETSNDBUF = 0x400454d4
|
||||
TUNSETSTEERINGEBPF = 0x800454e0
|
||||
TUNSETTXFILTER = 0x400454d1
|
||||
TUNSETVNETBE = 0x400454de
|
||||
TUNSETVNETHDRSZ = 0x400454d8
|
||||
TUNSETVNETLE = 0x400454dc
|
||||
UBI_IOCATT = 0x40186f40
|
||||
UBI_IOCDET = 0x40046f41
|
||||
UBI_IOCEBCH = 0x40044f02
|
||||
UBI_IOCEBER = 0x40044f01
|
||||
UBI_IOCEBISMAP = 0x80044f05
|
||||
UBI_IOCEBMAP = 0x40084f03
|
||||
UBI_IOCEBUNMAP = 0x40044f04
|
||||
UBI_IOCMKVOL = 0x40986f00
|
||||
UBI_IOCRMVOL = 0x40046f01
|
||||
UBI_IOCRNVOL = 0x51106f03
|
||||
UBI_IOCRPEB = 0x40046f04
|
||||
UBI_IOCRSVOL = 0x400c6f02
|
||||
UBI_IOCSETVOLPROP = 0x40104f06
|
||||
UBI_IOCSPEB = 0x40046f05
|
||||
UBI_IOCVOLCRBLK = 0x40804f07
|
||||
UBI_IOCVOLRMBLK = 0x4f08
|
||||
UBI_IOCVOLUP = 0x40084f00
|
||||
VDISCARD = 0xd
|
||||
VEOF = 0x4
|
||||
VEOL = 0xb
|
||||
VEOL2 = 0x10
|
||||
VMIN = 0x6
|
||||
VREPRINT = 0xc
|
||||
VSTART = 0x8
|
||||
VSTOP = 0x9
|
||||
VSUSP = 0xa
|
||||
VSWTC = 0x7
|
||||
VT1 = 0x4000
|
||||
VTDLY = 0x4000
|
||||
VTIME = 0x5
|
||||
VWERASE = 0xe
|
||||
WDIOC_GETBOOTSTATUS = 0x80045702
|
||||
WDIOC_GETPRETIMEOUT = 0x80045709
|
||||
WDIOC_GETSTATUS = 0x80045701
|
||||
WDIOC_GETSUPPORT = 0x80285700
|
||||
WDIOC_GETTEMP = 0x80045703
|
||||
WDIOC_GETTIMELEFT = 0x8004570a
|
||||
WDIOC_GETTIMEOUT = 0x80045707
|
||||
WDIOC_KEEPALIVE = 0x80045705
|
||||
WDIOC_SETOPTIONS = 0x80045704
|
||||
WORDSIZE = 0x40
|
||||
XCASE = 0x4
|
||||
XTABS = 0x1800
|
||||
_HIDIOCGRAWNAME = 0x80804804
|
||||
_HIDIOCGRAWPHYS = 0x80404805
|
||||
_HIDIOCGRAWUNIQ = 0x80404808
|
||||
)
|
||||
|
||||
// Errors
|
||||
const (
|
||||
EADDRINUSE = syscall.Errno(0x62)
|
||||
EADDRNOTAVAIL = syscall.Errno(0x63)
|
||||
EADV = syscall.Errno(0x44)
|
||||
EAFNOSUPPORT = syscall.Errno(0x61)
|
||||
EALREADY = syscall.Errno(0x72)
|
||||
EBADE = syscall.Errno(0x34)
|
||||
EBADFD = syscall.Errno(0x4d)
|
||||
EBADMSG = syscall.Errno(0x4a)
|
||||
EBADR = syscall.Errno(0x35)
|
||||
EBADRQC = syscall.Errno(0x38)
|
||||
EBADSLT = syscall.Errno(0x39)
|
||||
EBFONT = syscall.Errno(0x3b)
|
||||
ECANCELED = syscall.Errno(0x7d)
|
||||
ECHRNG = syscall.Errno(0x2c)
|
||||
ECOMM = syscall.Errno(0x46)
|
||||
ECONNABORTED = syscall.Errno(0x67)
|
||||
ECONNREFUSED = syscall.Errno(0x6f)
|
||||
ECONNRESET = syscall.Errno(0x68)
|
||||
EDEADLK = syscall.Errno(0x23)
|
||||
EDEADLOCK = syscall.Errno(0x23)
|
||||
EDESTADDRREQ = syscall.Errno(0x59)
|
||||
EDOTDOT = syscall.Errno(0x49)
|
||||
EDQUOT = syscall.Errno(0x7a)
|
||||
EHOSTDOWN = syscall.Errno(0x70)
|
||||
EHOSTUNREACH = syscall.Errno(0x71)
|
||||
EHWPOISON = syscall.Errno(0x85)
|
||||
EIDRM = syscall.Errno(0x2b)
|
||||
EILSEQ = syscall.Errno(0x54)
|
||||
EINPROGRESS = syscall.Errno(0x73)
|
||||
EISCONN = syscall.Errno(0x6a)
|
||||
EISNAM = syscall.Errno(0x78)
|
||||
EKEYEXPIRED = syscall.Errno(0x7f)
|
||||
EKEYREJECTED = syscall.Errno(0x81)
|
||||
EKEYREVOKED = syscall.Errno(0x80)
|
||||
EL2HLT = syscall.Errno(0x33)
|
||||
EL2NSYNC = syscall.Errno(0x2d)
|
||||
EL3HLT = syscall.Errno(0x2e)
|
||||
EL3RST = syscall.Errno(0x2f)
|
||||
ELIBACC = syscall.Errno(0x4f)
|
||||
ELIBBAD = syscall.Errno(0x50)
|
||||
ELIBEXEC = syscall.Errno(0x53)
|
||||
ELIBMAX = syscall.Errno(0x52)
|
||||
ELIBSCN = syscall.Errno(0x51)
|
||||
ELNRNG = syscall.Errno(0x30)
|
||||
ELOOP = syscall.Errno(0x28)
|
||||
EMEDIUMTYPE = syscall.Errno(0x7c)
|
||||
EMSGSIZE = syscall.Errno(0x5a)
|
||||
EMULTIHOP = syscall.Errno(0x48)
|
||||
ENAMETOOLONG = syscall.Errno(0x24)
|
||||
ENAVAIL = syscall.Errno(0x77)
|
||||
ENETDOWN = syscall.Errno(0x64)
|
||||
ENETRESET = syscall.Errno(0x66)
|
||||
ENETUNREACH = syscall.Errno(0x65)
|
||||
ENOANO = syscall.Errno(0x37)
|
||||
ENOBUFS = syscall.Errno(0x69)
|
||||
ENOCSI = syscall.Errno(0x32)
|
||||
ENODATA = syscall.Errno(0x3d)
|
||||
ENOKEY = syscall.Errno(0x7e)
|
||||
ENOLCK = syscall.Errno(0x25)
|
||||
ENOLINK = syscall.Errno(0x43)
|
||||
ENOMEDIUM = syscall.Errno(0x7b)
|
||||
ENOMSG = syscall.Errno(0x2a)
|
||||
ENONET = syscall.Errno(0x40)
|
||||
ENOPKG = syscall.Errno(0x41)
|
||||
ENOPROTOOPT = syscall.Errno(0x5c)
|
||||
ENOSR = syscall.Errno(0x3f)
|
||||
ENOSTR = syscall.Errno(0x3c)
|
||||
ENOSYS = syscall.Errno(0x26)
|
||||
ENOTCONN = syscall.Errno(0x6b)
|
||||
ENOTEMPTY = syscall.Errno(0x27)
|
||||
ENOTNAM = syscall.Errno(0x76)
|
||||
ENOTRECOVERABLE = syscall.Errno(0x83)
|
||||
ENOTSOCK = syscall.Errno(0x58)
|
||||
ENOTSUP = syscall.Errno(0x5f)
|
||||
ENOTUNIQ = syscall.Errno(0x4c)
|
||||
EOPNOTSUPP = syscall.Errno(0x5f)
|
||||
EOVERFLOW = syscall.Errno(0x4b)
|
||||
EOWNERDEAD = syscall.Errno(0x82)
|
||||
EPFNOSUPPORT = syscall.Errno(0x60)
|
||||
EPROTO = syscall.Errno(0x47)
|
||||
EPROTONOSUPPORT = syscall.Errno(0x5d)
|
||||
EPROTOTYPE = syscall.Errno(0x5b)
|
||||
EREMCHG = syscall.Errno(0x4e)
|
||||
EREMOTE = syscall.Errno(0x42)
|
||||
EREMOTEIO = syscall.Errno(0x79)
|
||||
ERESTART = syscall.Errno(0x55)
|
||||
ERFKILL = syscall.Errno(0x84)
|
||||
ESHUTDOWN = syscall.Errno(0x6c)
|
||||
ESOCKTNOSUPPORT = syscall.Errno(0x5e)
|
||||
ESRMNT = syscall.Errno(0x45)
|
||||
ESTALE = syscall.Errno(0x74)
|
||||
ESTRPIPE = syscall.Errno(0x56)
|
||||
ETIME = syscall.Errno(0x3e)
|
||||
ETIMEDOUT = syscall.Errno(0x6e)
|
||||
ETOOMANYREFS = syscall.Errno(0x6d)
|
||||
EUCLEAN = syscall.Errno(0x75)
|
||||
EUNATCH = syscall.Errno(0x31)
|
||||
EUSERS = syscall.Errno(0x57)
|
||||
EXFULL = syscall.Errno(0x36)
|
||||
)
|
||||
|
||||
// Signals
|
||||
const (
|
||||
SIGBUS = syscall.Signal(0x7)
|
||||
SIGCHLD = syscall.Signal(0x11)
|
||||
SIGCLD = syscall.Signal(0x11)
|
||||
SIGCONT = syscall.Signal(0x12)
|
||||
SIGIO = syscall.Signal(0x1d)
|
||||
SIGPOLL = syscall.Signal(0x1d)
|
||||
SIGPROF = syscall.Signal(0x1b)
|
||||
SIGPWR = syscall.Signal(0x1e)
|
||||
SIGSTKFLT = syscall.Signal(0x10)
|
||||
SIGSTOP = syscall.Signal(0x13)
|
||||
SIGSYS = syscall.Signal(0x1f)
|
||||
SIGTSTP = syscall.Signal(0x14)
|
||||
SIGTTIN = syscall.Signal(0x15)
|
||||
SIGTTOU = syscall.Signal(0x16)
|
||||
SIGURG = syscall.Signal(0x17)
|
||||
SIGUSR1 = syscall.Signal(0xa)
|
||||
SIGUSR2 = syscall.Signal(0xc)
|
||||
SIGVTALRM = syscall.Signal(0x1a)
|
||||
SIGWINCH = syscall.Signal(0x1c)
|
||||
SIGXCPU = syscall.Signal(0x18)
|
||||
SIGXFSZ = syscall.Signal(0x19)
|
||||
)
|
||||
|
||||
// Error table
|
||||
var errorList = [...]struct {
|
||||
num syscall.Errno
|
||||
name string
|
||||
desc string
|
||||
}{
|
||||
{1, "EPERM", "operation not permitted"},
|
||||
{2, "ENOENT", "no such file or directory"},
|
||||
{3, "ESRCH", "no such process"},
|
||||
{4, "EINTR", "interrupted system call"},
|
||||
{5, "EIO", "input/output error"},
|
||||
{6, "ENXIO", "no such device or address"},
|
||||
{7, "E2BIG", "argument list too long"},
|
||||
{8, "ENOEXEC", "exec format error"},
|
||||
{9, "EBADF", "bad file descriptor"},
|
||||
{10, "ECHILD", "no child processes"},
|
||||
{11, "EAGAIN", "resource temporarily unavailable"},
|
||||
{12, "ENOMEM", "cannot allocate memory"},
|
||||
{13, "EACCES", "permission denied"},
|
||||
{14, "EFAULT", "bad address"},
|
||||
{15, "ENOTBLK", "block device required"},
|
||||
{16, "EBUSY", "device or resource busy"},
|
||||
{17, "EEXIST", "file exists"},
|
||||
{18, "EXDEV", "invalid cross-device link"},
|
||||
{19, "ENODEV", "no such device"},
|
||||
{20, "ENOTDIR", "not a directory"},
|
||||
{21, "EISDIR", "is a directory"},
|
||||
{22, "EINVAL", "invalid argument"},
|
||||
{23, "ENFILE", "too many open files in system"},
|
||||
{24, "EMFILE", "too many open files"},
|
||||
{25, "ENOTTY", "inappropriate ioctl for device"},
|
||||
{26, "ETXTBSY", "text file busy"},
|
||||
{27, "EFBIG", "file too large"},
|
||||
{28, "ENOSPC", "no space left on device"},
|
||||
{29, "ESPIPE", "illegal seek"},
|
||||
{30, "EROFS", "read-only file system"},
|
||||
{31, "EMLINK", "too many links"},
|
||||
{32, "EPIPE", "broken pipe"},
|
||||
{33, "EDOM", "numerical argument out of domain"},
|
||||
{34, "ERANGE", "numerical result out of range"},
|
||||
{35, "EDEADLK", "resource deadlock avoided"},
|
||||
{36, "ENAMETOOLONG", "file name too long"},
|
||||
{37, "ENOLCK", "no locks available"},
|
||||
{38, "ENOSYS", "function not implemented"},
|
||||
{39, "ENOTEMPTY", "directory not empty"},
|
||||
{40, "ELOOP", "too many levels of symbolic links"},
|
||||
{42, "ENOMSG", "no message of desired type"},
|
||||
{43, "EIDRM", "identifier removed"},
|
||||
{44, "ECHRNG", "channel number out of range"},
|
||||
{45, "EL2NSYNC", "level 2 not synchronized"},
|
||||
{46, "EL3HLT", "level 3 halted"},
|
||||
{47, "EL3RST", "level 3 reset"},
|
||||
{48, "ELNRNG", "link number out of range"},
|
||||
{49, "EUNATCH", "protocol driver not attached"},
|
||||
{50, "ENOCSI", "no CSI structure available"},
|
||||
{51, "EL2HLT", "level 2 halted"},
|
||||
{52, "EBADE", "invalid exchange"},
|
||||
{53, "EBADR", "invalid request descriptor"},
|
||||
{54, "EXFULL", "exchange full"},
|
||||
{55, "ENOANO", "no anode"},
|
||||
{56, "EBADRQC", "invalid request code"},
|
||||
{57, "EBADSLT", "invalid slot"},
|
||||
{59, "EBFONT", "bad font file format"},
|
||||
{60, "ENOSTR", "device not a stream"},
|
||||
{61, "ENODATA", "no data available"},
|
||||
{62, "ETIME", "timer expired"},
|
||||
{63, "ENOSR", "out of streams resources"},
|
||||
{64, "ENONET", "machine is not on the network"},
|
||||
{65, "ENOPKG", "package not installed"},
|
||||
{66, "EREMOTE", "object is remote"},
|
||||
{67, "ENOLINK", "link has been severed"},
|
||||
{68, "EADV", "advertise error"},
|
||||
{69, "ESRMNT", "srmount error"},
|
||||
{70, "ECOMM", "communication error on send"},
|
||||
{71, "EPROTO", "protocol error"},
|
||||
{72, "EMULTIHOP", "multihop attempted"},
|
||||
{73, "EDOTDOT", "RFS specific error"},
|
||||
{74, "EBADMSG", "bad message"},
|
||||
{75, "EOVERFLOW", "value too large for defined data type"},
|
||||
{76, "ENOTUNIQ", "name not unique on network"},
|
||||
{77, "EBADFD", "file descriptor in bad state"},
|
||||
{78, "EREMCHG", "remote address changed"},
|
||||
{79, "ELIBACC", "can not access a needed shared library"},
|
||||
{80, "ELIBBAD", "accessing a corrupted shared library"},
|
||||
{81, "ELIBSCN", ".lib section in a.out corrupted"},
|
||||
{82, "ELIBMAX", "attempting to link in too many shared libraries"},
|
||||
{83, "ELIBEXEC", "cannot exec a shared library directly"},
|
||||
{84, "EILSEQ", "invalid or incomplete multibyte or wide character"},
|
||||
{85, "ERESTART", "interrupted system call should be restarted"},
|
||||
{86, "ESTRPIPE", "streams pipe error"},
|
||||
{87, "EUSERS", "too many users"},
|
||||
{88, "ENOTSOCK", "socket operation on non-socket"},
|
||||
{89, "EDESTADDRREQ", "destination address required"},
|
||||
{90, "EMSGSIZE", "message too long"},
|
||||
{91, "EPROTOTYPE", "protocol wrong type for socket"},
|
||||
{92, "ENOPROTOOPT", "protocol not available"},
|
||||
{93, "EPROTONOSUPPORT", "protocol not supported"},
|
||||
{94, "ESOCKTNOSUPPORT", "socket type not supported"},
|
||||
{95, "ENOTSUP", "operation not supported"},
|
||||
{96, "EPFNOSUPPORT", "protocol family not supported"},
|
||||
{97, "EAFNOSUPPORT", "address family not supported by protocol"},
|
||||
{98, "EADDRINUSE", "address already in use"},
|
||||
{99, "EADDRNOTAVAIL", "cannot assign requested address"},
|
||||
{100, "ENETDOWN", "network is down"},
|
||||
{101, "ENETUNREACH", "network is unreachable"},
|
||||
{102, "ENETRESET", "network dropped connection on reset"},
|
||||
{103, "ECONNABORTED", "software caused connection abort"},
|
||||
{104, "ECONNRESET", "connection reset by peer"},
|
||||
{105, "ENOBUFS", "no buffer space available"},
|
||||
{106, "EISCONN", "transport endpoint is already connected"},
|
||||
{107, "ENOTCONN", "transport endpoint is not connected"},
|
||||
{108, "ESHUTDOWN", "cannot send after transport endpoint shutdown"},
|
||||
{109, "ETOOMANYREFS", "too many references: cannot splice"},
|
||||
{110, "ETIMEDOUT", "connection timed out"},
|
||||
{111, "ECONNREFUSED", "connection refused"},
|
||||
{112, "EHOSTDOWN", "host is down"},
|
||||
{113, "EHOSTUNREACH", "no route to host"},
|
||||
{114, "EALREADY", "operation already in progress"},
|
||||
{115, "EINPROGRESS", "operation now in progress"},
|
||||
{116, "ESTALE", "stale file handle"},
|
||||
{117, "EUCLEAN", "structure needs cleaning"},
|
||||
{118, "ENOTNAM", "not a XENIX named type file"},
|
||||
{119, "ENAVAIL", "no XENIX semaphores available"},
|
||||
{120, "EISNAM", "is a named type file"},
|
||||
{121, "EREMOTEIO", "remote I/O error"},
|
||||
{122, "EDQUOT", "disk quota exceeded"},
|
||||
{123, "ENOMEDIUM", "no medium found"},
|
||||
{124, "EMEDIUMTYPE", "wrong medium type"},
|
||||
{125, "ECANCELED", "operation canceled"},
|
||||
{126, "ENOKEY", "required key not available"},
|
||||
{127, "EKEYEXPIRED", "key has expired"},
|
||||
{128, "EKEYREVOKED", "key has been revoked"},
|
||||
{129, "EKEYREJECTED", "key was rejected by service"},
|
||||
{130, "EOWNERDEAD", "owner died"},
|
||||
{131, "ENOTRECOVERABLE", "state not recoverable"},
|
||||
{132, "ERFKILL", "operation not possible due to RF-kill"},
|
||||
{133, "EHWPOISON", "memory page has hardware error"},
|
||||
}
|
||||
|
||||
// Signal table
|
||||
var signalList = [...]struct {
|
||||
num syscall.Signal
|
||||
name string
|
||||
desc string
|
||||
}{
|
||||
{1, "SIGHUP", "hangup"},
|
||||
{2, "SIGINT", "interrupt"},
|
||||
{3, "SIGQUIT", "quit"},
|
||||
{4, "SIGILL", "illegal instruction"},
|
||||
{5, "SIGTRAP", "trace/breakpoint trap"},
|
||||
{6, "SIGABRT", "aborted"},
|
||||
{7, "SIGBUS", "bus error"},
|
||||
{8, "SIGFPE", "floating point exception"},
|
||||
{9, "SIGKILL", "killed"},
|
||||
{10, "SIGUSR1", "user defined signal 1"},
|
||||
{11, "SIGSEGV", "segmentation fault"},
|
||||
{12, "SIGUSR2", "user defined signal 2"},
|
||||
{13, "SIGPIPE", "broken pipe"},
|
||||
{14, "SIGALRM", "alarm clock"},
|
||||
{15, "SIGTERM", "terminated"},
|
||||
{16, "SIGSTKFLT", "stack fault"},
|
||||
{17, "SIGCHLD", "child exited"},
|
||||
{18, "SIGCONT", "continued"},
|
||||
{19, "SIGSTOP", "stopped (signal)"},
|
||||
{20, "SIGTSTP", "stopped"},
|
||||
{21, "SIGTTIN", "stopped (tty input)"},
|
||||
{22, "SIGTTOU", "stopped (tty output)"},
|
||||
{23, "SIGURG", "urgent I/O condition"},
|
||||
{24, "SIGXCPU", "CPU time limit exceeded"},
|
||||
{25, "SIGXFSZ", "file size limit exceeded"},
|
||||
{26, "SIGVTALRM", "virtual timer expired"},
|
||||
{27, "SIGPROF", "profiling timer expired"},
|
||||
{28, "SIGWINCH", "window changed"},
|
||||
{29, "SIGIO", "I/O possible"},
|
||||
{30, "SIGPWR", "power failure"},
|
||||
{31, "SIGSYS", "bad system call"},
|
||||
}
|
2
vendor/golang.org/x/sys/unix/zerrors_linux_mips.go
generated
vendored
2
vendor/golang.org/x/sys/unix/zerrors_linux_mips.go
generated
vendored
@ -5,7 +5,7 @@
|
||||
// +build mips,linux
|
||||
|
||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go
|
||||
|
||||
package unix
|
||||
|
||||
|
2
vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go
generated
vendored
2
vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go
generated
vendored
@ -5,7 +5,7 @@
|
||||
// +build mips64,linux
|
||||
|
||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go
|
||||
|
||||
package unix
|
||||
|
||||
|
2
vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go
generated
vendored
2
vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go
generated
vendored
@ -5,7 +5,7 @@
|
||||
// +build mips64le,linux
|
||||
|
||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go
|
||||
|
||||
package unix
|
||||
|
||||
|
2
vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go
generated
vendored
2
vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go
generated
vendored
@ -5,7 +5,7 @@
|
||||
// +build mipsle,linux
|
||||
|
||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go
|
||||
|
||||
package unix
|
||||
|
||||
|
2
vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go
generated
vendored
2
vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go
generated
vendored
@ -5,7 +5,7 @@
|
||||
// +build ppc,linux
|
||||
|
||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go
|
||||
|
||||
package unix
|
||||
|
||||
|
2
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go
generated
vendored
2
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go
generated
vendored
@ -5,7 +5,7 @@
|
||||
// +build ppc64,linux
|
||||
|
||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go
|
||||
|
||||
package unix
|
||||
|
||||
|
2
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go
generated
vendored
2
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go
generated
vendored
@ -5,7 +5,7 @@
|
||||
// +build ppc64le,linux
|
||||
|
||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go
|
||||
|
||||
package unix
|
||||
|
||||
|
2
vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go
generated
vendored
2
vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go
generated
vendored
@ -5,7 +5,7 @@
|
||||
// +build riscv64,linux
|
||||
|
||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go
|
||||
|
||||
package unix
|
||||
|
||||
|
2
vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go
generated
vendored
2
vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go
generated
vendored
@ -5,7 +5,7 @@
|
||||
// +build s390x,linux
|
||||
|
||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char /build/unix/_const.go
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include -fsigned-char _const.go
|
||||
|
||||
package unix
|
||||
|
||||
|
2
vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go
generated
vendored
2
vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go
generated
vendored
@ -5,7 +5,7 @@
|
||||
// +build sparc64,linux
|
||||
|
||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include /build/unix/_const.go
|
||||
// cgo -godefs -- -Wall -Werror -static -I/tmp/include _const.go
|
||||
|
||||
package unix
|
||||
|
||||
|
24
vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go
generated
vendored
24
vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go
generated
vendored
@ -1643,6 +1643,30 @@ var libc_mknod_trampoline_addr uintptr
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Mount(fsType string, dir string, flags int, data unsafe.Pointer) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(fsType)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(dir)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_, _, e1 := syscall_syscall6(libc_mount_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flags), uintptr(data), 0, 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
var libc_mount_trampoline_addr uintptr
|
||||
|
||||
//go:cgo_import_dynamic libc_mount mount "/usr/lib/libSystem.B.dylib"
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Open(path string, mode int, perm uint32) (fd int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user