mirror of https://gogs.blitter.com/RLabs/xs
Update go mod deps
This commit is contained in:
parent
610781aadf
commit
653e732445
2
Makefile
2
Makefile
|
@ -1,4 +1,4 @@
|
||||||
VERSION := 0.9.5.1
|
VERSION := 0.9.5.2
|
||||||
.PHONY: lint vis clean common client server passwd subpkgs install uninstall reinstall
|
.PHONY: lint vis clean common client server passwd subpkgs install uninstall reinstall
|
||||||
|
|
||||||
## Tag version of binaries with build info wrt.
|
## Tag version of binaries with build info wrt.
|
||||||
|
|
15
go.mod
15
go.mod
|
@ -1,30 +1,31 @@
|
||||||
module blitter.com/go/xs
|
module blitter.com/go/xs
|
||||||
|
|
||||||
go 1.17
|
go 1.18
|
||||||
|
|
||||||
require (
|
require (
|
||||||
blitter.com/go/cryptmt v1.0.2
|
blitter.com/go/cryptmt v1.0.2
|
||||||
blitter.com/go/goutmp v1.0.6
|
blitter.com/go/goutmp v1.0.6
|
||||||
blitter.com/go/herradurakex v1.0.0
|
blitter.com/go/herradurakex v1.0.0
|
||||||
blitter.com/go/hopscotch v0.0.0-20211113042251-b8a306eea4dc
|
blitter.com/go/hopscotch v0.0.0-20220617051533-4b42ccd4e00a
|
||||||
blitter.com/go/kyber v0.0.0-20200130200857-6f2021cb88d9
|
blitter.com/go/kyber v0.0.0-20200130200857-6f2021cb88d9
|
||||||
blitter.com/go/newhope v0.0.0-20200130200750-192fc08a8aae
|
blitter.com/go/newhope v0.0.0-20200130200750-192fc08a8aae
|
||||||
github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da
|
github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da
|
||||||
github.com/creack/pty v1.1.18
|
github.com/creack/pty v1.1.18
|
||||||
github.com/jameskeane/bcrypt v0.0.0-20120420032655-c3cd44c1e20f
|
github.com/jameskeane/bcrypt v0.0.0-20120420032655-c3cd44c1e20f
|
||||||
github.com/kuking/go-frodokem v1.0.2
|
github.com/kuking/go-frodokem v1.0.2
|
||||||
github.com/mattn/go-isatty v0.0.14
|
github.com/mattn/go-isatty v0.0.16
|
||||||
github.com/xtaci/kcp-go v5.4.20+incompatible
|
github.com/xtaci/kcp-go v5.4.20+incompatible
|
||||||
golang.org/x/crypto v0.0.0-20220408190544-5352b0902921
|
golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90
|
||||||
golang.org/x/sys v0.0.0-20220408201424-a24fb2fb8a0f
|
golang.org/x/sys v0.0.0-20220909162455-aba9fc2a8ff2
|
||||||
gopkg.in/hlandau/passlib.v1 v1.0.11
|
gopkg.in/hlandau/passlib.v1 v1.0.11
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
blitter.com/go/chacha20 v0.0.0-20200130200441-214e4085f54c // indirect
|
blitter.com/go/chacha20 v0.0.0-20200130200441-214e4085f54c // indirect
|
||||||
|
blitter.com/go/groestl v0.0.0-20220410000905-c4decbf31d64 // indirect
|
||||||
blitter.com/go/mtwist v1.0.1 // indirect
|
blitter.com/go/mtwist v1.0.1 // indirect
|
||||||
github.com/klauspost/cpuid/v2 v2.0.6 // indirect
|
github.com/klauspost/cpuid/v2 v2.1.1 // indirect
|
||||||
github.com/klauspost/reedsolomon v1.9.16 // indirect
|
github.com/klauspost/reedsolomon v1.11.0 // indirect
|
||||||
github.com/pkg/errors v0.9.1 // indirect
|
github.com/pkg/errors v0.9.1 // indirect
|
||||||
github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161 // indirect
|
github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161 // indirect
|
||||||
github.com/templexxx/xor v0.0.0-20191217153810-f85b25db303b // indirect
|
github.com/templexxx/xor v0.0.0-20191217153810-f85b25db303b // indirect
|
||||||
|
|
34
go.sum
34
go.sum
|
@ -4,10 +4,12 @@ blitter.com/go/cryptmt v1.0.2 h1:ZcLhQk7onUssXyQwG3GdXDXctCVnNL+b7aFuvwOdKXc=
|
||||||
blitter.com/go/cryptmt v1.0.2/go.mod h1:tdME2J3O4agaDAYIYNQzzuB28yVGnPSMmV3a/ucSU84=
|
blitter.com/go/cryptmt v1.0.2/go.mod h1:tdME2J3O4agaDAYIYNQzzuB28yVGnPSMmV3a/ucSU84=
|
||||||
blitter.com/go/goutmp v1.0.6 h1:jRKRw2WalVBza4T50etAfbvT2xp9G5uykIHTvyB5r0k=
|
blitter.com/go/goutmp v1.0.6 h1:jRKRw2WalVBza4T50etAfbvT2xp9G5uykIHTvyB5r0k=
|
||||||
blitter.com/go/goutmp v1.0.6/go.mod h1:DnK/uLBu1/1yLFiuVlmwvWErzAWVp+pDv7t6ZaQRLNc=
|
blitter.com/go/goutmp v1.0.6/go.mod h1:DnK/uLBu1/1yLFiuVlmwvWErzAWVp+pDv7t6ZaQRLNc=
|
||||||
|
blitter.com/go/groestl v0.0.0-20220410000905-c4decbf31d64 h1:SH6cZ4JiOTmWGeVd5hCgt8gsMvfPPHWpEwNdxfsBugM=
|
||||||
|
blitter.com/go/groestl v0.0.0-20220410000905-c4decbf31d64/go.mod h1:YMdIR/gCtFwU/a09jyWAwUu2J9CQejUFwkfD+PyVg+4=
|
||||||
blitter.com/go/herradurakex v1.0.0 h1:6XaxY+JLT1HUWPF0gYJnjX3pVjrw4YhYZEzZ1U0wkyc=
|
blitter.com/go/herradurakex v1.0.0 h1:6XaxY+JLT1HUWPF0gYJnjX3pVjrw4YhYZEzZ1U0wkyc=
|
||||||
blitter.com/go/herradurakex v1.0.0/go.mod h1:m3+vYZX+2dDjdo+n/HDnXEYJX9pwmNeQLgAfJM8mtxw=
|
blitter.com/go/herradurakex v1.0.0/go.mod h1:m3+vYZX+2dDjdo+n/HDnXEYJX9pwmNeQLgAfJM8mtxw=
|
||||||
blitter.com/go/hopscotch v0.0.0-20211113042251-b8a306eea4dc h1:IS+jxdKSdlqp6TWG3yMoBde/cctBEMwMDg588JHxgTE=
|
blitter.com/go/hopscotch v0.0.0-20220617051533-4b42ccd4e00a h1:1fEN7eJMG9TweQuGMAgQlTJ0Wl7lsdDL4Nt5gHZijhY=
|
||||||
blitter.com/go/hopscotch v0.0.0-20211113042251-b8a306eea4dc/go.mod h1:9Da1oy0t9aUw3wviba+2mP1inbLGbDuCKAO3mmGQha4=
|
blitter.com/go/hopscotch v0.0.0-20220617051533-4b42ccd4e00a/go.mod h1:LtcFd2/R9xcau5SZIYeaHvdqAM7Y5pyvdZYT5J9HAME=
|
||||||
blitter.com/go/kyber v0.0.0-20200130200857-6f2021cb88d9 h1:D45AnrNphtvczBXRp5JQicZRTgaK/Is5bgPDDvRKhTc=
|
blitter.com/go/kyber v0.0.0-20200130200857-6f2021cb88d9 h1:D45AnrNphtvczBXRp5JQicZRTgaK/Is5bgPDDvRKhTc=
|
||||||
blitter.com/go/kyber v0.0.0-20200130200857-6f2021cb88d9/go.mod h1:SK6QfGG72lIfKW1Td0wH7f0wwN5nSIhV3K+wvzGNjrw=
|
blitter.com/go/kyber v0.0.0-20200130200857-6f2021cb88d9/go.mod h1:SK6QfGG72lIfKW1Td0wH7f0wwN5nSIhV3K+wvzGNjrw=
|
||||||
blitter.com/go/mtwist v1.0.1 h1:PxmoWexfMpLmc8neHP/PcRc3s17ct7iz4d5W/qJVt04=
|
blitter.com/go/mtwist v1.0.1 h1:PxmoWexfMpLmc8neHP/PcRc3s17ct7iz4d5W/qJVt04=
|
||||||
|
@ -45,14 +47,14 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw
|
||||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
github.com/jameskeane/bcrypt v0.0.0-20120420032655-c3cd44c1e20f h1:UWGE8Vi+1Agt0lrvnd7UsmvwqWKRzb9byK9iQmsbY0Y=
|
github.com/jameskeane/bcrypt v0.0.0-20120420032655-c3cd44c1e20f h1:UWGE8Vi+1Agt0lrvnd7UsmvwqWKRzb9byK9iQmsbY0Y=
|
||||||
github.com/jameskeane/bcrypt v0.0.0-20120420032655-c3cd44c1e20f/go.mod h1:u+9Snq0w+ZdYKi8BBoaxnEwWu0fY4Kvu9ByFpM51t1s=
|
github.com/jameskeane/bcrypt v0.0.0-20120420032655-c3cd44c1e20f/go.mod h1:u+9Snq0w+ZdYKi8BBoaxnEwWu0fY4Kvu9ByFpM51t1s=
|
||||||
github.com/klauspost/cpuid/v2 v2.0.6 h1:dQ5ueTiftKxp0gyjKSx5+8BtPWkyQbd95m8Gys/RarI=
|
github.com/klauspost/cpuid/v2 v2.1.1 h1:t0wUqjowdm8ezddV5k0tLWVklVuvLJpoHeb4WBdydm0=
|
||||||
github.com/klauspost/cpuid/v2 v2.0.6/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
github.com/klauspost/cpuid/v2 v2.1.1/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=
|
||||||
github.com/klauspost/reedsolomon v1.9.16 h1:mR0AwphBwqFv/I3B9AHtNKvzuowI1vrj8/3UX4XRmHA=
|
github.com/klauspost/reedsolomon v1.11.0 h1:fc24kMFf4I6dXJwSkVAsw8Za/dMcJrV5ImeDjG3ss1M=
|
||||||
github.com/klauspost/reedsolomon v1.9.16/go.mod h1:eqPAcE7xar5CIzcdfwydOEdcmchAKAP/qs14y4GCBOk=
|
github.com/klauspost/reedsolomon v1.11.0/go.mod h1:FXLZzlJIdfqEnQLdUKWNRuMZg747hZ4oYp2Ml60Lb/k=
|
||||||
github.com/kuking/go-frodokem v1.0.2 h1:sxdguENCyr6WnLbJ/cjz0AYCW75H1b+E6zXY2ldZnUU=
|
github.com/kuking/go-frodokem v1.0.2 h1:sxdguENCyr6WnLbJ/cjz0AYCW75H1b+E6zXY2ldZnUU=
|
||||||
github.com/kuking/go-frodokem v1.0.2/go.mod h1:83ZX1kHOd72ouCsvbffCqJIj7Ih83MQTAjH2QbqzLZk=
|
github.com/kuking/go-frodokem v1.0.2/go.mod h1:83ZX1kHOd72ouCsvbffCqJIj7Ih83MQTAjH2QbqzLZk=
|
||||||
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
|
github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ=
|
||||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
|
@ -79,8 +81,8 @@ golang.org/x/crypto v0.0.0-20200128174031-69ecbb4d6d5d/go.mod h1:LzIPMQfyMNhhGPh
|
||||||
golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/crypto v0.0.0-20220408190544-5352b0902921 h1:iU7T1X1J6yxDr0rda54sWGkHgOp5XJrqm79gcNlC2VM=
|
golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 h1:Y/gsMcFOcR+6S6f3YeMKl5g+dZMEWqcz5Czj/GWYbkM=
|
||||||
golang.org/x/crypto v0.0.0-20220408190544-5352b0902921/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||||
|
@ -102,16 +104,12 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h
|
||||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20190902133755-9109b7679e13/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190902133755-9109b7679e13/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220909162455-aba9fc2a8ff2 h1:wM1k/lXfpc5HdkJJyW9GELpd8ERGdnh8sMGL6Gzq3Ho=
|
||||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220909162455-aba9fc2a8ff2/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220408201424-a24fb2fb8a0f h1:8w7RhxzTVgUzw/AH/9mUV5q0vMgy40SQRursCcfmkCw=
|
|
||||||
golang.org/x/sys v0.0.0-20220408201424-a24fb2fb8a0f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
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-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||||
|
|
|
@ -25,10 +25,11 @@ import (
|
||||||
_ "crypto/sha512"
|
_ "crypto/sha512"
|
||||||
|
|
||||||
b2b "golang.org/x/crypto/blake2b"
|
b2b "golang.org/x/crypto/blake2b"
|
||||||
|
groestl "blitter.com/go/groestl"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
maxResched = 10 // above 20 starts to show outlines in 'tuxtest' ... so 10 max
|
maxResched = 99 // above 20 starts to show outlines in 'tuxtest' ... so 10 max
|
||||||
)
|
)
|
||||||
|
|
||||||
type Cipher struct {
|
type Cipher struct {
|
||||||
|
@ -71,9 +72,10 @@ func New(r io.Reader, w io.Writer, resched int, key []byte) (c *Cipher) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init all the hash algs we're going to 'hop' around with initial keystream
|
// Init all the hash algs we're going to 'hop' around with initial keystream
|
||||||
c.h = make([]hash.Hash, 2)
|
c.h = make([]hash.Hash, 3)
|
||||||
c.h[0] = sha512.New()
|
c.h[0] = sha512.New()
|
||||||
c.h[1], _ = b2b.New512(c.k)
|
c.h[1], _ = b2b.New512(c.k)
|
||||||
|
c.h[2] = groestl.New512()
|
||||||
c.keyUpdate(c.k)
|
c.keyUpdate(c.k)
|
||||||
|
|
||||||
c.rekeyCtr = len(c.hs) * c.resched // lower multiplier == greater security, lower speed
|
c.rekeyCtr = len(c.hs) * c.resched // lower multiplier == greater security, lower speed
|
||||||
|
@ -109,6 +111,11 @@ func (c *Cipher) keyUpdate(data []byte) {
|
||||||
sliceTmp := b2b.Sum512(data)
|
sliceTmp := b2b.Sum512(data)
|
||||||
c.hs = append(c.hs, sliceTmp[:]...)
|
c.hs = append(c.hs, sliceTmp[:]...)
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
c.h[2].Write(data)
|
||||||
|
sliceTmp := groestl.Sum512(data)
|
||||||
|
c.hs = append(c.hs, sliceTmp[:]...)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Cipher) yield(ib byte) (ob byte) {
|
func (c *Cipher) yield(ib byte) (ob byte) {
|
||||||
|
@ -118,25 +125,38 @@ func (c *Cipher) yield(ib byte) (ob byte) {
|
||||||
//fmt.Fprintf(os.Stderr, "[c.hidx:%v c.idx:%v]\n", c.hidx, c.idx)
|
//fmt.Fprintf(os.Stderr, "[c.hidx:%v c.idx:%v]\n", c.hidx, c.idx)
|
||||||
|
|
||||||
// NOTE: using a non-prime modulus degrades CV % from ~ 0.055 to ~ 0.07
|
// NOTE: using a non-prime modulus degrades CV % from ~ 0.055 to ~ 0.07
|
||||||
switch c.ctr % 3 {
|
switch c.ctr % 5 {
|
||||||
case 0:
|
case 0:
|
||||||
ob = c.bTmp ^ ib ^ byte(c.ctr) ^ byte(c.idx) ^
|
ob = c.bTmp ^ ib ^ byte(c.ctr) ^ byte(c.idx) ^
|
||||||
c.hs[len(c.hs)-19] ^ c.hs[len(c.hs)-2] ^ c.hs[len(c.hs)-3] ^ c.hs[len(c.hs)-5] ^
|
c.hs[len(c.hs)-19] ^ c.hs[len(c.hs)-2] ^ c.hs[len(c.hs)-3] ^ c.hs[len(c.hs)-5] ^
|
||||||
c.hs[len(c.hs)-7] ^ c.hs[len(c.hs)-11] ^ c.hs[len(c.hs)-13] ^ c.hs[len(c.hs)-17]
|
c.hs[len(c.hs)-7] ^ c.hs[len(c.hs)-11] ^ c.hs[len(c.hs)-13] ^ c.hs[len(c.hs)-17] ^
|
||||||
|
c.hs[len(c.hs)-47] ^ c.hs[len(c.hs)-43] ^ c.hs[len(c.hs)-41] ^ c.hs[len(c.hs)-39]
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
ob = c.bTmp ^ ib ^ byte(c.ctr) ^ byte(c.idx) ^
|
ob = c.bTmp ^ ib ^ byte(c.ctr) ^ byte(c.idx) ^
|
||||||
c.hs[len(c.hs)-5] ^ c.hs[len(c.hs)-7] ^ c.hs[len(c.hs)-11] ^ c.hs[len(c.hs)-13] ^
|
c.hs[len(c.hs)-5] ^ c.hs[len(c.hs)-7] ^ c.hs[len(c.hs)-11] ^ c.hs[len(c.hs)-13] ^
|
||||||
c.hs[len(c.hs)-17] ^ c.hs[len(c.hs)-19] ^ c.hs[len(c.hs)-23] ^ c.hs[len(c.hs)-29]
|
c.hs[len(c.hs)-17] ^ c.hs[len(c.hs)-19] ^ c.hs[len(c.hs)-23] ^ c.hs[len(c.hs)-29] ^
|
||||||
|
c.hs[len(c.hs)-43] ^ c.hs[len(c.hs)-41] ^ c.hs[len(c.hs)-39] ^ c.hs[len(c.hs)-37]
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
ob = c.bTmp ^ ib ^ byte(c.ctr) ^ byte(c.idx) ^
|
ob = c.bTmp ^ ib ^ byte(c.ctr) ^ byte(c.idx) ^
|
||||||
c.hs[len(c.hs)-13] ^ c.hs[len(c.hs)-17] ^ c.hs[len(c.hs)-23] ^ c.hs[len(c.hs)-27] ^
|
c.hs[len(c.hs)-13] ^ c.hs[len(c.hs)-17] ^ c.hs[len(c.hs)-23] ^ c.hs[len(c.hs)-27] ^
|
||||||
c.hs[len(c.hs)-29] ^ c.hs[len(c.hs)-31] ^ c.hs[len(c.hs)-2] ^ c.hs[len(c.hs)-3]
|
c.hs[len(c.hs)-29] ^ c.hs[len(c.hs)-31] ^ c.hs[len(c.hs)-2] ^ c.hs[len(c.hs)-3] ^
|
||||||
|
c.hs[len(c.hs)-37] ^ c.hs[len(c.hs)-41] ^ c.hs[len(c.hs)-39] ^ c.hs[len(c.hs)-47]
|
||||||
|
case 3:
|
||||||
|
ob = c.bTmp ^ ib ^ byte(c.ctr) ^ byte(c.idx) ^
|
||||||
|
c.hs[len(c.hs)-13] ^ c.hs[len(c.hs)-17] ^ c.hs[len(c.hs)-23] ^ c.hs[len(c.hs)-27] ^
|
||||||
|
c.hs[len(c.hs)-29] ^ c.hs[len(c.hs)-31] ^ c.hs[len(c.hs)-5] ^ c.hs[len(c.hs)-3] ^
|
||||||
|
c.hs[len(c.hs)-43] ^ c.hs[len(c.hs)-41] ^ c.hs[len(c.hs)-39] ^ c.hs[len(c.hs)-37]
|
||||||
|
case 4:
|
||||||
|
ob = c.bTmp ^ ib ^ byte(c.ctr) ^ byte(c.idx) ^
|
||||||
|
c.hs[len(c.hs)-13] ^ c.hs[len(c.hs)-17] ^ c.hs[len(c.hs)-23] ^ c.hs[len(c.hs)-27] ^
|
||||||
|
c.hs[len(c.hs)-29] ^ c.hs[len(c.hs)-31] ^ c.hs[len(c.hs)-7] ^ c.hs[len(c.hs)-3] ^
|
||||||
|
c.hs[len(c.hs)-33] ^ c.hs[len(c.hs)-41] ^ c.hs[len(c.hs)-45] ^ c.hs[len(c.hs)-43]
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.ctr%c.rekeyCtr == 0 {
|
if c.ctr%c.rekeyCtr == 0 {
|
||||||
bufTmp := make([]byte, 32)
|
bufTmp := make([]byte, 16*3)
|
||||||
_, _ = c.prng.Read(bufTmp)
|
_, _ = c.prng.Read(bufTmp)
|
||||||
c.keyUpdate(bufTmp)
|
c.keyUpdate(bufTmp)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,67 +0,0 @@
|
||||||
language: go
|
|
||||||
|
|
||||||
os:
|
|
||||||
- linux
|
|
||||||
- osx
|
|
||||||
- windows
|
|
||||||
|
|
||||||
arch:
|
|
||||||
- amd64
|
|
||||||
- arm64
|
|
||||||
|
|
||||||
go:
|
|
||||||
- 1.13.x
|
|
||||||
- 1.14.x
|
|
||||||
- 1.15.x
|
|
||||||
- 1.16.x
|
|
||||||
- master
|
|
||||||
|
|
||||||
env:
|
|
||||||
- CGO_ENABLED=0
|
|
||||||
|
|
||||||
script:
|
|
||||||
- go vet ./...
|
|
||||||
- go test -test.v -test.run ^TestCPUID$
|
|
||||||
- CGO_ENABLED=1 go test -race ./...
|
|
||||||
- go test -tags=nounsafe -test.v -test.run ^TestCPUID$
|
|
||||||
- go test -tags=noasm ./...
|
|
||||||
- go run ./cmd/cpuid/main.go
|
|
||||||
- go run ./cmd/cpuid/main.go -json
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
allow_failures:
|
|
||||||
- go: 'master'
|
|
||||||
fast_finish: true
|
|
||||||
include:
|
|
||||||
- stage: other
|
|
||||||
go: 1.16.x
|
|
||||||
os: linux
|
|
||||||
arch: amd64
|
|
||||||
script:
|
|
||||||
- diff <(gofmt -d .) <(printf "")
|
|
||||||
- diff <(gofmt -d ./private) <(printf "")
|
|
||||||
- curl -sfL https://git.io/goreleaser | VERSION=v0.157.0 sh -s -- check # check goreleaser config for deprecations
|
|
||||||
- curl -sL https://git.io/goreleaser | VERSION=v0.157.0 sh -s -- --snapshot --skip-publish --rm-dist
|
|
||||||
- go get github.com/klauspost/asmfmt&&go install github.com/klauspost/asmfmt/cmd/asmfmt
|
|
||||||
- diff <(asmfmt -d .) <(printf "")
|
|
||||||
- GOOS=linux GOARCH=386 go test .
|
|
||||||
- ./test-architectures.sh
|
|
||||||
- stage: other
|
|
||||||
go: 1.15.x
|
|
||||||
os: linux
|
|
||||||
arch: amd64
|
|
||||||
script:
|
|
||||||
- ./test-architectures.sh
|
|
||||||
|
|
||||||
deploy:
|
|
||||||
- provider: script
|
|
||||||
skip_cleanup: true
|
|
||||||
script: curl -sL https://git.io/goreleaser | VERSION=v0.157.0 bash || true
|
|
||||||
on:
|
|
||||||
tags: true
|
|
||||||
condition: ($TRAVIS_OS_NAME = linux) && ($TRAVIS_CPU_ARCH = amd64)
|
|
||||||
go: 1.16.x
|
|
||||||
branches:
|
|
||||||
only:
|
|
||||||
- master
|
|
||||||
- /^v\d+\.\d+(\.\d+)?(-\S*)?$/
|
|
|
@ -39,10 +39,10 @@ func main() {
|
||||||
fmt.Println("ThreadsPerCore:", CPU.ThreadsPerCore)
|
fmt.Println("ThreadsPerCore:", CPU.ThreadsPerCore)
|
||||||
fmt.Println("LogicalCores:", CPU.LogicalCores)
|
fmt.Println("LogicalCores:", CPU.LogicalCores)
|
||||||
fmt.Println("Family", CPU.Family, "Model:", CPU.Model, "Vendor ID:", CPU.VendorID)
|
fmt.Println("Family", CPU.Family, "Model:", CPU.Model, "Vendor ID:", CPU.VendorID)
|
||||||
fmt.Println("Features:", fmt.Sprintf(strings.Join(CPU.FeatureSet(), ",")))
|
fmt.Println("Features:", strings.Join(CPU.FeatureSet(), ","))
|
||||||
fmt.Println("Cacheline bytes:", CPU.CacheLine)
|
fmt.Println("Cacheline bytes:", CPU.CacheLine)
|
||||||
fmt.Println("L1 Data Cache:", CPU.Cache.L1D, "bytes")
|
fmt.Println("L1 Data Cache:", CPU.Cache.L1D, "bytes")
|
||||||
fmt.Println("L1 Instruction Cache:", CPU.Cache.L1D, "bytes")
|
fmt.Println("L1 Instruction Cache:", CPU.Cache.L1I, "bytes")
|
||||||
fmt.Println("L2 Cache:", CPU.Cache.L2, "bytes")
|
fmt.Println("L2 Cache:", CPU.Cache.L2, "bytes")
|
||||||
fmt.Println("L3 Cache:", CPU.Cache.L3, "bytes")
|
fmt.Println("L3 Cache:", CPU.Cache.L3, "bytes")
|
||||||
fmt.Println("Frequency", CPU.Hz, "hz")
|
fmt.Println("Frequency", CPU.Hz, "hz")
|
||||||
|
@ -132,6 +132,127 @@ func main() {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## commandline
|
||||||
|
|
||||||
|
Download as binary from: https://github.com/klauspost/cpuid/releases
|
||||||
|
|
||||||
|
Install from source:
|
||||||
|
|
||||||
|
`go install github.com/klauspost/cpuid/v2/cmd/cpuid@latest`
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
```
|
||||||
|
λ cpuid
|
||||||
|
Name: AMD Ryzen 9 3950X 16-Core Processor
|
||||||
|
Vendor String: AuthenticAMD
|
||||||
|
Vendor ID: AMD
|
||||||
|
PhysicalCores: 16
|
||||||
|
Threads Per Core: 2
|
||||||
|
Logical Cores: 32
|
||||||
|
CPU Family 23 Model: 113
|
||||||
|
Features: ADX,AESNI,AVX,AVX2,BMI1,BMI2,CLMUL,CLZERO,CMOV,CMPXCHG8,CPBOOST,CX16,F16C,FMA3,FXSR,FXSROPT,HTT,HYPERVISOR,LAHF,LZCNT,MCAOVERFLOW,MMX,MMXEXT,MOVBE,NX,OSXSAVE,POPCNT,RDRAND,RDSEED,RDTSCP,SCE,SHA,SSE,SSE2,SSE3,SSE4,SSE42,SSE4A,SSSE3,SUCCOR,X87,XSAVE
|
||||||
|
Microarchitecture level: 3
|
||||||
|
Cacheline bytes: 64
|
||||||
|
L1 Instruction Cache: 32768 bytes
|
||||||
|
L1 Data Cache: 32768 bytes
|
||||||
|
L2 Cache: 524288 bytes
|
||||||
|
L3 Cache: 16777216 bytes
|
||||||
|
|
||||||
|
```
|
||||||
|
### JSON Output:
|
||||||
|
|
||||||
|
```
|
||||||
|
λ cpuid --json
|
||||||
|
{
|
||||||
|
"BrandName": "AMD Ryzen 9 3950X 16-Core Processor",
|
||||||
|
"VendorID": 2,
|
||||||
|
"VendorString": "AuthenticAMD",
|
||||||
|
"PhysicalCores": 16,
|
||||||
|
"ThreadsPerCore": 2,
|
||||||
|
"LogicalCores": 32,
|
||||||
|
"Family": 23,
|
||||||
|
"Model": 113,
|
||||||
|
"CacheLine": 64,
|
||||||
|
"Hz": 0,
|
||||||
|
"BoostFreq": 0,
|
||||||
|
"Cache": {
|
||||||
|
"L1I": 32768,
|
||||||
|
"L1D": 32768,
|
||||||
|
"L2": 524288,
|
||||||
|
"L3": 16777216
|
||||||
|
},
|
||||||
|
"SGX": {
|
||||||
|
"Available": false,
|
||||||
|
"LaunchControl": false,
|
||||||
|
"SGX1Supported": false,
|
||||||
|
"SGX2Supported": false,
|
||||||
|
"MaxEnclaveSizeNot64": 0,
|
||||||
|
"MaxEnclaveSize64": 0,
|
||||||
|
"EPCSections": null
|
||||||
|
},
|
||||||
|
"Features": [
|
||||||
|
"ADX",
|
||||||
|
"AESNI",
|
||||||
|
"AVX",
|
||||||
|
"AVX2",
|
||||||
|
"BMI1",
|
||||||
|
"BMI2",
|
||||||
|
"CLMUL",
|
||||||
|
"CLZERO",
|
||||||
|
"CMOV",
|
||||||
|
"CMPXCHG8",
|
||||||
|
"CPBOOST",
|
||||||
|
"CX16",
|
||||||
|
"F16C",
|
||||||
|
"FMA3",
|
||||||
|
"FXSR",
|
||||||
|
"FXSROPT",
|
||||||
|
"HTT",
|
||||||
|
"HYPERVISOR",
|
||||||
|
"LAHF",
|
||||||
|
"LZCNT",
|
||||||
|
"MCAOVERFLOW",
|
||||||
|
"MMX",
|
||||||
|
"MMXEXT",
|
||||||
|
"MOVBE",
|
||||||
|
"NX",
|
||||||
|
"OSXSAVE",
|
||||||
|
"POPCNT",
|
||||||
|
"RDRAND",
|
||||||
|
"RDSEED",
|
||||||
|
"RDTSCP",
|
||||||
|
"SCE",
|
||||||
|
"SHA",
|
||||||
|
"SSE",
|
||||||
|
"SSE2",
|
||||||
|
"SSE3",
|
||||||
|
"SSE4",
|
||||||
|
"SSE42",
|
||||||
|
"SSE4A",
|
||||||
|
"SSSE3",
|
||||||
|
"SUCCOR",
|
||||||
|
"X87",
|
||||||
|
"XSAVE"
|
||||||
|
],
|
||||||
|
"X64Level": 3
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Check CPU microarch level
|
||||||
|
|
||||||
|
```
|
||||||
|
λ cpuid --check-level=3
|
||||||
|
2022/03/18 17:04:40 AMD Ryzen 9 3950X 16-Core Processor
|
||||||
|
2022/03/18 17:04:40 Microarchitecture level 3 is supported. Max level is 3.
|
||||||
|
Exit Code 0
|
||||||
|
|
||||||
|
λ cpuid --check-level=4
|
||||||
|
2022/03/18 17:06:18 AMD Ryzen 9 3950X 16-Core Processor
|
||||||
|
2022/03/18 17:06:18 Microarchitecture level 4 not supported. Max level is 3.
|
||||||
|
Exit Code 1
|
||||||
|
```
|
||||||
|
|
||||||
# license
|
# license
|
||||||
|
|
||||||
This code is published under an MIT license. See LICENSE file for more information.
|
This code is published under an MIT license. See LICENSE file for more information.
|
||||||
|
|
|
@ -14,6 +14,7 @@ import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
|
"math/bits"
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -83,6 +84,7 @@ const (
|
||||||
AVX512DQ // AVX-512 Doubleword and Quadword Instructions
|
AVX512DQ // AVX-512 Doubleword and Quadword Instructions
|
||||||
AVX512ER // AVX-512 Exponential and Reciprocal Instructions
|
AVX512ER // AVX-512 Exponential and Reciprocal Instructions
|
||||||
AVX512F // AVX-512 Foundation
|
AVX512F // AVX-512 Foundation
|
||||||
|
AVX512FP16 // AVX-512 FP16 Instructions
|
||||||
AVX512IFMA // AVX-512 Integer Fused Multiply-Add Instructions
|
AVX512IFMA // AVX-512 Integer Fused Multiply-Add Instructions
|
||||||
AVX512PF // AVX-512 Prefetch Instructions
|
AVX512PF // AVX-512 Prefetch Instructions
|
||||||
AVX512VBMI // AVX-512 Vector Bit Manipulation Instructions
|
AVX512VBMI // AVX-512 Vector Bit Manipulation Instructions
|
||||||
|
@ -91,21 +93,32 @@ const (
|
||||||
AVX512VNNI // AVX-512 Vector Neural Network Instructions
|
AVX512VNNI // AVX-512 Vector Neural Network Instructions
|
||||||
AVX512VP2INTERSECT // AVX-512 Intersect for D/Q
|
AVX512VP2INTERSECT // AVX-512 Intersect for D/Q
|
||||||
AVX512VPOPCNTDQ // AVX-512 Vector Population Count Doubleword and Quadword
|
AVX512VPOPCNTDQ // AVX-512 Vector Population Count Doubleword and Quadword
|
||||||
AVXSLOW // Indicates the CPU performs 2 128 bit operations instead of one.
|
AVXSLOW // Indicates the CPU performs 2 128 bit operations instead of one
|
||||||
|
AVXVNNI // AVX (VEX encoded) VNNI neural network instructions
|
||||||
BMI1 // Bit Manipulation Instruction Set 1
|
BMI1 // Bit Manipulation Instruction Set 1
|
||||||
BMI2 // Bit Manipulation Instruction Set 2
|
BMI2 // Bit Manipulation Instruction Set 2
|
||||||
|
CETIBT // Intel CET Indirect Branch Tracking
|
||||||
|
CETSS // Intel CET Shadow Stack
|
||||||
CLDEMOTE // Cache Line Demote
|
CLDEMOTE // Cache Line Demote
|
||||||
CLMUL // Carry-less Multiplication
|
CLMUL // Carry-less Multiplication
|
||||||
|
CLZERO // CLZERO instruction supported
|
||||||
CMOV // i686 CMOV
|
CMOV // i686 CMOV
|
||||||
|
CMPSB_SCADBS_SHORT // Fast short CMPSB and SCASB
|
||||||
|
CMPXCHG8 // CMPXCHG8 instruction
|
||||||
|
CPBOOST // Core Performance Boost
|
||||||
CX16 // CMPXCHG16B Instruction
|
CX16 // CMPXCHG16B Instruction
|
||||||
ENQCMD // Enqueue Command
|
ENQCMD // Enqueue Command
|
||||||
ERMS // Enhanced REP MOVSB/STOSB
|
ERMS // Enhanced REP MOVSB/STOSB
|
||||||
F16C // Half-precision floating-point conversion
|
F16C // Half-precision floating-point conversion
|
||||||
FMA3 // Intel FMA 3. Does not imply AVX.
|
FMA3 // Intel FMA 3. Does not imply AVX.
|
||||||
FMA4 // Bulldozer FMA4 functions
|
FMA4 // Bulldozer FMA4 functions
|
||||||
GFNI // Galois Field New Instructions
|
FXSR // FXSAVE, FXRESTOR instructions, CR4 bit 9
|
||||||
|
FXSROPT // FXSAVE/FXRSTOR optimizations
|
||||||
|
GFNI // Galois Field New Instructions. May require other features (AVX, AVX512VL,AVX512F) based on usage.
|
||||||
HLE // Hardware Lock Elision
|
HLE // Hardware Lock Elision
|
||||||
|
HRESET // If set CPU supports history reset and the IA32_HRESET_ENABLE MSR
|
||||||
HTT // Hyperthreading (enabled)
|
HTT // Hyperthreading (enabled)
|
||||||
|
HWA // Hardware assert supported. Indicates support for MSRC001_10
|
||||||
HYPERVISOR // This bit has been reserved by Intel & AMD for use by hypervisors
|
HYPERVISOR // This bit has been reserved by Intel & AMD for use by hypervisors
|
||||||
IBPB // Indirect Branch Restricted Speculation (IBRS) and Indirect Branch Predictor Barrier (IBPB)
|
IBPB // Indirect Branch Restricted Speculation (IBRS) and Indirect Branch Predictor Barrier (IBPB)
|
||||||
IBS // Instruction Based Sampling (AMD)
|
IBS // Instruction Based Sampling (AMD)
|
||||||
|
@ -117,22 +130,48 @@ const (
|
||||||
IBSOPSAM // Instruction Based Sampling Feature (AMD)
|
IBSOPSAM // Instruction Based Sampling Feature (AMD)
|
||||||
IBSRDWROPCNT // Instruction Based Sampling Feature (AMD)
|
IBSRDWROPCNT // Instruction Based Sampling Feature (AMD)
|
||||||
IBSRIPINVALIDCHK // Instruction Based Sampling Feature (AMD)
|
IBSRIPINVALIDCHK // Instruction Based Sampling Feature (AMD)
|
||||||
|
IBS_PREVENTHOST // Disallowing IBS use by the host supported
|
||||||
|
INT_WBINVD // WBINVD/WBNOINVD are interruptible.
|
||||||
|
INVLPGB // NVLPGB and TLBSYNC instruction supported
|
||||||
|
LAHF // LAHF/SAHF in long mode
|
||||||
|
LAM // If set, CPU supports Linear Address Masking
|
||||||
|
LBRVIRT // LBR virtualization
|
||||||
LZCNT // LZCNT instruction
|
LZCNT // LZCNT instruction
|
||||||
|
MCAOVERFLOW // MCA overflow recovery support.
|
||||||
|
MCOMMIT // MCOMMIT instruction supported
|
||||||
MMX // standard MMX
|
MMX // standard MMX
|
||||||
MMXEXT // SSE integer functions or AMD MMX ext
|
MMXEXT // SSE integer functions or AMD MMX ext
|
||||||
|
MOVBE // MOVBE instruction (big-endian)
|
||||||
MOVDIR64B // Move 64 Bytes as Direct Store
|
MOVDIR64B // Move 64 Bytes as Direct Store
|
||||||
MOVDIRI // Move Doubleword as Direct Store
|
MOVDIRI // Move Doubleword as Direct Store
|
||||||
|
MOVSB_ZL // Fast Zero-Length MOVSB
|
||||||
MPX // Intel MPX (Memory Protection Extensions)
|
MPX // Intel MPX (Memory Protection Extensions)
|
||||||
|
MSRIRC // Instruction Retired Counter MSR available
|
||||||
|
MSR_PAGEFLUSH // Page Flush MSR available
|
||||||
|
NRIPS // Indicates support for NRIP save on VMEXIT
|
||||||
NX // NX (No-Execute) bit
|
NX // NX (No-Execute) bit
|
||||||
|
OSXSAVE // XSAVE enabled by OS
|
||||||
|
PCONFIG // PCONFIG for Intel Multi-Key Total Memory Encryption
|
||||||
POPCNT // POPCNT instruction
|
POPCNT // POPCNT instruction
|
||||||
|
RDPRU // RDPRU instruction supported
|
||||||
RDRAND // RDRAND instruction is available
|
RDRAND // RDRAND instruction is available
|
||||||
RDSEED // RDSEED instruction is available
|
RDSEED // RDSEED instruction is available
|
||||||
RDTSCP // RDTSCP Instruction
|
RDTSCP // RDTSCP Instruction
|
||||||
RTM // Restricted Transactional Memory
|
RTM // Restricted Transactional Memory
|
||||||
|
RTM_ALWAYS_ABORT // Indicates that the loaded microcode is forcing RTM abort.
|
||||||
SERIALIZE // Serialize Instruction Execution
|
SERIALIZE // Serialize Instruction Execution
|
||||||
|
SEV // AMD Secure Encrypted Virtualization supported
|
||||||
|
SEV_64BIT // AMD SEV guest execution only allowed from a 64-bit host
|
||||||
|
SEV_ALTERNATIVE // AMD SEV Alternate Injection supported
|
||||||
|
SEV_DEBUGSWAP // Full debug state swap supported for SEV-ES guests
|
||||||
|
SEV_ES // AMD SEV Encrypted State supported
|
||||||
|
SEV_RESTRICTED // AMD SEV Restricted Injection supported
|
||||||
|
SEV_SNP // AMD SEV Secure Nested Paging supported
|
||||||
SGX // Software Guard Extensions
|
SGX // Software Guard Extensions
|
||||||
SGXLC // Software Guard Extensions Launch Control
|
SGXLC // Software Guard Extensions Launch Control
|
||||||
SHA // Intel SHA Extensions
|
SHA // Intel SHA Extensions
|
||||||
|
SME // AMD Secure Memory Encryption supported
|
||||||
|
SME_COHERENT // AMD Hardware cache coherency across encryption domains enforced
|
||||||
SSE // SSE functions
|
SSE // SSE functions
|
||||||
SSE2 // P4 SSE functions
|
SSE2 // P4 SSE functions
|
||||||
SSE3 // Prescott SSE3 functions
|
SSE3 // Prescott SSE3 functions
|
||||||
|
@ -141,14 +180,38 @@ const (
|
||||||
SSE4A // AMD Barcelona microarchitecture SSE4a instructions
|
SSE4A // AMD Barcelona microarchitecture SSE4a instructions
|
||||||
SSSE3 // Conroe SSSE3 functions
|
SSSE3 // Conroe SSSE3 functions
|
||||||
STIBP // Single Thread Indirect Branch Predictors
|
STIBP // Single Thread Indirect Branch Predictors
|
||||||
|
STOSB_SHORT // Fast short STOSB
|
||||||
|
SUCCOR // Software uncorrectable error containment and recovery capability.
|
||||||
|
SVM // AMD Secure Virtual Machine
|
||||||
|
SVMDA // Indicates support for the SVM decode assists.
|
||||||
|
SVMFBASID // SVM, Indicates that TLB flush events, including CR3 writes and CR4.PGE toggles, flush only the current ASID's TLB entries. Also indicates support for the extended VMCBTLB_Control
|
||||||
|
SVML // AMD SVM lock. Indicates support for SVM-Lock.
|
||||||
|
SVMNP // AMD SVM nested paging
|
||||||
|
SVMPF // SVM pause intercept filter. Indicates support for the pause intercept filter
|
||||||
|
SVMPFT // SVM PAUSE filter threshold. Indicates support for the PAUSE filter cycle count threshold
|
||||||
|
SYSCALL // System-Call Extension (SCE): SYSCALL and SYSRET instructions.
|
||||||
|
SYSEE // SYSENTER and SYSEXIT instructions
|
||||||
TBM // AMD Trailing Bit Manipulation
|
TBM // AMD Trailing Bit Manipulation
|
||||||
|
TOPEXT // TopologyExtensions: topology extensions support. Indicates support for CPUID Fn8000_001D_EAX_x[N:0]-CPUID Fn8000_001E_EDX.
|
||||||
|
TME // Intel Total Memory Encryption. The following MSRs are supported: IA32_TME_CAPABILITY, IA32_TME_ACTIVATE, IA32_TME_EXCLUDE_MASK, and IA32_TME_EXCLUDE_BASE.
|
||||||
|
TSCRATEMSR // MSR based TSC rate control. Indicates support for MSR TSC ratio MSRC000_0104
|
||||||
TSXLDTRK // Intel TSX Suspend Load Address Tracking
|
TSXLDTRK // Intel TSX Suspend Load Address Tracking
|
||||||
VAES // Vector AES
|
VAES // Vector AES. AVX(512) versions requires additional checks.
|
||||||
|
VMCBCLEAN // VMCB clean bits. Indicates support for VMCB clean bits.
|
||||||
|
VMPL // AMD VM Permission Levels supported
|
||||||
|
VMSA_REGPROT // AMD VMSA Register Protection supported
|
||||||
VMX // Virtual Machine Extensions
|
VMX // Virtual Machine Extensions
|
||||||
VPCLMULQDQ // Carry-Less Multiplication Quadword
|
VPCLMULQDQ // Carry-Less Multiplication Quadword. Requires AVX for 3 register versions.
|
||||||
|
VTE // AMD Virtual Transparent Encryption supported
|
||||||
WAITPKG // TPAUSE, UMONITOR, UMWAIT
|
WAITPKG // TPAUSE, UMONITOR, UMWAIT
|
||||||
WBNOINVD // Write Back and Do Not Invalidate Cache
|
WBNOINVD // Write Back and Do Not Invalidate Cache
|
||||||
|
X87 // FPU
|
||||||
|
XGETBV1 // Supports XGETBV with ECX = 1
|
||||||
XOP // Bulldozer XOP functions
|
XOP // Bulldozer XOP functions
|
||||||
|
XSAVE // XSAVE, XRESTOR, XSETBV, XGETBV
|
||||||
|
XSAVEC // Supports XSAVEC and the compacted form of XRSTOR.
|
||||||
|
XSAVEOPT // XSAVEOPT available
|
||||||
|
XSAVES // Supports XSAVES/XRSTORS and IA32_XSS
|
||||||
|
|
||||||
// ARM features:
|
// ARM features:
|
||||||
AESARM // AES instructions
|
AESARM // AES instructions
|
||||||
|
@ -175,7 +238,6 @@ const (
|
||||||
SM3 // SM3 instructions
|
SM3 // SM3 instructions
|
||||||
SM4 // SM4 instructions
|
SM4 // SM4 instructions
|
||||||
SVE // Scalable Vector Extension
|
SVE // Scalable Vector Extension
|
||||||
|
|
||||||
// Keep it last. It automatically defines the size of []flagSet
|
// Keep it last. It automatically defines the size of []flagSet
|
||||||
lastID
|
lastID
|
||||||
|
|
||||||
|
@ -193,8 +255,10 @@ type CPUInfo struct {
|
||||||
LogicalCores int // Number of physical cores times threads that can run on each core through the use of hyperthreading. Will be 0 if undetectable.
|
LogicalCores int // Number of physical cores times threads that can run on each core through the use of hyperthreading. Will be 0 if undetectable.
|
||||||
Family int // CPU family number
|
Family int // CPU family number
|
||||||
Model int // CPU model number
|
Model int // CPU model number
|
||||||
|
Stepping int // CPU stepping info
|
||||||
CacheLine int // Cache line size in bytes. Will be 0 if undetectable.
|
CacheLine int // Cache line size in bytes. Will be 0 if undetectable.
|
||||||
Hz int64 // Clock speed, if known, 0 otherwise
|
Hz int64 // Clock speed, if known, 0 otherwise. Will attempt to contain base clock speed.
|
||||||
|
BoostFreq int64 // Max clock speed, if known, 0 otherwise
|
||||||
Cache struct {
|
Cache struct {
|
||||||
L1I int // L1 Instruction Cache (per core or shared). Will be -1 if undetected
|
L1I int // L1 Instruction Cache (per core or shared). Will be -1 if undetected
|
||||||
L1D int // L1 Data Cache (per core or shared). Will be -1 if undetected
|
L1D int // L1 Data Cache (per core or shared). Will be -1 if undetected
|
||||||
|
@ -298,6 +362,41 @@ func (c CPUInfo) Has(id FeatureID) bool {
|
||||||
return c.featureSet.inSet(id)
|
return c.featureSet.inSet(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AnyOf returns whether the CPU supports one or more of the requested features.
|
||||||
|
func (c CPUInfo) AnyOf(ids ...FeatureID) bool {
|
||||||
|
for _, id := range ids {
|
||||||
|
if c.featureSet.inSet(id) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://en.wikipedia.org/wiki/X86-64#Microarchitecture_levels
|
||||||
|
var level1Features = flagSetWith(CMOV, CMPXCHG8, X87, FXSR, MMX, SYSCALL, SSE, SSE2)
|
||||||
|
var level2Features = flagSetWith(CMOV, CMPXCHG8, X87, FXSR, MMX, SYSCALL, SSE, SSE2, CX16, LAHF, POPCNT, SSE3, SSE4, SSE42, SSSE3)
|
||||||
|
var level3Features = flagSetWith(CMOV, CMPXCHG8, X87, FXSR, MMX, SYSCALL, SSE, SSE2, CX16, LAHF, POPCNT, SSE3, SSE4, SSE42, SSSE3, AVX, AVX2, BMI1, BMI2, F16C, FMA3, LZCNT, MOVBE, OSXSAVE)
|
||||||
|
var level4Features = flagSetWith(CMOV, CMPXCHG8, X87, FXSR, MMX, SYSCALL, SSE, SSE2, CX16, LAHF, POPCNT, SSE3, SSE4, SSE42, SSSE3, AVX, AVX2, BMI1, BMI2, F16C, FMA3, LZCNT, MOVBE, OSXSAVE, AVX512F, AVX512BW, AVX512CD, AVX512DQ, AVX512VL)
|
||||||
|
|
||||||
|
// X64Level returns the microarchitecture level detected on the CPU.
|
||||||
|
// If features are lacking or non x64 mode, 0 is returned.
|
||||||
|
// See https://en.wikipedia.org/wiki/X86-64#Microarchitecture_levels
|
||||||
|
func (c CPUInfo) X64Level() int {
|
||||||
|
if c.featureSet.hasSet(level4Features) {
|
||||||
|
return 4
|
||||||
|
}
|
||||||
|
if c.featureSet.hasSet(level3Features) {
|
||||||
|
return 3
|
||||||
|
}
|
||||||
|
if c.featureSet.hasSet(level2Features) {
|
||||||
|
return 2
|
||||||
|
}
|
||||||
|
if c.featureSet.hasSet(level1Features) {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
// Disable will disable one or several features.
|
// Disable will disable one or several features.
|
||||||
func (c *CPUInfo) Disable(ids ...FeatureID) bool {
|
func (c *CPUInfo) Disable(ids ...FeatureID) bool {
|
||||||
for _, id := range ids {
|
for _, id := range ids {
|
||||||
|
@ -320,11 +419,10 @@ func (c CPUInfo) IsVendor(v Vendor) bool {
|
||||||
return c.VendorID == v
|
return c.VendorID == v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FeatureSet returns all available features as strings.
|
||||||
func (c CPUInfo) FeatureSet() []string {
|
func (c CPUInfo) FeatureSet() []string {
|
||||||
s := make([]string, 0)
|
s := make([]string, 0, c.featureSet.nEnabled())
|
||||||
for _, f := range c.featureSet.Strings() {
|
s = append(s, c.featureSet.Strings()...)
|
||||||
s = append(s, f)
|
|
||||||
}
|
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,25 +461,42 @@ func (c CPUInfo) LogicalCPU() int {
|
||||||
return int(ebx >> 24)
|
return int(ebx >> 24)
|
||||||
}
|
}
|
||||||
|
|
||||||
// hertz tries to compute the clock speed of the CPU. If leaf 15 is
|
// frequencies tries to compute the clock speed of the CPU. If leaf 15 is
|
||||||
// supported, use it, otherwise parse the brand string. Yes, really.
|
// supported, use it, otherwise parse the brand string. Yes, really.
|
||||||
func hertz(model string) int64 {
|
func (c *CPUInfo) frequencies() {
|
||||||
|
c.Hz, c.BoostFreq = 0, 0
|
||||||
mfi := maxFunctionID()
|
mfi := maxFunctionID()
|
||||||
if mfi >= 0x15 {
|
if mfi >= 0x15 {
|
||||||
eax, ebx, ecx, _ := cpuid(0x15)
|
eax, ebx, ecx, _ := cpuid(0x15)
|
||||||
if eax != 0 && ebx != 0 && ecx != 0 {
|
if eax != 0 && ebx != 0 && ecx != 0 {
|
||||||
return int64((int64(ecx) * int64(ebx)) / int64(eax))
|
c.Hz = (int64(ecx) * int64(ebx)) / int64(eax)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if mfi >= 0x16 {
|
||||||
|
a, b, _, _ := cpuid(0x16)
|
||||||
|
// Base...
|
||||||
|
if a&0xffff > 0 {
|
||||||
|
c.Hz = int64(a&0xffff) * 1_000_000
|
||||||
|
}
|
||||||
|
// Boost...
|
||||||
|
if b&0xffff > 0 {
|
||||||
|
c.BoostFreq = int64(b&0xffff) * 1_000_000
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if c.Hz > 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// computeHz determines the official rated speed of a CPU from its brand
|
// computeHz determines the official rated speed of a CPU from its brand
|
||||||
// string. This insanity is *actually the official documented way to do
|
// string. This insanity is *actually the official documented way to do
|
||||||
// this according to Intel*, prior to leaf 0x15 existing. The official
|
// this according to Intel*, prior to leaf 0x15 existing. The official
|
||||||
// documentation only shows this working for exactly `x.xx` or `xxxx`
|
// documentation only shows this working for exactly `x.xx` or `xxxx`
|
||||||
// cases, e.g., `2.50GHz` or `1300MHz`; this parser will accept other
|
// cases, e.g., `2.50GHz` or `1300MHz`; this parser will accept other
|
||||||
// sizes.
|
// sizes.
|
||||||
|
model := c.BrandName
|
||||||
hz := strings.LastIndex(model, "Hz")
|
hz := strings.LastIndex(model, "Hz")
|
||||||
if hz < 3 {
|
if hz < 3 {
|
||||||
return 0
|
return
|
||||||
}
|
}
|
||||||
var multiplier int64
|
var multiplier int64
|
||||||
switch model[hz-1] {
|
switch model[hz-1] {
|
||||||
|
@ -393,7 +508,7 @@ func hertz(model string) int64 {
|
||||||
multiplier = 1000 * 1000 * 1000 * 1000
|
multiplier = 1000 * 1000 * 1000 * 1000
|
||||||
}
|
}
|
||||||
if multiplier == 0 {
|
if multiplier == 0 {
|
||||||
return 0
|
return
|
||||||
}
|
}
|
||||||
freq := int64(0)
|
freq := int64(0)
|
||||||
divisor := int64(0)
|
divisor := int64(0)
|
||||||
|
@ -405,21 +520,22 @@ func hertz(model string) int64 {
|
||||||
decimalShift *= 10
|
decimalShift *= 10
|
||||||
} else if model[i] == '.' {
|
} else if model[i] == '.' {
|
||||||
if divisor != 0 {
|
if divisor != 0 {
|
||||||
return 0
|
return
|
||||||
}
|
}
|
||||||
divisor = decimalShift
|
divisor = decimalShift
|
||||||
} else {
|
} else {
|
||||||
return 0
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// we didn't find a space
|
// we didn't find a space
|
||||||
if i < 0 {
|
if i < 0 {
|
||||||
return 0
|
return
|
||||||
}
|
}
|
||||||
if divisor != 0 {
|
if divisor != 0 {
|
||||||
return (freq * multiplier) / divisor
|
c.Hz = (freq * multiplier) / divisor
|
||||||
|
return
|
||||||
}
|
}
|
||||||
return freq * multiplier
|
c.Hz = freq * multiplier
|
||||||
}
|
}
|
||||||
|
|
||||||
// VM Will return true if the cpu id indicates we are in
|
// VM Will return true if the cpu id indicates we are in
|
||||||
|
@ -468,6 +584,32 @@ func (s *flagSet) or(other flagSet) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// hasSet returns whether all features are present.
|
||||||
|
func (s flagSet) hasSet(other flagSet) bool {
|
||||||
|
for i, v := range other[:] {
|
||||||
|
if s[i]&v != v {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// nEnabled will return the number of enabled flags.
|
||||||
|
func (s flagSet) nEnabled() (n int) {
|
||||||
|
for _, v := range s[:] {
|
||||||
|
n += bits.OnesCount64(uint64(v))
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
func flagSetWith(feat ...FeatureID) flagSet {
|
||||||
|
var res flagSet
|
||||||
|
for _, f := range feat {
|
||||||
|
res.set(f)
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
// ParseFeature will parse the string and return the ID of the matching feature.
|
// ParseFeature will parse the string and return the ID of the matching feature.
|
||||||
// Will return UNKNOWN if not found.
|
// Will return UNKNOWN if not found.
|
||||||
func ParseFeature(s string) FeatureID {
|
func ParseFeature(s string) FeatureID {
|
||||||
|
@ -548,7 +690,7 @@ func threadsPerCore() int {
|
||||||
if vend == AMD {
|
if vend == AMD {
|
||||||
// Workaround for AMD returning 0, assume 2 if >= Zen 2
|
// Workaround for AMD returning 0, assume 2 if >= Zen 2
|
||||||
// It will be more correct than not.
|
// It will be more correct than not.
|
||||||
fam, _ := familyModel()
|
fam, _, _ := familyModel()
|
||||||
_, _, _, d := cpuid(1)
|
_, _, _, d := cpuid(1)
|
||||||
if (d&(1<<28)) != 0 && fam >= 23 {
|
if (d&(1<<28)) != 0 && fam >= 23 {
|
||||||
return 2
|
return 2
|
||||||
|
@ -586,14 +728,27 @@ func logicalCores() int {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func familyModel() (int, int) {
|
func familyModel() (family, model, stepping int) {
|
||||||
if maxFunctionID() < 0x1 {
|
if maxFunctionID() < 0x1 {
|
||||||
return 0, 0
|
return 0, 0, 0
|
||||||
}
|
}
|
||||||
eax, _, _, _ := cpuid(1)
|
eax, _, _, _ := cpuid(1)
|
||||||
family := ((eax >> 8) & 0xf) + ((eax >> 20) & 0xff)
|
// If BaseFamily[3:0] is less than Fh then ExtendedFamily[7:0] is reserved and Family is equal to BaseFamily[3:0].
|
||||||
model := ((eax >> 4) & 0xf) + ((eax >> 12) & 0xf0)
|
family = int((eax >> 8) & 0xf)
|
||||||
return int(family), int(model)
|
extFam := family == 0x6 // Intel is 0x6, needs extended model.
|
||||||
|
if family == 0xf {
|
||||||
|
// Add ExtFamily
|
||||||
|
family += int((eax >> 20) & 0xff)
|
||||||
|
extFam = true
|
||||||
|
}
|
||||||
|
// If BaseFamily[3:0] is less than 0Fh then ExtendedModel[3:0] is reserved and Model is equal to BaseModel[3:0].
|
||||||
|
model = int((eax >> 4) & 0xf)
|
||||||
|
if extFam {
|
||||||
|
// Add ExtModel
|
||||||
|
model += int((eax >> 12) & 0xf0)
|
||||||
|
}
|
||||||
|
stepping = int(eax & 0xf)
|
||||||
|
return family, model, stepping
|
||||||
}
|
}
|
||||||
|
|
||||||
func physicalCores() int {
|
func physicalCores() int {
|
||||||
|
@ -677,6 +832,7 @@ func (c *CPUInfo) cacheSize() {
|
||||||
if maxFunctionID() < 4 {
|
if maxFunctionID() < 4 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
c.Cache.L1I, c.Cache.L1D, c.Cache.L2, c.Cache.L3 = 0, 0, 0, 0
|
||||||
for i := uint32(0); ; i++ {
|
for i := uint32(0); ; i++ {
|
||||||
eax, ebx, ecx, _ := cpuidex(4, i)
|
eax, ebx, ecx, _ := cpuidex(4, i)
|
||||||
cacheType := eax & 15
|
cacheType := eax & 15
|
||||||
|
@ -727,9 +883,14 @@ func (c *CPUInfo) cacheSize() {
|
||||||
c.Cache.L2 = int(((ecx >> 16) & 0xFFFF) * 1024)
|
c.Cache.L2 = int(((ecx >> 16) & 0xFFFF) * 1024)
|
||||||
|
|
||||||
// CPUID Fn8000_001D_EAX_x[N:0] Cache Properties
|
// CPUID Fn8000_001D_EAX_x[N:0] Cache Properties
|
||||||
if maxExtendedFunction() < 0x8000001D {
|
if maxExtendedFunction() < 0x8000001D || !c.Has(TOPEXT) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Xen Hypervisor is buggy and returns the same entry no matter ECX value.
|
||||||
|
// Hack: When we encounter the same entry 100 times we break.
|
||||||
|
nSame := 0
|
||||||
|
var last uint32
|
||||||
for i := uint32(0); i < math.MaxUint32; i++ {
|
for i := uint32(0); i < math.MaxUint32; i++ {
|
||||||
eax, ebx, ecx, _ := cpuidex(0x8000001D, i)
|
eax, ebx, ecx, _ := cpuidex(0x8000001D, i)
|
||||||
|
|
||||||
|
@ -745,6 +906,16 @@ func (c *CPUInfo) cacheSize() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check for the same value repeated.
|
||||||
|
comb := eax ^ ebx ^ ecx
|
||||||
|
if comb == last {
|
||||||
|
nSame++
|
||||||
|
if nSame == 100 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
last = comb
|
||||||
|
|
||||||
switch level {
|
switch level {
|
||||||
case 1:
|
case 1:
|
||||||
switch typ {
|
switch typ {
|
||||||
|
@ -769,8 +940,6 @@ func (c *CPUInfo) cacheSize() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type SGXEPCSection struct {
|
type SGXEPCSection struct {
|
||||||
|
@ -831,21 +1000,26 @@ func support() flagSet {
|
||||||
if mfi < 0x1 {
|
if mfi < 0x1 {
|
||||||
return fs
|
return fs
|
||||||
}
|
}
|
||||||
family, model := familyModel()
|
family, model, _ := familyModel()
|
||||||
|
|
||||||
_, _, c, d := cpuid(1)
|
_, _, c, d := cpuid(1)
|
||||||
|
fs.setIf((d&(1<<0)) != 0, X87)
|
||||||
|
fs.setIf((d&(1<<8)) != 0, CMPXCHG8)
|
||||||
|
fs.setIf((d&(1<<11)) != 0, SYSEE)
|
||||||
fs.setIf((d&(1<<15)) != 0, CMOV)
|
fs.setIf((d&(1<<15)) != 0, CMOV)
|
||||||
fs.setIf((d&(1<<23)) != 0, MMX)
|
fs.setIf((d&(1<<23)) != 0, MMX)
|
||||||
fs.setIf((d&(1<<25)) != 0, MMXEXT)
|
fs.setIf((d&(1<<24)) != 0, FXSR)
|
||||||
|
fs.setIf((d&(1<<25)) != 0, FXSROPT)
|
||||||
fs.setIf((d&(1<<25)) != 0, SSE)
|
fs.setIf((d&(1<<25)) != 0, SSE)
|
||||||
fs.setIf((d&(1<<26)) != 0, SSE2)
|
fs.setIf((d&(1<<26)) != 0, SSE2)
|
||||||
fs.setIf((c&1) != 0, SSE3)
|
fs.setIf((c&1) != 0, SSE3)
|
||||||
fs.setIf((c&(1<<5)) != 0, VMX)
|
fs.setIf((c&(1<<5)) != 0, VMX)
|
||||||
fs.setIf((c&0x00000200) != 0, SSSE3)
|
fs.setIf((c&(1<<9)) != 0, SSSE3)
|
||||||
fs.setIf((c&0x00080000) != 0, SSE4)
|
fs.setIf((c&(1<<19)) != 0, SSE4)
|
||||||
fs.setIf((c&0x00100000) != 0, SSE42)
|
fs.setIf((c&(1<<20)) != 0, SSE42)
|
||||||
fs.setIf((c&(1<<25)) != 0, AESNI)
|
fs.setIf((c&(1<<25)) != 0, AESNI)
|
||||||
fs.setIf((c&(1<<1)) != 0, CLMUL)
|
fs.setIf((c&(1<<1)) != 0, CLMUL)
|
||||||
|
fs.setIf(c&(1<<22) != 0, MOVBE)
|
||||||
fs.setIf(c&(1<<23) != 0, POPCNT)
|
fs.setIf(c&(1<<23) != 0, POPCNT)
|
||||||
fs.setIf(c&(1<<30) != 0, RDRAND)
|
fs.setIf(c&(1<<30) != 0, RDRAND)
|
||||||
|
|
||||||
|
@ -861,6 +1035,8 @@ func support() flagSet {
|
||||||
if vend == AMD && (d&(1<<28)) != 0 && mfi >= 4 {
|
if vend == AMD && (d&(1<<28)) != 0 && mfi >= 4 {
|
||||||
fs.setIf(threadsPerCore() > 1, HTT)
|
fs.setIf(threadsPerCore() > 1, HTT)
|
||||||
}
|
}
|
||||||
|
fs.setIf(c&1<<26 != 0, XSAVE)
|
||||||
|
fs.setIf(c&1<<27 != 0, OSXSAVE)
|
||||||
// Check XGETBV/XSAVE (26), OXSAVE (27) and AVX (28) bits
|
// Check XGETBV/XSAVE (26), OXSAVE (27) and AVX (28) bits
|
||||||
const avxCheck = 1<<26 | 1<<27 | 1<<28
|
const avxCheck = 1<<26 | 1<<27 | 1<<28
|
||||||
if c&avxCheck == avxCheck {
|
if c&avxCheck == avxCheck {
|
||||||
|
@ -886,7 +1062,6 @@ func support() flagSet {
|
||||||
// Check AVX2, AVX2 requires OS support, but BMI1/2 don't.
|
// Check AVX2, AVX2 requires OS support, but BMI1/2 don't.
|
||||||
if mfi >= 7 {
|
if mfi >= 7 {
|
||||||
_, ebx, ecx, edx := cpuidex(7, 0)
|
_, ebx, ecx, edx := cpuidex(7, 0)
|
||||||
eax1, _, _, _ := cpuidex(7, 1)
|
|
||||||
if fs.inSet(AVX) && (ebx&0x00000020) != 0 {
|
if fs.inSet(AVX) && (ebx&0x00000020) != 0 {
|
||||||
fs.set(AVX2)
|
fs.set(AVX2)
|
||||||
}
|
}
|
||||||
|
@ -903,19 +1078,38 @@ func support() flagSet {
|
||||||
fs.setIf(ebx&(1<<18) != 0, RDSEED)
|
fs.setIf(ebx&(1<<18) != 0, RDSEED)
|
||||||
fs.setIf(ebx&(1<<19) != 0, ADX)
|
fs.setIf(ebx&(1<<19) != 0, ADX)
|
||||||
fs.setIf(ebx&(1<<29) != 0, SHA)
|
fs.setIf(ebx&(1<<29) != 0, SHA)
|
||||||
|
|
||||||
// CPUID.(EAX=7, ECX=0).ECX
|
// CPUID.(EAX=7, ECX=0).ECX
|
||||||
fs.setIf(ecx&(1<<5) != 0, WAITPKG)
|
fs.setIf(ecx&(1<<5) != 0, WAITPKG)
|
||||||
|
fs.setIf(ecx&(1<<7) != 0, CETSS)
|
||||||
|
fs.setIf(ecx&(1<<8) != 0, GFNI)
|
||||||
|
fs.setIf(ecx&(1<<9) != 0, VAES)
|
||||||
|
fs.setIf(ecx&(1<<10) != 0, VPCLMULQDQ)
|
||||||
|
fs.setIf(ecx&(1<<13) != 0, TME)
|
||||||
fs.setIf(ecx&(1<<25) != 0, CLDEMOTE)
|
fs.setIf(ecx&(1<<25) != 0, CLDEMOTE)
|
||||||
fs.setIf(ecx&(1<<27) != 0, MOVDIRI)
|
fs.setIf(ecx&(1<<27) != 0, MOVDIRI)
|
||||||
fs.setIf(ecx&(1<<28) != 0, MOVDIR64B)
|
fs.setIf(ecx&(1<<28) != 0, MOVDIR64B)
|
||||||
fs.setIf(ecx&(1<<29) != 0, ENQCMD)
|
fs.setIf(ecx&(1<<29) != 0, ENQCMD)
|
||||||
fs.setIf(ecx&(1<<30) != 0, SGXLC)
|
fs.setIf(ecx&(1<<30) != 0, SGXLC)
|
||||||
|
|
||||||
// CPUID.(EAX=7, ECX=0).EDX
|
// CPUID.(EAX=7, ECX=0).EDX
|
||||||
|
fs.setIf(edx&(1<<11) != 0, RTM_ALWAYS_ABORT)
|
||||||
fs.setIf(edx&(1<<14) != 0, SERIALIZE)
|
fs.setIf(edx&(1<<14) != 0, SERIALIZE)
|
||||||
fs.setIf(edx&(1<<16) != 0, TSXLDTRK)
|
fs.setIf(edx&(1<<16) != 0, TSXLDTRK)
|
||||||
|
fs.setIf(edx&(1<<18) != 0, PCONFIG)
|
||||||
|
fs.setIf(edx&(1<<20) != 0, CETIBT)
|
||||||
fs.setIf(edx&(1<<26) != 0, IBPB)
|
fs.setIf(edx&(1<<26) != 0, IBPB)
|
||||||
fs.setIf(edx&(1<<27) != 0, STIBP)
|
fs.setIf(edx&(1<<27) != 0, STIBP)
|
||||||
|
|
||||||
|
// CPUID.(EAX=7, ECX=1)
|
||||||
|
eax1, _, _, _ := cpuidex(7, 1)
|
||||||
|
fs.setIf(fs.inSet(AVX) && eax1&(1<<4) != 0, AVXVNNI)
|
||||||
|
fs.setIf(eax1&(1<<10) != 0, MOVSB_ZL)
|
||||||
|
fs.setIf(eax1&(1<<11) != 0, STOSB_SHORT)
|
||||||
|
fs.setIf(eax1&(1<<12) != 0, CMPSB_SCADBS_SHORT)
|
||||||
|
fs.setIf(eax1&(1<<22) != 0, HRESET)
|
||||||
|
fs.setIf(eax1&(1<<26) != 0, LAM)
|
||||||
|
|
||||||
// Only detect AVX-512 features if XGETBV is supported
|
// Only detect AVX-512 features if XGETBV is supported
|
||||||
if c&((1<<26)|(1<<27)) == (1<<26)|(1<<27) {
|
if c&((1<<26)|(1<<27)) == (1<<26)|(1<<27) {
|
||||||
// Check for OS support
|
// Check for OS support
|
||||||
|
@ -940,15 +1134,13 @@ func support() flagSet {
|
||||||
// ecx
|
// ecx
|
||||||
fs.setIf(ecx&(1<<1) != 0, AVX512VBMI)
|
fs.setIf(ecx&(1<<1) != 0, AVX512VBMI)
|
||||||
fs.setIf(ecx&(1<<6) != 0, AVX512VBMI2)
|
fs.setIf(ecx&(1<<6) != 0, AVX512VBMI2)
|
||||||
fs.setIf(ecx&(1<<8) != 0, GFNI)
|
|
||||||
fs.setIf(ecx&(1<<9) != 0, VAES)
|
|
||||||
fs.setIf(ecx&(1<<10) != 0, VPCLMULQDQ)
|
|
||||||
fs.setIf(ecx&(1<<11) != 0, AVX512VNNI)
|
fs.setIf(ecx&(1<<11) != 0, AVX512VNNI)
|
||||||
fs.setIf(ecx&(1<<12) != 0, AVX512BITALG)
|
fs.setIf(ecx&(1<<12) != 0, AVX512BITALG)
|
||||||
fs.setIf(ecx&(1<<14) != 0, AVX512VPOPCNTDQ)
|
fs.setIf(ecx&(1<<14) != 0, AVX512VPOPCNTDQ)
|
||||||
// edx
|
// edx
|
||||||
fs.setIf(edx&(1<<8) != 0, AVX512VP2INTERSECT)
|
fs.setIf(edx&(1<<8) != 0, AVX512VP2INTERSECT)
|
||||||
fs.setIf(edx&(1<<22) != 0, AMXBF16)
|
fs.setIf(edx&(1<<22) != 0, AMXBF16)
|
||||||
|
fs.setIf(edx&(1<<23) != 0, AVX512FP16)
|
||||||
fs.setIf(edx&(1<<24) != 0, AMXTILE)
|
fs.setIf(edx&(1<<24) != 0, AMXTILE)
|
||||||
fs.setIf(edx&(1<<25) != 0, AMXINT8)
|
fs.setIf(edx&(1<<25) != 0, AMXINT8)
|
||||||
// eax1 = CPUID.(EAX=7, ECX=1).EAX
|
// eax1 = CPUID.(EAX=7, ECX=1).EAX
|
||||||
|
@ -956,33 +1148,91 @@ func support() flagSet {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Processor Extended State Enumeration Sub-leaf (EAX = 0DH, ECX = 1)
|
||||||
|
// EAX
|
||||||
|
// Bit 00: XSAVEOPT is available.
|
||||||
|
// Bit 01: Supports XSAVEC and the compacted form of XRSTOR if set.
|
||||||
|
// Bit 02: Supports XGETBV with ECX = 1 if set.
|
||||||
|
// Bit 03: Supports XSAVES/XRSTORS and IA32_XSS if set.
|
||||||
|
// Bits 31 - 04: Reserved.
|
||||||
|
// EBX
|
||||||
|
// Bits 31 - 00: The size in bytes of the XSAVE area containing all states enabled by XCRO | IA32_XSS.
|
||||||
|
// ECX
|
||||||
|
// Bits 31 - 00: Reports the supported bits of the lower 32 bits of the IA32_XSS MSR. IA32_XSS[n] can be set to 1 only if ECX[n] is 1.
|
||||||
|
// EDX?
|
||||||
|
// Bits 07 - 00: Used for XCR0. Bit 08: PT state. Bit 09: Used for XCR0. Bits 12 - 10: Reserved. Bit 13: HWP state. Bits 31 - 14: Reserved.
|
||||||
|
if mfi >= 0xd {
|
||||||
|
if fs.inSet(XSAVE) {
|
||||||
|
eax, _, _, _ := cpuidex(0xd, 1)
|
||||||
|
fs.setIf(eax&(1<<0) != 0, XSAVEOPT)
|
||||||
|
fs.setIf(eax&(1<<1) != 0, XSAVEC)
|
||||||
|
fs.setIf(eax&(1<<2) != 0, XGETBV1)
|
||||||
|
fs.setIf(eax&(1<<3) != 0, XSAVES)
|
||||||
|
}
|
||||||
|
}
|
||||||
if maxExtendedFunction() >= 0x80000001 {
|
if maxExtendedFunction() >= 0x80000001 {
|
||||||
_, _, c, d := cpuid(0x80000001)
|
_, _, c, d := cpuid(0x80000001)
|
||||||
if (c & (1 << 5)) != 0 {
|
if (c & (1 << 5)) != 0 {
|
||||||
fs.set(LZCNT)
|
fs.set(LZCNT)
|
||||||
fs.set(POPCNT)
|
fs.set(POPCNT)
|
||||||
}
|
}
|
||||||
fs.setIf((c&(1<<10)) != 0, IBS)
|
// ECX
|
||||||
fs.setIf((d&(1<<31)) != 0, AMD3DNOW)
|
fs.setIf((c&(1<<0)) != 0, LAHF)
|
||||||
fs.setIf((d&(1<<30)) != 0, AMD3DNOWEXT)
|
fs.setIf((c&(1<<2)) != 0, SVM)
|
||||||
fs.setIf((d&(1<<23)) != 0, MMX)
|
|
||||||
fs.setIf((d&(1<<22)) != 0, MMXEXT)
|
|
||||||
fs.setIf((c&(1<<6)) != 0, SSE4A)
|
fs.setIf((c&(1<<6)) != 0, SSE4A)
|
||||||
|
fs.setIf((c&(1<<10)) != 0, IBS)
|
||||||
|
fs.setIf((c&(1<<22)) != 0, TOPEXT)
|
||||||
|
|
||||||
|
// EDX
|
||||||
|
fs.setIf(d&(1<<11) != 0, SYSCALL)
|
||||||
fs.setIf(d&(1<<20) != 0, NX)
|
fs.setIf(d&(1<<20) != 0, NX)
|
||||||
|
fs.setIf(d&(1<<22) != 0, MMXEXT)
|
||||||
|
fs.setIf(d&(1<<23) != 0, MMX)
|
||||||
|
fs.setIf(d&(1<<24) != 0, FXSR)
|
||||||
|
fs.setIf(d&(1<<25) != 0, FXSROPT)
|
||||||
fs.setIf(d&(1<<27) != 0, RDTSCP)
|
fs.setIf(d&(1<<27) != 0, RDTSCP)
|
||||||
|
fs.setIf(d&(1<<30) != 0, AMD3DNOWEXT)
|
||||||
|
fs.setIf(d&(1<<31) != 0, AMD3DNOW)
|
||||||
|
|
||||||
/* XOP and FMA4 use the AVX instruction coding scheme, so they can't be
|
/* XOP and FMA4 use the AVX instruction coding scheme, so they can't be
|
||||||
* used unless the OS has AVX support. */
|
* used unless the OS has AVX support. */
|
||||||
if fs.inSet(AVX) {
|
if fs.inSet(AVX) {
|
||||||
fs.setIf((c&0x00000800) != 0, XOP)
|
fs.setIf((c&(1<<11)) != 0, XOP)
|
||||||
fs.setIf((c&0x00010000) != 0, FMA4)
|
fs.setIf((c&(1<<16)) != 0, FMA4)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if maxExtendedFunction() >= 0x80000007 {
|
||||||
|
_, b, _, d := cpuid(0x80000007)
|
||||||
|
fs.setIf((b&(1<<0)) != 0, MCAOVERFLOW)
|
||||||
|
fs.setIf((b&(1<<1)) != 0, SUCCOR)
|
||||||
|
fs.setIf((b&(1<<2)) != 0, HWA)
|
||||||
|
fs.setIf((d&(1<<9)) != 0, CPBOOST)
|
||||||
|
}
|
||||||
|
|
||||||
if maxExtendedFunction() >= 0x80000008 {
|
if maxExtendedFunction() >= 0x80000008 {
|
||||||
_, b, _, _ := cpuid(0x80000008)
|
_, b, _, _ := cpuid(0x80000008)
|
||||||
fs.setIf((b&(1<<9)) != 0, WBNOINVD)
|
fs.setIf((b&(1<<9)) != 0, WBNOINVD)
|
||||||
|
fs.setIf((b&(1<<8)) != 0, MCOMMIT)
|
||||||
|
fs.setIf((b&(1<<13)) != 0, INT_WBINVD)
|
||||||
|
fs.setIf((b&(1<<4)) != 0, RDPRU)
|
||||||
|
fs.setIf((b&(1<<3)) != 0, INVLPGB)
|
||||||
|
fs.setIf((b&(1<<1)) != 0, MSRIRC)
|
||||||
|
fs.setIf((b&(1<<0)) != 0, CLZERO)
|
||||||
|
}
|
||||||
|
|
||||||
|
if fs.inSet(SVM) && maxExtendedFunction() >= 0x8000000A {
|
||||||
|
_, _, _, edx := cpuid(0x8000000A)
|
||||||
|
fs.setIf((edx>>0)&1 == 1, SVMNP)
|
||||||
|
fs.setIf((edx>>1)&1 == 1, LBRVIRT)
|
||||||
|
fs.setIf((edx>>2)&1 == 1, SVML)
|
||||||
|
fs.setIf((edx>>3)&1 == 1, NRIPS)
|
||||||
|
fs.setIf((edx>>4)&1 == 1, TSCRATEMSR)
|
||||||
|
fs.setIf((edx>>5)&1 == 1, VMCBCLEAN)
|
||||||
|
fs.setIf((edx>>6)&1 == 1, SVMFBASID)
|
||||||
|
fs.setIf((edx>>7)&1 == 1, SVMDA)
|
||||||
|
fs.setIf((edx>>10)&1 == 1, SVMPF)
|
||||||
|
fs.setIf((edx>>12)&1 == 1, SVMPFT)
|
||||||
}
|
}
|
||||||
|
|
||||||
if maxExtendedFunction() >= 0x8000001b && fs.inSet(IBS) {
|
if maxExtendedFunction() >= 0x8000001b && fs.inSet(IBS) {
|
||||||
|
@ -997,6 +1247,24 @@ func support() flagSet {
|
||||||
fs.setIf((eax>>7)&1 == 1, IBSRIPINVALIDCHK)
|
fs.setIf((eax>>7)&1 == 1, IBSRIPINVALIDCHK)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if maxExtendedFunction() >= 0x8000001f && vend == AMD {
|
||||||
|
a, _, _, _ := cpuid(0x8000001f)
|
||||||
|
fs.setIf((a>>0)&1 == 1, SME)
|
||||||
|
fs.setIf((a>>1)&1 == 1, SEV)
|
||||||
|
fs.setIf((a>>2)&1 == 1, MSR_PAGEFLUSH)
|
||||||
|
fs.setIf((a>>3)&1 == 1, SEV_ES)
|
||||||
|
fs.setIf((a>>4)&1 == 1, SEV_SNP)
|
||||||
|
fs.setIf((a>>5)&1 == 1, VMPL)
|
||||||
|
fs.setIf((a>>10)&1 == 1, SME_COHERENT)
|
||||||
|
fs.setIf((a>>11)&1 == 1, SEV_64BIT)
|
||||||
|
fs.setIf((a>>12)&1 == 1, SEV_RESTRICTED)
|
||||||
|
fs.setIf((a>>13)&1 == 1, SEV_ALTERNATIVE)
|
||||||
|
fs.setIf((a>>14)&1 == 1, SEV_DEBUGSWAP)
|
||||||
|
fs.setIf((a>>15)&1 == 1, IBS_PREVENTHOST)
|
||||||
|
fs.setIf((a>>16)&1 == 1, VTE)
|
||||||
|
fs.setIf((a>>24)&1 == 1, VMSA_REGPROT)
|
||||||
|
}
|
||||||
|
|
||||||
return fs
|
return fs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file.
|
// Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file.
|
||||||
|
|
||||||
//+build arm64,!gccgo,!noasm,!appengine
|
//go:build arm64 && !gccgo && !noasm && !appengine
|
||||||
|
// +build arm64,!gccgo,!noasm,!appengine
|
||||||
|
|
||||||
package cpuid
|
package cpuid
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file.
|
// Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file.
|
||||||
|
|
||||||
//+build !amd64,!386,!arm64 gccgo noasm appengine
|
//go:build (!amd64 && !386 && !arm64) || gccgo || noasm || appengine
|
||||||
|
// +build !amd64,!386,!arm64 gccgo noasm appengine
|
||||||
|
|
||||||
package cpuid
|
package cpuid
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file.
|
// Copyright (c) 2015 Klaus Post, released under MIT License. See LICENSE file.
|
||||||
|
|
||||||
//+build 386,!gccgo,!noasm,!appengine amd64,!gccgo,!noasm,!appengine
|
//go:build (386 && !gccgo && !noasm && !appengine) || (amd64 && !gccgo && !noasm && !appengine)
|
||||||
|
// +build 386,!gccgo,!noasm,!appengine amd64,!gccgo,!noasm,!appengine
|
||||||
|
|
||||||
package cpuid
|
package cpuid
|
||||||
|
|
||||||
|
@ -23,13 +24,13 @@ func addInfo(c *CPUInfo, safe bool) {
|
||||||
c.maxExFunc = maxExtendedFunction()
|
c.maxExFunc = maxExtendedFunction()
|
||||||
c.BrandName = brandName()
|
c.BrandName = brandName()
|
||||||
c.CacheLine = cacheLine()
|
c.CacheLine = cacheLine()
|
||||||
c.Family, c.Model = familyModel()
|
c.Family, c.Model, c.Stepping = familyModel()
|
||||||
c.featureSet = support()
|
c.featureSet = support()
|
||||||
c.SGX = hasSGX(c.featureSet.inSet(SGX), c.featureSet.inSet(SGXLC))
|
c.SGX = hasSGX(c.featureSet.inSet(SGX), c.featureSet.inSet(SGXLC))
|
||||||
c.ThreadsPerCore = threadsPerCore()
|
c.ThreadsPerCore = threadsPerCore()
|
||||||
c.LogicalCores = logicalCores()
|
c.LogicalCores = logicalCores()
|
||||||
c.PhysicalCores = physicalCores()
|
c.PhysicalCores = physicalCores()
|
||||||
c.VendorID, c.VendorString = vendorID()
|
c.VendorID, c.VendorString = vendorID()
|
||||||
c.Hz = hertz(c.BrandName)
|
|
||||||
c.cacheSize()
|
c.cacheSize()
|
||||||
|
c.frequencies()
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,103 +24,165 @@ func _() {
|
||||||
_ = x[AVX512DQ-14]
|
_ = x[AVX512DQ-14]
|
||||||
_ = x[AVX512ER-15]
|
_ = x[AVX512ER-15]
|
||||||
_ = x[AVX512F-16]
|
_ = x[AVX512F-16]
|
||||||
_ = x[AVX512IFMA-17]
|
_ = x[AVX512FP16-17]
|
||||||
_ = x[AVX512PF-18]
|
_ = x[AVX512IFMA-18]
|
||||||
_ = x[AVX512VBMI-19]
|
_ = x[AVX512PF-19]
|
||||||
_ = x[AVX512VBMI2-20]
|
_ = x[AVX512VBMI-20]
|
||||||
_ = x[AVX512VL-21]
|
_ = x[AVX512VBMI2-21]
|
||||||
_ = x[AVX512VNNI-22]
|
_ = x[AVX512VL-22]
|
||||||
_ = x[AVX512VP2INTERSECT-23]
|
_ = x[AVX512VNNI-23]
|
||||||
_ = x[AVX512VPOPCNTDQ-24]
|
_ = x[AVX512VP2INTERSECT-24]
|
||||||
_ = x[AVXSLOW-25]
|
_ = x[AVX512VPOPCNTDQ-25]
|
||||||
_ = x[BMI1-26]
|
_ = x[AVXSLOW-26]
|
||||||
_ = x[BMI2-27]
|
_ = x[AVXVNNI-27]
|
||||||
_ = x[CLDEMOTE-28]
|
_ = x[BMI1-28]
|
||||||
_ = x[CLMUL-29]
|
_ = x[BMI2-29]
|
||||||
_ = x[CMOV-30]
|
_ = x[CETIBT-30]
|
||||||
_ = x[CX16-31]
|
_ = x[CETSS-31]
|
||||||
_ = x[ENQCMD-32]
|
_ = x[CLDEMOTE-32]
|
||||||
_ = x[ERMS-33]
|
_ = x[CLMUL-33]
|
||||||
_ = x[F16C-34]
|
_ = x[CLZERO-34]
|
||||||
_ = x[FMA3-35]
|
_ = x[CMOV-35]
|
||||||
_ = x[FMA4-36]
|
_ = x[CMPSB_SCADBS_SHORT-36]
|
||||||
_ = x[GFNI-37]
|
_ = x[CMPXCHG8-37]
|
||||||
_ = x[HLE-38]
|
_ = x[CPBOOST-38]
|
||||||
_ = x[HTT-39]
|
_ = x[CX16-39]
|
||||||
_ = x[HYPERVISOR-40]
|
_ = x[ENQCMD-40]
|
||||||
_ = x[IBPB-41]
|
_ = x[ERMS-41]
|
||||||
_ = x[IBS-42]
|
_ = x[F16C-42]
|
||||||
_ = x[IBSBRNTRGT-43]
|
_ = x[FMA3-43]
|
||||||
_ = x[IBSFETCHSAM-44]
|
_ = x[FMA4-44]
|
||||||
_ = x[IBSFFV-45]
|
_ = x[FXSR-45]
|
||||||
_ = x[IBSOPCNT-46]
|
_ = x[FXSROPT-46]
|
||||||
_ = x[IBSOPCNTEXT-47]
|
_ = x[GFNI-47]
|
||||||
_ = x[IBSOPSAM-48]
|
_ = x[HLE-48]
|
||||||
_ = x[IBSRDWROPCNT-49]
|
_ = x[HRESET-49]
|
||||||
_ = x[IBSRIPINVALIDCHK-50]
|
_ = x[HTT-50]
|
||||||
_ = x[LZCNT-51]
|
_ = x[HWA-51]
|
||||||
_ = x[MMX-52]
|
_ = x[HYPERVISOR-52]
|
||||||
_ = x[MMXEXT-53]
|
_ = x[IBPB-53]
|
||||||
_ = x[MOVDIR64B-54]
|
_ = x[IBS-54]
|
||||||
_ = x[MOVDIRI-55]
|
_ = x[IBSBRNTRGT-55]
|
||||||
_ = x[MPX-56]
|
_ = x[IBSFETCHSAM-56]
|
||||||
_ = x[NX-57]
|
_ = x[IBSFFV-57]
|
||||||
_ = x[POPCNT-58]
|
_ = x[IBSOPCNT-58]
|
||||||
_ = x[RDRAND-59]
|
_ = x[IBSOPCNTEXT-59]
|
||||||
_ = x[RDSEED-60]
|
_ = x[IBSOPSAM-60]
|
||||||
_ = x[RDTSCP-61]
|
_ = x[IBSRDWROPCNT-61]
|
||||||
_ = x[RTM-62]
|
_ = x[IBSRIPINVALIDCHK-62]
|
||||||
_ = x[SERIALIZE-63]
|
_ = x[IBS_PREVENTHOST-63]
|
||||||
_ = x[SGX-64]
|
_ = x[INT_WBINVD-64]
|
||||||
_ = x[SGXLC-65]
|
_ = x[INVLPGB-65]
|
||||||
_ = x[SHA-66]
|
_ = x[LAHF-66]
|
||||||
_ = x[SSE-67]
|
_ = x[LAM-67]
|
||||||
_ = x[SSE2-68]
|
_ = x[LBRVIRT-68]
|
||||||
_ = x[SSE3-69]
|
_ = x[LZCNT-69]
|
||||||
_ = x[SSE4-70]
|
_ = x[MCAOVERFLOW-70]
|
||||||
_ = x[SSE42-71]
|
_ = x[MCOMMIT-71]
|
||||||
_ = x[SSE4A-72]
|
_ = x[MMX-72]
|
||||||
_ = x[SSSE3-73]
|
_ = x[MMXEXT-73]
|
||||||
_ = x[STIBP-74]
|
_ = x[MOVBE-74]
|
||||||
_ = x[TBM-75]
|
_ = x[MOVDIR64B-75]
|
||||||
_ = x[TSXLDTRK-76]
|
_ = x[MOVDIRI-76]
|
||||||
_ = x[VAES-77]
|
_ = x[MOVSB_ZL-77]
|
||||||
_ = x[VMX-78]
|
_ = x[MPX-78]
|
||||||
_ = x[VPCLMULQDQ-79]
|
_ = x[MSRIRC-79]
|
||||||
_ = x[WAITPKG-80]
|
_ = x[MSR_PAGEFLUSH-80]
|
||||||
_ = x[WBNOINVD-81]
|
_ = x[NRIPS-81]
|
||||||
_ = x[XOP-82]
|
_ = x[NX-82]
|
||||||
_ = x[AESARM-83]
|
_ = x[OSXSAVE-83]
|
||||||
_ = x[ARMCPUID-84]
|
_ = x[PCONFIG-84]
|
||||||
_ = x[ASIMD-85]
|
_ = x[POPCNT-85]
|
||||||
_ = x[ASIMDDP-86]
|
_ = x[RDPRU-86]
|
||||||
_ = x[ASIMDHP-87]
|
_ = x[RDRAND-87]
|
||||||
_ = x[ASIMDRDM-88]
|
_ = x[RDSEED-88]
|
||||||
_ = x[ATOMICS-89]
|
_ = x[RDTSCP-89]
|
||||||
_ = x[CRC32-90]
|
_ = x[RTM-90]
|
||||||
_ = x[DCPOP-91]
|
_ = x[RTM_ALWAYS_ABORT-91]
|
||||||
_ = x[EVTSTRM-92]
|
_ = x[SERIALIZE-92]
|
||||||
_ = x[FCMA-93]
|
_ = x[SEV-93]
|
||||||
_ = x[FP-94]
|
_ = x[SEV_64BIT-94]
|
||||||
_ = x[FPHP-95]
|
_ = x[SEV_ALTERNATIVE-95]
|
||||||
_ = x[GPA-96]
|
_ = x[SEV_DEBUGSWAP-96]
|
||||||
_ = x[JSCVT-97]
|
_ = x[SEV_ES-97]
|
||||||
_ = x[LRCPC-98]
|
_ = x[SEV_RESTRICTED-98]
|
||||||
_ = x[PMULL-99]
|
_ = x[SEV_SNP-99]
|
||||||
_ = x[SHA1-100]
|
_ = x[SGX-100]
|
||||||
_ = x[SHA2-101]
|
_ = x[SGXLC-101]
|
||||||
_ = x[SHA3-102]
|
_ = x[SHA-102]
|
||||||
_ = x[SHA512-103]
|
_ = x[SME-103]
|
||||||
_ = x[SM3-104]
|
_ = x[SME_COHERENT-104]
|
||||||
_ = x[SM4-105]
|
_ = x[SSE-105]
|
||||||
_ = x[SVE-106]
|
_ = x[SSE2-106]
|
||||||
_ = x[lastID-107]
|
_ = x[SSE3-107]
|
||||||
|
_ = x[SSE4-108]
|
||||||
|
_ = x[SSE42-109]
|
||||||
|
_ = x[SSE4A-110]
|
||||||
|
_ = x[SSSE3-111]
|
||||||
|
_ = x[STIBP-112]
|
||||||
|
_ = x[STOSB_SHORT-113]
|
||||||
|
_ = x[SUCCOR-114]
|
||||||
|
_ = x[SVM-115]
|
||||||
|
_ = x[SVMDA-116]
|
||||||
|
_ = x[SVMFBASID-117]
|
||||||
|
_ = x[SVML-118]
|
||||||
|
_ = x[SVMNP-119]
|
||||||
|
_ = x[SVMPF-120]
|
||||||
|
_ = x[SVMPFT-121]
|
||||||
|
_ = x[SYSCALL-122]
|
||||||
|
_ = x[SYSEE-123]
|
||||||
|
_ = x[TBM-124]
|
||||||
|
_ = x[TOPEXT-125]
|
||||||
|
_ = x[TME-126]
|
||||||
|
_ = x[TSCRATEMSR-127]
|
||||||
|
_ = x[TSXLDTRK-128]
|
||||||
|
_ = x[VAES-129]
|
||||||
|
_ = x[VMCBCLEAN-130]
|
||||||
|
_ = x[VMPL-131]
|
||||||
|
_ = x[VMSA_REGPROT-132]
|
||||||
|
_ = x[VMX-133]
|
||||||
|
_ = x[VPCLMULQDQ-134]
|
||||||
|
_ = x[VTE-135]
|
||||||
|
_ = x[WAITPKG-136]
|
||||||
|
_ = x[WBNOINVD-137]
|
||||||
|
_ = x[X87-138]
|
||||||
|
_ = x[XGETBV1-139]
|
||||||
|
_ = x[XOP-140]
|
||||||
|
_ = x[XSAVE-141]
|
||||||
|
_ = x[XSAVEC-142]
|
||||||
|
_ = x[XSAVEOPT-143]
|
||||||
|
_ = x[XSAVES-144]
|
||||||
|
_ = x[AESARM-145]
|
||||||
|
_ = x[ARMCPUID-146]
|
||||||
|
_ = x[ASIMD-147]
|
||||||
|
_ = x[ASIMDDP-148]
|
||||||
|
_ = x[ASIMDHP-149]
|
||||||
|
_ = x[ASIMDRDM-150]
|
||||||
|
_ = x[ATOMICS-151]
|
||||||
|
_ = x[CRC32-152]
|
||||||
|
_ = x[DCPOP-153]
|
||||||
|
_ = x[EVTSTRM-154]
|
||||||
|
_ = x[FCMA-155]
|
||||||
|
_ = x[FP-156]
|
||||||
|
_ = x[FPHP-157]
|
||||||
|
_ = x[GPA-158]
|
||||||
|
_ = x[JSCVT-159]
|
||||||
|
_ = x[LRCPC-160]
|
||||||
|
_ = x[PMULL-161]
|
||||||
|
_ = x[SHA1-162]
|
||||||
|
_ = x[SHA2-163]
|
||||||
|
_ = x[SHA3-164]
|
||||||
|
_ = x[SHA512-165]
|
||||||
|
_ = x[SM3-166]
|
||||||
|
_ = x[SM4-167]
|
||||||
|
_ = x[SVE-168]
|
||||||
|
_ = x[lastID-169]
|
||||||
_ = x[firstID-0]
|
_ = x[firstID-0]
|
||||||
}
|
}
|
||||||
|
|
||||||
const _FeatureID_name = "firstIDADXAESNIAMD3DNOWAMD3DNOWEXTAMXBF16AMXINT8AMXTILEAVXAVX2AVX512BF16AVX512BITALGAVX512BWAVX512CDAVX512DQAVX512ERAVX512FAVX512IFMAAVX512PFAVX512VBMIAVX512VBMI2AVX512VLAVX512VNNIAVX512VP2INTERSECTAVX512VPOPCNTDQAVXSLOWBMI1BMI2CLDEMOTECLMULCMOVCX16ENQCMDERMSF16CFMA3FMA4GFNIHLEHTTHYPERVISORIBPBIBSIBSBRNTRGTIBSFETCHSAMIBSFFVIBSOPCNTIBSOPCNTEXTIBSOPSAMIBSRDWROPCNTIBSRIPINVALIDCHKLZCNTMMXMMXEXTMOVDIR64BMOVDIRIMPXNXPOPCNTRDRANDRDSEEDRDTSCPRTMSERIALIZESGXSGXLCSHASSESSE2SSE3SSE4SSE42SSE4ASSSE3STIBPTBMTSXLDTRKVAESVMXVPCLMULQDQWAITPKGWBNOINVDXOPAESARMARMCPUIDASIMDASIMDDPASIMDHPASIMDRDMATOMICSCRC32DCPOPEVTSTRMFCMAFPFPHPGPAJSCVTLRCPCPMULLSHA1SHA2SHA3SHA512SM3SM4SVElastID"
|
const _FeatureID_name = "firstIDADXAESNIAMD3DNOWAMD3DNOWEXTAMXBF16AMXINT8AMXTILEAVXAVX2AVX512BF16AVX512BITALGAVX512BWAVX512CDAVX512DQAVX512ERAVX512FAVX512FP16AVX512IFMAAVX512PFAVX512VBMIAVX512VBMI2AVX512VLAVX512VNNIAVX512VP2INTERSECTAVX512VPOPCNTDQAVXSLOWAVXVNNIBMI1BMI2CETIBTCETSSCLDEMOTECLMULCLZEROCMOVCMPSB_SCADBS_SHORTCMPXCHG8CPBOOSTCX16ENQCMDERMSF16CFMA3FMA4FXSRFXSROPTGFNIHLEHRESETHTTHWAHYPERVISORIBPBIBSIBSBRNTRGTIBSFETCHSAMIBSFFVIBSOPCNTIBSOPCNTEXTIBSOPSAMIBSRDWROPCNTIBSRIPINVALIDCHKIBS_PREVENTHOSTINT_WBINVDINVLPGBLAHFLAMLBRVIRTLZCNTMCAOVERFLOWMCOMMITMMXMMXEXTMOVBEMOVDIR64BMOVDIRIMOVSB_ZLMPXMSRIRCMSR_PAGEFLUSHNRIPSNXOSXSAVEPCONFIGPOPCNTRDPRURDRANDRDSEEDRDTSCPRTMRTM_ALWAYS_ABORTSERIALIZESEVSEV_64BITSEV_ALTERNATIVESEV_DEBUGSWAPSEV_ESSEV_RESTRICTEDSEV_SNPSGXSGXLCSHASMESME_COHERENTSSESSE2SSE3SSE4SSE42SSE4ASSSE3STIBPSTOSB_SHORTSUCCORSVMSVMDASVMFBASIDSVMLSVMNPSVMPFSVMPFTSYSCALLSYSEETBMTOPEXTTMETSCRATEMSRTSXLDTRKVAESVMCBCLEANVMPLVMSA_REGPROTVMXVPCLMULQDQVTEWAITPKGWBNOINVDX87XGETBV1XOPXSAVEXSAVECXSAVEOPTXSAVESAESARMARMCPUIDASIMDASIMDDPASIMDHPASIMDRDMATOMICSCRC32DCPOPEVTSTRMFCMAFPFPHPGPAJSCVTLRCPCPMULLSHA1SHA2SHA3SHA512SM3SM4SVElastID"
|
||||||
|
|
||||||
var _FeatureID_index = [...]uint16{0, 7, 10, 15, 23, 34, 41, 48, 55, 58, 62, 72, 84, 92, 100, 108, 116, 123, 133, 141, 151, 162, 170, 180, 198, 213, 220, 224, 228, 236, 241, 245, 249, 255, 259, 263, 267, 271, 275, 278, 281, 291, 295, 298, 308, 319, 325, 333, 344, 352, 364, 380, 385, 388, 394, 403, 410, 413, 415, 421, 427, 433, 439, 442, 451, 454, 459, 462, 465, 469, 473, 477, 482, 487, 492, 497, 500, 508, 512, 515, 525, 532, 540, 543, 549, 557, 562, 569, 576, 584, 591, 596, 601, 608, 612, 614, 618, 621, 626, 631, 636, 640, 644, 648, 654, 657, 660, 663, 669}
|
var _FeatureID_index = [...]uint16{0, 7, 10, 15, 23, 34, 41, 48, 55, 58, 62, 72, 84, 92, 100, 108, 116, 123, 133, 143, 151, 161, 172, 180, 190, 208, 223, 230, 237, 241, 245, 251, 256, 264, 269, 275, 279, 297, 305, 312, 316, 322, 326, 330, 334, 338, 342, 349, 353, 356, 362, 365, 368, 378, 382, 385, 395, 406, 412, 420, 431, 439, 451, 467, 482, 492, 499, 503, 506, 513, 518, 529, 536, 539, 545, 550, 559, 566, 574, 577, 583, 596, 601, 603, 610, 617, 623, 628, 634, 640, 646, 649, 665, 674, 677, 686, 701, 714, 720, 734, 741, 744, 749, 752, 755, 767, 770, 774, 778, 782, 787, 792, 797, 802, 813, 819, 822, 827, 836, 840, 845, 850, 856, 863, 868, 871, 877, 880, 890, 898, 902, 911, 915, 927, 930, 940, 943, 950, 958, 961, 968, 971, 976, 982, 990, 996, 1002, 1010, 1015, 1022, 1029, 1037, 1044, 1049, 1054, 1061, 1065, 1067, 1071, 1074, 1079, 1084, 1089, 1093, 1097, 1101, 1107, 1110, 1113, 1116, 1122}
|
||||||
|
|
||||||
func (i FeatureID) String() string {
|
func (i FeatureID) String() string {
|
||||||
if i < 0 || i >= FeatureID(len(_FeatureID_index)-1) {
|
if i < 0 || i >= FeatureID(len(_FeatureID_index)-1) {
|
||||||
|
|
|
@ -2,18 +2,120 @@
|
||||||
|
|
||||||
package cpuid
|
package cpuid
|
||||||
|
|
||||||
import "runtime"
|
import (
|
||||||
|
"runtime"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"golang.org/x/sys/unix"
|
||||||
|
)
|
||||||
|
|
||||||
func detectOS(c *CPUInfo) bool {
|
func detectOS(c *CPUInfo) bool {
|
||||||
|
if runtime.GOOS != "ios" {
|
||||||
|
tryToFillCPUInfoFomSysctl(c)
|
||||||
|
}
|
||||||
// There are no hw.optional sysctl values for the below features on Mac OS 11.0
|
// There are no hw.optional sysctl values for the below features on Mac OS 11.0
|
||||||
// to detect their supported state dynamically. Assume the CPU features that
|
// to detect their supported state dynamically. Assume the CPU features that
|
||||||
// Apple Silicon M1 supports to be available as a minimal set of features
|
// Apple Silicon M1 supports to be available as a minimal set of features
|
||||||
// to all Go programs running on darwin/arm64.
|
// to all Go programs running on darwin/arm64.
|
||||||
// TODO: Add more if we know them.
|
// TODO: Add more if we know them.
|
||||||
c.featureSet.setIf(runtime.GOOS != "ios", AESARM, PMULL, SHA1, SHA2)
|
c.featureSet.setIf(runtime.GOOS != "ios", AESARM, PMULL, SHA1, SHA2)
|
||||||
c.PhysicalCores = runtime.NumCPU()
|
|
||||||
// For now assuming 1 thread per core...
|
|
||||||
c.ThreadsPerCore = 1
|
|
||||||
c.LogicalCores = c.PhysicalCores
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func sysctlGetBool(name string) bool {
|
||||||
|
value, err := unix.SysctlUint32(name)
|
||||||
|
if err != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return value != 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func sysctlGetString(name string) string {
|
||||||
|
value, err := unix.Sysctl(name)
|
||||||
|
if err != nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
|
||||||
|
func sysctlGetInt(unknown int, names ...string) int {
|
||||||
|
for _, name := range names {
|
||||||
|
value, err := unix.SysctlUint32(name)
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if value != 0 {
|
||||||
|
return int(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return unknown
|
||||||
|
}
|
||||||
|
|
||||||
|
func sysctlGetInt64(unknown int, names ...string) int {
|
||||||
|
for _, name := range names {
|
||||||
|
value64, err := unix.SysctlUint64(name)
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if int(value64) != unknown {
|
||||||
|
return int(value64)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return unknown
|
||||||
|
}
|
||||||
|
|
||||||
|
func setFeature(c *CPUInfo, name string, feature FeatureID) {
|
||||||
|
c.featureSet.setIf(sysctlGetBool(name), feature)
|
||||||
|
}
|
||||||
|
func tryToFillCPUInfoFomSysctl(c *CPUInfo) {
|
||||||
|
c.BrandName = sysctlGetString("machdep.cpu.brand_string")
|
||||||
|
|
||||||
|
if len(c.BrandName) != 0 {
|
||||||
|
c.VendorString = strings.Fields(c.BrandName)[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
c.PhysicalCores = sysctlGetInt(runtime.NumCPU(), "hw.physicalcpu")
|
||||||
|
c.ThreadsPerCore = sysctlGetInt(1, "machdep.cpu.thread_count", "kern.num_threads") /
|
||||||
|
sysctlGetInt(1, "hw.physicalcpu")
|
||||||
|
c.LogicalCores = sysctlGetInt(runtime.NumCPU(), "machdep.cpu.core_count")
|
||||||
|
c.Family = sysctlGetInt(0, "machdep.cpu.family", "hw.cpufamily")
|
||||||
|
c.Model = sysctlGetInt(0, "machdep.cpu.model")
|
||||||
|
c.CacheLine = sysctlGetInt64(0, "hw.cachelinesize")
|
||||||
|
c.Cache.L1I = sysctlGetInt64(-1, "hw.l1icachesize")
|
||||||
|
c.Cache.L1D = sysctlGetInt64(-1, "hw.l1icachesize")
|
||||||
|
c.Cache.L2 = sysctlGetInt64(-1, "hw.l2cachesize")
|
||||||
|
c.Cache.L3 = sysctlGetInt64(-1, "hw.l3cachesize")
|
||||||
|
|
||||||
|
// from https://developer.arm.com/downloads/-/exploration-tools/feature-names-for-a-profile
|
||||||
|
setFeature(c, "hw.optional.arm.FEAT_AES", AESARM)
|
||||||
|
setFeature(c, "hw.optional.AdvSIMD", ASIMD)
|
||||||
|
setFeature(c, "hw.optional.arm.FEAT_DotProd", ASIMDDP)
|
||||||
|
setFeature(c, "hw.optional.arm.FEAT_RDM", ASIMDRDM)
|
||||||
|
setFeature(c, "hw.optional.FEAT_CRC32", CRC32)
|
||||||
|
setFeature(c, "hw.optional.arm.FEAT_DPB", DCPOP)
|
||||||
|
// setFeature(c, "", EVTSTRM)
|
||||||
|
setFeature(c, "hw.optional.arm.FEAT_FCMA", FCMA)
|
||||||
|
setFeature(c, "hw.optional.arm.FEAT_FP", FP)
|
||||||
|
setFeature(c, "hw.optional.arm.FEAT_FP16", FPHP)
|
||||||
|
setFeature(c, "hw.optional.arm.FEAT_PAuth", GPA)
|
||||||
|
setFeature(c, "hw.optional.arm.FEAT_JSCVT", JSCVT)
|
||||||
|
setFeature(c, "hw.optional.arm.FEAT_LRCPC", LRCPC)
|
||||||
|
setFeature(c, "hw.optional.arm.FEAT_PMULL", PMULL)
|
||||||
|
setFeature(c, "hw.optional.arm.FEAT_SHA1", SHA1)
|
||||||
|
setFeature(c, "hw.optional.arm.FEAT_SHA256", SHA2)
|
||||||
|
setFeature(c, "hw.optional.arm.FEAT_SHA3", SHA3)
|
||||||
|
setFeature(c, "hw.optional.arm.FEAT_SHA512", SHA512)
|
||||||
|
// setFeature(c, "", SM3)
|
||||||
|
// setFeature(c, "", SM4)
|
||||||
|
setFeature(c, "hw.optional.arm.FEAT_SVE", SVE)
|
||||||
|
|
||||||
|
// from empirical observation
|
||||||
|
setFeature(c, "hw.optional.AdvSIMD_HPFPCvt", ASIMDHP)
|
||||||
|
setFeature(c, "hw.optional.armv8_1_atomics", ATOMICS)
|
||||||
|
setFeature(c, "hw.optional.floatingpoint", FP)
|
||||||
|
setFeature(c, "hw.optional.armv8_2_sha3", SHA3)
|
||||||
|
setFeature(c, "hw.optional.armv8_2_sha512", SHA512)
|
||||||
|
setFeature(c, "hw.optional.armv8_3_compnum", FCMA)
|
||||||
|
setFeature(c, "hw.optional.armv8_crc32", CRC32)
|
||||||
|
}
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
// Copyright (c) 2020 Klaus Post, released under MIT License. See LICENSE file.
|
// Copyright (c) 2020 Klaus Post, released under MIT License. See LICENSE file.
|
||||||
|
|
||||||
// +build arm64
|
//go:build arm64 && !linux && !darwin
|
||||||
// +build !linux
|
// +build arm64,!linux,!darwin
|
||||||
// +build !darwin
|
|
||||||
|
|
||||||
package cpuid
|
package cpuid
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// Copyright (c) 2021 Klaus Post, released under MIT License. See LICENSE file.
|
// Copyright (c) 2021 Klaus Post, released under MIT License. See LICENSE file.
|
||||||
|
|
||||||
//+build nounsafe
|
//go:build nounsafe
|
||||||
|
// +build nounsafe
|
||||||
|
|
||||||
package cpuid
|
package cpuid
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// Copyright (c) 2021 Klaus Post, released under MIT License. See LICENSE file.
|
// Copyright (c) 2021 Klaus Post, released under MIT License. See LICENSE file.
|
||||||
|
|
||||||
//+build !nounsafe
|
//go:build !nounsafe
|
||||||
|
// +build !nounsafe
|
||||||
|
|
||||||
package cpuid
|
package cpuid
|
||||||
|
|
||||||
|
|
|
@ -1,65 +0,0 @@
|
||||||
language: go
|
|
||||||
|
|
||||||
os:
|
|
||||||
- linux
|
|
||||||
- osx
|
|
||||||
- windows
|
|
||||||
|
|
||||||
arch:
|
|
||||||
- amd64
|
|
||||||
- arm64
|
|
||||||
- ppc64le
|
|
||||||
- s390x
|
|
||||||
|
|
||||||
go:
|
|
||||||
- 1.14.x
|
|
||||||
- 1.15.x
|
|
||||||
- 1.16.x
|
|
||||||
- master
|
|
||||||
|
|
||||||
env:
|
|
||||||
- GO111MODULE=off CGO_ENABLED=0
|
|
||||||
|
|
||||||
install:
|
|
||||||
- go get ./...
|
|
||||||
|
|
||||||
script:
|
|
||||||
- go vet ./...
|
|
||||||
- go test -cpu=1,2 .
|
|
||||||
- go test -tags=noasm -cpu=1,2 .
|
|
||||||
- go build examples/simple-decoder.go
|
|
||||||
- go build examples/simple-encoder.go
|
|
||||||
- go build examples/stream-decoder.go
|
|
||||||
- go build examples/stream-encoder.go
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
allow_failures:
|
|
||||||
- go: 'master'
|
|
||||||
- arch: s390x
|
|
||||||
fast_finish: true
|
|
||||||
include:
|
|
||||||
- stage: other
|
|
||||||
go: 1.16.x
|
|
||||||
os: linux
|
|
||||||
arch: amd64
|
|
||||||
script:
|
|
||||||
- diff <(gofmt -d .) <(printf "")
|
|
||||||
- diff <(gofmt -d ./examples) <(printf "")
|
|
||||||
- go get github.com/klauspost/asmfmt&&go install github.com/klauspost/asmfmt/cmd/asmfmt
|
|
||||||
- diff <(asmfmt -d .) <(printf "")
|
|
||||||
- CGO_ENABLED=1 go test -cpu=1 -short -race .
|
|
||||||
- CGO_ENABLED=1 go test -cpu=2 -short -race .
|
|
||||||
- CGO_ENABLED=1 go test -tags=noasm -cpu=1 -short -race .
|
|
||||||
- CGO_ENABLED=1 go test -tags=noasm -cpu=4 -short -race .
|
|
||||||
- CGO_ENABLED=1 go test -no-avx512 -short -race .
|
|
||||||
- CGO_ENABLED=1 go test -no-avx512 -no-avx2 -short -race .
|
|
||||||
- CGO_ENABLED=1 go test -no-avx512 -no-avx2 -no-ssse3 -short -race .
|
|
||||||
- GOOS=linux GOARCH=386 go test -short .
|
|
||||||
- stage: other
|
|
||||||
go: 1.15.x
|
|
||||||
os: linux
|
|
||||||
arch: amd64
|
|
||||||
script:
|
|
||||||
- go test -no-avx512
|
|
||||||
- go test -no-avx512 -no-avx2
|
|
||||||
- go test -no-avx512 -no-avx2 -no-ssse3
|
|
|
@ -1,8 +1,5 @@
|
||||||
# Reed-Solomon
|
# Reed-Solomon
|
||||||
[![Go Reference](https://pkg.go.dev/badge/github.com/klauspost/reedsolomon.svg)](https://pkg.go.dev/github.com/klauspost/reedsolomon) [![Build Status][3]][4]
|
[![Go Reference](https://pkg.go.dev/badge/github.com/klauspost/reedsolomon.svg)](https://pkg.go.dev/github.com/klauspost/reedsolomon) [![Go](https://github.com/klauspost/reedsolomon/actions/workflows/go.yml/badge.svg)](https://github.com/klauspost/reedsolomon/actions/workflows/go.yml)
|
||||||
|
|
||||||
[3]: https://travis-ci.org/klauspost/reedsolomon.svg?branch=master
|
|
||||||
[4]: https://travis-ci.org/klauspost/reedsolomon
|
|
||||||
|
|
||||||
Reed-Solomon Erasure Coding in Go, with speeds exceeding 1GB/s/cpu core implemented in pure Go.
|
Reed-Solomon Erasure Coding in Go, with speeds exceeding 1GB/s/cpu core implemented in pure Go.
|
||||||
|
|
||||||
|
@ -11,9 +8,12 @@ This is a Go port of the [JavaReedSolomon](https://github.com/Backblaze/JavaReed
|
||||||
|
|
||||||
For an introduction on erasure coding, see the post on the [Backblaze blog](https://www.backblaze.com/blog/reed-solomon/).
|
For an introduction on erasure coding, see the post on the [Backblaze blog](https://www.backblaze.com/blog/reed-solomon/).
|
||||||
|
|
||||||
|
For encoding high shard counts (>256) a Leopard implementation is used.
|
||||||
|
For most platforms this performs close to the original Leopard implementation in terms of speed.
|
||||||
|
|
||||||
Package home: https://github.com/klauspost/reedsolomon
|
Package home: https://github.com/klauspost/reedsolomon
|
||||||
|
|
||||||
Godoc: https://pkg.go.dev/github.com/klauspost/reedsolomon?tab=doc
|
Godoc: https://pkg.go.dev/github.com/klauspost/reedsolomon
|
||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
To get the package use the standard:
|
To get the package use the standard:
|
||||||
|
@ -21,11 +21,18 @@ To get the package use the standard:
|
||||||
go get -u github.com/klauspost/reedsolomon
|
go get -u github.com/klauspost/reedsolomon
|
||||||
```
|
```
|
||||||
|
|
||||||
Using Go modules recommended.
|
Using Go modules is recommended.
|
||||||
|
|
||||||
# Changes
|
# Changes
|
||||||
|
|
||||||
|
## 2022
|
||||||
|
|
||||||
|
* Leopard GF16 mode added, for up to 63336 shards.
|
||||||
|
* [WithJerasureMatrix](https://pkg.go.dev/github.com/klauspost/reedsolomon?tab=doc#WithJerasureMatrix) allows constructing a [Jerasure](https://github.com/tsuraan/Jerasure) compatible matrix.
|
||||||
|
|
||||||
## 2021
|
## 2021
|
||||||
|
|
||||||
|
* Use `GOAMD64=v4` to enable faster AVX2.
|
||||||
* Add progressive shard encoding.
|
* Add progressive shard encoding.
|
||||||
* Wider AVX2 loops
|
* Wider AVX2 loops
|
||||||
* Limit concurrency on AVX2, since we are likely memory bound.
|
* Limit concurrency on AVX2, since we are likely memory bound.
|
||||||
|
@ -33,6 +40,8 @@ Using Go modules recommended.
|
||||||
* Allow disabling inversion cache.
|
* Allow disabling inversion cache.
|
||||||
* Faster AVX2 encoding.
|
* Faster AVX2 encoding.
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>See older changes</summary>
|
||||||
|
|
||||||
## May 2020
|
## May 2020
|
||||||
|
|
||||||
|
@ -96,6 +105,8 @@ The [`StreamEncoder`](https://godoc.org/github.com/klauspost/reedsolomon#StreamE
|
||||||
handles this without modifying the interface.
|
handles this without modifying the interface.
|
||||||
This is a good lesson on why returning interfaces is not a good design.
|
This is a good lesson on why returning interfaces is not a good design.
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
|
|
||||||
This section assumes you know the basics of Reed-Solomon encoding.
|
This section assumes you know the basics of Reed-Solomon encoding.
|
||||||
|
@ -105,23 +116,19 @@ This package performs the calculation of the parity sets. The usage is therefore
|
||||||
|
|
||||||
First of all, you need to choose your distribution of data and parity shards.
|
First of all, you need to choose your distribution of data and parity shards.
|
||||||
A 'good' distribution is very subjective, and will depend a lot on your usage scenario.
|
A 'good' distribution is very subjective, and will depend a lot on your usage scenario.
|
||||||
A good starting point is above 5 and below 257 data shards (the maximum supported number),
|
|
||||||
and the number of parity shards to be 2 or above, and below the number of data shards.
|
|
||||||
|
|
||||||
To create an encoder with 10 data shards (where your data goes) and 3 parity shards (calculated):
|
To create an encoder with 10 data shards (where your data goes) and 3 parity shards (calculated):
|
||||||
```Go
|
```Go
|
||||||
enc, err := reedsolomon.New(10, 3)
|
enc, err := reedsolomon.New(10, 3)
|
||||||
```
|
```
|
||||||
This encoder will work for all parity sets with this distribution of data and parity shards.
|
This encoder will work for all parity sets with this distribution of data and parity shards.
|
||||||
The error will only be set if you specify 0 or negative values in any of the parameters,
|
|
||||||
or if you specify more than 256 data shards.
|
|
||||||
|
|
||||||
If you will primarily be using it with one shard size it is recommended to use
|
If you will primarily be using it with one shard size it is recommended to use
|
||||||
[`WithAutoGoroutines(shardSize)`](https://pkg.go.dev/github.com/klauspost/reedsolomon?tab=doc#WithAutoGoroutines)
|
[`WithAutoGoroutines(shardSize)`](https://pkg.go.dev/github.com/klauspost/reedsolomon?tab=doc#WithAutoGoroutines)
|
||||||
as an additional parameter. This will attempt to calculate the optimal number of goroutines to use for the best speed.
|
as an additional parameter. This will attempt to calculate the optimal number of goroutines to use for the best speed.
|
||||||
It is not required that all shards are this size.
|
It is not required that all shards are this size.
|
||||||
|
|
||||||
The you send and receive data is a simple slice of byte slices; `[][]byte`.
|
Then you send and receive data that is a simple slice of byte slices; `[][]byte`.
|
||||||
In the example above, the top slice must have a length of 13.
|
In the example above, the top slice must have a length of 13.
|
||||||
|
|
||||||
```Go
|
```Go
|
||||||
|
@ -187,6 +194,17 @@ If you are only interested in the data shards (for reading purposes) you can cal
|
||||||
err := enc.ReconstructData(data)
|
err := enc.ReconstructData(data)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you don't need all data shards you can use `ReconstructSome()`:
|
||||||
|
|
||||||
|
```Go
|
||||||
|
// Delete two data shards
|
||||||
|
data[3] = nil
|
||||||
|
data[7] = nil
|
||||||
|
|
||||||
|
// Reconstruct just the shard 3
|
||||||
|
err := enc.ReconstructSome(data, []bool{false, false, false, true, false, false, false, false})
|
||||||
|
```
|
||||||
|
|
||||||
So to sum up reconstruction:
|
So to sum up reconstruction:
|
||||||
* The number of data/parity shards must match the numbers used for encoding.
|
* The number of data/parity shards must match the numbers used for encoding.
|
||||||
* The order of shards must be the same as used when encoding.
|
* The order of shards must be the same as used when encoding.
|
||||||
|
@ -333,6 +351,8 @@ There is no buffering or timeouts/retry specified. If you want to add that, you
|
||||||
For complete examples of a streaming encoder and decoder see the
|
For complete examples of a streaming encoder and decoder see the
|
||||||
[examples folder](https://github.com/klauspost/reedsolomon/tree/master/examples).
|
[examples folder](https://github.com/klauspost/reedsolomon/tree/master/examples).
|
||||||
|
|
||||||
|
GF16 (more than 256 shards) is not supported by the streaming interface.
|
||||||
|
|
||||||
# Advanced Options
|
# Advanced Options
|
||||||
|
|
||||||
You can modify internal options which affects how jobs are split between and processed by goroutines.
|
You can modify internal options which affects how jobs are split between and processed by goroutines.
|
||||||
|
@ -346,8 +366,83 @@ Example of how to supply options:
|
||||||
enc, err := reedsolomon.New(10, 3, WithMaxGoroutines(25))
|
enc, err := reedsolomon.New(10, 3, WithMaxGoroutines(25))
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# Leopard Compatible GF16
|
||||||
|
|
||||||
|
When you encode more than 256 shards the library will switch to a [Leopard-RS](https://github.com/catid/leopard) implementation.
|
||||||
|
|
||||||
|
This allows encoding up to 65536 shards (data+parity) with the following limitations, similar to leopard:
|
||||||
|
|
||||||
|
* The original and recovery data must not exceed 65536 pieces.
|
||||||
|
* The shard size *must* each be a multiple of 64 bytes.
|
||||||
|
* Each buffer should have the same number of bytes.
|
||||||
|
* Even the last shard must be rounded up to the block size.
|
||||||
|
|
||||||
|
| | Regular | Leopard |
|
||||||
|
|-----------------|---------|---------|
|
||||||
|
| Encode | ✓ | ✓ |
|
||||||
|
| EncodeIdx | ✓ | - |
|
||||||
|
| Verify | ✓ | ✓ |
|
||||||
|
| Reconstruct | ✓ | ✓ |
|
||||||
|
| ReconstructData | ✓ | ✓ |
|
||||||
|
| ReconstructSome | ✓ | ✓ (+) |
|
||||||
|
| Update | ✓ | - |
|
||||||
|
| Split | ✓ | ✓ |
|
||||||
|
| Join | ✓ | ✓ |
|
||||||
|
|
||||||
|
* (+) Same as calling `ReconstructData`.
|
||||||
|
|
||||||
|
The Split/Join functions will help to split an input to the proper sizes.
|
||||||
|
|
||||||
|
Speed can be expected to be `O(N*log(N))`, compared to the `O(N*N)`.
|
||||||
|
Reconstruction matrix calculation is more time-consuming,
|
||||||
|
so be sure to include that as part of any benchmark you run.
|
||||||
|
|
||||||
|
For now SSSE3, AVX2 and AVX512 assembly are available on AMD64 platforms.
|
||||||
|
|
||||||
|
Leopard mode currently always runs as a single goroutine, since multiple gorouties doesn't provide any worthwhile speedup.
|
||||||
|
|
||||||
|
## Forcing Leopard GF16
|
||||||
|
|
||||||
|
The `WithLeopardGF16(true)` can be used to use Leopard GF16 for all operations.
|
||||||
|
This is *not* compatible with the Leopard library that has a separate GF8 implementation.
|
||||||
|
|
||||||
|
Benchmark Encoding and Reconstructing *1KB* shards with variable number of shards.
|
||||||
|
For Cauchy matrix the inversion cache is disabled for a more "fair" test.
|
||||||
|
Speed is total shard size for each operation. Data shard throughput is speed/2.
|
||||||
|
AVX2 is used.
|
||||||
|
|
||||||
|
| Encoder | Shards | Encode | Recover All | Recover One |
|
||||||
|
|--------------|-------------|---------------|--------------|--------------|
|
||||||
|
| Cauchy | 4+4 | 23076.83 MB/s | 3048.86 MB/s | 5620.84 MB/s |
|
||||||
|
| Cauchy | 8+8 | 15206.87 MB/s | 3041.99 MB/s | 7173.71 MB/s |
|
||||||
|
| Cauchy | 16+16 | 7427.47 MB/s | 1384.58 MB/s | 6343.85 MB/s |
|
||||||
|
| Cauchy | 32+32 | 3785.64 MB/s | 557.60 MB/s | 4660.27 MB/s |
|
||||||
|
| Cauchy | 64+64 | 1911.93 MB/s | 160.54 MB/s | 2864.63 MB/s |
|
||||||
|
| Cauchy | 128+128 | 963.83 MB/s | 42.81 MB/s | 1597.93 MB/s |
|
||||||
|
| Leopard GF16 | 4+4 | 18468.32 MB/s | 10.45 MB/s | 10.30 MB/s |
|
||||||
|
| Leopard GF16 | 8+8 | 10293.79 MB/s | 20.83 MB/s | 20.51 MB/s |
|
||||||
|
| Leopard GF16 | 16+16 | 12386.04 MB/s | 40.80 MB/s | 40.47 MB/s |
|
||||||
|
| Leopard GF16 | 32+32 | 7347.35 MB/s | 81.15 MB/s | 79.80 MB/s |
|
||||||
|
| Leopard GF16 | 64+64 | 8299.63 MB/s | 150.47 MB/s | 154.15 MB/s |
|
||||||
|
| Leopard GF16 | 128+128 | 5629.04 MB/s | 278.84 MB/s | 289.15 MB/s |
|
||||||
|
| Leopard GF16 | 256+256 | 6158.66 MB/s | 454.14 MB/s | 506.70 MB/s |
|
||||||
|
| Leopard GF16 | 512+512 | 4418.58 MB/s | 685.75 MB/s | 801.63 MB/s |
|
||||||
|
| Leopard GF16 | 1024+1024 | 4778.05 MB/s | 814.51 MB/s | 1080.19 MB/s |
|
||||||
|
| Leopard GF16 | 2048+2048 | 3417.05 MB/s | 911.64 MB/s | 1179.48 MB/s |
|
||||||
|
| Leopard GF16 | 4096+4096 | 3209.41 MB/s | 729.13 MB/s | 1135.06 MB/s |
|
||||||
|
| Leopard GF16 | 8192+8192 | 2034.11 MB/s | 604.52 MB/s | 842.13 MB/s |
|
||||||
|
| Leopard GF16 | 16384+16384 | 1525.88 MB/s | 486.74 MB/s | 750.01 MB/s |
|
||||||
|
| Leopard GF16 | 32768+32768 | 1138.67 MB/s | 482.81 MB/s | 712.73 MB/s |
|
||||||
|
|
||||||
|
"Traditional" encoding is faster until somewhere between 16 and 32 shards.
|
||||||
|
Leopard provides fast encoding in all cases, but shows a significant overhead for reconstruction.
|
||||||
|
|
||||||
|
Calculating the reconstruction matrix takes a significant amount of computation.
|
||||||
|
With bigger shards that will be smaller. Arguably, fewer shards typically also means bigger shards.
|
||||||
|
Due to the high shard count caching reconstruction matrices generally isn't feasible for Leopard.
|
||||||
|
|
||||||
# Performance
|
# Performance
|
||||||
|
|
||||||
Performance depends mainly on the number of parity shards.
|
Performance depends mainly on the number of parity shards.
|
||||||
In rough terms, doubling the number of parity shards will double the encoding time.
|
In rough terms, doubling the number of parity shards will double the encoding time.
|
||||||
|
|
||||||
|
@ -356,27 +451,16 @@ For reference each shard is 1MB random data, and 16 CPU cores are used for encod
|
||||||
|
|
||||||
| Data | Parity | Go MB/s | SSSE3 MB/s | AVX2 MB/s |
|
| Data | Parity | Go MB/s | SSSE3 MB/s | AVX2 MB/s |
|
||||||
|------|--------|---------|------------|-----------|
|
|------|--------|---------|------------|-----------|
|
||||||
| 5 | 2 | 14287 | 66355 | 108755 |
|
| 5 | 2 | 20,772 | 66,355 | 108,755 |
|
||||||
| 8 | 8 | 5569 | 34298 | 70516 |
|
| 8 | 8 | 6,815 | 38,338 | 70,516 |
|
||||||
| 10 | 4 | 6766 | 48237 | 93875 |
|
| 10 | 4 | 9,245 | 48,237 | 93,875 |
|
||||||
| 50 | 20 | 1540 | 12130 | 22090 |
|
| 50 | 20 | 2,063 | 12,130 | 22,828 |
|
||||||
|
|
||||||
The throughput numbers here is the size of the encoded data and parity shards.
|
The throughput numbers here is the size of the encoded data and parity shards.
|
||||||
|
|
||||||
If `runtime.GOMAXPROCS()` is set to a value higher than 1,
|
If `runtime.GOMAXPROCS()` is set to a value higher than 1,
|
||||||
the encoder will use multiple goroutines to perform the calculations in `Verify`, `Encode` and `Reconstruct`.
|
the encoder will use multiple goroutines to perform the calculations in `Verify`, `Encode` and `Reconstruct`.
|
||||||
|
|
||||||
Example of performance scaling on AMD Ryzen 3950X - 16 physical cores, 32 logical cores, AVX 2.
|
|
||||||
The example uses 10 blocks with 1MB data each and 4 parity blocks.
|
|
||||||
|
|
||||||
| Threads | Speed |
|
|
||||||
|---------|------------|
|
|
||||||
| 1 | 9979 MB/s |
|
|
||||||
| 2 | 18870 MB/s |
|
|
||||||
| 4 | 33697 MB/s |
|
|
||||||
| 8 | 51531 MB/s |
|
|
||||||
| 16 | 59204 MB/s |
|
|
||||||
|
|
||||||
|
|
||||||
Benchmarking `Reconstruct()` followed by a `Verify()` (=`all`) versus just calling `ReconstructData()` (=`data`) gives the following result:
|
Benchmarking `Reconstruct()` followed by a `Verify()` (=`all`) versus just calling `ReconstructData()` (=`data`) gives the following result:
|
||||||
```
|
```
|
||||||
|
@ -390,22 +474,9 @@ BenchmarkReconstruct50x20x1M-8 1364.35 4189.79 3.07x
|
||||||
BenchmarkReconstruct10x4x16M-8 1484.35 5779.53 3.89x
|
BenchmarkReconstruct10x4x16M-8 1484.35 5779.53 3.89x
|
||||||
```
|
```
|
||||||
|
|
||||||
# Performance on AVX512
|
The performance on AVX512 has been accelerated for CPUs when available.
|
||||||
|
|
||||||
The performance on AVX512 has been accelerated for Intel CPUs.
|
## ARM64 NEON
|
||||||
This gives speedups on a per-core basis typically up to 2x compared to
|
|
||||||
AVX2 as can be seen in the following table:
|
|
||||||
|
|
||||||
```
|
|
||||||
[...]
|
|
||||||
```
|
|
||||||
|
|
||||||
This speedup has been achieved by computing multiple parity blocks in parallel as opposed to one after the other.
|
|
||||||
In doing so it is possible to minimize the memory bandwidth required for loading all data shards.
|
|
||||||
At the same time the calculations are performed in the 512-bit wide ZMM registers and the surplus of ZMM
|
|
||||||
registers (32 in total) is used to keep more data around (most notably the matrix coefficients).
|
|
||||||
|
|
||||||
# Performance on ARM64 NEON
|
|
||||||
|
|
||||||
By exploiting NEON instructions the performance for ARM has been accelerated.
|
By exploiting NEON instructions the performance for ARM has been accelerated.
|
||||||
Below are the performance numbers for a single core on an EC2 m6g.16xlarge (Graviton2) instance (Amazon Linux 2):
|
Below are the performance numbers for a single core on an EC2 m6g.16xlarge (Graviton2) instance (Amazon Linux 2):
|
||||||
|
@ -420,7 +491,7 @@ BenchmarkGaloisXor1M-64 10000 100322 ns/op 10452.13 MB/s
|
||||||
# Performance on ppc64le
|
# Performance on ppc64le
|
||||||
|
|
||||||
The performance for ppc64le has been accelerated.
|
The performance for ppc64le has been accelerated.
|
||||||
This gives roughly a 10x performance improvement on this architecture as can been seen below:
|
This gives roughly a 10x performance improvement on this architecture as can be seen below:
|
||||||
|
|
||||||
```
|
```
|
||||||
benchmark old MB/s new MB/s speedup
|
benchmark old MB/s new MB/s speedup
|
||||||
|
@ -430,9 +501,6 @@ BenchmarkGaloisXor128K-160 862.02 7905.00 9.17x
|
||||||
BenchmarkGaloisXor1M-160 784.60 6296.65 8.03x
|
BenchmarkGaloisXor1M-160 784.60 6296.65 8.03x
|
||||||
```
|
```
|
||||||
|
|
||||||
# asm2plan9s
|
|
||||||
|
|
||||||
[asm2plan9s](https://github.com/fwessels/asm2plan9s) is used for assembling the AVX2 instructions into their BYTE/WORD/LONG equivalents.
|
|
||||||
|
|
||||||
# Links
|
# Links
|
||||||
* [Backblaze Open Sources Reed-Solomon Erasure Coding Source Code](https://www.backblaze.com/blog/reed-solomon/).
|
* [Backblaze Open Sources Reed-Solomon Erasure Coding Source Code](https://www.backblaze.com/blog/reed-solomon/).
|
||||||
|
@ -443,6 +511,7 @@ BenchmarkGaloisXor1M-160 784.60 6296.65 8.03x
|
||||||
* [reed-solomon-erasure](https://github.com/darrenldl/reed-solomon-erasure). Compatible Rust implementation.
|
* [reed-solomon-erasure](https://github.com/darrenldl/reed-solomon-erasure). Compatible Rust implementation.
|
||||||
* [go-erasure](https://github.com/somethingnew2-0/go-erasure). A similar library using cgo, slower in my tests.
|
* [go-erasure](https://github.com/somethingnew2-0/go-erasure). A similar library using cgo, slower in my tests.
|
||||||
* [Screaming Fast Galois Field Arithmetic](http://www.snia.org/sites/default/files2/SDC2013/presentations/NewThinking/EthanMiller_Screaming_Fast_Galois_Field%20Arithmetic_SIMD%20Instructions.pdf). Basis for SSE3 optimizations.
|
* [Screaming Fast Galois Field Arithmetic](http://www.snia.org/sites/default/files2/SDC2013/presentations/NewThinking/EthanMiller_Screaming_Fast_Galois_Field%20Arithmetic_SIMD%20Instructions.pdf). Basis for SSE3 optimizations.
|
||||||
|
* [Leopard-RS](https://github.com/catid/leopard) C library used as basis for GF16 implementation.
|
||||||
|
|
||||||
# License
|
# License
|
||||||
|
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
os: Visual Studio 2015
|
|
||||||
|
|
||||||
platform: x64
|
|
||||||
|
|
||||||
clone_folder: c:\gopath\src\github.com\klauspost\reedsolomon
|
|
||||||
|
|
||||||
# environment variables
|
|
||||||
environment:
|
|
||||||
GOPATH: c:\gopath
|
|
||||||
|
|
||||||
install:
|
|
||||||
- echo %PATH%
|
|
||||||
- echo %GOPATH%
|
|
||||||
- go version
|
|
||||||
- go env
|
|
||||||
- go get -d ./...
|
|
||||||
|
|
||||||
build_script:
|
|
||||||
- go test -v -cpu=2 ./...
|
|
||||||
- go test -cpu=1,2,4 -short -race ./...
|
|
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
package reedsolomon
|
package reedsolomon
|
||||||
|
|
||||||
|
import "encoding/binary"
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// The number of elements in the field.
|
// The number of elements in the field.
|
||||||
fieldSize = 256
|
fieldSize = 256
|
||||||
|
@ -929,3 +931,24 @@ func genAvx2Matrix(matrixRows [][]byte, inputs, inIdx, outputs int, dst []byte)
|
||||||
}
|
}
|
||||||
return dst
|
return dst
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// xor slices writing to out.
|
||||||
|
func sliceXorGo(in, out []byte, _ *options) {
|
||||||
|
for len(out) >= 32 {
|
||||||
|
inS := in[:32]
|
||||||
|
v0 := binary.LittleEndian.Uint64(out[:8]) ^ binary.LittleEndian.Uint64(inS[:8])
|
||||||
|
v1 := binary.LittleEndian.Uint64(out[8:16]) ^ binary.LittleEndian.Uint64(inS[8:16])
|
||||||
|
v2 := binary.LittleEndian.Uint64(out[16:24]) ^ binary.LittleEndian.Uint64(inS[16:24])
|
||||||
|
v3 := binary.LittleEndian.Uint64(out[24:32]) ^ binary.LittleEndian.Uint64(inS[24:32])
|
||||||
|
binary.LittleEndian.PutUint64(out[:8], v0)
|
||||||
|
binary.LittleEndian.PutUint64(out[8:16], v1)
|
||||||
|
binary.LittleEndian.PutUint64(out[16:24], v2)
|
||||||
|
binary.LittleEndian.PutUint64(out[24:32], v3)
|
||||||
|
out = out[32:]
|
||||||
|
in = in[32:]
|
||||||
|
}
|
||||||
|
out = out[:len(in)]
|
||||||
|
for n, input := range in {
|
||||||
|
out[n] ^= input
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ func setupMatrix84(matrixRows [][]byte, inputOffset, outputOffset int, matrix *[
|
||||||
// Invoke AVX512 routine for single output row in parallel
|
// Invoke AVX512 routine for single output row in parallel
|
||||||
func galMulAVX512Parallel81(in, out [][]byte, matrixRows [][]byte, inputOffset, outputOffset, start, stop int, matrix81 *[matrixSize81]byte) {
|
func galMulAVX512Parallel81(in, out [][]byte, matrixRows [][]byte, inputOffset, outputOffset, start, stop int, matrix81 *[matrixSize81]byte) {
|
||||||
done := stop - start
|
done := stop - start
|
||||||
if done <= 0 {
|
if done <= 0 || len(in) == 0 || len(out) == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ func galMulAVX512Parallel81(in, out [][]byte, matrixRows [][]byte, inputOffset,
|
||||||
// Invoke AVX512 routine for 2 output rows in parallel
|
// Invoke AVX512 routine for 2 output rows in parallel
|
||||||
func galMulAVX512Parallel82(in, out [][]byte, matrixRows [][]byte, inputOffset, outputOffset, start, stop int, matrix82 *[matrixSize82]byte) {
|
func galMulAVX512Parallel82(in, out [][]byte, matrixRows [][]byte, inputOffset, outputOffset, start, stop int, matrix82 *[matrixSize82]byte) {
|
||||||
done := stop - start
|
done := stop - start
|
||||||
if done <= 0 {
|
if done <= 0 || len(in) == 0 || len(out) == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ func galMulAVX512Parallel82(in, out [][]byte, matrixRows [][]byte, inputOffset,
|
||||||
// Invoke AVX512 routine for 4 output rows in parallel
|
// Invoke AVX512 routine for 4 output rows in parallel
|
||||||
func galMulAVX512Parallel84(in, out [][]byte, matrixRows [][]byte, inputOffset, outputOffset, start, stop int, matrix84 *[matrixSize84]byte) {
|
func galMulAVX512Parallel84(in, out [][]byte, matrixRows [][]byte, inputOffset, outputOffset, start, stop int, matrix84 *[matrixSize84]byte) {
|
||||||
done := stop - start
|
done := stop - start
|
||||||
if done <= 0 {
|
if done <= 0 || len(in) == 0 || len(out) == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -132,9 +132,215 @@ func sliceXor(in, out []byte, o *options) {
|
||||||
in = in[done:]
|
in = in[done:]
|
||||||
out = out[done:]
|
out = out[done:]
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
sliceXorGo(in, out, o)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
out = out[:len(in)]
|
out = out[:len(in)]
|
||||||
for i := range in {
|
for i := range in {
|
||||||
out[i] ^= in[i]
|
out[i] ^= in[i]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 4-way butterfly
|
||||||
|
func ifftDIT4(work [][]byte, dist int, log_m01, log_m23, log_m02 ffe, o *options) {
|
||||||
|
if len(work[0]) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
t01 := &multiply256LUT[log_m01]
|
||||||
|
t23 := &multiply256LUT[log_m23]
|
||||||
|
t02 := &multiply256LUT[log_m02]
|
||||||
|
if o.useAVX512 {
|
||||||
|
if log_m01 == modulus {
|
||||||
|
if log_m23 == modulus {
|
||||||
|
if log_m02 == modulus {
|
||||||
|
ifftDIT4_avx512_7(work, dist*24, t01, t23, t02)
|
||||||
|
} else {
|
||||||
|
ifftDIT4_avx512_3(work, dist*24, t01, t23, t02)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if log_m02 == modulus {
|
||||||
|
ifftDIT4_avx512_5(work, dist*24, t01, t23, t02)
|
||||||
|
} else {
|
||||||
|
ifftDIT4_avx512_1(work, dist*24, t01, t23, t02)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if log_m23 == modulus {
|
||||||
|
if log_m02 == modulus {
|
||||||
|
ifftDIT4_avx512_6(work, dist*24, t01, t23, t02)
|
||||||
|
} else {
|
||||||
|
ifftDIT4_avx512_2(work, dist*24, t01, t23, t02)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if log_m02 == modulus {
|
||||||
|
ifftDIT4_avx512_4(work, dist*24, t01, t23, t02)
|
||||||
|
} else {
|
||||||
|
ifftDIT4_avx512_0(work, dist*24, t01, t23, t02)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
} else if o.useAVX2 {
|
||||||
|
if log_m01 == modulus {
|
||||||
|
if log_m23 == modulus {
|
||||||
|
if log_m02 == modulus {
|
||||||
|
ifftDIT4_avx2_7(work, dist*24, t01, t23, t02)
|
||||||
|
} else {
|
||||||
|
ifftDIT4_avx2_3(work, dist*24, t01, t23, t02)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if log_m02 == modulus {
|
||||||
|
ifftDIT4_avx2_5(work, dist*24, t01, t23, t02)
|
||||||
|
} else {
|
||||||
|
ifftDIT4_avx2_1(work, dist*24, t01, t23, t02)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if log_m23 == modulus {
|
||||||
|
if log_m02 == modulus {
|
||||||
|
ifftDIT4_avx2_6(work, dist*24, t01, t23, t02)
|
||||||
|
} else {
|
||||||
|
ifftDIT4_avx2_2(work, dist*24, t01, t23, t02)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if log_m02 == modulus {
|
||||||
|
ifftDIT4_avx2_4(work, dist*24, t01, t23, t02)
|
||||||
|
} else {
|
||||||
|
ifftDIT4_avx2_0(work, dist*24, t01, t23, t02)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ifftDIT4Ref(work, dist, log_m01, log_m23, log_m02, o)
|
||||||
|
}
|
||||||
|
|
||||||
|
func fftDIT4(work [][]byte, dist int, log_m01, log_m23, log_m02 ffe, o *options) {
|
||||||
|
if len(work[0]) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
t01 := &multiply256LUT[log_m01]
|
||||||
|
t23 := &multiply256LUT[log_m23]
|
||||||
|
t02 := &multiply256LUT[log_m02]
|
||||||
|
if o.useAVX512 {
|
||||||
|
if log_m02 == modulus {
|
||||||
|
if log_m01 == modulus {
|
||||||
|
if log_m23 == modulus {
|
||||||
|
fftDIT4_avx512_7(work, dist*24, t01, t23, t02)
|
||||||
|
} else {
|
||||||
|
fftDIT4_avx512_3(work, dist*24, t01, t23, t02)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if log_m23 == modulus {
|
||||||
|
fftDIT4_avx512_5(work, dist*24, t01, t23, t02)
|
||||||
|
} else {
|
||||||
|
fftDIT4_avx512_1(work, dist*24, t01, t23, t02)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if log_m01 == modulus {
|
||||||
|
if log_m23 == modulus {
|
||||||
|
fftDIT4_avx512_6(work, dist*24, t01, t23, t02)
|
||||||
|
} else {
|
||||||
|
fftDIT4_avx512_2(work, dist*24, t01, t23, t02)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if log_m23 == modulus {
|
||||||
|
fftDIT4_avx512_4(work, dist*24, t01, t23, t02)
|
||||||
|
} else {
|
||||||
|
fftDIT4_avx512_0(work, dist*24, t01, t23, t02)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
} else if o.useAVX2 {
|
||||||
|
if log_m02 == modulus {
|
||||||
|
if log_m01 == modulus {
|
||||||
|
if log_m23 == modulus {
|
||||||
|
fftDIT4_avx2_7(work, dist*24, t01, t23, t02)
|
||||||
|
} else {
|
||||||
|
fftDIT4_avx2_3(work, dist*24, t01, t23, t02)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if log_m23 == modulus {
|
||||||
|
fftDIT4_avx2_5(work, dist*24, t01, t23, t02)
|
||||||
|
} else {
|
||||||
|
fftDIT4_avx2_1(work, dist*24, t01, t23, t02)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if log_m01 == modulus {
|
||||||
|
if log_m23 == modulus {
|
||||||
|
fftDIT4_avx2_6(work, dist*24, t01, t23, t02)
|
||||||
|
} else {
|
||||||
|
fftDIT4_avx2_2(work, dist*24, t01, t23, t02)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if log_m23 == modulus {
|
||||||
|
fftDIT4_avx2_4(work, dist*24, t01, t23, t02)
|
||||||
|
} else {
|
||||||
|
fftDIT4_avx2_0(work, dist*24, t01, t23, t02)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
fftDIT4Ref(work, dist, log_m01, log_m23, log_m02, o)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2-way butterfly forward
|
||||||
|
func fftDIT2(x, y []byte, log_m ffe, o *options) {
|
||||||
|
if o.useAVX2 {
|
||||||
|
if len(x) > 0 {
|
||||||
|
tmp := &multiply256LUT[log_m]
|
||||||
|
fftDIT2_avx2(x, y, tmp)
|
||||||
|
}
|
||||||
|
} else if o.useSSSE3 {
|
||||||
|
if len(x) > 0 {
|
||||||
|
tmp := &multiply256LUT[log_m]
|
||||||
|
fftDIT2_ssse3(x, y, tmp)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Reference version:
|
||||||
|
refMulAdd(x, y, log_m)
|
||||||
|
sliceXor(x, y, o)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2-way butterfly
|
||||||
|
func ifftDIT2(x, y []byte, log_m ffe, o *options) {
|
||||||
|
if o.useAVX2 {
|
||||||
|
if len(x) > 0 {
|
||||||
|
tmp := &multiply256LUT[log_m]
|
||||||
|
ifftDIT2_avx2(x, y, tmp)
|
||||||
|
}
|
||||||
|
} else if o.useSSSE3 {
|
||||||
|
if len(x) > 0 {
|
||||||
|
tmp := &multiply256LUT[log_m]
|
||||||
|
ifftDIT2_ssse3(x, y, tmp)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Reference version:
|
||||||
|
sliceXor(x, y, o)
|
||||||
|
refMulAdd(x, y, log_m)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func mulgf16(x, y []byte, log_m ffe, o *options) {
|
||||||
|
if o.useAVX2 {
|
||||||
|
if len(x) > 0 {
|
||||||
|
tmp := &multiply256LUT[log_m]
|
||||||
|
mulgf16_avx2(x, y, tmp)
|
||||||
|
}
|
||||||
|
} else if o.useSSSE3 {
|
||||||
|
if len(x) > 0 {
|
||||||
|
tmp := &multiply256LUT[log_m]
|
||||||
|
mulgf16_ssse3(x, y, tmp)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
refMul(x, y, log_m)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -64,3 +64,33 @@ func sliceXor(in, out []byte, o *options) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 4-way butterfly
|
||||||
|
func ifftDIT4(work [][]byte, dist int, log_m01, log_m23, log_m02 ffe, o *options) {
|
||||||
|
ifftDIT4Ref(work, dist, log_m01, log_m23, log_m02, o)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4-way butterfly
|
||||||
|
func fftDIT4(work [][]byte, dist int, log_m01, log_m23, log_m02 ffe, o *options) {
|
||||||
|
fftDIT4Ref(work, dist, log_m01, log_m23, log_m02, o)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2-way butterfly forward
|
||||||
|
func fftDIT2(x, y []byte, log_m ffe, o *options) {
|
||||||
|
// Reference version:
|
||||||
|
refMulAdd(x, y, log_m)
|
||||||
|
// 64 byte aligned, always full.
|
||||||
|
galXorNEON(x, y)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2-way butterfly
|
||||||
|
func ifftDIT2(x, y []byte, log_m ffe, o *options) {
|
||||||
|
// 64 byte aligned, always full.
|
||||||
|
galXorNEON(x, y)
|
||||||
|
// Reference version:
|
||||||
|
refMulAdd(x, y, log_m)
|
||||||
|
}
|
||||||
|
|
||||||
|
func mulgf16(x, y []byte, log_m ffe, o *options) {
|
||||||
|
refMul(x, y, log_m)
|
||||||
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -7,8 +7,6 @@
|
||||||
|
|
||||||
package reedsolomon
|
package reedsolomon
|
||||||
|
|
||||||
import "encoding/binary"
|
|
||||||
|
|
||||||
func galMulSlice(c byte, in, out []byte, o *options) {
|
func galMulSlice(c byte, in, out []byte, o *options) {
|
||||||
out = out[:len(in)]
|
out = out[:len(in)]
|
||||||
if c == 1 {
|
if c == 1 {
|
||||||
|
@ -34,25 +32,38 @@ func galMulSliceXor(c byte, in, out []byte, o *options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// simple slice xor
|
// simple slice xor
|
||||||
func sliceXor(in, out []byte, _ *options) {
|
func sliceXor(in, out []byte, o *options) {
|
||||||
for len(out) >= 32 {
|
sliceXorGo(in, out, o)
|
||||||
inS := in[:32]
|
|
||||||
v0 := binary.LittleEndian.Uint64(out[:]) ^ binary.LittleEndian.Uint64(inS[:])
|
|
||||||
v1 := binary.LittleEndian.Uint64(out[8:]) ^ binary.LittleEndian.Uint64(inS[8:])
|
|
||||||
v2 := binary.LittleEndian.Uint64(out[16:]) ^ binary.LittleEndian.Uint64(inS[16:])
|
|
||||||
v3 := binary.LittleEndian.Uint64(out[24:]) ^ binary.LittleEndian.Uint64(inS[24:])
|
|
||||||
binary.LittleEndian.PutUint64(out[:], v0)
|
|
||||||
binary.LittleEndian.PutUint64(out[8:], v1)
|
|
||||||
binary.LittleEndian.PutUint64(out[16:], v2)
|
|
||||||
binary.LittleEndian.PutUint64(out[24:], v3)
|
|
||||||
out = out[32:]
|
|
||||||
in = in[32:]
|
|
||||||
}
|
|
||||||
for n, input := range in {
|
|
||||||
out[n] ^= input
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
defaultOptions.useAVX512 = false
|
defaultOptions.useAVX512 = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 4-way butterfly
|
||||||
|
func ifftDIT4(work [][]byte, dist int, log_m01, log_m23, log_m02 ffe, o *options) {
|
||||||
|
ifftDIT4Ref(work, dist, log_m01, log_m23, log_m02, o)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4-way butterfly
|
||||||
|
func fftDIT4(work [][]byte, dist int, log_m01, log_m23, log_m02 ffe, o *options) {
|
||||||
|
fftDIT4Ref(work, dist, log_m01, log_m23, log_m02, o)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2-way butterfly forward
|
||||||
|
func fftDIT2(x, y []byte, log_m ffe, o *options) {
|
||||||
|
// Reference version:
|
||||||
|
refMulAdd(x, y, log_m)
|
||||||
|
sliceXorGo(x, y, o)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2-way butterfly inverse
|
||||||
|
func ifftDIT2(x, y []byte, log_m ffe, o *options) {
|
||||||
|
// Reference version:
|
||||||
|
sliceXorGo(x, y, o)
|
||||||
|
refMulAdd(x, y, log_m)
|
||||||
|
}
|
||||||
|
|
||||||
|
func mulgf16(x, y []byte, log_m ffe, o *options) {
|
||||||
|
refMul(x, y, log_m)
|
||||||
|
}
|
||||||
|
|
|
@ -72,3 +72,31 @@ func sliceXor(in, out []byte, o *options) {
|
||||||
out[n] ^= input
|
out[n] ^= input
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 4-way butterfly
|
||||||
|
func ifftDIT4(work [][]byte, dist int, log_m01, log_m23, log_m02 ffe, o *options) {
|
||||||
|
ifftDIT4Ref(work, dist, log_m01, log_m23, log_m02, o)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4-way butterfly
|
||||||
|
func fftDIT4(work [][]byte, dist int, log_m01, log_m23, log_m02 ffe, o *options) {
|
||||||
|
fftDIT4Ref(work, dist, log_m01, log_m23, log_m02, o)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2-way butterfly forward
|
||||||
|
func fftDIT2(x, y []byte, log_m ffe, o *options) {
|
||||||
|
// Reference version:
|
||||||
|
refMulAdd(x, y, log_m)
|
||||||
|
sliceXor(x, y, o)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2-way butterfly inverse
|
||||||
|
func ifftDIT2(x, y []byte, log_m ffe, o *options) {
|
||||||
|
// Reference version:
|
||||||
|
sliceXor(x, y, o)
|
||||||
|
refMulAdd(x, y, log_m)
|
||||||
|
}
|
||||||
|
|
||||||
|
func mulgf16(x, y []byte, log_m ffe, o *options) {
|
||||||
|
refMul(x, y, log_m)
|
||||||
|
}
|
||||||
|
|
|
@ -16,10 +16,13 @@ type options struct {
|
||||||
perRound int
|
perRound int
|
||||||
|
|
||||||
useAVX512, useAVX2, useSSSE3, useSSE2 bool
|
useAVX512, useAVX2, useSSSE3, useSSE2 bool
|
||||||
|
useJerasureMatrix bool
|
||||||
usePAR1Matrix bool
|
usePAR1Matrix bool
|
||||||
useCauchy bool
|
useCauchy bool
|
||||||
fastOneParity bool
|
fastOneParity bool
|
||||||
inversionCache bool
|
inversionCache bool
|
||||||
|
customMatrix [][]byte
|
||||||
|
withLeopard *bool
|
||||||
|
|
||||||
// stream options
|
// stream options
|
||||||
concReads bool
|
concReads bool
|
||||||
|
@ -130,36 +133,57 @@ func WithStreamBlockSize(n int) Option {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func withSSSE3(enabled bool) Option {
|
// WithSSSE3 allows to enable/disable SSSE3 instructions.
|
||||||
|
// If not set, SSSE3 will be turned on or off automatically based on CPU ID information.
|
||||||
|
func WithSSSE3(enabled bool) Option {
|
||||||
return func(o *options) {
|
return func(o *options) {
|
||||||
o.useSSSE3 = enabled
|
o.useSSSE3 = enabled
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func withAVX2(enabled bool) Option {
|
// WithAVX2 allows to enable/disable AVX2 instructions.
|
||||||
|
// If not set, AVX2 will be turned on or off automatically based on CPU ID information.
|
||||||
|
func WithAVX2(enabled bool) Option {
|
||||||
return func(o *options) {
|
return func(o *options) {
|
||||||
o.useAVX2 = enabled
|
o.useAVX2 = enabled
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func withSSE2(enabled bool) Option {
|
// WithSSE2 allows to enable/disable SSE2 instructions.
|
||||||
|
// If not set, SSE2 will be turned on or off automatically based on CPU ID information.
|
||||||
|
func WithSSE2(enabled bool) Option {
|
||||||
return func(o *options) {
|
return func(o *options) {
|
||||||
o.useSSE2 = enabled
|
o.useSSE2 = enabled
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func withAVX512(enabled bool) Option {
|
// WithAVX512 allows to enable/disable AVX512 instructions.
|
||||||
|
// If not set, AVX512 will be turned on or off automatically based on CPU ID information.
|
||||||
|
func WithAVX512(enabled bool) Option {
|
||||||
return func(o *options) {
|
return func(o *options) {
|
||||||
o.useAVX512 = enabled
|
o.useAVX512 = enabled
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithJerasureMatrix causes the encoder to build the Reed-Solomon-Vandermonde
|
||||||
|
// matrix in the same way as done by the Jerasure library.
|
||||||
|
// The first row and column of the coding matrix only contains 1's in this method
|
||||||
|
// so the first parity chunk is always equal to XOR of all data chunks.
|
||||||
|
func WithJerasureMatrix() Option {
|
||||||
|
return func(o *options) {
|
||||||
|
o.useJerasureMatrix = true
|
||||||
|
o.usePAR1Matrix = false
|
||||||
|
o.useCauchy = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// WithPAR1Matrix causes the encoder to build the matrix how PARv1
|
// WithPAR1Matrix causes the encoder to build the matrix how PARv1
|
||||||
// does. Note that the method they use is buggy, and may lead to cases
|
// does. Note that the method they use is buggy, and may lead to cases
|
||||||
// where recovery is impossible, even if there are enough parity
|
// where recovery is impossible, even if there are enough parity
|
||||||
// shards.
|
// shards.
|
||||||
func WithPAR1Matrix() Option {
|
func WithPAR1Matrix() Option {
|
||||||
return func(o *options) {
|
return func(o *options) {
|
||||||
|
o.useJerasureMatrix = false
|
||||||
o.usePAR1Matrix = true
|
o.usePAR1Matrix = true
|
||||||
o.useCauchy = false
|
o.useCauchy = false
|
||||||
}
|
}
|
||||||
|
@ -171,8 +195,9 @@ func WithPAR1Matrix() Option {
|
||||||
// but will result in slightly faster start-up time.
|
// but will result in slightly faster start-up time.
|
||||||
func WithCauchyMatrix() Option {
|
func WithCauchyMatrix() Option {
|
||||||
return func(o *options) {
|
return func(o *options) {
|
||||||
o.useCauchy = true
|
o.useJerasureMatrix = false
|
||||||
o.usePAR1Matrix = false
|
o.usePAR1Matrix = false
|
||||||
|
o.useCauchy = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,3 +209,26 @@ func WithFastOneParityMatrix() Option {
|
||||||
o.fastOneParity = true
|
o.fastOneParity = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithCustomMatrix causes the encoder to use the manually specified matrix.
|
||||||
|
// customMatrix represents only the parity chunks.
|
||||||
|
// customMatrix must have at least ParityShards rows and DataShards columns.
|
||||||
|
// It can be used for interoperability with libraries which generate
|
||||||
|
// the matrix differently or to implement more complex coding schemes like LRC
|
||||||
|
// (locally reconstructible codes).
|
||||||
|
func WithCustomMatrix(customMatrix [][]byte) Option {
|
||||||
|
return func(o *options) {
|
||||||
|
o.customMatrix = customMatrix
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithLeopardGF16 will always use leopard GF16 for encoding,
|
||||||
|
// even when there is less than 256 shards.
|
||||||
|
// This will likely improve reconstruction time for some setups.
|
||||||
|
// This is not compatible with Leopard output for <= 256 shards.
|
||||||
|
// Note that Leopard places certain restrictions on use see other documentation.
|
||||||
|
func WithLeopardGF16(enabled bool) Option {
|
||||||
|
return func(o *options) {
|
||||||
|
o.withLeopard = &enabled
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
// Package reedsolomon enables Erasure Coding in Go
|
// Package reedsolomon enables Erasure Coding in Go
|
||||||
//
|
//
|
||||||
// For usage and examples, see https://github.com/klauspost/reedsolomon
|
// For usage and examples, see https://github.com/klauspost/reedsolomon
|
||||||
//
|
|
||||||
package reedsolomon
|
package reedsolomon
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -77,6 +76,24 @@ type Encoder interface {
|
||||||
// calling the Verify function is likely to fail.
|
// calling the Verify function is likely to fail.
|
||||||
ReconstructData(shards [][]byte) error
|
ReconstructData(shards [][]byte) error
|
||||||
|
|
||||||
|
// ReconstructSome will recreate only requested data shards, if possible.
|
||||||
|
//
|
||||||
|
// Given a list of shards, some of which contain data, fills in the
|
||||||
|
// data shards indicated by true values in the "required" parameter.
|
||||||
|
// The length of "required" array must be equal to DataShards.
|
||||||
|
//
|
||||||
|
// The length of "shards" array must be equal to Shards.
|
||||||
|
// You indicate that a shard is missing by setting it to nil or zero-length.
|
||||||
|
// If a shard is zero-length but has sufficient capacity, that memory will
|
||||||
|
// be used, otherwise a new []byte will be allocated.
|
||||||
|
//
|
||||||
|
// If there are too few shards to reconstruct the missing
|
||||||
|
// ones, ErrTooFewShards will be returned.
|
||||||
|
//
|
||||||
|
// As the reconstructed shard set may contain missing parity shards,
|
||||||
|
// calling the Verify function is likely to fail.
|
||||||
|
ReconstructSome(shards [][]byte, required []bool) error
|
||||||
|
|
||||||
// Update parity is use for change a few data shards and update it's parity.
|
// Update parity is use for change a few data shards and update it's parity.
|
||||||
// Input 'newDatashards' containing data shards changed.
|
// Input 'newDatashards' containing data shards changed.
|
||||||
// Input 'shards' containing old data shards (if data shard not changed, it can be nil) and old parity shards.
|
// Input 'shards' containing old data shards (if data shard not changed, it can be nil) and old parity shards.
|
||||||
|
@ -108,6 +125,22 @@ type Encoder interface {
|
||||||
Join(dst io.Writer, shards [][]byte, outSize int) error
|
Join(dst io.Writer, shards [][]byte, outSize int) error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Extensions is an optional interface.
|
||||||
|
// All returned instances will support this interface.
|
||||||
|
type Extensions interface {
|
||||||
|
// ShardSizeMultiple will return the size the shard sizes must be a multiple of.
|
||||||
|
ShardSizeMultiple() int
|
||||||
|
|
||||||
|
// DataShards will return the number of data shards.
|
||||||
|
DataShards() int
|
||||||
|
|
||||||
|
// ParityShards will return the number of parity shards.
|
||||||
|
ParityShards() int
|
||||||
|
|
||||||
|
// TotalShards will return the total number of shards.
|
||||||
|
TotalShards() int
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
avx2CodeGenMinSize = 64
|
avx2CodeGenMinSize = 64
|
||||||
avx2CodeGenMinShards = 3
|
avx2CodeGenMinShards = 3
|
||||||
|
@ -121,9 +154,9 @@ const (
|
||||||
// distribution of datashards and parity shards.
|
// distribution of datashards and parity shards.
|
||||||
// Construct if using New()
|
// Construct if using New()
|
||||||
type reedSolomon struct {
|
type reedSolomon struct {
|
||||||
DataShards int // Number of data shards, should not be modified.
|
dataShards int // Number of data shards, should not be modified.
|
||||||
ParityShards int // Number of parity shards, should not be modified.
|
parityShards int // Number of parity shards, should not be modified.
|
||||||
Shards int // Total number of shards. Calculated, and should not be modified.
|
totalShards int // Total number of shards. Calculated, and should not be modified.
|
||||||
m matrix
|
m matrix
|
||||||
tree *inversionTree
|
tree *inversionTree
|
||||||
parity [][]byte
|
parity [][]byte
|
||||||
|
@ -131,6 +164,24 @@ type reedSolomon struct {
|
||||||
mPool sync.Pool
|
mPool sync.Pool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _ = Extensions(&reedSolomon{})
|
||||||
|
|
||||||
|
func (r *reedSolomon) ShardSizeMultiple() int {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *reedSolomon) DataShards() int {
|
||||||
|
return r.dataShards
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *reedSolomon) ParityShards() int {
|
||||||
|
return r.parityShards
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *reedSolomon) TotalShards() int {
|
||||||
|
return r.parityShards
|
||||||
|
}
|
||||||
|
|
||||||
// ErrInvShardNum will be returned by New, if you attempt to create
|
// ErrInvShardNum will be returned by New, if you attempt to create
|
||||||
// an Encoder with less than one data shard or less than zero parity
|
// an Encoder with less than one data shard or less than zero parity
|
||||||
// shards.
|
// shards.
|
||||||
|
@ -141,6 +192,9 @@ var ErrInvShardNum = errors.New("cannot create Encoder with less than one data s
|
||||||
// GF(2^8).
|
// GF(2^8).
|
||||||
var ErrMaxShardNum = errors.New("cannot create Encoder with more than 256 data+parity shards")
|
var ErrMaxShardNum = errors.New("cannot create Encoder with more than 256 data+parity shards")
|
||||||
|
|
||||||
|
// ErrNotSupported is returned when an operation is not supported.
|
||||||
|
var ErrNotSupported = errors.New("operation not supported")
|
||||||
|
|
||||||
// buildMatrix creates the matrix to use for encoding, given the
|
// buildMatrix creates the matrix to use for encoding, given the
|
||||||
// number of data shards and the number of total shards.
|
// number of data shards and the number of total shards.
|
||||||
//
|
//
|
||||||
|
@ -173,6 +227,87 @@ func buildMatrix(dataShards, totalShards int) (matrix, error) {
|
||||||
return vm.Multiply(topInv)
|
return vm.Multiply(topInv)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// buildMatrixJerasure creates the same encoding matrix as Jerasure library
|
||||||
|
//
|
||||||
|
// The top square of the matrix is guaranteed to be an identity
|
||||||
|
// matrix, which means that the data shards are unchanged after
|
||||||
|
// encoding.
|
||||||
|
func buildMatrixJerasure(dataShards, totalShards int) (matrix, error) {
|
||||||
|
// Start with a Vandermonde matrix. This matrix would work,
|
||||||
|
// in theory, but doesn't have the property that the data
|
||||||
|
// shards are unchanged after encoding.
|
||||||
|
vm, err := vandermonde(totalShards, dataShards)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Jerasure does this:
|
||||||
|
// first row is always 100..00
|
||||||
|
vm[0][0] = 1
|
||||||
|
for i := 1; i < dataShards; i++ {
|
||||||
|
vm[0][i] = 0
|
||||||
|
}
|
||||||
|
// last row is always 000..01
|
||||||
|
for i := 0; i < dataShards-1; i++ {
|
||||||
|
vm[totalShards-1][i] = 0
|
||||||
|
}
|
||||||
|
vm[totalShards-1][dataShards-1] = 1
|
||||||
|
|
||||||
|
for i := 0; i < dataShards; i++ {
|
||||||
|
// Find the row where i'th col is not 0
|
||||||
|
r := i
|
||||||
|
for ; r < totalShards && vm[r][i] == 0; r++ {
|
||||||
|
}
|
||||||
|
if r != i {
|
||||||
|
// Swap it with i'th row if not already
|
||||||
|
t := vm[r]
|
||||||
|
vm[r] = vm[i]
|
||||||
|
vm[i] = t
|
||||||
|
}
|
||||||
|
// Multiply by the inverted matrix (same as vm.Multiply(vm[0:dataShards].Invert()))
|
||||||
|
if vm[i][i] != 1 {
|
||||||
|
// Make vm[i][i] = 1 by dividing the column by vm[i][i]
|
||||||
|
tmp := galDivide(1, vm[i][i])
|
||||||
|
for j := 0; j < totalShards; j++ {
|
||||||
|
vm[j][i] = galMultiply(vm[j][i], tmp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for j := 0; j < dataShards; j++ {
|
||||||
|
// Make vm[i][j] = 0 where j != i by adding vm[i][j]*vm[.][i] to each column
|
||||||
|
tmp := vm[i][j]
|
||||||
|
if j != i && tmp != 0 {
|
||||||
|
for r := 0; r < totalShards; r++ {
|
||||||
|
vm[r][j] = galAdd(vm[r][j], galMultiply(tmp, vm[r][i]))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make vm[dataShards] row all ones - divide each column j by vm[dataShards][j]
|
||||||
|
for j := 0; j < dataShards; j++ {
|
||||||
|
tmp := vm[dataShards][j]
|
||||||
|
if tmp != 1 {
|
||||||
|
tmp = galDivide(1, tmp)
|
||||||
|
for i := dataShards; i < totalShards; i++ {
|
||||||
|
vm[i][j] = galMultiply(vm[i][j], tmp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make vm[dataShards...totalShards-1][0] column all ones - divide each row
|
||||||
|
for i := dataShards + 1; i < totalShards; i++ {
|
||||||
|
tmp := vm[i][0]
|
||||||
|
if tmp != 1 {
|
||||||
|
tmp = galDivide(1, tmp)
|
||||||
|
for j := 0; j < dataShards; j++ {
|
||||||
|
vm[i][j] = galMultiply(vm[i][j], tmp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return vm, nil
|
||||||
|
}
|
||||||
|
|
||||||
// buildMatrixPAR1 creates the matrix to use for encoding according to
|
// buildMatrixPAR1 creates the matrix to use for encoding according to
|
||||||
// the PARv1 spec, given the number of data shards and the number of
|
// the PARv1 spec, given the number of data shards and the number of
|
||||||
// total shards. Note that the method they use is buggy, and may lead
|
// total shards. Note that the method they use is buggy, and may lead
|
||||||
|
@ -252,41 +387,70 @@ func buildXorMatrix(dataShards, totalShards int) (matrix, error) {
|
||||||
// New creates a new encoder and initializes it to
|
// New creates a new encoder and initializes it to
|
||||||
// the number of data shards and parity shards that
|
// the number of data shards and parity shards that
|
||||||
// you want to use. You can reuse this encoder.
|
// you want to use. You can reuse this encoder.
|
||||||
// Note that the maximum number of total shards is 256.
|
// Note that the maximum number of total shards is 65536, with some
|
||||||
|
// restrictions for a total larger than 256:
|
||||||
|
//
|
||||||
|
// - Shard sizes must be multiple of 64
|
||||||
|
// - The methods Join/Split/Update/EncodeIdx are not supported
|
||||||
|
//
|
||||||
// If no options are supplied, default options are used.
|
// If no options are supplied, default options are used.
|
||||||
func New(dataShards, parityShards int, opts ...Option) (Encoder, error) {
|
func New(dataShards, parityShards int, opts ...Option) (Encoder, error) {
|
||||||
r := reedSolomon{
|
o := defaultOptions
|
||||||
DataShards: dataShards,
|
|
||||||
ParityShards: parityShards,
|
|
||||||
Shards: dataShards + parityShards,
|
|
||||||
o: defaultOptions,
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, opt := range opts {
|
for _, opt := range opts {
|
||||||
opt(&r.o)
|
opt(&o)
|
||||||
}
|
|
||||||
if dataShards <= 0 || parityShards < 0 {
|
|
||||||
return nil, ErrInvShardNum
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dataShards+parityShards > 256 && o.withLeopard == nil) ||
|
||||||
|
(o.withLeopard != nil && *o.withLeopard == true && parityShards > 0) {
|
||||||
|
return newFF16(dataShards, parityShards, o)
|
||||||
|
}
|
||||||
if dataShards+parityShards > 256 {
|
if dataShards+parityShards > 256 {
|
||||||
return nil, ErrMaxShardNum
|
return nil, ErrMaxShardNum
|
||||||
}
|
}
|
||||||
|
|
||||||
|
r := reedSolomon{
|
||||||
|
dataShards: dataShards,
|
||||||
|
parityShards: parityShards,
|
||||||
|
totalShards: dataShards + parityShards,
|
||||||
|
o: o,
|
||||||
|
}
|
||||||
|
|
||||||
|
if dataShards <= 0 || parityShards < 0 {
|
||||||
|
return nil, ErrInvShardNum
|
||||||
|
}
|
||||||
|
|
||||||
if parityShards == 0 {
|
if parityShards == 0 {
|
||||||
return &r, nil
|
return &r, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
switch {
|
switch {
|
||||||
|
case r.o.customMatrix != nil:
|
||||||
|
if len(r.o.customMatrix) < parityShards {
|
||||||
|
return nil, errors.New("coding matrix must contain at least parityShards rows")
|
||||||
|
}
|
||||||
|
r.m = make([][]byte, r.totalShards)
|
||||||
|
for i := 0; i < dataShards; i++ {
|
||||||
|
r.m[i] = make([]byte, dataShards)
|
||||||
|
r.m[i][i] = 1
|
||||||
|
}
|
||||||
|
for k, row := range r.o.customMatrix {
|
||||||
|
if len(row) < dataShards {
|
||||||
|
return nil, errors.New("coding matrix must contain at least dataShards columns")
|
||||||
|
}
|
||||||
|
r.m[dataShards+k] = make([]byte, dataShards)
|
||||||
|
copy(r.m[dataShards+k], row)
|
||||||
|
}
|
||||||
case r.o.fastOneParity && parityShards == 1:
|
case r.o.fastOneParity && parityShards == 1:
|
||||||
r.m, err = buildXorMatrix(dataShards, r.Shards)
|
r.m, err = buildXorMatrix(dataShards, r.totalShards)
|
||||||
case r.o.useCauchy:
|
case r.o.useCauchy:
|
||||||
r.m, err = buildMatrixCauchy(dataShards, r.Shards)
|
r.m, err = buildMatrixCauchy(dataShards, r.totalShards)
|
||||||
case r.o.usePAR1Matrix:
|
case r.o.usePAR1Matrix:
|
||||||
r.m, err = buildMatrixPAR1(dataShards, r.Shards)
|
r.m, err = buildMatrixPAR1(dataShards, r.totalShards)
|
||||||
|
case r.o.useJerasureMatrix:
|
||||||
|
r.m, err = buildMatrixJerasure(dataShards, r.totalShards)
|
||||||
default:
|
default:
|
||||||
r.m, err = buildMatrix(dataShards, r.Shards)
|
r.m, err = buildMatrix(dataShards, r.totalShards)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -384,7 +548,7 @@ func New(dataShards, parityShards int, opts ...Option) (Encoder, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if avx2CodeGen && r.o.useAVX2 {
|
if avx2CodeGen && r.o.useAVX2 {
|
||||||
sz := r.DataShards * r.ParityShards * 2 * 32
|
sz := r.dataShards * r.parityShards * 2 * 32
|
||||||
r.mPool.New = func() interface{} {
|
r.mPool.New = func() interface{} {
|
||||||
return make([]byte, sz)
|
return make([]byte, sz)
|
||||||
}
|
}
|
||||||
|
@ -404,7 +568,7 @@ var ErrTooFewShards = errors.New("too few shards given")
|
||||||
// The parity shards will always be overwritten and the data shards
|
// The parity shards will always be overwritten and the data shards
|
||||||
// will remain the same.
|
// will remain the same.
|
||||||
func (r *reedSolomon) Encode(shards [][]byte) error {
|
func (r *reedSolomon) Encode(shards [][]byte) error {
|
||||||
if len(shards) != r.Shards {
|
if len(shards) != r.totalShards {
|
||||||
return ErrTooFewShards
|
return ErrTooFewShards
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -414,10 +578,10 @@ func (r *reedSolomon) Encode(shards [][]byte) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the slice of output buffers.
|
// Get the slice of output buffers.
|
||||||
output := shards[r.DataShards:]
|
output := shards[r.dataShards:]
|
||||||
|
|
||||||
// Do the coding.
|
// Do the coding.
|
||||||
r.codeSomeShards(r.parity, shards[0:r.DataShards], output[:r.ParityShards], len(shards[0]))
|
r.codeSomeShards(r.parity, shards[0:r.dataShards], output[:r.parityShards], len(shards[0]))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,13 +590,13 @@ func (r *reedSolomon) Encode(shards [][]byte) error {
|
||||||
// Data shards should only be delivered once. There is no check for this.
|
// Data shards should only be delivered once. There is no check for this.
|
||||||
// The parity shards will always be updated and the data shards will remain the unchanged.
|
// The parity shards will always be updated and the data shards will remain the unchanged.
|
||||||
func (r *reedSolomon) EncodeIdx(dataShard []byte, idx int, parity [][]byte) error {
|
func (r *reedSolomon) EncodeIdx(dataShard []byte, idx int, parity [][]byte) error {
|
||||||
if len(parity) != r.ParityShards {
|
if len(parity) != r.parityShards {
|
||||||
return ErrTooFewShards
|
return ErrTooFewShards
|
||||||
}
|
}
|
||||||
if len(parity) == 0 {
|
if len(parity) == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if idx < 0 || idx >= r.DataShards {
|
if idx < 0 || idx >= r.dataShards {
|
||||||
return ErrInvShardNum
|
return ErrInvShardNum
|
||||||
}
|
}
|
||||||
err := checkShards(parity, false)
|
err := checkShards(parity, false)
|
||||||
|
@ -451,7 +615,7 @@ func (r *reedSolomon) EncodeIdx(dataShard []byte, idx int, parity [][]byte) erro
|
||||||
|
|
||||||
for start < len(dataShard) {
|
for start < len(dataShard) {
|
||||||
in := dataShard[start:end]
|
in := dataShard[start:end]
|
||||||
for iRow := 0; iRow < r.ParityShards; iRow++ {
|
for iRow := 0; iRow < r.parityShards; iRow++ {
|
||||||
galMulSliceXor(r.parity[iRow][idx], in, parity[iRow][start:end], &r.o)
|
galMulSliceXor(r.parity[iRow][idx], in, parity[iRow][start:end], &r.o)
|
||||||
}
|
}
|
||||||
start = end
|
start = end
|
||||||
|
@ -467,11 +631,11 @@ func (r *reedSolomon) EncodeIdx(dataShard []byte, idx int, parity [][]byte) erro
|
||||||
var ErrInvalidInput = errors.New("invalid input")
|
var ErrInvalidInput = errors.New("invalid input")
|
||||||
|
|
||||||
func (r *reedSolomon) Update(shards [][]byte, newDatashards [][]byte) error {
|
func (r *reedSolomon) Update(shards [][]byte, newDatashards [][]byte) error {
|
||||||
if len(shards) != r.Shards {
|
if len(shards) != r.totalShards {
|
||||||
return ErrTooFewShards
|
return ErrTooFewShards
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(newDatashards) != r.DataShards {
|
if len(newDatashards) != r.dataShards {
|
||||||
return ErrTooFewShards
|
return ErrTooFewShards
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -490,7 +654,7 @@ func (r *reedSolomon) Update(shards [][]byte, newDatashards [][]byte) error {
|
||||||
return ErrInvalidInput
|
return ErrInvalidInput
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, p := range shards[r.DataShards:] {
|
for _, p := range shards[r.dataShards:] {
|
||||||
if p == nil {
|
if p == nil {
|
||||||
return ErrInvalidInput
|
return ErrInvalidInput
|
||||||
}
|
}
|
||||||
|
@ -499,10 +663,10 @@ func (r *reedSolomon) Update(shards [][]byte, newDatashards [][]byte) error {
|
||||||
shardSize := shardSize(shards)
|
shardSize := shardSize(shards)
|
||||||
|
|
||||||
// Get the slice of output buffers.
|
// Get the slice of output buffers.
|
||||||
output := shards[r.DataShards:]
|
output := shards[r.dataShards:]
|
||||||
|
|
||||||
// Do the coding.
|
// Do the coding.
|
||||||
r.updateParityShards(r.parity, shards[0:r.DataShards], newDatashards[0:r.DataShards], output, r.ParityShards, shardSize)
|
r.updateParityShards(r.parity, shards[0:r.dataShards], newDatashards[0:r.dataShards], output, r.parityShards, shardSize)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -516,7 +680,7 @@ func (r *reedSolomon) updateParityShards(matrixRows, oldinputs, newinputs, outpu
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
for c := 0; c < r.DataShards; c++ {
|
for c := 0; c < r.dataShards; c++ {
|
||||||
in := newinputs[c]
|
in := newinputs[c]
|
||||||
if in == nil {
|
if in == nil {
|
||||||
continue
|
continue
|
||||||
|
@ -543,7 +707,7 @@ func (r *reedSolomon) updateParityShardsP(matrixRows, oldinputs, newinputs, outp
|
||||||
}
|
}
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func(start, stop int) {
|
go func(start, stop int) {
|
||||||
for c := 0; c < r.DataShards; c++ {
|
for c := 0; c < r.dataShards; c++ {
|
||||||
in := newinputs[c]
|
in := newinputs[c]
|
||||||
if in == nil {
|
if in == nil {
|
||||||
continue
|
continue
|
||||||
|
@ -565,7 +729,7 @@ func (r *reedSolomon) updateParityShardsP(matrixRows, oldinputs, newinputs, outp
|
||||||
// Verify returns true if the parity shards contain the right data.
|
// Verify returns true if the parity shards contain the right data.
|
||||||
// The data is the same format as Encode. No data is modified.
|
// The data is the same format as Encode. No data is modified.
|
||||||
func (r *reedSolomon) Verify(shards [][]byte) (bool, error) {
|
func (r *reedSolomon) Verify(shards [][]byte) (bool, error) {
|
||||||
if len(shards) != r.Shards {
|
if len(shards) != r.totalShards {
|
||||||
return false, ErrTooFewShards
|
return false, ErrTooFewShards
|
||||||
}
|
}
|
||||||
err := checkShards(shards, false)
|
err := checkShards(shards, false)
|
||||||
|
@ -574,10 +738,10 @@ func (r *reedSolomon) Verify(shards [][]byte) (bool, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Slice of buffers being checked.
|
// Slice of buffers being checked.
|
||||||
toCheck := shards[r.DataShards:]
|
toCheck := shards[r.dataShards:]
|
||||||
|
|
||||||
// Do the checking.
|
// Do the checking.
|
||||||
return r.checkSomeShards(r.parity, shards[:r.DataShards], toCheck[:r.ParityShards], len(shards[0])), nil
|
return r.checkSomeShards(r.parity, shards[:r.dataShards], toCheck[:r.parityShards], len(shards[0])), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *reedSolomon) canAVX2C(byteCount int, inputs, outputs int) bool {
|
func (r *reedSolomon) canAVX2C(byteCount int, inputs, outputs int) bool {
|
||||||
|
@ -587,11 +751,11 @@ func (r *reedSolomon) canAVX2C(byteCount int, inputs, outputs int) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Multiplies a subset of rows from a coding matrix by a full set of
|
// Multiplies a subset of rows from a coding matrix by a full set of
|
||||||
// input shards to produce some output shards.
|
// input totalShards to produce some output totalShards.
|
||||||
// 'matrixRows' is The rows from the matrix to use.
|
// 'matrixRows' is The rows from the matrix to use.
|
||||||
// 'inputs' An array of byte arrays, each of which is one input shard.
|
// 'inputs' An array of byte arrays, each of which is one input shard.
|
||||||
// The number of inputs used is determined by the length of each matrix row.
|
// The number of inputs used is determined by the length of each matrix row.
|
||||||
// outputs Byte arrays where the computed shards are stored.
|
// outputs Byte arrays where the computed totalShards are stored.
|
||||||
// The number of outputs computed, and the
|
// The number of outputs computed, and the
|
||||||
// number of matrix rows used, is determined by
|
// number of matrix rows used, is determined by
|
||||||
// outputCount, which is the number of outputs to compute.
|
// outputCount, which is the number of outputs to compute.
|
||||||
|
@ -968,7 +1132,7 @@ func shardSize(shards [][]byte) int {
|
||||||
// Given a list of shards, some of which contain data, fills in the
|
// Given a list of shards, some of which contain data, fills in the
|
||||||
// ones that don't have data.
|
// ones that don't have data.
|
||||||
//
|
//
|
||||||
// The length of the array must be equal to Shards.
|
// The length of the array must be equal to shards.
|
||||||
// You indicate that a shard is missing by setting it to nil or zero-length.
|
// You indicate that a shard is missing by setting it to nil or zero-length.
|
||||||
// If a shard is zero-length but has sufficient capacity, that memory will
|
// If a shard is zero-length but has sufficient capacity, that memory will
|
||||||
// be used, otherwise a new []byte will be allocated.
|
// be used, otherwise a new []byte will be allocated.
|
||||||
|
@ -979,7 +1143,7 @@ func shardSize(shards [][]byte) int {
|
||||||
// The reconstructed shard set is complete, but integrity is not verified.
|
// The reconstructed shard set is complete, but integrity is not verified.
|
||||||
// Use the Verify function to check if data set is ok.
|
// Use the Verify function to check if data set is ok.
|
||||||
func (r *reedSolomon) Reconstruct(shards [][]byte) error {
|
func (r *reedSolomon) Reconstruct(shards [][]byte) error {
|
||||||
return r.reconstruct(shards, false)
|
return r.reconstruct(shards, false, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReconstructData will recreate any missing data shards, if possible.
|
// ReconstructData will recreate any missing data shards, if possible.
|
||||||
|
@ -987,7 +1151,7 @@ func (r *reedSolomon) Reconstruct(shards [][]byte) error {
|
||||||
// Given a list of shards, some of which contain data, fills in the
|
// Given a list of shards, some of which contain data, fills in the
|
||||||
// data shards that don't have data.
|
// data shards that don't have data.
|
||||||
//
|
//
|
||||||
// The length of the array must be equal to Shards.
|
// The length of the array must be equal to shards.
|
||||||
// You indicate that a shard is missing by setting it to nil or zero-length.
|
// You indicate that a shard is missing by setting it to nil or zero-length.
|
||||||
// If a shard is zero-length but has sufficient capacity, that memory will
|
// If a shard is zero-length but has sufficient capacity, that memory will
|
||||||
// be used, otherwise a new []byte will be allocated.
|
// be used, otherwise a new []byte will be allocated.
|
||||||
|
@ -998,19 +1162,39 @@ func (r *reedSolomon) Reconstruct(shards [][]byte) error {
|
||||||
// As the reconstructed shard set may contain missing parity shards,
|
// As the reconstructed shard set may contain missing parity shards,
|
||||||
// calling the Verify function is likely to fail.
|
// calling the Verify function is likely to fail.
|
||||||
func (r *reedSolomon) ReconstructData(shards [][]byte) error {
|
func (r *reedSolomon) ReconstructData(shards [][]byte) error {
|
||||||
return r.reconstruct(shards, true)
|
return r.reconstruct(shards, true, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// reconstruct will recreate the missing data shards, and unless
|
// ReconstructSome will recreate only requested data shards, if possible.
|
||||||
// dataOnly is true, also the missing parity shards
|
|
||||||
//
|
//
|
||||||
// The length of the array must be equal to Shards.
|
// Given a list of shards, some of which contain data, fills in the
|
||||||
// You indicate that a shard is missing by setting it to nil.
|
// data shards indicated by true values in the "required" parameter.
|
||||||
|
// The length of "required" array must be equal to dataShards.
|
||||||
|
//
|
||||||
|
// The length of "shards" array must be equal to shards.
|
||||||
|
// You indicate that a shard is missing by setting it to nil or zero-length.
|
||||||
|
// If a shard is zero-length but has sufficient capacity, that memory will
|
||||||
|
// be used, otherwise a new []byte will be allocated.
|
||||||
//
|
//
|
||||||
// If there are too few shards to reconstruct the missing
|
// If there are too few shards to reconstruct the missing
|
||||||
// ones, ErrTooFewShards will be returned.
|
// ones, ErrTooFewShards will be returned.
|
||||||
func (r *reedSolomon) reconstruct(shards [][]byte, dataOnly bool) error {
|
//
|
||||||
if len(shards) != r.Shards {
|
// As the reconstructed shard set may contain missing parity shards,
|
||||||
|
// calling the Verify function is likely to fail.
|
||||||
|
func (r *reedSolomon) ReconstructSome(shards [][]byte, required []bool) error {
|
||||||
|
return r.reconstruct(shards, true, required)
|
||||||
|
}
|
||||||
|
|
||||||
|
// reconstruct will recreate the missing data totalShards, and unless
|
||||||
|
// dataOnly is true, also the missing parity totalShards
|
||||||
|
//
|
||||||
|
// The length of "shards" array must be equal to totalShards.
|
||||||
|
// You indicate that a shard is missing by setting it to nil.
|
||||||
|
//
|
||||||
|
// If there are too few totalShards to reconstruct the missing
|
||||||
|
// ones, ErrTooFewShards will be returned.
|
||||||
|
func (r *reedSolomon) reconstruct(shards [][]byte, dataOnly bool, required []bool) error {
|
||||||
|
if len(shards) != r.totalShards || required != nil && len(required) < r.dataShards {
|
||||||
return ErrTooFewShards
|
return ErrTooFewShards
|
||||||
}
|
}
|
||||||
// Check arguments.
|
// Check arguments.
|
||||||
|
@ -1025,22 +1209,26 @@ func (r *reedSolomon) reconstruct(shards [][]byte, dataOnly bool) error {
|
||||||
// nothing to do.
|
// nothing to do.
|
||||||
numberPresent := 0
|
numberPresent := 0
|
||||||
dataPresent := 0
|
dataPresent := 0
|
||||||
for i := 0; i < r.Shards; i++ {
|
missingRequired := 0
|
||||||
|
for i := 0; i < r.totalShards; i++ {
|
||||||
if len(shards[i]) != 0 {
|
if len(shards[i]) != 0 {
|
||||||
numberPresent++
|
numberPresent++
|
||||||
if i < r.DataShards {
|
if i < r.dataShards {
|
||||||
dataPresent++
|
dataPresent++
|
||||||
}
|
}
|
||||||
|
} else if required != nil && required[i] {
|
||||||
|
missingRequired++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if numberPresent == r.Shards || dataOnly && dataPresent == r.DataShards {
|
if numberPresent == r.totalShards || dataOnly && dataPresent == r.dataShards ||
|
||||||
// Cool. All of the shards data data. We don't
|
required != nil && missingRequired == 0 {
|
||||||
|
// Cool. All of the shards have data. We don't
|
||||||
// need to do anything.
|
// need to do anything.
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// More complete sanity check
|
// More complete sanity check
|
||||||
if numberPresent < r.DataShards {
|
if numberPresent < r.dataShards {
|
||||||
return ErrTooFewShards
|
return ErrTooFewShards
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1051,11 +1239,11 @@ func (r *reedSolomon) reconstruct(shards [][]byte, dataOnly bool) error {
|
||||||
//
|
//
|
||||||
// Also, create an array of indices of the valid rows we do have
|
// Also, create an array of indices of the valid rows we do have
|
||||||
// and the invalid rows we don't have up until we have enough valid rows.
|
// and the invalid rows we don't have up until we have enough valid rows.
|
||||||
subShards := make([][]byte, r.DataShards)
|
subShards := make([][]byte, r.dataShards)
|
||||||
validIndices := make([]int, r.DataShards)
|
validIndices := make([]int, r.dataShards)
|
||||||
invalidIndices := make([]int, 0)
|
invalidIndices := make([]int, 0)
|
||||||
subMatrixRow := 0
|
subMatrixRow := 0
|
||||||
for matrixRow := 0; matrixRow < r.Shards && subMatrixRow < r.DataShards; matrixRow++ {
|
for matrixRow := 0; matrixRow < r.totalShards && subMatrixRow < r.dataShards; matrixRow++ {
|
||||||
if len(shards[matrixRow]) != 0 {
|
if len(shards[matrixRow]) != 0 {
|
||||||
subShards[subMatrixRow] = shards[matrixRow]
|
subShards[subMatrixRow] = shards[matrixRow]
|
||||||
validIndices[subMatrixRow] = matrixRow
|
validIndices[subMatrixRow] = matrixRow
|
||||||
|
@ -1077,9 +1265,9 @@ func (r *reedSolomon) reconstruct(shards [][]byte, dataOnly bool) error {
|
||||||
// shards that we have and build a square matrix. This
|
// shards that we have and build a square matrix. This
|
||||||
// matrix could be used to generate the shards that we have
|
// matrix could be used to generate the shards that we have
|
||||||
// from the original data.
|
// from the original data.
|
||||||
subMatrix, _ := newMatrix(r.DataShards, r.DataShards)
|
subMatrix, _ := newMatrix(r.dataShards, r.dataShards)
|
||||||
for subMatrixRow, validIndex := range validIndices {
|
for subMatrixRow, validIndex := range validIndices {
|
||||||
for c := 0; c < r.DataShards; c++ {
|
for c := 0; c < r.dataShards; c++ {
|
||||||
subMatrix[subMatrixRow][c] = r.m[validIndex][c]
|
subMatrix[subMatrixRow][c] = r.m[validIndex][c]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1095,7 +1283,7 @@ func (r *reedSolomon) reconstruct(shards [][]byte, dataOnly bool) error {
|
||||||
|
|
||||||
// Cache the inverted matrix in the tree for future use keyed on the
|
// Cache the inverted matrix in the tree for future use keyed on the
|
||||||
// indices of the invalid rows.
|
// indices of the invalid rows.
|
||||||
err = r.tree.InsertInvertedMatrix(invalidIndices, dataDecodeMatrix, r.Shards)
|
err = r.tree.InsertInvertedMatrix(invalidIndices, dataDecodeMatrix, r.totalShards)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -1106,12 +1294,12 @@ func (r *reedSolomon) reconstruct(shards [][]byte, dataOnly bool) error {
|
||||||
// The input to the coding is all of the shards we actually
|
// The input to the coding is all of the shards we actually
|
||||||
// have, and the output is the missing data shards. The computation
|
// have, and the output is the missing data shards. The computation
|
||||||
// is done using the special decode matrix we just built.
|
// is done using the special decode matrix we just built.
|
||||||
outputs := make([][]byte, r.ParityShards)
|
outputs := make([][]byte, r.parityShards)
|
||||||
matrixRows := make([][]byte, r.ParityShards)
|
matrixRows := make([][]byte, r.parityShards)
|
||||||
outputCount := 0
|
outputCount := 0
|
||||||
|
|
||||||
for iShard := 0; iShard < r.DataShards; iShard++ {
|
for iShard := 0; iShard < r.dataShards; iShard++ {
|
||||||
if len(shards[iShard]) == 0 {
|
if len(shards[iShard]) == 0 && (required == nil || required[iShard]) {
|
||||||
if cap(shards[iShard]) >= shardSize {
|
if cap(shards[iShard]) >= shardSize {
|
||||||
shards[iShard] = shards[iShard][0:shardSize]
|
shards[iShard] = shards[iShard][0:shardSize]
|
||||||
} else {
|
} else {
|
||||||
|
@ -1136,19 +1324,19 @@ func (r *reedSolomon) reconstruct(shards [][]byte, dataOnly bool) error {
|
||||||
// any that we just calculated. The output is whichever of the
|
// any that we just calculated. The output is whichever of the
|
||||||
// data shards were missing.
|
// data shards were missing.
|
||||||
outputCount = 0
|
outputCount = 0
|
||||||
for iShard := r.DataShards; iShard < r.Shards; iShard++ {
|
for iShard := r.dataShards; iShard < r.totalShards; iShard++ {
|
||||||
if len(shards[iShard]) == 0 {
|
if len(shards[iShard]) == 0 && (required == nil || required[iShard]) {
|
||||||
if cap(shards[iShard]) >= shardSize {
|
if cap(shards[iShard]) >= shardSize {
|
||||||
shards[iShard] = shards[iShard][0:shardSize]
|
shards[iShard] = shards[iShard][0:shardSize]
|
||||||
} else {
|
} else {
|
||||||
shards[iShard] = make([]byte, shardSize)
|
shards[iShard] = make([]byte, shardSize)
|
||||||
}
|
}
|
||||||
outputs[outputCount] = shards[iShard]
|
outputs[outputCount] = shards[iShard]
|
||||||
matrixRows[outputCount] = r.parity[iShard-r.DataShards]
|
matrixRows[outputCount] = r.parity[iShard-r.dataShards]
|
||||||
outputCount++
|
outputCount++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
r.codeSomeShards(matrixRows, shards[:r.DataShards], outputs[:outputCount], shardSize)
|
r.codeSomeShards(matrixRows, shards[:r.dataShards], outputs[:outputCount], shardSize)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1174,7 +1362,7 @@ func (r *reedSolomon) Split(data []byte) ([][]byte, error) {
|
||||||
}
|
}
|
||||||
dataLen := len(data)
|
dataLen := len(data)
|
||||||
// Calculate number of bytes per data shard.
|
// Calculate number of bytes per data shard.
|
||||||
perShard := (len(data) + r.DataShards - 1) / r.DataShards
|
perShard := (len(data) + r.dataShards - 1) / r.dataShards
|
||||||
|
|
||||||
if cap(data) > len(data) {
|
if cap(data) > len(data) {
|
||||||
data = data[:cap(data)]
|
data = data[:cap(data)]
|
||||||
|
@ -1182,20 +1370,20 @@ func (r *reedSolomon) Split(data []byte) ([][]byte, error) {
|
||||||
|
|
||||||
// Only allocate memory if necessary
|
// Only allocate memory if necessary
|
||||||
var padding []byte
|
var padding []byte
|
||||||
if len(data) < (r.Shards * perShard) {
|
if len(data) < (r.totalShards * perShard) {
|
||||||
// calculate maximum number of full shards in `data` slice
|
// calculate maximum number of full shards in `data` slice
|
||||||
fullShards := len(data) / perShard
|
fullShards := len(data) / perShard
|
||||||
padding = make([]byte, r.Shards*perShard-perShard*fullShards)
|
padding = make([]byte, r.totalShards*perShard-perShard*fullShards)
|
||||||
copy(padding, data[perShard*fullShards:])
|
copy(padding, data[perShard*fullShards:])
|
||||||
data = data[0 : perShard*fullShards]
|
data = data[0 : perShard*fullShards]
|
||||||
} else {
|
} else {
|
||||||
for i := dataLen; i < dataLen+r.DataShards; i++ {
|
for i := dataLen; i < dataLen+r.dataShards; i++ {
|
||||||
data[i] = 0
|
data[i] = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Split into equal-length shards.
|
// Split into equal-length shards.
|
||||||
dst := make([][]byte, r.Shards)
|
dst := make([][]byte, r.totalShards)
|
||||||
i := 0
|
i := 0
|
||||||
for ; i < len(dst) && len(data) >= perShard; i++ {
|
for ; i < len(dst) && len(data) >= perShard; i++ {
|
||||||
dst[i] = data[:perShard:perShard]
|
dst[i] = data[:perShard:perShard]
|
||||||
|
@ -1224,10 +1412,10 @@ var ErrReconstructRequired = errors.New("reconstruction required as one or more
|
||||||
// If one or more required data shards are nil, ErrReconstructRequired will be returned.
|
// If one or more required data shards are nil, ErrReconstructRequired will be returned.
|
||||||
func (r *reedSolomon) Join(dst io.Writer, shards [][]byte, outSize int) error {
|
func (r *reedSolomon) Join(dst io.Writer, shards [][]byte, outSize int) error {
|
||||||
// Do we have enough shards?
|
// Do we have enough shards?
|
||||||
if len(shards) < r.DataShards {
|
if len(shards) < r.dataShards {
|
||||||
return ErrTooFewShards
|
return ErrTooFewShards
|
||||||
}
|
}
|
||||||
shards = shards[:r.DataShards]
|
shards = shards[:r.dataShards]
|
||||||
|
|
||||||
// Do we have enough data?
|
// Do we have enough data?
|
||||||
size := 0
|
size := 0
|
||||||
|
|
|
@ -147,6 +147,10 @@ type rsStream struct {
|
||||||
// you want to use. You can reuse this encoder.
|
// you want to use. You can reuse this encoder.
|
||||||
// Note that the maximum number of data shards is 256.
|
// Note that the maximum number of data shards is 256.
|
||||||
func NewStream(dataShards, parityShards int, o ...Option) (StreamEncoder, error) {
|
func NewStream(dataShards, parityShards int, o ...Option) (StreamEncoder, error) {
|
||||||
|
if dataShards+parityShards > 256 {
|
||||||
|
return nil, ErrMaxShardNum
|
||||||
|
}
|
||||||
|
|
||||||
r := rsStream{o: defaultOptions}
|
r := rsStream{o: defaultOptions}
|
||||||
for _, opt := range o {
|
for _, opt := range o {
|
||||||
opt(&r.o)
|
opt(&r.o)
|
||||||
|
@ -219,18 +223,18 @@ func (r *rsStream) createSlice() [][]byte {
|
||||||
// will be returned. If a parity writer returns an error, a
|
// will be returned. If a parity writer returns an error, a
|
||||||
// StreamWriteError will be returned.
|
// StreamWriteError will be returned.
|
||||||
func (r *rsStream) Encode(data []io.Reader, parity []io.Writer) error {
|
func (r *rsStream) Encode(data []io.Reader, parity []io.Writer) error {
|
||||||
if len(data) != r.r.DataShards {
|
if len(data) != r.r.dataShards {
|
||||||
return ErrTooFewShards
|
return ErrTooFewShards
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(parity) != r.r.ParityShards {
|
if len(parity) != r.r.parityShards {
|
||||||
return ErrTooFewShards
|
return ErrTooFewShards
|
||||||
}
|
}
|
||||||
|
|
||||||
all := r.createSlice()
|
all := r.createSlice()
|
||||||
defer r.blockPool.Put(all)
|
defer r.blockPool.Put(all)
|
||||||
in := all[:r.r.DataShards]
|
in := all[:r.r.dataShards]
|
||||||
out := all[r.r.DataShards:]
|
out := all[r.r.dataShards:]
|
||||||
read := 0
|
read := 0
|
||||||
|
|
||||||
for {
|
for {
|
||||||
|
@ -425,7 +429,7 @@ func cWriteShards(out []io.Writer, in [][]byte) error {
|
||||||
// If a shard stream returns an error, a StreamReadError type error
|
// If a shard stream returns an error, a StreamReadError type error
|
||||||
// will be returned.
|
// will be returned.
|
||||||
func (r *rsStream) Verify(shards []io.Reader) (bool, error) {
|
func (r *rsStream) Verify(shards []io.Reader) (bool, error) {
|
||||||
if len(shards) != r.r.Shards {
|
if len(shards) != r.r.totalShards {
|
||||||
return false, ErrTooFewShards
|
return false, ErrTooFewShards
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -472,10 +476,10 @@ var ErrReconstructMismatch = errors.New("valid shards and fill shards are mutual
|
||||||
// However its integrity is not automatically verified.
|
// However its integrity is not automatically verified.
|
||||||
// Use the Verify function to check in case the data set is complete.
|
// Use the Verify function to check in case the data set is complete.
|
||||||
func (r *rsStream) Reconstruct(valid []io.Reader, fill []io.Writer) error {
|
func (r *rsStream) Reconstruct(valid []io.Reader, fill []io.Writer) error {
|
||||||
if len(valid) != r.r.Shards {
|
if len(valid) != r.r.totalShards {
|
||||||
return ErrTooFewShards
|
return ErrTooFewShards
|
||||||
}
|
}
|
||||||
if len(fill) != r.r.Shards {
|
if len(fill) != r.r.totalShards {
|
||||||
return ErrTooFewShards
|
return ErrTooFewShards
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -486,7 +490,7 @@ func (r *rsStream) Reconstruct(valid []io.Reader, fill []io.Writer) error {
|
||||||
if valid[i] != nil && fill[i] != nil {
|
if valid[i] != nil && fill[i] != nil {
|
||||||
return ErrReconstructMismatch
|
return ErrReconstructMismatch
|
||||||
}
|
}
|
||||||
if i >= r.r.DataShards && fill[i] != nil {
|
if i >= r.r.dataShards && fill[i] != nil {
|
||||||
reconDataOnly = false
|
reconDataOnly = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -530,12 +534,12 @@ func (r *rsStream) Reconstruct(valid []io.Reader, fill []io.Writer) error {
|
||||||
// If the total data size is less than outSize, ErrShortData will be returned.
|
// If the total data size is less than outSize, ErrShortData will be returned.
|
||||||
func (r *rsStream) Join(dst io.Writer, shards []io.Reader, outSize int64) error {
|
func (r *rsStream) Join(dst io.Writer, shards []io.Reader, outSize int64) error {
|
||||||
// Do we have enough shards?
|
// Do we have enough shards?
|
||||||
if len(shards) < r.r.DataShards {
|
if len(shards) < r.r.dataShards {
|
||||||
return ErrTooFewShards
|
return ErrTooFewShards
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trim off parity shards if any
|
// Trim off parity shards if any
|
||||||
shards = shards[:r.r.DataShards]
|
shards = shards[:r.r.dataShards]
|
||||||
for i := range shards {
|
for i := range shards {
|
||||||
if shards[i] == nil {
|
if shards[i] == nil {
|
||||||
return StreamReadError{Err: ErrShardNoData, Stream: i}
|
return StreamReadError{Err: ErrShardNoData, Stream: i}
|
||||||
|
@ -571,7 +575,7 @@ func (r *rsStream) Split(data io.Reader, dst []io.Writer, size int64) error {
|
||||||
if size == 0 {
|
if size == 0 {
|
||||||
return ErrShortData
|
return ErrShortData
|
||||||
}
|
}
|
||||||
if len(dst) != r.r.DataShards {
|
if len(dst) != r.r.dataShards {
|
||||||
return ErrInvShardNum
|
return ErrInvShardNum
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -582,10 +586,10 @@ func (r *rsStream) Split(data io.Reader, dst []io.Writer, size int64) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate number of bytes per shard.
|
// Calculate number of bytes per shard.
|
||||||
perShard := (size + int64(r.r.DataShards) - 1) / int64(r.r.DataShards)
|
perShard := (size + int64(r.r.dataShards) - 1) / int64(r.r.dataShards)
|
||||||
|
|
||||||
// Pad data to r.Shards*perShard.
|
// Pad data to r.Shards*perShard.
|
||||||
padding := make([]byte, (int64(r.r.Shards)*perShard)-size)
|
padding := make([]byte, (int64(r.r.totalShards)*perShard)-size)
|
||||||
data = io.MultiReader(data, bytes.NewBuffer(padding))
|
data = io.MultiReader(data, bytes.NewBuffer(padding))
|
||||||
|
|
||||||
// Split into equal-length shards and copy.
|
// Split into equal-length shards and copy.
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
# This source code refers to The Go Authors for copyright purposes.
|
|
||||||
# The master list of authors is in the main Go distribution,
|
|
||||||
# visible at https://tip.golang.org/AUTHORS.
|
|
|
@ -1,3 +0,0 @@
|
||||||
# This source code was written by the Go contributors.
|
|
||||||
# The master list of contributors is in the main Go distribution,
|
|
||||||
# visible at https://tip.golang.org/CONTRIBUTORS.
|
|
|
@ -11,8 +11,7 @@
|
||||||
// If you aren't sure which function you need, use Argon2id (IDKey) and
|
// If you aren't sure which function you need, use Argon2id (IDKey) and
|
||||||
// the parameter recommendations for your scenario.
|
// the parameter recommendations for your scenario.
|
||||||
//
|
//
|
||||||
//
|
// # Argon2i
|
||||||
// Argon2i
|
|
||||||
//
|
//
|
||||||
// Argon2i (implemented by Key) is the side-channel resistant version of Argon2.
|
// Argon2i (implemented by Key) is the side-channel resistant version of Argon2.
|
||||||
// It uses data-independent memory access, which is preferred for password
|
// It uses data-independent memory access, which is preferred for password
|
||||||
|
@ -21,8 +20,7 @@
|
||||||
// parameters (taken from [2]) for non-interactive operations are time=3 and to
|
// parameters (taken from [2]) for non-interactive operations are time=3 and to
|
||||||
// use the maximum available memory.
|
// use the maximum available memory.
|
||||||
//
|
//
|
||||||
//
|
// # Argon2id
|
||||||
// Argon2id
|
|
||||||
//
|
//
|
||||||
// Argon2id (implemented by IDKey) is a hybrid version of Argon2 combining
|
// Argon2id (implemented by IDKey) is a hybrid version of Argon2 combining
|
||||||
// Argon2i and Argon2d. It uses data-independent memory access for the first
|
// Argon2i and Argon2d. It uses data-independent memory access for the first
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
// Copyright 2018 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
//go:build !purego
|
|
||||||
// +build !purego
|
|
||||||
|
|
||||||
// Package subtle implements functions that are often useful in cryptographic
|
|
||||||
// code but require careful thought to use correctly.
|
|
||||||
package subtle // import "golang.org/x/crypto/internal/subtle"
|
|
||||||
|
|
||||||
import "unsafe"
|
|
||||||
|
|
||||||
// AnyOverlap reports whether x and y share memory at any (not necessarily
|
|
||||||
// corresponding) index. The memory beyond the slice length is ignored.
|
|
||||||
func AnyOverlap(x, y []byte) bool {
|
|
||||||
return len(x) > 0 && len(y) > 0 &&
|
|
||||||
uintptr(unsafe.Pointer(&x[0])) <= uintptr(unsafe.Pointer(&y[len(y)-1])) &&
|
|
||||||
uintptr(unsafe.Pointer(&y[0])) <= uintptr(unsafe.Pointer(&x[len(x)-1]))
|
|
||||||
}
|
|
||||||
|
|
||||||
// InexactOverlap reports whether x and y share memory at any non-corresponding
|
|
||||||
// index. The memory beyond the slice length is ignored. Note that x and y can
|
|
||||||
// have different lengths and still not have any inexact overlap.
|
|
||||||
//
|
|
||||||
// InexactOverlap can be used to implement the requirements of the crypto/cipher
|
|
||||||
// AEAD, Block, BlockMode and Stream interfaces.
|
|
||||||
func InexactOverlap(x, y []byte) bool {
|
|
||||||
if len(x) == 0 || len(y) == 0 || &x[0] == &y[0] {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return AnyOverlap(x, y)
|
|
||||||
}
|
|
|
@ -1,36 +0,0 @@
|
||||||
// Copyright 2018 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
//go:build purego
|
|
||||||
// +build purego
|
|
||||||
|
|
||||||
// Package subtle implements functions that are often useful in cryptographic
|
|
||||||
// code but require careful thought to use correctly.
|
|
||||||
package subtle // import "golang.org/x/crypto/internal/subtle"
|
|
||||||
|
|
||||||
// This is the Google App Engine standard variant based on reflect
|
|
||||||
// because the unsafe package and cgo are disallowed.
|
|
||||||
|
|
||||||
import "reflect"
|
|
||||||
|
|
||||||
// AnyOverlap reports whether x and y share memory at any (not necessarily
|
|
||||||
// corresponding) index. The memory beyond the slice length is ignored.
|
|
||||||
func AnyOverlap(x, y []byte) bool {
|
|
||||||
return len(x) > 0 && len(y) > 0 &&
|
|
||||||
reflect.ValueOf(&x[0]).Pointer() <= reflect.ValueOf(&y[len(y)-1]).Pointer() &&
|
|
||||||
reflect.ValueOf(&y[0]).Pointer() <= reflect.ValueOf(&x[len(x)-1]).Pointer()
|
|
||||||
}
|
|
||||||
|
|
||||||
// InexactOverlap reports whether x and y share memory at any non-corresponding
|
|
||||||
// index. The memory beyond the slice length is ignored. Note that x and y can
|
|
||||||
// have different lengths and still not have any inexact overlap.
|
|
||||||
//
|
|
||||||
// InexactOverlap can be used to implement the requirements of the crypto/cipher
|
|
||||||
// AEAD, Block, BlockMode and Stream interfaces.
|
|
||||||
func InexactOverlap(x, y []byte) bool {
|
|
||||||
if len(x) == 0 || len(y) == 0 || &x[0] == &y[0] {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return AnyOverlap(x, y)
|
|
||||||
}
|
|
|
@ -24,7 +24,7 @@ package salsa20 // import "golang.org/x/crypto/salsa20"
|
||||||
// TODO(agl): implement XORKeyStream12 and XORKeyStream8 - the reduced round variants of Salsa20.
|
// TODO(agl): implement XORKeyStream12 and XORKeyStream8 - the reduced round variants of Salsa20.
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"golang.org/x/crypto/internal/subtle"
|
"golang.org/x/crypto/internal/alias"
|
||||||
"golang.org/x/crypto/salsa20/salsa"
|
"golang.org/x/crypto/salsa20/salsa"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ func XORKeyStream(out, in []byte, nonce []byte, key *[32]byte) {
|
||||||
if len(out) < len(in) {
|
if len(out) < len(in) {
|
||||||
panic("salsa20: output smaller than input")
|
panic("salsa20: output smaller than input")
|
||||||
}
|
}
|
||||||
if subtle.InexactOverlap(out[:len(in)], in) {
|
if alias.InexactOverlap(out[:len(in)], in) {
|
||||||
panic("salsa20: invalid buffer overlap")
|
panic("salsa20: invalid buffer overlap")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,7 @@
|
||||||
// Both types of hash function use the "sponge" construction and the Keccak
|
// Both types of hash function use the "sponge" construction and the Keccak
|
||||||
// permutation. For a detailed specification see http://keccak.noekeon.org/
|
// permutation. For a detailed specification see http://keccak.noekeon.org/
|
||||||
//
|
//
|
||||||
//
|
// # Guidance
|
||||||
// Guidance
|
|
||||||
//
|
//
|
||||||
// If you aren't sure what function you need, use SHAKE256 with at least 64
|
// If you aren't sure what function you need, use SHAKE256 with at least 64
|
||||||
// bytes of output. The SHAKE instances are faster than the SHA3 instances;
|
// bytes of output. The SHAKE instances are faster than the SHA3 instances;
|
||||||
|
@ -19,8 +18,7 @@
|
||||||
// secret key to the input, hash with SHAKE256 and read at least 32 bytes of
|
// secret key to the input, hash with SHAKE256 and read at least 32 bytes of
|
||||||
// output.
|
// output.
|
||||||
//
|
//
|
||||||
//
|
// # Security strengths
|
||||||
// Security strengths
|
|
||||||
//
|
//
|
||||||
// The SHA3-x (x equals 224, 256, 384, or 512) functions have a security
|
// The SHA3-x (x equals 224, 256, 384, or 512) functions have a security
|
||||||
// strength against preimage attacks of x bits. Since they only produce "x"
|
// strength against preimage attacks of x bits. Since they only produce "x"
|
||||||
|
@ -31,8 +29,7 @@
|
||||||
// is used. Requesting more than 64 or 32 bytes of output, respectively, does
|
// is used. Requesting more than 64 or 32 bytes of output, respectively, does
|
||||||
// not increase the collision-resistance of the SHAKE functions.
|
// not increase the collision-resistance of the SHAKE functions.
|
||||||
//
|
//
|
||||||
//
|
// # The sponge construction
|
||||||
// The sponge construction
|
|
||||||
//
|
//
|
||||||
// A sponge builds a pseudo-random function from a public pseudo-random
|
// A sponge builds a pseudo-random function from a public pseudo-random
|
||||||
// permutation, by applying the permutation to a state of "rate + capacity"
|
// permutation, by applying the permutation to a state of "rate + capacity"
|
||||||
|
@ -50,8 +47,7 @@
|
||||||
// Since the KeccakF-1600 permutation is 1600 bits (200 bytes) wide, this means
|
// Since the KeccakF-1600 permutation is 1600 bits (200 bytes) wide, this means
|
||||||
// that the security strength of a sponge instance is equal to (1600 - bitrate) / 2.
|
// that the security strength of a sponge instance is equal to (1600 - bitrate) / 2.
|
||||||
//
|
//
|
||||||
//
|
// # Recommendations
|
||||||
// Recommendations
|
|
||||||
//
|
//
|
||||||
// The SHAKE functions are recommended for most new uses. They can produce
|
// The SHAKE functions are recommended for most new uses. They can produce
|
||||||
// output of arbitrary length. SHAKE256, with an output length of at least
|
// output of arbitrary length. SHAKE256, with an output length of at least
|
||||||
|
|
|
@ -34,11 +34,13 @@ const (
|
||||||
|
|
||||||
// kimd is a wrapper for the 'compute intermediate message digest' instruction.
|
// kimd is a wrapper for the 'compute intermediate message digest' instruction.
|
||||||
// src must be a multiple of the rate for the given function code.
|
// src must be a multiple of the rate for the given function code.
|
||||||
|
//
|
||||||
//go:noescape
|
//go:noescape
|
||||||
func kimd(function code, chain *[200]byte, src []byte)
|
func kimd(function code, chain *[200]byte, src []byte)
|
||||||
|
|
||||||
// klmd is a wrapper for the 'compute last message digest' instruction.
|
// klmd is a wrapper for the 'compute last message digest' instruction.
|
||||||
// src padding is handled by the instruction.
|
// src padding is handled by the instruction.
|
||||||
|
//
|
||||||
//go:noescape
|
//go:noescape
|
||||||
func klmd(function code, chain *[200]byte, dst, src []byte)
|
func klmd(function code, chain *[200]byte, dst, src []byte)
|
||||||
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
# This source code refers to The Go Authors for copyright purposes.
|
|
||||||
# The master list of authors is in the main Go distribution,
|
|
||||||
# visible at http://tip.golang.org/AUTHORS.
|
|
|
@ -1,3 +0,0 @@
|
||||||
# This source code was written by the Go contributors.
|
|
||||||
# The master list of contributors is in the main Go distribution,
|
|
||||||
# visible at http://tip.golang.org/CONTRIBUTORS.
|
|
|
@ -46,6 +46,7 @@ func hostByteOrder() byteOrder {
|
||||||
case "386", "amd64", "amd64p32",
|
case "386", "amd64", "amd64p32",
|
||||||
"alpha",
|
"alpha",
|
||||||
"arm", "arm64",
|
"arm", "arm64",
|
||||||
|
"loong64",
|
||||||
"mipsle", "mips64le", "mips64p32le",
|
"mipsle", "mips64le", "mips64p32le",
|
||||||
"nios2",
|
"nios2",
|
||||||
"ppc64le",
|
"ppc64le",
|
||||||
|
|
|
@ -6,7 +6,10 @@ package cpu
|
||||||
|
|
||||||
import "runtime"
|
import "runtime"
|
||||||
|
|
||||||
const cacheLineSize = 64
|
// cacheLineSize is used to prevent false sharing of cache lines.
|
||||||
|
// We choose 128 because Apple Silicon, a.k.a. M1, has 128-byte cache line size.
|
||||||
|
// It doesn't cost much and is much more future-proof.
|
||||||
|
const cacheLineSize = 128
|
||||||
|
|
||||||
func initOptions() {
|
func initOptions() {
|
||||||
options = []option{
|
options = []option{
|
||||||
|
@ -41,13 +44,10 @@ func archInit() {
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
case "freebsd":
|
case "freebsd":
|
||||||
readARM64Registers()
|
readARM64Registers()
|
||||||
case "linux", "netbsd":
|
case "linux", "netbsd", "openbsd":
|
||||||
doinit()
|
doinit()
|
||||||
default:
|
default:
|
||||||
// Most platforms don't seem to allow reading these registers.
|
// Many platforms don't seem to allow reading these registers.
|
||||||
//
|
|
||||||
// OpenBSD:
|
|
||||||
// See https://golang.org/issue/31746
|
|
||||||
setMinimalFeatures()
|
setMinimalFeatures()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include <cpuid.h>
|
#include <cpuid.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <x86intrin.h>
|
||||||
|
|
||||||
// Need to wrap __get_cpuid_count because it's declared as static.
|
// Need to wrap __get_cpuid_count because it's declared as static.
|
||||||
int
|
int
|
||||||
|
@ -17,27 +18,21 @@ gccgoGetCpuidCount(uint32_t leaf, uint32_t subleaf,
|
||||||
return __get_cpuid_count(leaf, subleaf, eax, ebx, ecx, edx);
|
return __get_cpuid_count(leaf, subleaf, eax, ebx, ecx, edx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma GCC diagnostic ignored "-Wunknown-pragmas"
|
||||||
|
#pragma GCC push_options
|
||||||
|
#pragma GCC target("xsave")
|
||||||
|
#pragma clang attribute push (__attribute__((target("xsave"))), apply_to=function)
|
||||||
|
|
||||||
// xgetbv reads the contents of an XCR (Extended Control Register)
|
// xgetbv reads the contents of an XCR (Extended Control Register)
|
||||||
// specified in the ECX register into registers EDX:EAX.
|
// specified in the ECX register into registers EDX:EAX.
|
||||||
// Currently, the only supported value for XCR is 0.
|
// Currently, the only supported value for XCR is 0.
|
||||||
//
|
|
||||||
// TODO: Replace with a better alternative:
|
|
||||||
//
|
|
||||||
// #include <xsaveintrin.h>
|
|
||||||
//
|
|
||||||
// #pragma GCC target("xsave")
|
|
||||||
//
|
|
||||||
// void gccgoXgetbv(uint32_t *eax, uint32_t *edx) {
|
|
||||||
// unsigned long long x = _xgetbv(0);
|
|
||||||
// *eax = x & 0xffffffff;
|
|
||||||
// *edx = (x >> 32) & 0xffffffff;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// Note that _xgetbv is defined starting with GCC 8.
|
|
||||||
void
|
void
|
||||||
gccgoXgetbv(uint32_t *eax, uint32_t *edx)
|
gccgoXgetbv(uint32_t *eax, uint32_t *edx)
|
||||||
{
|
{
|
||||||
__asm(" xorl %%ecx, %%ecx\n"
|
uint64_t v = _xgetbv(0);
|
||||||
" xgetbv"
|
*eax = v & 0xffffffff;
|
||||||
: "=a"(*eax), "=d"(*edx));
|
*edx = v >> 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma clang attribute pop
|
||||||
|
#pragma GCC pop_options
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
//go:build !linux && !netbsd && arm64
|
//go:build !linux && !netbsd && !openbsd && arm64
|
||||||
// +build !linux,!netbsd,arm64
|
// +build !linux,!netbsd,!openbsd,arm64
|
||||||
|
|
||||||
package cpu
|
package cpu
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// 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
|
//go:build 386 || amd64 || amd64p32 || alpha || arm || arm64 || loong64 || mipsle || mips64le || mips64p32le || nios2 || ppc64le || riscv || riscv64 || sh
|
||||||
// +build 386 amd64 amd64p32 alpha arm arm64 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
|
package unix
|
||||||
|
|
||||||
|
|
|
@ -1,233 +0,0 @@
|
||||||
// Copyright 2017 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// Constants that were deprecated or moved to enums in the FreeBSD headers. Keep
|
|
||||||
// them here for backwards compatibility.
|
|
||||||
|
|
||||||
package unix
|
|
||||||
|
|
||||||
const (
|
|
||||||
DLT_HHDLC = 0x79
|
|
||||||
IFF_SMART = 0x20
|
|
||||||
IFT_1822 = 0x2
|
|
||||||
IFT_A12MPPSWITCH = 0x82
|
|
||||||
IFT_AAL2 = 0xbb
|
|
||||||
IFT_AAL5 = 0x31
|
|
||||||
IFT_ADSL = 0x5e
|
|
||||||
IFT_AFLANE8023 = 0x3b
|
|
||||||
IFT_AFLANE8025 = 0x3c
|
|
||||||
IFT_ARAP = 0x58
|
|
||||||
IFT_ARCNET = 0x23
|
|
||||||
IFT_ARCNETPLUS = 0x24
|
|
||||||
IFT_ASYNC = 0x54
|
|
||||||
IFT_ATM = 0x25
|
|
||||||
IFT_ATMDXI = 0x69
|
|
||||||
IFT_ATMFUNI = 0x6a
|
|
||||||
IFT_ATMIMA = 0x6b
|
|
||||||
IFT_ATMLOGICAL = 0x50
|
|
||||||
IFT_ATMRADIO = 0xbd
|
|
||||||
IFT_ATMSUBINTERFACE = 0x86
|
|
||||||
IFT_ATMVCIENDPT = 0xc2
|
|
||||||
IFT_ATMVIRTUAL = 0x95
|
|
||||||
IFT_BGPPOLICYACCOUNTING = 0xa2
|
|
||||||
IFT_BSC = 0x53
|
|
||||||
IFT_CCTEMUL = 0x3d
|
|
||||||
IFT_CEPT = 0x13
|
|
||||||
IFT_CES = 0x85
|
|
||||||
IFT_CHANNEL = 0x46
|
|
||||||
IFT_CNR = 0x55
|
|
||||||
IFT_COFFEE = 0x84
|
|
||||||
IFT_COMPOSITELINK = 0x9b
|
|
||||||
IFT_DCN = 0x8d
|
|
||||||
IFT_DIGITALPOWERLINE = 0x8a
|
|
||||||
IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba
|
|
||||||
IFT_DLSW = 0x4a
|
|
||||||
IFT_DOCSCABLEDOWNSTREAM = 0x80
|
|
||||||
IFT_DOCSCABLEMACLAYER = 0x7f
|
|
||||||
IFT_DOCSCABLEUPSTREAM = 0x81
|
|
||||||
IFT_DS0 = 0x51
|
|
||||||
IFT_DS0BUNDLE = 0x52
|
|
||||||
IFT_DS1FDL = 0xaa
|
|
||||||
IFT_DS3 = 0x1e
|
|
||||||
IFT_DTM = 0x8c
|
|
||||||
IFT_DVBASILN = 0xac
|
|
||||||
IFT_DVBASIOUT = 0xad
|
|
||||||
IFT_DVBRCCDOWNSTREAM = 0x93
|
|
||||||
IFT_DVBRCCMACLAYER = 0x92
|
|
||||||
IFT_DVBRCCUPSTREAM = 0x94
|
|
||||||
IFT_ENC = 0xf4
|
|
||||||
IFT_EON = 0x19
|
|
||||||
IFT_EPLRS = 0x57
|
|
||||||
IFT_ESCON = 0x49
|
|
||||||
IFT_ETHER = 0x6
|
|
||||||
IFT_FAITH = 0xf2
|
|
||||||
IFT_FAST = 0x7d
|
|
||||||
IFT_FASTETHER = 0x3e
|
|
||||||
IFT_FASTETHERFX = 0x45
|
|
||||||
IFT_FDDI = 0xf
|
|
||||||
IFT_FIBRECHANNEL = 0x38
|
|
||||||
IFT_FRAMERELAYINTERCONNECT = 0x3a
|
|
||||||
IFT_FRAMERELAYMPI = 0x5c
|
|
||||||
IFT_FRDLCIENDPT = 0xc1
|
|
||||||
IFT_FRELAY = 0x20
|
|
||||||
IFT_FRELAYDCE = 0x2c
|
|
||||||
IFT_FRF16MFRBUNDLE = 0xa3
|
|
||||||
IFT_FRFORWARD = 0x9e
|
|
||||||
IFT_G703AT2MB = 0x43
|
|
||||||
IFT_G703AT64K = 0x42
|
|
||||||
IFT_GIF = 0xf0
|
|
||||||
IFT_GIGABITETHERNET = 0x75
|
|
||||||
IFT_GR303IDT = 0xb2
|
|
||||||
IFT_GR303RDT = 0xb1
|
|
||||||
IFT_H323GATEKEEPER = 0xa4
|
|
||||||
IFT_H323PROXY = 0xa5
|
|
||||||
IFT_HDH1822 = 0x3
|
|
||||||
IFT_HDLC = 0x76
|
|
||||||
IFT_HDSL2 = 0xa8
|
|
||||||
IFT_HIPERLAN2 = 0xb7
|
|
||||||
IFT_HIPPI = 0x2f
|
|
||||||
IFT_HIPPIINTERFACE = 0x39
|
|
||||||
IFT_HOSTPAD = 0x5a
|
|
||||||
IFT_HSSI = 0x2e
|
|
||||||
IFT_HY = 0xe
|
|
||||||
IFT_IBM370PARCHAN = 0x48
|
|
||||||
IFT_IDSL = 0x9a
|
|
||||||
IFT_IEEE80211 = 0x47
|
|
||||||
IFT_IEEE80212 = 0x37
|
|
||||||
IFT_IEEE8023ADLAG = 0xa1
|
|
||||||
IFT_IFGSN = 0x91
|
|
||||||
IFT_IMT = 0xbe
|
|
||||||
IFT_INTERLEAVE = 0x7c
|
|
||||||
IFT_IP = 0x7e
|
|
||||||
IFT_IPFORWARD = 0x8e
|
|
||||||
IFT_IPOVERATM = 0x72
|
|
||||||
IFT_IPOVERCDLC = 0x6d
|
|
||||||
IFT_IPOVERCLAW = 0x6e
|
|
||||||
IFT_IPSWITCH = 0x4e
|
|
||||||
IFT_IPXIP = 0xf9
|
|
||||||
IFT_ISDN = 0x3f
|
|
||||||
IFT_ISDNBASIC = 0x14
|
|
||||||
IFT_ISDNPRIMARY = 0x15
|
|
||||||
IFT_ISDNS = 0x4b
|
|
||||||
IFT_ISDNU = 0x4c
|
|
||||||
IFT_ISO88022LLC = 0x29
|
|
||||||
IFT_ISO88023 = 0x7
|
|
||||||
IFT_ISO88024 = 0x8
|
|
||||||
IFT_ISO88025 = 0x9
|
|
||||||
IFT_ISO88025CRFPINT = 0x62
|
|
||||||
IFT_ISO88025DTR = 0x56
|
|
||||||
IFT_ISO88025FIBER = 0x73
|
|
||||||
IFT_ISO88026 = 0xa
|
|
||||||
IFT_ISUP = 0xb3
|
|
||||||
IFT_L3IPXVLAN = 0x89
|
|
||||||
IFT_LAPB = 0x10
|
|
||||||
IFT_LAPD = 0x4d
|
|
||||||
IFT_LAPF = 0x77
|
|
||||||
IFT_LOCALTALK = 0x2a
|
|
||||||
IFT_LOOP = 0x18
|
|
||||||
IFT_MEDIAMAILOVERIP = 0x8b
|
|
||||||
IFT_MFSIGLINK = 0xa7
|
|
||||||
IFT_MIOX25 = 0x26
|
|
||||||
IFT_MODEM = 0x30
|
|
||||||
IFT_MPC = 0x71
|
|
||||||
IFT_MPLS = 0xa6
|
|
||||||
IFT_MPLSTUNNEL = 0x96
|
|
||||||
IFT_MSDSL = 0x8f
|
|
||||||
IFT_MVL = 0xbf
|
|
||||||
IFT_MYRINET = 0x63
|
|
||||||
IFT_NFAS = 0xaf
|
|
||||||
IFT_NSIP = 0x1b
|
|
||||||
IFT_OPTICALCHANNEL = 0xc3
|
|
||||||
IFT_OPTICALTRANSPORT = 0xc4
|
|
||||||
IFT_OTHER = 0x1
|
|
||||||
IFT_P10 = 0xc
|
|
||||||
IFT_P80 = 0xd
|
|
||||||
IFT_PARA = 0x22
|
|
||||||
IFT_PFLOG = 0xf6
|
|
||||||
IFT_PFSYNC = 0xf7
|
|
||||||
IFT_PLC = 0xae
|
|
||||||
IFT_POS = 0xab
|
|
||||||
IFT_PPPMULTILINKBUNDLE = 0x6c
|
|
||||||
IFT_PROPBWAP2MP = 0xb8
|
|
||||||
IFT_PROPCNLS = 0x59
|
|
||||||
IFT_PROPDOCSWIRELESSDOWNSTREAM = 0xb5
|
|
||||||
IFT_PROPDOCSWIRELESSMACLAYER = 0xb4
|
|
||||||
IFT_PROPDOCSWIRELESSUPSTREAM = 0xb6
|
|
||||||
IFT_PROPMUX = 0x36
|
|
||||||
IFT_PROPWIRELESSP2P = 0x9d
|
|
||||||
IFT_PTPSERIAL = 0x16
|
|
||||||
IFT_PVC = 0xf1
|
|
||||||
IFT_QLLC = 0x44
|
|
||||||
IFT_RADIOMAC = 0xbc
|
|
||||||
IFT_RADSL = 0x5f
|
|
||||||
IFT_REACHDSL = 0xc0
|
|
||||||
IFT_RFC1483 = 0x9f
|
|
||||||
IFT_RS232 = 0x21
|
|
||||||
IFT_RSRB = 0x4f
|
|
||||||
IFT_SDLC = 0x11
|
|
||||||
IFT_SDSL = 0x60
|
|
||||||
IFT_SHDSL = 0xa9
|
|
||||||
IFT_SIP = 0x1f
|
|
||||||
IFT_SLIP = 0x1c
|
|
||||||
IFT_SMDSDXI = 0x2b
|
|
||||||
IFT_SMDSICIP = 0x34
|
|
||||||
IFT_SONET = 0x27
|
|
||||||
IFT_SONETOVERHEADCHANNEL = 0xb9
|
|
||||||
IFT_SONETPATH = 0x32
|
|
||||||
IFT_SONETVT = 0x33
|
|
||||||
IFT_SRP = 0x97
|
|
||||||
IFT_SS7SIGLINK = 0x9c
|
|
||||||
IFT_STACKTOSTACK = 0x6f
|
|
||||||
IFT_STARLAN = 0xb
|
|
||||||
IFT_STF = 0xd7
|
|
||||||
IFT_T1 = 0x12
|
|
||||||
IFT_TDLC = 0x74
|
|
||||||
IFT_TERMPAD = 0x5b
|
|
||||||
IFT_TR008 = 0xb0
|
|
||||||
IFT_TRANSPHDLC = 0x7b
|
|
||||||
IFT_TUNNEL = 0x83
|
|
||||||
IFT_ULTRA = 0x1d
|
|
||||||
IFT_USB = 0xa0
|
|
||||||
IFT_V11 = 0x40
|
|
||||||
IFT_V35 = 0x2d
|
|
||||||
IFT_V36 = 0x41
|
|
||||||
IFT_V37 = 0x78
|
|
||||||
IFT_VDSL = 0x61
|
|
||||||
IFT_VIRTUALIPADDRESS = 0x70
|
|
||||||
IFT_VOICEEM = 0x64
|
|
||||||
IFT_VOICEENCAP = 0x67
|
|
||||||
IFT_VOICEFXO = 0x65
|
|
||||||
IFT_VOICEFXS = 0x66
|
|
||||||
IFT_VOICEOVERATM = 0x98
|
|
||||||
IFT_VOICEOVERFRAMERELAY = 0x99
|
|
||||||
IFT_VOICEOVERIP = 0x68
|
|
||||||
IFT_X213 = 0x5d
|
|
||||||
IFT_X25 = 0x5
|
|
||||||
IFT_X25DDN = 0x4
|
|
||||||
IFT_X25HUNTGROUP = 0x7a
|
|
||||||
IFT_X25MLP = 0x79
|
|
||||||
IFT_X25PLE = 0x28
|
|
||||||
IFT_XETHER = 0x1a
|
|
||||||
IPPROTO_MAXID = 0x34
|
|
||||||
IPV6_FAITH = 0x1d
|
|
||||||
IPV6_MIN_MEMBERSHIPS = 0x1f
|
|
||||||
IP_FAITH = 0x16
|
|
||||||
IP_MAX_SOURCE_FILTER = 0x400
|
|
||||||
IP_MIN_MEMBERSHIPS = 0x1f
|
|
||||||
MAP_NORESERVE = 0x40
|
|
||||||
MAP_RENAME = 0x20
|
|
||||||
NET_RT_MAXID = 0x6
|
|
||||||
RTF_PRCLONING = 0x10000
|
|
||||||
RTM_OLDADD = 0x9
|
|
||||||
RTM_OLDDEL = 0xa
|
|
||||||
RT_CACHING_CONTEXT = 0x1
|
|
||||||
RT_NORTREF = 0x2
|
|
||||||
SIOCADDRT = 0x8030720a
|
|
||||||
SIOCALIFADDR = 0x8118691b
|
|
||||||
SIOCDELRT = 0x8030720b
|
|
||||||
SIOCDLIFADDR = 0x8118691d
|
|
||||||
SIOCGLIFADDR = 0xc118691c
|
|
||||||
SIOCGLIFPHYADDR = 0xc118694b
|
|
||||||
SIOCSLIFPHYADDR = 0x8118694a
|
|
||||||
)
|
|
|
@ -1,233 +0,0 @@
|
||||||
// Copyright 2017 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// Constants that were deprecated or moved to enums in the FreeBSD headers. Keep
|
|
||||||
// them here for backwards compatibility.
|
|
||||||
|
|
||||||
package unix
|
|
||||||
|
|
||||||
const (
|
|
||||||
DLT_HHDLC = 0x79
|
|
||||||
IFF_SMART = 0x20
|
|
||||||
IFT_1822 = 0x2
|
|
||||||
IFT_A12MPPSWITCH = 0x82
|
|
||||||
IFT_AAL2 = 0xbb
|
|
||||||
IFT_AAL5 = 0x31
|
|
||||||
IFT_ADSL = 0x5e
|
|
||||||
IFT_AFLANE8023 = 0x3b
|
|
||||||
IFT_AFLANE8025 = 0x3c
|
|
||||||
IFT_ARAP = 0x58
|
|
||||||
IFT_ARCNET = 0x23
|
|
||||||
IFT_ARCNETPLUS = 0x24
|
|
||||||
IFT_ASYNC = 0x54
|
|
||||||
IFT_ATM = 0x25
|
|
||||||
IFT_ATMDXI = 0x69
|
|
||||||
IFT_ATMFUNI = 0x6a
|
|
||||||
IFT_ATMIMA = 0x6b
|
|
||||||
IFT_ATMLOGICAL = 0x50
|
|
||||||
IFT_ATMRADIO = 0xbd
|
|
||||||
IFT_ATMSUBINTERFACE = 0x86
|
|
||||||
IFT_ATMVCIENDPT = 0xc2
|
|
||||||
IFT_ATMVIRTUAL = 0x95
|
|
||||||
IFT_BGPPOLICYACCOUNTING = 0xa2
|
|
||||||
IFT_BSC = 0x53
|
|
||||||
IFT_CCTEMUL = 0x3d
|
|
||||||
IFT_CEPT = 0x13
|
|
||||||
IFT_CES = 0x85
|
|
||||||
IFT_CHANNEL = 0x46
|
|
||||||
IFT_CNR = 0x55
|
|
||||||
IFT_COFFEE = 0x84
|
|
||||||
IFT_COMPOSITELINK = 0x9b
|
|
||||||
IFT_DCN = 0x8d
|
|
||||||
IFT_DIGITALPOWERLINE = 0x8a
|
|
||||||
IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba
|
|
||||||
IFT_DLSW = 0x4a
|
|
||||||
IFT_DOCSCABLEDOWNSTREAM = 0x80
|
|
||||||
IFT_DOCSCABLEMACLAYER = 0x7f
|
|
||||||
IFT_DOCSCABLEUPSTREAM = 0x81
|
|
||||||
IFT_DS0 = 0x51
|
|
||||||
IFT_DS0BUNDLE = 0x52
|
|
||||||
IFT_DS1FDL = 0xaa
|
|
||||||
IFT_DS3 = 0x1e
|
|
||||||
IFT_DTM = 0x8c
|
|
||||||
IFT_DVBASILN = 0xac
|
|
||||||
IFT_DVBASIOUT = 0xad
|
|
||||||
IFT_DVBRCCDOWNSTREAM = 0x93
|
|
||||||
IFT_DVBRCCMACLAYER = 0x92
|
|
||||||
IFT_DVBRCCUPSTREAM = 0x94
|
|
||||||
IFT_ENC = 0xf4
|
|
||||||
IFT_EON = 0x19
|
|
||||||
IFT_EPLRS = 0x57
|
|
||||||
IFT_ESCON = 0x49
|
|
||||||
IFT_ETHER = 0x6
|
|
||||||
IFT_FAITH = 0xf2
|
|
||||||
IFT_FAST = 0x7d
|
|
||||||
IFT_FASTETHER = 0x3e
|
|
||||||
IFT_FASTETHERFX = 0x45
|
|
||||||
IFT_FDDI = 0xf
|
|
||||||
IFT_FIBRECHANNEL = 0x38
|
|
||||||
IFT_FRAMERELAYINTERCONNECT = 0x3a
|
|
||||||
IFT_FRAMERELAYMPI = 0x5c
|
|
||||||
IFT_FRDLCIENDPT = 0xc1
|
|
||||||
IFT_FRELAY = 0x20
|
|
||||||
IFT_FRELAYDCE = 0x2c
|
|
||||||
IFT_FRF16MFRBUNDLE = 0xa3
|
|
||||||
IFT_FRFORWARD = 0x9e
|
|
||||||
IFT_G703AT2MB = 0x43
|
|
||||||
IFT_G703AT64K = 0x42
|
|
||||||
IFT_GIF = 0xf0
|
|
||||||
IFT_GIGABITETHERNET = 0x75
|
|
||||||
IFT_GR303IDT = 0xb2
|
|
||||||
IFT_GR303RDT = 0xb1
|
|
||||||
IFT_H323GATEKEEPER = 0xa4
|
|
||||||
IFT_H323PROXY = 0xa5
|
|
||||||
IFT_HDH1822 = 0x3
|
|
||||||
IFT_HDLC = 0x76
|
|
||||||
IFT_HDSL2 = 0xa8
|
|
||||||
IFT_HIPERLAN2 = 0xb7
|
|
||||||
IFT_HIPPI = 0x2f
|
|
||||||
IFT_HIPPIINTERFACE = 0x39
|
|
||||||
IFT_HOSTPAD = 0x5a
|
|
||||||
IFT_HSSI = 0x2e
|
|
||||||
IFT_HY = 0xe
|
|
||||||
IFT_IBM370PARCHAN = 0x48
|
|
||||||
IFT_IDSL = 0x9a
|
|
||||||
IFT_IEEE80211 = 0x47
|
|
||||||
IFT_IEEE80212 = 0x37
|
|
||||||
IFT_IEEE8023ADLAG = 0xa1
|
|
||||||
IFT_IFGSN = 0x91
|
|
||||||
IFT_IMT = 0xbe
|
|
||||||
IFT_INTERLEAVE = 0x7c
|
|
||||||
IFT_IP = 0x7e
|
|
||||||
IFT_IPFORWARD = 0x8e
|
|
||||||
IFT_IPOVERATM = 0x72
|
|
||||||
IFT_IPOVERCDLC = 0x6d
|
|
||||||
IFT_IPOVERCLAW = 0x6e
|
|
||||||
IFT_IPSWITCH = 0x4e
|
|
||||||
IFT_IPXIP = 0xf9
|
|
||||||
IFT_ISDN = 0x3f
|
|
||||||
IFT_ISDNBASIC = 0x14
|
|
||||||
IFT_ISDNPRIMARY = 0x15
|
|
||||||
IFT_ISDNS = 0x4b
|
|
||||||
IFT_ISDNU = 0x4c
|
|
||||||
IFT_ISO88022LLC = 0x29
|
|
||||||
IFT_ISO88023 = 0x7
|
|
||||||
IFT_ISO88024 = 0x8
|
|
||||||
IFT_ISO88025 = 0x9
|
|
||||||
IFT_ISO88025CRFPINT = 0x62
|
|
||||||
IFT_ISO88025DTR = 0x56
|
|
||||||
IFT_ISO88025FIBER = 0x73
|
|
||||||
IFT_ISO88026 = 0xa
|
|
||||||
IFT_ISUP = 0xb3
|
|
||||||
IFT_L3IPXVLAN = 0x89
|
|
||||||
IFT_LAPB = 0x10
|
|
||||||
IFT_LAPD = 0x4d
|
|
||||||
IFT_LAPF = 0x77
|
|
||||||
IFT_LOCALTALK = 0x2a
|
|
||||||
IFT_LOOP = 0x18
|
|
||||||
IFT_MEDIAMAILOVERIP = 0x8b
|
|
||||||
IFT_MFSIGLINK = 0xa7
|
|
||||||
IFT_MIOX25 = 0x26
|
|
||||||
IFT_MODEM = 0x30
|
|
||||||
IFT_MPC = 0x71
|
|
||||||
IFT_MPLS = 0xa6
|
|
||||||
IFT_MPLSTUNNEL = 0x96
|
|
||||||
IFT_MSDSL = 0x8f
|
|
||||||
IFT_MVL = 0xbf
|
|
||||||
IFT_MYRINET = 0x63
|
|
||||||
IFT_NFAS = 0xaf
|
|
||||||
IFT_NSIP = 0x1b
|
|
||||||
IFT_OPTICALCHANNEL = 0xc3
|
|
||||||
IFT_OPTICALTRANSPORT = 0xc4
|
|
||||||
IFT_OTHER = 0x1
|
|
||||||
IFT_P10 = 0xc
|
|
||||||
IFT_P80 = 0xd
|
|
||||||
IFT_PARA = 0x22
|
|
||||||
IFT_PFLOG = 0xf6
|
|
||||||
IFT_PFSYNC = 0xf7
|
|
||||||
IFT_PLC = 0xae
|
|
||||||
IFT_POS = 0xab
|
|
||||||
IFT_PPPMULTILINKBUNDLE = 0x6c
|
|
||||||
IFT_PROPBWAP2MP = 0xb8
|
|
||||||
IFT_PROPCNLS = 0x59
|
|
||||||
IFT_PROPDOCSWIRELESSDOWNSTREAM = 0xb5
|
|
||||||
IFT_PROPDOCSWIRELESSMACLAYER = 0xb4
|
|
||||||
IFT_PROPDOCSWIRELESSUPSTREAM = 0xb6
|
|
||||||
IFT_PROPMUX = 0x36
|
|
||||||
IFT_PROPWIRELESSP2P = 0x9d
|
|
||||||
IFT_PTPSERIAL = 0x16
|
|
||||||
IFT_PVC = 0xf1
|
|
||||||
IFT_QLLC = 0x44
|
|
||||||
IFT_RADIOMAC = 0xbc
|
|
||||||
IFT_RADSL = 0x5f
|
|
||||||
IFT_REACHDSL = 0xc0
|
|
||||||
IFT_RFC1483 = 0x9f
|
|
||||||
IFT_RS232 = 0x21
|
|
||||||
IFT_RSRB = 0x4f
|
|
||||||
IFT_SDLC = 0x11
|
|
||||||
IFT_SDSL = 0x60
|
|
||||||
IFT_SHDSL = 0xa9
|
|
||||||
IFT_SIP = 0x1f
|
|
||||||
IFT_SLIP = 0x1c
|
|
||||||
IFT_SMDSDXI = 0x2b
|
|
||||||
IFT_SMDSICIP = 0x34
|
|
||||||
IFT_SONET = 0x27
|
|
||||||
IFT_SONETOVERHEADCHANNEL = 0xb9
|
|
||||||
IFT_SONETPATH = 0x32
|
|
||||||
IFT_SONETVT = 0x33
|
|
||||||
IFT_SRP = 0x97
|
|
||||||
IFT_SS7SIGLINK = 0x9c
|
|
||||||
IFT_STACKTOSTACK = 0x6f
|
|
||||||
IFT_STARLAN = 0xb
|
|
||||||
IFT_STF = 0xd7
|
|
||||||
IFT_T1 = 0x12
|
|
||||||
IFT_TDLC = 0x74
|
|
||||||
IFT_TERMPAD = 0x5b
|
|
||||||
IFT_TR008 = 0xb0
|
|
||||||
IFT_TRANSPHDLC = 0x7b
|
|
||||||
IFT_TUNNEL = 0x83
|
|
||||||
IFT_ULTRA = 0x1d
|
|
||||||
IFT_USB = 0xa0
|
|
||||||
IFT_V11 = 0x40
|
|
||||||
IFT_V35 = 0x2d
|
|
||||||
IFT_V36 = 0x41
|
|
||||||
IFT_V37 = 0x78
|
|
||||||
IFT_VDSL = 0x61
|
|
||||||
IFT_VIRTUALIPADDRESS = 0x70
|
|
||||||
IFT_VOICEEM = 0x64
|
|
||||||
IFT_VOICEENCAP = 0x67
|
|
||||||
IFT_VOICEFXO = 0x65
|
|
||||||
IFT_VOICEFXS = 0x66
|
|
||||||
IFT_VOICEOVERATM = 0x98
|
|
||||||
IFT_VOICEOVERFRAMERELAY = 0x99
|
|
||||||
IFT_VOICEOVERIP = 0x68
|
|
||||||
IFT_X213 = 0x5d
|
|
||||||
IFT_X25 = 0x5
|
|
||||||
IFT_X25DDN = 0x4
|
|
||||||
IFT_X25HUNTGROUP = 0x7a
|
|
||||||
IFT_X25MLP = 0x79
|
|
||||||
IFT_X25PLE = 0x28
|
|
||||||
IFT_XETHER = 0x1a
|
|
||||||
IPPROTO_MAXID = 0x34
|
|
||||||
IPV6_FAITH = 0x1d
|
|
||||||
IPV6_MIN_MEMBERSHIPS = 0x1f
|
|
||||||
IP_FAITH = 0x16
|
|
||||||
IP_MAX_SOURCE_FILTER = 0x400
|
|
||||||
IP_MIN_MEMBERSHIPS = 0x1f
|
|
||||||
MAP_NORESERVE = 0x40
|
|
||||||
MAP_RENAME = 0x20
|
|
||||||
NET_RT_MAXID = 0x6
|
|
||||||
RTF_PRCLONING = 0x10000
|
|
||||||
RTM_OLDADD = 0x9
|
|
||||||
RTM_OLDDEL = 0xa
|
|
||||||
RT_CACHING_CONTEXT = 0x1
|
|
||||||
RT_NORTREF = 0x2
|
|
||||||
SIOCADDRT = 0x8040720a
|
|
||||||
SIOCALIFADDR = 0x8118691b
|
|
||||||
SIOCDELRT = 0x8040720b
|
|
||||||
SIOCDLIFADDR = 0x8118691d
|
|
||||||
SIOCGLIFADDR = 0xc118691c
|
|
||||||
SIOCGLIFPHYADDR = 0xc118694b
|
|
||||||
SIOCSLIFPHYADDR = 0x8118694a
|
|
||||||
)
|
|
|
@ -1,226 +0,0 @@
|
||||||
// Copyright 2017 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
package unix
|
|
||||||
|
|
||||||
const (
|
|
||||||
IFT_1822 = 0x2
|
|
||||||
IFT_A12MPPSWITCH = 0x82
|
|
||||||
IFT_AAL2 = 0xbb
|
|
||||||
IFT_AAL5 = 0x31
|
|
||||||
IFT_ADSL = 0x5e
|
|
||||||
IFT_AFLANE8023 = 0x3b
|
|
||||||
IFT_AFLANE8025 = 0x3c
|
|
||||||
IFT_ARAP = 0x58
|
|
||||||
IFT_ARCNET = 0x23
|
|
||||||
IFT_ARCNETPLUS = 0x24
|
|
||||||
IFT_ASYNC = 0x54
|
|
||||||
IFT_ATM = 0x25
|
|
||||||
IFT_ATMDXI = 0x69
|
|
||||||
IFT_ATMFUNI = 0x6a
|
|
||||||
IFT_ATMIMA = 0x6b
|
|
||||||
IFT_ATMLOGICAL = 0x50
|
|
||||||
IFT_ATMRADIO = 0xbd
|
|
||||||
IFT_ATMSUBINTERFACE = 0x86
|
|
||||||
IFT_ATMVCIENDPT = 0xc2
|
|
||||||
IFT_ATMVIRTUAL = 0x95
|
|
||||||
IFT_BGPPOLICYACCOUNTING = 0xa2
|
|
||||||
IFT_BSC = 0x53
|
|
||||||
IFT_CCTEMUL = 0x3d
|
|
||||||
IFT_CEPT = 0x13
|
|
||||||
IFT_CES = 0x85
|
|
||||||
IFT_CHANNEL = 0x46
|
|
||||||
IFT_CNR = 0x55
|
|
||||||
IFT_COFFEE = 0x84
|
|
||||||
IFT_COMPOSITELINK = 0x9b
|
|
||||||
IFT_DCN = 0x8d
|
|
||||||
IFT_DIGITALPOWERLINE = 0x8a
|
|
||||||
IFT_DIGITALWRAPPEROVERHEADCHANNEL = 0xba
|
|
||||||
IFT_DLSW = 0x4a
|
|
||||||
IFT_DOCSCABLEDOWNSTREAM = 0x80
|
|
||||||
IFT_DOCSCABLEMACLAYER = 0x7f
|
|
||||||
IFT_DOCSCABLEUPSTREAM = 0x81
|
|
||||||
IFT_DS0 = 0x51
|
|
||||||
IFT_DS0BUNDLE = 0x52
|
|
||||||
IFT_DS1FDL = 0xaa
|
|
||||||
IFT_DS3 = 0x1e
|
|
||||||
IFT_DTM = 0x8c
|
|
||||||
IFT_DVBASILN = 0xac
|
|
||||||
IFT_DVBASIOUT = 0xad
|
|
||||||
IFT_DVBRCCDOWNSTREAM = 0x93
|
|
||||||
IFT_DVBRCCMACLAYER = 0x92
|
|
||||||
IFT_DVBRCCUPSTREAM = 0x94
|
|
||||||
IFT_ENC = 0xf4
|
|
||||||
IFT_EON = 0x19
|
|
||||||
IFT_EPLRS = 0x57
|
|
||||||
IFT_ESCON = 0x49
|
|
||||||
IFT_ETHER = 0x6
|
|
||||||
IFT_FAST = 0x7d
|
|
||||||
IFT_FASTETHER = 0x3e
|
|
||||||
IFT_FASTETHERFX = 0x45
|
|
||||||
IFT_FDDI = 0xf
|
|
||||||
IFT_FIBRECHANNEL = 0x38
|
|
||||||
IFT_FRAMERELAYINTERCONNECT = 0x3a
|
|
||||||
IFT_FRAMERELAYMPI = 0x5c
|
|
||||||
IFT_FRDLCIENDPT = 0xc1
|
|
||||||
IFT_FRELAY = 0x20
|
|
||||||
IFT_FRELAYDCE = 0x2c
|
|
||||||
IFT_FRF16MFRBUNDLE = 0xa3
|
|
||||||
IFT_FRFORWARD = 0x9e
|
|
||||||
IFT_G703AT2MB = 0x43
|
|
||||||
IFT_G703AT64K = 0x42
|
|
||||||
IFT_GIF = 0xf0
|
|
||||||
IFT_GIGABITETHERNET = 0x75
|
|
||||||
IFT_GR303IDT = 0xb2
|
|
||||||
IFT_GR303RDT = 0xb1
|
|
||||||
IFT_H323GATEKEEPER = 0xa4
|
|
||||||
IFT_H323PROXY = 0xa5
|
|
||||||
IFT_HDH1822 = 0x3
|
|
||||||
IFT_HDLC = 0x76
|
|
||||||
IFT_HDSL2 = 0xa8
|
|
||||||
IFT_HIPERLAN2 = 0xb7
|
|
||||||
IFT_HIPPI = 0x2f
|
|
||||||
IFT_HIPPIINTERFACE = 0x39
|
|
||||||
IFT_HOSTPAD = 0x5a
|
|
||||||
IFT_HSSI = 0x2e
|
|
||||||
IFT_HY = 0xe
|
|
||||||
IFT_IBM370PARCHAN = 0x48
|
|
||||||
IFT_IDSL = 0x9a
|
|
||||||
IFT_IEEE80211 = 0x47
|
|
||||||
IFT_IEEE80212 = 0x37
|
|
||||||
IFT_IEEE8023ADLAG = 0xa1
|
|
||||||
IFT_IFGSN = 0x91
|
|
||||||
IFT_IMT = 0xbe
|
|
||||||
IFT_INTERLEAVE = 0x7c
|
|
||||||
IFT_IP = 0x7e
|
|
||||||
IFT_IPFORWARD = 0x8e
|
|
||||||
IFT_IPOVERATM = 0x72
|
|
||||||
IFT_IPOVERCDLC = 0x6d
|
|
||||||
IFT_IPOVERCLAW = 0x6e
|
|
||||||
IFT_IPSWITCH = 0x4e
|
|
||||||
IFT_ISDN = 0x3f
|
|
||||||
IFT_ISDNBASIC = 0x14
|
|
||||||
IFT_ISDNPRIMARY = 0x15
|
|
||||||
IFT_ISDNS = 0x4b
|
|
||||||
IFT_ISDNU = 0x4c
|
|
||||||
IFT_ISO88022LLC = 0x29
|
|
||||||
IFT_ISO88023 = 0x7
|
|
||||||
IFT_ISO88024 = 0x8
|
|
||||||
IFT_ISO88025 = 0x9
|
|
||||||
IFT_ISO88025CRFPINT = 0x62
|
|
||||||
IFT_ISO88025DTR = 0x56
|
|
||||||
IFT_ISO88025FIBER = 0x73
|
|
||||||
IFT_ISO88026 = 0xa
|
|
||||||
IFT_ISUP = 0xb3
|
|
||||||
IFT_L3IPXVLAN = 0x89
|
|
||||||
IFT_LAPB = 0x10
|
|
||||||
IFT_LAPD = 0x4d
|
|
||||||
IFT_LAPF = 0x77
|
|
||||||
IFT_LOCALTALK = 0x2a
|
|
||||||
IFT_LOOP = 0x18
|
|
||||||
IFT_MEDIAMAILOVERIP = 0x8b
|
|
||||||
IFT_MFSIGLINK = 0xa7
|
|
||||||
IFT_MIOX25 = 0x26
|
|
||||||
IFT_MODEM = 0x30
|
|
||||||
IFT_MPC = 0x71
|
|
||||||
IFT_MPLS = 0xa6
|
|
||||||
IFT_MPLSTUNNEL = 0x96
|
|
||||||
IFT_MSDSL = 0x8f
|
|
||||||
IFT_MVL = 0xbf
|
|
||||||
IFT_MYRINET = 0x63
|
|
||||||
IFT_NFAS = 0xaf
|
|
||||||
IFT_NSIP = 0x1b
|
|
||||||
IFT_OPTICALCHANNEL = 0xc3
|
|
||||||
IFT_OPTICALTRANSPORT = 0xc4
|
|
||||||
IFT_OTHER = 0x1
|
|
||||||
IFT_P10 = 0xc
|
|
||||||
IFT_P80 = 0xd
|
|
||||||
IFT_PARA = 0x22
|
|
||||||
IFT_PFLOG = 0xf6
|
|
||||||
IFT_PFSYNC = 0xf7
|
|
||||||
IFT_PLC = 0xae
|
|
||||||
IFT_POS = 0xab
|
|
||||||
IFT_PPPMULTILINKBUNDLE = 0x6c
|
|
||||||
IFT_PROPBWAP2MP = 0xb8
|
|
||||||
IFT_PROPCNLS = 0x59
|
|
||||||
IFT_PROPDOCSWIRELESSDOWNSTREAM = 0xb5
|
|
||||||
IFT_PROPDOCSWIRELESSMACLAYER = 0xb4
|
|
||||||
IFT_PROPDOCSWIRELESSUPSTREAM = 0xb6
|
|
||||||
IFT_PROPMUX = 0x36
|
|
||||||
IFT_PROPWIRELESSP2P = 0x9d
|
|
||||||
IFT_PTPSERIAL = 0x16
|
|
||||||
IFT_PVC = 0xf1
|
|
||||||
IFT_QLLC = 0x44
|
|
||||||
IFT_RADIOMAC = 0xbc
|
|
||||||
IFT_RADSL = 0x5f
|
|
||||||
IFT_REACHDSL = 0xc0
|
|
||||||
IFT_RFC1483 = 0x9f
|
|
||||||
IFT_RS232 = 0x21
|
|
||||||
IFT_RSRB = 0x4f
|
|
||||||
IFT_SDLC = 0x11
|
|
||||||
IFT_SDSL = 0x60
|
|
||||||
IFT_SHDSL = 0xa9
|
|
||||||
IFT_SIP = 0x1f
|
|
||||||
IFT_SLIP = 0x1c
|
|
||||||
IFT_SMDSDXI = 0x2b
|
|
||||||
IFT_SMDSICIP = 0x34
|
|
||||||
IFT_SONET = 0x27
|
|
||||||
IFT_SONETOVERHEADCHANNEL = 0xb9
|
|
||||||
IFT_SONETPATH = 0x32
|
|
||||||
IFT_SONETVT = 0x33
|
|
||||||
IFT_SRP = 0x97
|
|
||||||
IFT_SS7SIGLINK = 0x9c
|
|
||||||
IFT_STACKTOSTACK = 0x6f
|
|
||||||
IFT_STARLAN = 0xb
|
|
||||||
IFT_STF = 0xd7
|
|
||||||
IFT_T1 = 0x12
|
|
||||||
IFT_TDLC = 0x74
|
|
||||||
IFT_TERMPAD = 0x5b
|
|
||||||
IFT_TR008 = 0xb0
|
|
||||||
IFT_TRANSPHDLC = 0x7b
|
|
||||||
IFT_TUNNEL = 0x83
|
|
||||||
IFT_ULTRA = 0x1d
|
|
||||||
IFT_USB = 0xa0
|
|
||||||
IFT_V11 = 0x40
|
|
||||||
IFT_V35 = 0x2d
|
|
||||||
IFT_V36 = 0x41
|
|
||||||
IFT_V37 = 0x78
|
|
||||||
IFT_VDSL = 0x61
|
|
||||||
IFT_VIRTUALIPADDRESS = 0x70
|
|
||||||
IFT_VOICEEM = 0x64
|
|
||||||
IFT_VOICEENCAP = 0x67
|
|
||||||
IFT_VOICEFXO = 0x65
|
|
||||||
IFT_VOICEFXS = 0x66
|
|
||||||
IFT_VOICEOVERATM = 0x98
|
|
||||||
IFT_VOICEOVERFRAMERELAY = 0x99
|
|
||||||
IFT_VOICEOVERIP = 0x68
|
|
||||||
IFT_X213 = 0x5d
|
|
||||||
IFT_X25 = 0x5
|
|
||||||
IFT_X25DDN = 0x4
|
|
||||||
IFT_X25HUNTGROUP = 0x7a
|
|
||||||
IFT_X25MLP = 0x79
|
|
||||||
IFT_X25PLE = 0x28
|
|
||||||
IFT_XETHER = 0x1a
|
|
||||||
|
|
||||||
// missing constants on FreeBSD-11.1-RELEASE, copied from old values in ztypes_freebsd_arm.go
|
|
||||||
IFF_SMART = 0x20
|
|
||||||
IFT_FAITH = 0xf2
|
|
||||||
IFT_IPXIP = 0xf9
|
|
||||||
IPPROTO_MAXID = 0x34
|
|
||||||
IPV6_FAITH = 0x1d
|
|
||||||
IP_FAITH = 0x16
|
|
||||||
MAP_NORESERVE = 0x40
|
|
||||||
MAP_RENAME = 0x20
|
|
||||||
NET_RT_MAXID = 0x6
|
|
||||||
RTF_PRCLONING = 0x10000
|
|
||||||
RTM_OLDADD = 0x9
|
|
||||||
RTM_OLDDEL = 0xa
|
|
||||||
SIOCADDRT = 0x8030720a
|
|
||||||
SIOCALIFADDR = 0x8118691b
|
|
||||||
SIOCDELRT = 0x8030720b
|
|
||||||
SIOCDLIFADDR = 0x8118691d
|
|
||||||
SIOCGLIFADDR = 0xc118691c
|
|
||||||
SIOCGLIFPHYADDR = 0xc118694b
|
|
||||||
SIOCSLIFPHYADDR = 0x8118694a
|
|
||||||
)
|
|
|
@ -1,17 +0,0 @@
|
||||||
// Copyright 2020 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// Constants that were deprecated or moved to enums in the FreeBSD headers. Keep
|
|
||||||
// them here for backwards compatibility.
|
|
||||||
|
|
||||||
package unix
|
|
||||||
|
|
||||||
const (
|
|
||||||
DLT_HHDLC = 0x79
|
|
||||||
IPV6_MIN_MEMBERSHIPS = 0x1f
|
|
||||||
IP_MAX_SOURCE_FILTER = 0x400
|
|
||||||
IP_MIN_MEMBERSHIPS = 0x1f
|
|
||||||
RT_CACHING_CONTEXT = 0x1
|
|
||||||
RT_NORTREF = 0x2
|
|
||||||
)
|
|
|
@ -8,7 +8,6 @@
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -45,13 +44,7 @@ func NewIfreq(name string) (*Ifreq, error) {
|
||||||
|
|
||||||
// Name returns the interface name associated with the Ifreq.
|
// Name returns the interface name associated with the Ifreq.
|
||||||
func (ifr *Ifreq) Name() string {
|
func (ifr *Ifreq) Name() string {
|
||||||
// BytePtrToString requires a NULL terminator or the program may crash. If
|
return ByteSliceToString(ifr.raw.Ifrn[:])
|
||||||
// one is not present, just return the empty string.
|
|
||||||
if !bytes.Contains(ifr.raw.Ifrn[:], []byte{0x00}) {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
return BytePtrToString(&ifr.raw.Ifrn[0])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// According to netdevice(7), only AF_INET addresses are returned for numerous
|
// According to netdevice(7), only AF_INET addresses are returned for numerous
|
||||||
|
|
|
@ -4,9 +4,7 @@
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
import (
|
import "unsafe"
|
||||||
"unsafe"
|
|
||||||
)
|
|
||||||
|
|
||||||
// IoctlRetInt performs an ioctl operation specified by req on a device
|
// IoctlRetInt performs an ioctl operation specified by req on a device
|
||||||
// associated with opened file descriptor fd, and returns a non-negative
|
// associated with opened file descriptor fd, and returns a non-negative
|
||||||
|
@ -217,3 +215,19 @@ func IoctlKCMAttach(fd int, info KCMAttach) error {
|
||||||
func IoctlKCMUnattach(fd int, info KCMUnattach) error {
|
func IoctlKCMUnattach(fd int, info KCMUnattach) error {
|
||||||
return ioctlPtr(fd, SIOCKCMUNATTACH, unsafe.Pointer(&info))
|
return ioctlPtr(fd, SIOCKCMUNATTACH, unsafe.Pointer(&info))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IoctlLoopGetStatus64 gets the status of the loop device associated with the
|
||||||
|
// file descriptor fd using the LOOP_GET_STATUS64 operation.
|
||||||
|
func IoctlLoopGetStatus64(fd int) (*LoopInfo64, error) {
|
||||||
|
var value LoopInfo64
|
||||||
|
if err := ioctlPtr(fd, LOOP_GET_STATUS64, unsafe.Pointer(&value)); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &value, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlLoopSetStatus64 sets the status of the loop device associated with the
|
||||||
|
// file descriptor fd using the LOOP_SET_STATUS64 operation.
|
||||||
|
func IoctlLoopSetStatus64(fd int, value *LoopInfo64) error {
|
||||||
|
return ioctlPtr(fd, LOOP_SET_STATUS64, unsafe.Pointer(value))
|
||||||
|
}
|
||||||
|
|
|
@ -73,12 +73,12 @@ aix_ppc64)
|
||||||
darwin_amd64)
|
darwin_amd64)
|
||||||
mkerrors="$mkerrors -m64"
|
mkerrors="$mkerrors -m64"
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||||
mkasm="go run mkasm_darwin.go"
|
mkasm="go run mkasm.go"
|
||||||
;;
|
;;
|
||||||
darwin_arm64)
|
darwin_arm64)
|
||||||
mkerrors="$mkerrors -m64"
|
mkerrors="$mkerrors -m64"
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||||
mkasm="go run mkasm_darwin.go"
|
mkasm="go run mkasm.go"
|
||||||
;;
|
;;
|
||||||
dragonfly_amd64)
|
dragonfly_amd64)
|
||||||
mkerrors="$mkerrors -m64"
|
mkerrors="$mkerrors -m64"
|
||||||
|
@ -89,25 +89,30 @@ dragonfly_amd64)
|
||||||
freebsd_386)
|
freebsd_386)
|
||||||
mkerrors="$mkerrors -m32"
|
mkerrors="$mkerrors -m32"
|
||||||
mksyscall="go run mksyscall.go -l32"
|
mksyscall="go run mksyscall.go -l32"
|
||||||
mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master'"
|
mksysnum="go run mksysnum.go 'https://cgit.freebsd.org/src/plain/sys/kern/syscalls.master?h=stable/12'"
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||||
;;
|
;;
|
||||||
freebsd_amd64)
|
freebsd_amd64)
|
||||||
mkerrors="$mkerrors -m64"
|
mkerrors="$mkerrors -m64"
|
||||||
mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master'"
|
mksysnum="go run mksysnum.go 'https://cgit.freebsd.org/src/plain/sys/kern/syscalls.master?h=stable/12'"
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||||
;;
|
;;
|
||||||
freebsd_arm)
|
freebsd_arm)
|
||||||
mkerrors="$mkerrors"
|
mkerrors="$mkerrors"
|
||||||
mksyscall="go run mksyscall.go -l32 -arm"
|
mksyscall="go run mksyscall.go -l32 -arm"
|
||||||
mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master'"
|
mksysnum="go run mksysnum.go 'https://cgit.freebsd.org/src/plain/sys/kern/syscalls.master?h=stable/12'"
|
||||||
# Let the type of C char be signed for making the bare syscall
|
# Let the type of C char be signed for making the bare syscall
|
||||||
# API consistent across platforms.
|
# API consistent across platforms.
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
|
||||||
;;
|
;;
|
||||||
freebsd_arm64)
|
freebsd_arm64)
|
||||||
mkerrors="$mkerrors -m64"
|
mkerrors="$mkerrors -m64"
|
||||||
mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/11/sys/kern/syscalls.master'"
|
mksysnum="go run mksysnum.go 'https://cgit.freebsd.org/src/plain/sys/kern/syscalls.master?h=stable/12'"
|
||||||
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
|
||||||
|
;;
|
||||||
|
freebsd_riscv64)
|
||||||
|
mkerrors="$mkerrors -m64"
|
||||||
|
mksysnum="go run mksysnum.go 'https://cgit.freebsd.org/src/plain/sys/kern/syscalls.master?h=stable/12'"
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
|
||||||
;;
|
;;
|
||||||
netbsd_386)
|
netbsd_386)
|
||||||
|
@ -137,33 +142,33 @@ netbsd_arm64)
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||||
;;
|
;;
|
||||||
openbsd_386)
|
openbsd_386)
|
||||||
|
mkasm="go run mkasm.go"
|
||||||
mkerrors="$mkerrors -m32"
|
mkerrors="$mkerrors -m32"
|
||||||
mksyscall="go run mksyscall.go -l32 -openbsd"
|
mksyscall="go run mksyscall.go -l32 -openbsd -libc"
|
||||||
mksysctl="go run mksysctl_openbsd.go"
|
mksysctl="go run mksysctl_openbsd.go"
|
||||||
mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
|
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||||
;;
|
;;
|
||||||
openbsd_amd64)
|
openbsd_amd64)
|
||||||
|
mkasm="go run mkasm.go"
|
||||||
mkerrors="$mkerrors -m64"
|
mkerrors="$mkerrors -m64"
|
||||||
mksyscall="go run mksyscall.go -openbsd"
|
mksyscall="go run mksyscall.go -openbsd -libc"
|
||||||
mksysctl="go run mksysctl_openbsd.go"
|
mksysctl="go run mksysctl_openbsd.go"
|
||||||
mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
|
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||||
;;
|
;;
|
||||||
openbsd_arm)
|
openbsd_arm)
|
||||||
|
mkasm="go run mkasm.go"
|
||||||
mkerrors="$mkerrors"
|
mkerrors="$mkerrors"
|
||||||
mksyscall="go run mksyscall.go -l32 -openbsd -arm"
|
mksyscall="go run mksyscall.go -l32 -openbsd -arm -libc"
|
||||||
mksysctl="go run mksysctl_openbsd.go"
|
mksysctl="go run mksysctl_openbsd.go"
|
||||||
mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
|
|
||||||
# Let the type of C char be signed for making the bare syscall
|
# Let the type of C char be signed for making the bare syscall
|
||||||
# API consistent across platforms.
|
# API consistent across platforms.
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
|
||||||
;;
|
;;
|
||||||
openbsd_arm64)
|
openbsd_arm64)
|
||||||
|
mkasm="go run mkasm.go"
|
||||||
mkerrors="$mkerrors -m64"
|
mkerrors="$mkerrors -m64"
|
||||||
mksyscall="go run mksyscall.go -openbsd"
|
mksyscall="go run mksyscall.go -openbsd -libc"
|
||||||
mksysctl="go run mksysctl_openbsd.go"
|
mksysctl="go run mksysctl_openbsd.go"
|
||||||
mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
|
|
||||||
# Let the type of C char be signed for making the bare syscall
|
# Let the type of C char be signed for making the bare syscall
|
||||||
# API consistent across platforms.
|
# API consistent across platforms.
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
|
||||||
|
@ -227,5 +232,5 @@ esac
|
||||||
if [ -n "$mksysctl" ]; then echo "$mksysctl |gofmt >$zsysctl"; fi
|
if [ -n "$mksysctl" ]; then echo "$mksysctl |gofmt >$zsysctl"; fi
|
||||||
if [ -n "$mksysnum" ]; then echo "$mksysnum |gofmt >zsysnum_$GOOSARCH.go"; fi
|
if [ -n "$mksysnum" ]; then echo "$mksysnum |gofmt >zsysnum_$GOOSARCH.go"; fi
|
||||||
if [ -n "$mktypes" ]; then echo "$mktypes types_$GOOS.go | go run mkpost.go > ztypes_$GOOSARCH.go"; fi
|
if [ -n "$mktypes" ]; then echo "$mktypes types_$GOOS.go | go run mkpost.go > ztypes_$GOOSARCH.go"; fi
|
||||||
if [ -n "$mkasm" ]; then echo "$mkasm $GOARCH"; fi
|
if [ -n "$mkasm" ]; then echo "$mkasm $GOOS $GOARCH"; fi
|
||||||
) | $run
|
) | $run
|
||||||
|
|
|
@ -128,6 +128,7 @@ includes_FreeBSD='
|
||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
#include <sys/ptrace.h>
|
||||||
#include <net/bpf.h>
|
#include <net/bpf.h>
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
#include <net/if_types.h>
|
#include <net/if_types.h>
|
||||||
|
@ -202,6 +203,7 @@ struct ltchars {
|
||||||
#include <sys/timerfd.h>
|
#include <sys/timerfd.h>
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
#include <sys/xattr.h>
|
#include <sys/xattr.h>
|
||||||
|
#include <linux/audit.h>
|
||||||
#include <linux/bpf.h>
|
#include <linux/bpf.h>
|
||||||
#include <linux/can.h>
|
#include <linux/can.h>
|
||||||
#include <linux/can/error.h>
|
#include <linux/can/error.h>
|
||||||
|
@ -295,6 +297,10 @@ struct ltchars {
|
||||||
#define SOL_NETLINK 270
|
#define SOL_NETLINK 270
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef SOL_SMC
|
||||||
|
#define SOL_SMC 286
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef SOL_BLUETOOTH
|
#ifdef SOL_BLUETOOTH
|
||||||
// SPARC includes this in /usr/include/sparc64-linux-gnu/bits/socket.h
|
// SPARC includes this in /usr/include/sparc64-linux-gnu/bits/socket.h
|
||||||
// but it is already in bluetooth_linux.go
|
// but it is already in bluetooth_linux.go
|
||||||
|
@ -529,7 +535,7 @@ ccflags="$@"
|
||||||
$2 ~ /^(MS|MNT|MOUNT|UMOUNT)_/ ||
|
$2 ~ /^(MS|MNT|MOUNT|UMOUNT)_/ ||
|
||||||
$2 ~ /^NS_GET_/ ||
|
$2 ~ /^NS_GET_/ ||
|
||||||
$2 ~ /^TUN(SET|GET|ATTACH|DETACH)/ ||
|
$2 ~ /^TUN(SET|GET|ATTACH|DETACH)/ ||
|
||||||
$2 ~ /^(O|F|[ES]?FD|NAME|S|PTRACE|PT|TFD)_/ ||
|
$2 ~ /^(O|F|[ES]?FD|NAME|S|PTRACE|PT|PIOD|TFD)_/ ||
|
||||||
$2 ~ /^KEXEC_/ ||
|
$2 ~ /^KEXEC_/ ||
|
||||||
$2 ~ /^LINUX_REBOOT_CMD_/ ||
|
$2 ~ /^LINUX_REBOOT_CMD_/ ||
|
||||||
$2 ~ /^LINUX_REBOOT_MAGIC[12]$/ ||
|
$2 ~ /^LINUX_REBOOT_MAGIC[12]$/ ||
|
||||||
|
@ -553,6 +559,7 @@ ccflags="$@"
|
||||||
$2 ~ /^CLONE_[A-Z_]+/ ||
|
$2 ~ /^CLONE_[A-Z_]+/ ||
|
||||||
$2 !~ /^(BPF_TIMEVAL|BPF_FIB_LOOKUP_[A-Z]+)$/ &&
|
$2 !~ /^(BPF_TIMEVAL|BPF_FIB_LOOKUP_[A-Z]+)$/ &&
|
||||||
$2 ~ /^(BPF|DLT)_/ ||
|
$2 ~ /^(BPF|DLT)_/ ||
|
||||||
|
$2 ~ /^AUDIT_/ ||
|
||||||
$2 ~ /^(CLOCK|TIMER)_/ ||
|
$2 ~ /^(CLOCK|TIMER)_/ ||
|
||||||
$2 ~ /^CAN_/ ||
|
$2 ~ /^CAN_/ ||
|
||||||
$2 ~ /^CAP_/ ||
|
$2 ~ /^CAP_/ ||
|
||||||
|
@ -575,7 +582,6 @@ ccflags="$@"
|
||||||
$2 ~ /^SEEK_/ ||
|
$2 ~ /^SEEK_/ ||
|
||||||
$2 ~ /^SPLICE_/ ||
|
$2 ~ /^SPLICE_/ ||
|
||||||
$2 ~ /^SYNC_FILE_RANGE_/ ||
|
$2 ~ /^SYNC_FILE_RANGE_/ ||
|
||||||
$2 !~ /^AUDIT_RECORD_MAGIC/ &&
|
|
||||||
$2 !~ /IOC_MAGIC/ &&
|
$2 !~ /IOC_MAGIC/ &&
|
||||||
$2 ~ /^[A-Z][A-Z0-9_]+_MAGIC2?$/ ||
|
$2 ~ /^[A-Z][A-Z0-9_]+_MAGIC2?$/ ||
|
||||||
$2 ~ /^(VM|VMADDR)_/ ||
|
$2 ~ /^(VM|VMADDR)_/ ||
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
// Copyright 2009 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
|
|
||||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
|
||||||
|
|
||||||
package unix
|
|
||||||
|
|
||||||
func itoa(val int) string { // do it here rather than with fmt to avoid dependency
|
|
||||||
if val < 0 {
|
|
||||||
return "-" + uitoa(uint(-val))
|
|
||||||
}
|
|
||||||
return uitoa(uint(val))
|
|
||||||
}
|
|
||||||
|
|
||||||
func uitoa(val uint) string {
|
|
||||||
var buf [32]byte // big enough for int64
|
|
||||||
i := len(buf) - 1
|
|
||||||
for val >= 10 {
|
|
||||||
buf[i] = byte(val%10 + '0')
|
|
||||||
i--
|
|
||||||
val /= 10
|
|
||||||
}
|
|
||||||
buf[i] = byte(val + '0')
|
|
||||||
return string(buf[i:])
|
|
||||||
}
|
|
|
@ -29,8 +29,6 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"strings"
|
"strings"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
"golang.org/x/sys/internal/unsafeheader"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// ByteSliceFromString returns a NUL-terminated slice of bytes
|
// ByteSliceFromString returns a NUL-terminated slice of bytes
|
||||||
|
@ -82,12 +80,7 @@ func BytePtrToString(p *byte) string {
|
||||||
ptr = unsafe.Pointer(uintptr(ptr) + 1)
|
ptr = unsafe.Pointer(uintptr(ptr) + 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
var s []byte
|
s := unsafe.Slice((*byte)(unsafe.Pointer(p)), n)
|
||||||
h := (*unsafeheader.Slice)(unsafe.Pointer(&s))
|
|
||||||
h.Data = unsafe.Pointer(p)
|
|
||||||
h.Len = n
|
|
||||||
h.Cap = n
|
|
||||||
|
|
||||||
return string(s)
|
return string(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@ func Creat(path string, mode uint32) (fd int, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//sys utimes(path string, times *[2]Timeval) (err error)
|
//sys utimes(path string, times *[2]Timeval) (err error)
|
||||||
|
|
||||||
func Utimes(path string, tv []Timeval) error {
|
func Utimes(path string, tv []Timeval) error {
|
||||||
if len(tv) != 2 {
|
if len(tv) != 2 {
|
||||||
return EINVAL
|
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)
|
//sys utimensat(dirfd int, path string, times *[2]Timespec, flag int) (err error)
|
||||||
|
|
||||||
func UtimesNano(path string, ts []Timespec) error {
|
func UtimesNano(path string, ts []Timespec) error {
|
||||||
if len(ts) != 2 {
|
if len(ts) != 2 {
|
||||||
return EINVAL
|
return EINVAL
|
||||||
|
@ -215,14 +217,63 @@ func Accept(fd int) (nfd int, sa Sockaddr, err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func recvmsgRaw(fd int, p, oob []byte, flags int, rsa *RawSockaddrAny) (n, oobn int, recvflags int, err error) {
|
func recvmsgRaw(fd int, iov []Iovec, oob []byte, flags int, rsa *RawSockaddrAny) (n, oobn int, recvflags int, err error) {
|
||||||
// Recvmsg not implemented on AIX
|
var msg Msghdr
|
||||||
return -1, -1, -1, ENOSYS
|
msg.Name = (*byte)(unsafe.Pointer(rsa))
|
||||||
|
msg.Namelen = uint32(SizeofSockaddrAny)
|
||||||
|
var dummy byte
|
||||||
|
if len(oob) > 0 {
|
||||||
|
// receive at least one normal byte
|
||||||
|
if emptyIovecs(iov) {
|
||||||
|
var iova [1]Iovec
|
||||||
|
iova[0].Base = &dummy
|
||||||
|
iova[0].SetLen(1)
|
||||||
|
iov = iova[:]
|
||||||
|
}
|
||||||
|
msg.Control = (*byte)(unsafe.Pointer(&oob[0]))
|
||||||
|
msg.SetControllen(len(oob))
|
||||||
|
}
|
||||||
|
if len(iov) > 0 {
|
||||||
|
msg.Iov = &iov[0]
|
||||||
|
msg.SetIovlen(len(iov))
|
||||||
|
}
|
||||||
|
if n, err = recvmsg(fd, &msg, flags); n == -1 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
oobn = int(msg.Controllen)
|
||||||
|
recvflags = int(msg.Flags)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func sendmsgN(fd int, p, oob []byte, ptr unsafe.Pointer, salen _Socklen, flags int) (n int, err error) {
|
func sendmsgN(fd int, iov []Iovec, oob []byte, ptr unsafe.Pointer, salen _Socklen, flags int) (n int, err error) {
|
||||||
// SendmsgN not implemented on AIX
|
var msg Msghdr
|
||||||
return -1, ENOSYS
|
msg.Name = (*byte)(unsafe.Pointer(ptr))
|
||||||
|
msg.Namelen = uint32(salen)
|
||||||
|
var dummy byte
|
||||||
|
var empty bool
|
||||||
|
if len(oob) > 0 {
|
||||||
|
// send at least one normal byte
|
||||||
|
empty = emptyIovecs(iov)
|
||||||
|
if empty {
|
||||||
|
var iova [1]Iovec
|
||||||
|
iova[0].Base = &dummy
|
||||||
|
iova[0].SetLen(1)
|
||||||
|
iov = iova[:]
|
||||||
|
}
|
||||||
|
msg.Control = (*byte)(unsafe.Pointer(&oob[0]))
|
||||||
|
msg.SetControllen(len(oob))
|
||||||
|
}
|
||||||
|
if len(iov) > 0 {
|
||||||
|
msg.Iov = &iov[0]
|
||||||
|
msg.SetIovlen(len(iov))
|
||||||
|
}
|
||||||
|
if n, err = sendmsg(fd, &msg, flags); err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
if len(oob) > 0 && empty {
|
||||||
|
n = 0
|
||||||
|
}
|
||||||
|
return n, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||||
|
@ -300,11 +351,13 @@ func direntNamlen(buf []byte) (uint64, bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//sys getdirent(fd int, buf []byte) (n int, err error)
|
//sys getdirent(fd int, buf []byte) (n int, err error)
|
||||||
|
|
||||||
func Getdents(fd int, buf []byte) (n int, err error) {
|
func Getdents(fd int, buf []byte) (n int, err error) {
|
||||||
return getdirent(fd, buf)
|
return getdirent(fd, buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
//sys wait4(pid Pid_t, status *_C_int, options int, rusage *Rusage) (wpid Pid_t, err error)
|
//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) {
|
func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, err error) {
|
||||||
var status _C_int
|
var status _C_int
|
||||||
var r Pid_t
|
var r Pid_t
|
||||||
|
@ -372,6 +425,7 @@ func (w WaitStatus) TrapCause() int { return -1 }
|
||||||
//sys fcntl(fd int, cmd int, arg int) (val int, err error)
|
//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
|
//sys fsyncRange(fd int, how int, start int64, length int64) (err error) = fsync_range
|
||||||
|
|
||||||
func Fsync(fd int) error {
|
func Fsync(fd int) error {
|
||||||
return fsyncRange(fd, O_SYNC, 0, 0)
|
return fsyncRange(fd, O_SYNC, 0, 0)
|
||||||
}
|
}
|
||||||
|
@ -536,6 +590,7 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||||
//sys Getsystemcfg(label int) (n uint64)
|
//sys Getsystemcfg(label int) (n uint64)
|
||||||
|
|
||||||
//sys umount(target string) (err error)
|
//sys umount(target string) (err error)
|
||||||
|
|
||||||
func Unmount(target string, flags int) (err error) {
|
func Unmount(target string, flags int) (err error) {
|
||||||
if flags != 0 {
|
if flags != 0 {
|
||||||
// AIX doesn't have any flags for umount.
|
// AIX doesn't have any flags for umount.
|
||||||
|
|
|
@ -325,27 +325,26 @@ func GetsockoptString(fd, level, opt int) (string, error) {
|
||||||
//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (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 recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
|
||||||
|
|
||||||
func recvmsgRaw(fd int, p, oob []byte, flags int, rsa *RawSockaddrAny) (n, oobn int, recvflags int, err error) {
|
func recvmsgRaw(fd int, iov []Iovec, oob []byte, flags int, rsa *RawSockaddrAny) (n, oobn int, recvflags int, err error) {
|
||||||
var msg Msghdr
|
var msg Msghdr
|
||||||
msg.Name = (*byte)(unsafe.Pointer(rsa))
|
msg.Name = (*byte)(unsafe.Pointer(rsa))
|
||||||
msg.Namelen = uint32(SizeofSockaddrAny)
|
msg.Namelen = uint32(SizeofSockaddrAny)
|
||||||
var iov Iovec
|
|
||||||
if len(p) > 0 {
|
|
||||||
iov.Base = (*byte)(unsafe.Pointer(&p[0]))
|
|
||||||
iov.SetLen(len(p))
|
|
||||||
}
|
|
||||||
var dummy byte
|
var dummy byte
|
||||||
if len(oob) > 0 {
|
if len(oob) > 0 {
|
||||||
// receive at least one normal byte
|
// receive at least one normal byte
|
||||||
if len(p) == 0 {
|
if emptyIovecs(iov) {
|
||||||
iov.Base = &dummy
|
var iova [1]Iovec
|
||||||
iov.SetLen(1)
|
iova[0].Base = &dummy
|
||||||
|
iova[0].SetLen(1)
|
||||||
|
iov = iova[:]
|
||||||
}
|
}
|
||||||
msg.Control = (*byte)(unsafe.Pointer(&oob[0]))
|
msg.Control = (*byte)(unsafe.Pointer(&oob[0]))
|
||||||
msg.SetControllen(len(oob))
|
msg.SetControllen(len(oob))
|
||||||
}
|
}
|
||||||
msg.Iov = &iov
|
if len(iov) > 0 {
|
||||||
msg.Iovlen = 1
|
msg.Iov = &iov[0]
|
||||||
|
msg.SetIovlen(len(iov))
|
||||||
|
}
|
||||||
if n, err = recvmsg(fd, &msg, flags); err != nil {
|
if n, err = recvmsg(fd, &msg, flags); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -356,31 +355,32 @@ func recvmsgRaw(fd int, p, oob []byte, flags int, rsa *RawSockaddrAny) (n, oobn
|
||||||
|
|
||||||
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
|
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
|
||||||
|
|
||||||
func sendmsgN(fd int, p, oob []byte, ptr unsafe.Pointer, salen _Socklen, flags int) (n int, err error) {
|
func sendmsgN(fd int, iov []Iovec, oob []byte, ptr unsafe.Pointer, salen _Socklen, flags int) (n int, err error) {
|
||||||
var msg Msghdr
|
var msg Msghdr
|
||||||
msg.Name = (*byte)(unsafe.Pointer(ptr))
|
msg.Name = (*byte)(unsafe.Pointer(ptr))
|
||||||
msg.Namelen = uint32(salen)
|
msg.Namelen = uint32(salen)
|
||||||
var iov Iovec
|
|
||||||
if len(p) > 0 {
|
|
||||||
iov.Base = (*byte)(unsafe.Pointer(&p[0]))
|
|
||||||
iov.SetLen(len(p))
|
|
||||||
}
|
|
||||||
var dummy byte
|
var dummy byte
|
||||||
|
var empty bool
|
||||||
if len(oob) > 0 {
|
if len(oob) > 0 {
|
||||||
// send at least one normal byte
|
// send at least one normal byte
|
||||||
if len(p) == 0 {
|
empty = emptyIovecs(iov)
|
||||||
iov.Base = &dummy
|
if empty {
|
||||||
iov.SetLen(1)
|
var iova [1]Iovec
|
||||||
|
iova[0].Base = &dummy
|
||||||
|
iova[0].SetLen(1)
|
||||||
|
iov = iova[:]
|
||||||
}
|
}
|
||||||
msg.Control = (*byte)(unsafe.Pointer(&oob[0]))
|
msg.Control = (*byte)(unsafe.Pointer(&oob[0]))
|
||||||
msg.SetControllen(len(oob))
|
msg.SetControllen(len(oob))
|
||||||
}
|
}
|
||||||
msg.Iov = &iov
|
if len(iov) > 0 {
|
||||||
msg.Iovlen = 1
|
msg.Iov = &iov[0]
|
||||||
|
msg.SetIovlen(len(iov))
|
||||||
|
}
|
||||||
if n, err = sendmsg(fd, &msg, flags); err != nil {
|
if n, err = sendmsg(fd, &msg, flags); err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
if len(oob) > 0 && len(p) == 0 {
|
if len(oob) > 0 && empty {
|
||||||
n = 0
|
n = 0
|
||||||
}
|
}
|
||||||
return n, nil
|
return n, nil
|
||||||
|
|
|
@ -7,11 +7,7 @@
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
import (
|
import "unsafe"
|
||||||
"unsafe"
|
|
||||||
|
|
||||||
"golang.org/x/sys/internal/unsafeheader"
|
|
||||||
)
|
|
||||||
|
|
||||||
//sys closedir(dir uintptr) (err error)
|
//sys closedir(dir uintptr) (err error)
|
||||||
//sys readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno)
|
//sys readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno)
|
||||||
|
@ -86,11 +82,7 @@ func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy entry into return buffer.
|
// Copy entry into return buffer.
|
||||||
var s []byte
|
s := unsafe.Slice((*byte)(unsafe.Pointer(&entry)), reclen)
|
||||||
hdr := (*unsafeheader.Slice)(unsafe.Pointer(&s))
|
|
||||||
hdr.Data = unsafe.Pointer(&entry)
|
|
||||||
hdr.Cap = reclen
|
|
||||||
hdr.Len = reclen
|
|
||||||
copy(buf, s)
|
copy(buf, s)
|
||||||
|
|
||||||
buf = buf[reclen:]
|
buf = buf[reclen:]
|
||||||
|
|
|
@ -393,6 +393,13 @@ func GetsockoptXucred(fd, level, opt int) (*Xucred, error) {
|
||||||
return x, err
|
return x, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetsockoptTCPConnectionInfo(fd, level, opt int) (*TCPConnectionInfo, error) {
|
||||||
|
var value TCPConnectionInfo
|
||||||
|
vallen := _Socklen(SizeofTCPConnectionInfo)
|
||||||
|
err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
|
||||||
|
return &value, err
|
||||||
|
}
|
||||||
|
|
||||||
func SysctlKinfoProc(name string, args ...int) (*KinfoProc, error) {
|
func SysctlKinfoProc(name string, args ...int) (*KinfoProc, error) {
|
||||||
mib, err := sysctlmib(name, args...)
|
mib, err := sysctlmib(name, args...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -504,6 +511,7 @@ func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, error) {
|
||||||
//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
|
//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
|
||||||
//sys Mkfifo(path string, mode uint32) (err error)
|
//sys Mkfifo(path string, mode uint32) (err error)
|
||||||
//sys Mknod(path string, mode uint32, dev int) (err error)
|
//sys Mknod(path string, mode uint32, dev int) (err error)
|
||||||
|
//sys 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 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 Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error)
|
||||||
//sys Pathconf(path string, name int) (val int, err error)
|
//sys Pathconf(path string, name int) (val int, err error)
|
||||||
|
@ -572,7 +580,6 @@ func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, error) {
|
||||||
// Nfssvc
|
// Nfssvc
|
||||||
// Getfh
|
// Getfh
|
||||||
// Quotactl
|
// Quotactl
|
||||||
// Mount
|
|
||||||
// Csops
|
// Csops
|
||||||
// Waitid
|
// Waitid
|
||||||
// Add_profil
|
// Add_profil
|
||||||
|
|
|
@ -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)
|
//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) {
|
func pread(fd int, p []byte, offset int64) (n int, err error) {
|
||||||
return extpread(fd, p, 0, offset)
|
return extpread(fd, p, 0, offset)
|
||||||
}
|
}
|
||||||
|
|
||||||
//sys extpwrite(fd int, p []byte, flags int, offset int64) (n int, err error)
|
//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) {
|
func pwrite(fd int, p []byte, offset int64) (n int, err error) {
|
||||||
return extpwrite(fd, p, 0, offset)
|
return extpwrite(fd, p, 0, offset)
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,25 +17,12 @@ import (
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
SYS_FSTAT_FREEBSD12 = 551 // { int fstat(int fd, _Out_ struct stat *sb); }
|
|
||||||
SYS_FSTATAT_FREEBSD12 = 552 // { int fstatat(int fd, _In_z_ char *path, \
|
|
||||||
SYS_GETDIRENTRIES_FREEBSD12 = 554 // { ssize_t getdirentries(int fd, \
|
|
||||||
SYS_STATFS_FREEBSD12 = 555 // { int statfs(_In_z_ char *path, \
|
|
||||||
SYS_FSTATFS_FREEBSD12 = 556 // { int fstatfs(int fd, \
|
|
||||||
SYS_GETFSSTAT_FREEBSD12 = 557 // { int getfsstat( \
|
|
||||||
SYS_MKNODAT_FREEBSD12 = 559 // { int mknodat(int fd, _In_z_ char *path, \
|
|
||||||
)
|
|
||||||
|
|
||||||
// See https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/versions.html.
|
// See https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/versions.html.
|
||||||
var (
|
var (
|
||||||
osreldateOnce sync.Once
|
osreldateOnce sync.Once
|
||||||
osreldate uint32
|
osreldate uint32
|
||||||
)
|
)
|
||||||
|
|
||||||
// INO64_FIRST from /usr/src/lib/libc/sys/compat-ino64.h
|
|
||||||
const _ino64First = 1200031
|
|
||||||
|
|
||||||
func supportsABI(ver uint32) bool {
|
func supportsABI(ver uint32) bool {
|
||||||
osreldateOnce.Do(func() { osreldate, _ = SysctlUint32("kern.osreldate") })
|
osreldateOnce.Do(func() { osreldate, _ = SysctlUint32("kern.osreldate") })
|
||||||
return osreldate >= ver
|
return osreldate >= ver
|
||||||
|
@ -161,36 +148,16 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
|
||||||
var (
|
var (
|
||||||
_p0 unsafe.Pointer
|
_p0 unsafe.Pointer
|
||||||
bufsize uintptr
|
bufsize uintptr
|
||||||
oldBuf []statfs_freebsd11_t
|
|
||||||
needsConvert bool
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if len(buf) > 0 {
|
if len(buf) > 0 {
|
||||||
if supportsABI(_ino64First) {
|
|
||||||
_p0 = unsafe.Pointer(&buf[0])
|
_p0 = unsafe.Pointer(&buf[0])
|
||||||
bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf))
|
bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf))
|
||||||
} else {
|
|
||||||
n := len(buf)
|
|
||||||
oldBuf = make([]statfs_freebsd11_t, n)
|
|
||||||
_p0 = unsafe.Pointer(&oldBuf[0])
|
|
||||||
bufsize = unsafe.Sizeof(statfs_freebsd11_t{}) * uintptr(n)
|
|
||||||
needsConvert = true
|
|
||||||
}
|
}
|
||||||
}
|
r0, _, e1 := Syscall(SYS_GETFSSTAT, uintptr(_p0), bufsize, uintptr(flags))
|
||||||
var sysno uintptr = SYS_GETFSSTAT
|
|
||||||
if supportsABI(_ino64First) {
|
|
||||||
sysno = SYS_GETFSSTAT_FREEBSD12
|
|
||||||
}
|
|
||||||
r0, _, e1 := Syscall(sysno, uintptr(_p0), bufsize, uintptr(flags))
|
|
||||||
n = int(r0)
|
n = int(r0)
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
err = e1
|
err = e1
|
||||||
}
|
}
|
||||||
if e1 == 0 && needsConvert {
|
|
||||||
for i := range oldBuf {
|
|
||||||
buf[i].convertFrom(&oldBuf[i])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,87 +212,11 @@ func Uname(uname *Utsname) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Stat(path string, st *Stat_t) (err error) {
|
func Stat(path string, st *Stat_t) (err error) {
|
||||||
var oldStat stat_freebsd11_t
|
return Fstatat(AT_FDCWD, path, st, 0)
|
||||||
if supportsABI(_ino64First) {
|
|
||||||
return fstatat_freebsd12(AT_FDCWD, path, st, 0)
|
|
||||||
}
|
|
||||||
err = stat(path, &oldStat)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
st.convertFrom(&oldStat)
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func Lstat(path string, st *Stat_t) (err error) {
|
func Lstat(path string, st *Stat_t) (err error) {
|
||||||
var oldStat stat_freebsd11_t
|
return Fstatat(AT_FDCWD, path, st, AT_SYMLINK_NOFOLLOW)
|
||||||
if supportsABI(_ino64First) {
|
|
||||||
return fstatat_freebsd12(AT_FDCWD, path, st, AT_SYMLINK_NOFOLLOW)
|
|
||||||
}
|
|
||||||
err = lstat(path, &oldStat)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
st.convertFrom(&oldStat)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func Fstat(fd int, st *Stat_t) (err error) {
|
|
||||||
var oldStat stat_freebsd11_t
|
|
||||||
if supportsABI(_ino64First) {
|
|
||||||
return fstat_freebsd12(fd, st)
|
|
||||||
}
|
|
||||||
err = fstat(fd, &oldStat)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
st.convertFrom(&oldStat)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func Fstatat(fd int, path string, st *Stat_t, flags int) (err error) {
|
|
||||||
var oldStat stat_freebsd11_t
|
|
||||||
if supportsABI(_ino64First) {
|
|
||||||
return fstatat_freebsd12(fd, path, st, flags)
|
|
||||||
}
|
|
||||||
err = fstatat(fd, path, &oldStat, flags)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
st.convertFrom(&oldStat)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func Statfs(path string, st *Statfs_t) (err error) {
|
|
||||||
var oldStatfs statfs_freebsd11_t
|
|
||||||
if supportsABI(_ino64First) {
|
|
||||||
return statfs_freebsd12(path, st)
|
|
||||||
}
|
|
||||||
err = statfs(path, &oldStatfs)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
st.convertFrom(&oldStatfs)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func Fstatfs(fd int, st *Statfs_t) (err error) {
|
|
||||||
var oldStatfs statfs_freebsd11_t
|
|
||||||
if supportsABI(_ino64First) {
|
|
||||||
return fstatfs_freebsd12(fd, st)
|
|
||||||
}
|
|
||||||
err = fstatfs(fd, &oldStatfs)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
st.convertFrom(&oldStatfs)
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func Getdents(fd int, buf []byte) (n int, err error) {
|
func Getdents(fd int, buf []byte) (n int, err error) {
|
||||||
|
@ -333,14 +224,13 @@ func Getdents(fd int, buf []byte) (n int, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
|
func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
|
||||||
if supportsABI(_ino64First) {
|
|
||||||
if basep == nil || unsafe.Sizeof(*basep) == 8 {
|
if basep == nil || unsafe.Sizeof(*basep) == 8 {
|
||||||
return getdirentries_freebsd12(fd, buf, (*uint64)(unsafe.Pointer(basep)))
|
return getdirentries(fd, buf, (*uint64)(unsafe.Pointer(basep)))
|
||||||
}
|
}
|
||||||
// The freebsd12 syscall needs a 64-bit base. On 32-bit machines
|
// The syscall needs a 64-bit base. On 32-bit machines
|
||||||
// we can't just use the basep passed in. See #32498.
|
// we can't just use the basep passed in. See #32498.
|
||||||
var base uint64 = uint64(*basep)
|
var base uint64 = uint64(*basep)
|
||||||
n, err = getdirentries_freebsd12(fd, buf, &base)
|
n, err = getdirentries(fd, buf, &base)
|
||||||
*basep = uintptr(base)
|
*basep = uintptr(base)
|
||||||
if base>>32 != 0 {
|
if base>>32 != 0 {
|
||||||
// We can't stuff the base back into a uintptr, so any
|
// We can't stuff the base back into a uintptr, so any
|
||||||
|
@ -349,146 +239,10 @@ func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
|
||||||
err = EIO
|
err = EIO
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
|
||||||
|
|
||||||
// The old syscall entries are smaller than the new. Use 1/4 of the original
|
|
||||||
// buffer size rounded up to DIRBLKSIZ (see /usr/src/lib/libc/sys/getdirentries.c).
|
|
||||||
oldBufLen := roundup(len(buf)/4, _dirblksiz)
|
|
||||||
oldBuf := make([]byte, oldBufLen)
|
|
||||||
n, err = getdirentries(fd, oldBuf, basep)
|
|
||||||
if err == nil && n > 0 {
|
|
||||||
n = convertFromDirents11(buf, oldBuf[:n])
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func Mknod(path string, mode uint32, dev uint64) (err error) {
|
func Mknod(path string, mode uint32, dev uint64) (err error) {
|
||||||
var oldDev int
|
return Mknodat(AT_FDCWD, path, mode, dev)
|
||||||
if supportsABI(_ino64First) {
|
|
||||||
return mknodat_freebsd12(AT_FDCWD, path, mode, dev)
|
|
||||||
}
|
|
||||||
oldDev = int(dev)
|
|
||||||
return mknod(path, mode, oldDev)
|
|
||||||
}
|
|
||||||
|
|
||||||
func Mknodat(fd int, path string, mode uint32, dev uint64) (err error) {
|
|
||||||
var oldDev int
|
|
||||||
if supportsABI(_ino64First) {
|
|
||||||
return mknodat_freebsd12(fd, path, mode, dev)
|
|
||||||
}
|
|
||||||
oldDev = int(dev)
|
|
||||||
return mknodat(fd, path, mode, oldDev)
|
|
||||||
}
|
|
||||||
|
|
||||||
// round x to the nearest multiple of y, larger or equal to x.
|
|
||||||
//
|
|
||||||
// from /usr/include/sys/param.h Macros for counting and rounding.
|
|
||||||
// #define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
|
|
||||||
func roundup(x, y int) int {
|
|
||||||
return ((x + y - 1) / y) * y
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *Stat_t) convertFrom(old *stat_freebsd11_t) {
|
|
||||||
*s = Stat_t{
|
|
||||||
Dev: uint64(old.Dev),
|
|
||||||
Ino: uint64(old.Ino),
|
|
||||||
Nlink: uint64(old.Nlink),
|
|
||||||
Mode: old.Mode,
|
|
||||||
Uid: old.Uid,
|
|
||||||
Gid: old.Gid,
|
|
||||||
Rdev: uint64(old.Rdev),
|
|
||||||
Atim: old.Atim,
|
|
||||||
Mtim: old.Mtim,
|
|
||||||
Ctim: old.Ctim,
|
|
||||||
Btim: old.Btim,
|
|
||||||
Size: old.Size,
|
|
||||||
Blocks: old.Blocks,
|
|
||||||
Blksize: old.Blksize,
|
|
||||||
Flags: old.Flags,
|
|
||||||
Gen: uint64(old.Gen),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *Statfs_t) convertFrom(old *statfs_freebsd11_t) {
|
|
||||||
*s = Statfs_t{
|
|
||||||
Version: _statfsVersion,
|
|
||||||
Type: old.Type,
|
|
||||||
Flags: old.Flags,
|
|
||||||
Bsize: old.Bsize,
|
|
||||||
Iosize: old.Iosize,
|
|
||||||
Blocks: old.Blocks,
|
|
||||||
Bfree: old.Bfree,
|
|
||||||
Bavail: old.Bavail,
|
|
||||||
Files: old.Files,
|
|
||||||
Ffree: old.Ffree,
|
|
||||||
Syncwrites: old.Syncwrites,
|
|
||||||
Asyncwrites: old.Asyncwrites,
|
|
||||||
Syncreads: old.Syncreads,
|
|
||||||
Asyncreads: old.Asyncreads,
|
|
||||||
// Spare
|
|
||||||
Namemax: old.Namemax,
|
|
||||||
Owner: old.Owner,
|
|
||||||
Fsid: old.Fsid,
|
|
||||||
// Charspare
|
|
||||||
// Fstypename
|
|
||||||
// Mntfromname
|
|
||||||
// Mntonname
|
|
||||||
}
|
|
||||||
|
|
||||||
sl := old.Fstypename[:]
|
|
||||||
n := clen(*(*[]byte)(unsafe.Pointer(&sl)))
|
|
||||||
copy(s.Fstypename[:], old.Fstypename[:n])
|
|
||||||
|
|
||||||
sl = old.Mntfromname[:]
|
|
||||||
n = clen(*(*[]byte)(unsafe.Pointer(&sl)))
|
|
||||||
copy(s.Mntfromname[:], old.Mntfromname[:n])
|
|
||||||
|
|
||||||
sl = old.Mntonname[:]
|
|
||||||
n = clen(*(*[]byte)(unsafe.Pointer(&sl)))
|
|
||||||
copy(s.Mntonname[:], old.Mntonname[:n])
|
|
||||||
}
|
|
||||||
|
|
||||||
func convertFromDirents11(buf []byte, old []byte) int {
|
|
||||||
const (
|
|
||||||
fixedSize = int(unsafe.Offsetof(Dirent{}.Name))
|
|
||||||
oldFixedSize = int(unsafe.Offsetof(dirent_freebsd11{}.Name))
|
|
||||||
)
|
|
||||||
|
|
||||||
dstPos := 0
|
|
||||||
srcPos := 0
|
|
||||||
for dstPos+fixedSize < len(buf) && srcPos+oldFixedSize < len(old) {
|
|
||||||
var dstDirent Dirent
|
|
||||||
var srcDirent dirent_freebsd11
|
|
||||||
|
|
||||||
// If multiple direntries are written, sometimes when we reach the final one,
|
|
||||||
// we may have cap of old less than size of dirent_freebsd11.
|
|
||||||
copy((*[unsafe.Sizeof(srcDirent)]byte)(unsafe.Pointer(&srcDirent))[:], old[srcPos:])
|
|
||||||
|
|
||||||
reclen := roundup(fixedSize+int(srcDirent.Namlen)+1, 8)
|
|
||||||
if dstPos+reclen > len(buf) {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
dstDirent.Fileno = uint64(srcDirent.Fileno)
|
|
||||||
dstDirent.Off = 0
|
|
||||||
dstDirent.Reclen = uint16(reclen)
|
|
||||||
dstDirent.Type = srcDirent.Type
|
|
||||||
dstDirent.Pad0 = 0
|
|
||||||
dstDirent.Namlen = uint16(srcDirent.Namlen)
|
|
||||||
dstDirent.Pad1 = 0
|
|
||||||
|
|
||||||
copy(dstDirent.Name[:], srcDirent.Name[:srcDirent.Namlen])
|
|
||||||
copy(buf[dstPos:], (*[unsafe.Sizeof(dstDirent)]byte)(unsafe.Pointer(&dstDirent))[:])
|
|
||||||
padding := buf[dstPos+fixedSize+int(dstDirent.Namlen) : dstPos+reclen]
|
|
||||||
for i := range padding {
|
|
||||||
padding[i] = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
dstPos += int(dstDirent.Reclen)
|
|
||||||
srcPos += int(srcDirent.Reclen)
|
|
||||||
}
|
|
||||||
|
|
||||||
return dstPos
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||||
|
@ -501,31 +255,31 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
|
||||||
//sys ptrace(request int, pid int, addr uintptr, data int) (err error)
|
//sys ptrace(request int, pid int, addr uintptr, data int) (err error)
|
||||||
|
|
||||||
func PtraceAttach(pid int) (err error) {
|
func PtraceAttach(pid int) (err error) {
|
||||||
return ptrace(PTRACE_ATTACH, pid, 0, 0)
|
return ptrace(PT_ATTACH, pid, 0, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func PtraceCont(pid int, signal int) (err error) {
|
func PtraceCont(pid int, signal int) (err error) {
|
||||||
return ptrace(PTRACE_CONT, pid, 1, signal)
|
return ptrace(PT_CONTINUE, pid, 1, signal)
|
||||||
}
|
}
|
||||||
|
|
||||||
func PtraceDetach(pid int) (err error) {
|
func PtraceDetach(pid int) (err error) {
|
||||||
return ptrace(PTRACE_DETACH, pid, 1, 0)
|
return ptrace(PT_DETACH, pid, 1, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func PtraceGetFpRegs(pid int, fpregsout *FpReg) (err error) {
|
func PtraceGetFpRegs(pid int, fpregsout *FpReg) (err error) {
|
||||||
return ptrace(PTRACE_GETFPREGS, pid, uintptr(unsafe.Pointer(fpregsout)), 0)
|
return ptrace(PT_GETFPREGS, pid, uintptr(unsafe.Pointer(fpregsout)), 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func PtraceGetRegs(pid int, regsout *Reg) (err error) {
|
func PtraceGetRegs(pid int, regsout *Reg) (err error) {
|
||||||
return ptrace(PTRACE_GETREGS, pid, uintptr(unsafe.Pointer(regsout)), 0)
|
return ptrace(PT_GETREGS, pid, uintptr(unsafe.Pointer(regsout)), 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func PtraceLwpEvents(pid int, enable int) (err error) {
|
func PtraceLwpEvents(pid int, enable int) (err error) {
|
||||||
return ptrace(PTRACE_LWPEVENTS, pid, 0, enable)
|
return ptrace(PT_LWP_EVENTS, pid, 0, enable)
|
||||||
}
|
}
|
||||||
|
|
||||||
func PtraceLwpInfo(pid int, info uintptr) (err error) {
|
func PtraceLwpInfo(pid int, info uintptr) (err error) {
|
||||||
return ptrace(PTRACE_LWPINFO, pid, info, int(unsafe.Sizeof(PtraceLwpInfoStruct{})))
|
return ptrace(PT_LWPINFO, pid, info, int(unsafe.Sizeof(PtraceLwpInfoStruct{})))
|
||||||
}
|
}
|
||||||
|
|
||||||
func PtracePeekData(pid int, addr uintptr, out []byte) (count int, err error) {
|
func PtracePeekData(pid int, addr uintptr, out []byte) (count int, err error) {
|
||||||
|
@ -545,11 +299,11 @@ func PtracePokeText(pid int, addr uintptr, data []byte) (count int, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func PtraceSetRegs(pid int, regs *Reg) (err error) {
|
func PtraceSetRegs(pid int, regs *Reg) (err error) {
|
||||||
return ptrace(PTRACE_SETREGS, pid, uintptr(unsafe.Pointer(regs)), 0)
|
return ptrace(PT_SETREGS, pid, uintptr(unsafe.Pointer(regs)), 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func PtraceSingleStep(pid int) (err error) {
|
func PtraceSingleStep(pid int) (err error) {
|
||||||
return ptrace(PTRACE_SINGLESTEP, pid, 1, 0)
|
return ptrace(PT_STEP, pid, 1, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -591,16 +345,12 @@ func PtraceSingleStep(pid int) (err error) {
|
||||||
//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
|
//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
|
||||||
//sys Flock(fd int, how int) (err error)
|
//sys Flock(fd int, how int) (err error)
|
||||||
//sys Fpathconf(fd int, name int) (val int, err error)
|
//sys Fpathconf(fd int, name int) (val int, err error)
|
||||||
//sys fstat(fd int, stat *stat_freebsd11_t) (err error)
|
//sys Fstat(fd int, stat *Stat_t) (err error)
|
||||||
//sys fstat_freebsd12(fd int, stat *Stat_t) (err error)
|
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
|
||||||
//sys fstatat(fd int, path string, stat *stat_freebsd11_t, flags int) (err error)
|
//sys Fstatfs(fd int, stat *Statfs_t) (err error)
|
||||||
//sys fstatat_freebsd12(fd int, path string, stat *Stat_t, flags int) (err error)
|
|
||||||
//sys fstatfs(fd int, stat *statfs_freebsd11_t) (err error)
|
|
||||||
//sys fstatfs_freebsd12(fd int, stat *Statfs_t) (err error)
|
|
||||||
//sys Fsync(fd int) (err error)
|
//sys Fsync(fd int) (err error)
|
||||||
//sys Ftruncate(fd int, length int64) (err error)
|
//sys Ftruncate(fd int, length int64) (err error)
|
||||||
//sys getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error)
|
//sys getdirentries(fd int, buf []byte, basep *uint64) (n int, err error)
|
||||||
//sys getdirentries_freebsd12(fd int, buf []byte, basep *uint64) (n int, err error)
|
|
||||||
//sys Getdtablesize() (size int)
|
//sys Getdtablesize() (size int)
|
||||||
//sysnb Getegid() (egid int)
|
//sysnb Getegid() (egid int)
|
||||||
//sysnb Geteuid() (uid int)
|
//sysnb Geteuid() (uid int)
|
||||||
|
@ -622,13 +372,10 @@ func PtraceSingleStep(pid int) (err error) {
|
||||||
//sys Link(path string, link string) (err error)
|
//sys Link(path string, link string) (err error)
|
||||||
//sys Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error)
|
//sys Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error)
|
||||||
//sys Listen(s int, backlog int) (err error)
|
//sys Listen(s int, backlog int) (err error)
|
||||||
//sys lstat(path string, stat *stat_freebsd11_t) (err error)
|
|
||||||
//sys Mkdir(path string, mode uint32) (err error)
|
//sys Mkdir(path string, mode uint32) (err error)
|
||||||
//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
|
//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
|
||||||
//sys Mkfifo(path string, mode uint32) (err error)
|
//sys Mkfifo(path string, mode uint32) (err error)
|
||||||
//sys mknod(path string, mode uint32, dev int) (err error)
|
//sys Mknodat(fd int, path string, mode uint32, dev uint64) (err error)
|
||||||
//sys mknodat(fd int, path string, mode uint32, dev int) (err error)
|
|
||||||
//sys mknodat_freebsd12(fd int, path string, mode uint32, dev uint64) (err error)
|
|
||||||
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
|
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
|
||||||
//sys Open(path string, mode int, perm uint32) (fd int, err error)
|
//sys Open(path string, mode int, perm uint32) (fd int, err error)
|
||||||
//sys Openat(fdat int, path string, mode int, perm uint32) (fd int, err error)
|
//sys Openat(fdat int, path string, mode int, perm uint32) (fd int, err error)
|
||||||
|
@ -658,9 +405,7 @@ func PtraceSingleStep(pid int) (err error) {
|
||||||
//sysnb Setsid() (pid int, err error)
|
//sysnb Setsid() (pid int, err error)
|
||||||
//sysnb Settimeofday(tp *Timeval) (err error)
|
//sysnb Settimeofday(tp *Timeval) (err error)
|
||||||
//sysnb Setuid(uid int) (err error)
|
//sysnb Setuid(uid int) (err error)
|
||||||
//sys stat(path string, stat *stat_freebsd11_t) (err error)
|
//sys Statfs(path string, stat *Statfs_t) (err error)
|
||||||
//sys statfs(path string, stat *statfs_freebsd11_t) (err error)
|
|
||||||
//sys statfs_freebsd12(path string, stat *Statfs_t) (err error)
|
|
||||||
//sys Symlink(path string, link string) (err error)
|
//sys Symlink(path string, link string) (err error)
|
||||||
//sys Symlinkat(oldpath string, newdirfd int, newpath string) (err error)
|
//sys Symlinkat(oldpath string, newdirfd int, newpath string) (err error)
|
||||||
//sys Sync() (err error)
|
//sys Sync() (err error)
|
||||||
|
|
|
@ -57,11 +57,11 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
|
||||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
||||||
|
|
||||||
func PtraceGetFsBase(pid int, fsbase *int64) (err error) {
|
func PtraceGetFsBase(pid int, fsbase *int64) (err error) {
|
||||||
return ptrace(PTRACE_GETFSBASE, pid, uintptr(unsafe.Pointer(fsbase)), 0)
|
return ptrace(PT_GETFSBASE, pid, uintptr(unsafe.Pointer(fsbase)), 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func PtraceIO(req int, pid int, addr uintptr, out []byte, countin int) (count int, err error) {
|
func PtraceIO(req int, pid int, addr uintptr, out []byte, countin int) (count int, err error) {
|
||||||
ioDesc := PtraceIoDesc{Op: int32(req), Offs: (*byte)(unsafe.Pointer(addr)), Addr: (*byte)(unsafe.Pointer(&out[0])), Len: uint32(countin)}
|
ioDesc := PtraceIoDesc{Op: int32(req), Offs: uintptr(unsafe.Pointer(addr)), Addr: uintptr(unsafe.Pointer(&out[0])), Len: uint32(countin)}
|
||||||
err = ptrace(PTRACE_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0)
|
err = ptrace(PT_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0)
|
||||||
return int(ioDesc.Len), err
|
return int(ioDesc.Len), err
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,11 +57,11 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
|
||||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
||||||
|
|
||||||
func PtraceGetFsBase(pid int, fsbase *int64) (err error) {
|
func PtraceGetFsBase(pid int, fsbase *int64) (err error) {
|
||||||
return ptrace(PTRACE_GETFSBASE, pid, uintptr(unsafe.Pointer(fsbase)), 0)
|
return ptrace(PT_GETFSBASE, pid, uintptr(unsafe.Pointer(fsbase)), 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func PtraceIO(req int, pid int, addr uintptr, out []byte, countin int) (count int, err error) {
|
func PtraceIO(req int, pid int, addr uintptr, out []byte, countin int) (count int, err error) {
|
||||||
ioDesc := PtraceIoDesc{Op: int32(req), Offs: (*byte)(unsafe.Pointer(addr)), Addr: (*byte)(unsafe.Pointer(&out[0])), Len: uint64(countin)}
|
ioDesc := PtraceIoDesc{Op: int32(req), Offs: uintptr(unsafe.Pointer(addr)), Addr: uintptr(unsafe.Pointer(&out[0])), Len: uint64(countin)}
|
||||||
err = ptrace(PTRACE_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0)
|
err = ptrace(PT_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0)
|
||||||
return int(ioDesc.Len), err
|
return int(ioDesc.Len), err
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
|
||||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
||||||
|
|
||||||
func PtraceIO(req int, pid int, addr uintptr, out []byte, countin int) (count int, err error) {
|
func PtraceIO(req int, pid int, addr uintptr, out []byte, countin int) (count int, err error) {
|
||||||
ioDesc := PtraceIoDesc{Op: int32(req), Offs: (*byte)(unsafe.Pointer(addr)), Addr: (*byte)(unsafe.Pointer(&out[0])), Len: uint32(countin)}
|
ioDesc := PtraceIoDesc{Op: int32(req), Offs: uintptr(unsafe.Pointer(addr)), Addr: uintptr(unsafe.Pointer(&out[0])), Len: uint32(countin)}
|
||||||
err = ptrace(PTRACE_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0)
|
err = ptrace(PT_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0)
|
||||||
return int(ioDesc.Len), err
|
return int(ioDesc.Len), err
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
|
||||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
||||||
|
|
||||||
func PtraceIO(req int, pid int, addr uintptr, out []byte, countin int) (count int, err error) {
|
func PtraceIO(req int, pid int, addr uintptr, out []byte, countin int) (count int, err error) {
|
||||||
ioDesc := PtraceIoDesc{Op: int32(req), Offs: (*byte)(unsafe.Pointer(addr)), Addr: (*byte)(unsafe.Pointer(&out[0])), Len: uint64(countin)}
|
ioDesc := PtraceIoDesc{Op: int32(req), Offs: uintptr(unsafe.Pointer(addr)), Addr: uintptr(unsafe.Pointer(&out[0])), Len: uint64(countin)}
|
||||||
err = ptrace(PTRACE_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0)
|
err = ptrace(PT_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0)
|
||||||
return int(ioDesc.Len), err
|
return int(ioDesc.Len), err
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,10 +20,9 @@ func bytes2iovec(bs [][]byte) []Iovec {
|
||||||
for i, b := range bs {
|
for i, b := range bs {
|
||||||
iovecs[i].SetLen(len(b))
|
iovecs[i].SetLen(len(b))
|
||||||
if len(b) > 0 {
|
if len(b) > 0 {
|
||||||
// somehow Iovec.Base on illumos is (*int8), not (*byte)
|
iovecs[i].Base = &b[0]
|
||||||
iovecs[i].Base = (*int8)(unsafe.Pointer(&b[0]))
|
|
||||||
} else {
|
} else {
|
||||||
iovecs[i].Base = (*int8)(unsafe.Pointer(&_zero))
|
iovecs[i].Base = (*byte)(unsafe.Pointer(&_zero))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return iovecs
|
return iovecs
|
||||||
|
|
|
@ -13,6 +13,7 @@ package unix
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
"strconv"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
@ -233,7 +234,7 @@ func Futimesat(dirfd int, path string, tv []Timeval) error {
|
||||||
func Futimes(fd int, tv []Timeval) (err error) {
|
func Futimes(fd int, tv []Timeval) (err error) {
|
||||||
// Believe it or not, this is the best we can do on Linux
|
// Believe it or not, this is the best we can do on Linux
|
||||||
// (and is what glibc does).
|
// (and is what glibc does).
|
||||||
return Utimes("/proc/self/fd/"+itoa(fd), tv)
|
return Utimes("/proc/self/fd/"+strconv.Itoa(fd), tv)
|
||||||
}
|
}
|
||||||
|
|
||||||
const ImplementsGetwd = true
|
const ImplementsGetwd = true
|
||||||
|
@ -1499,18 +1500,13 @@ func KeyctlRestrictKeyring(ringid int, keyType string, restriction string) error
|
||||||
//sys keyctlRestrictKeyringByType(cmd int, arg2 int, keyType string, restriction string) (err error) = SYS_KEYCTL
|
//sys keyctlRestrictKeyringByType(cmd int, arg2 int, keyType string, restriction string) (err error) = SYS_KEYCTL
|
||||||
//sys keyctlRestrictKeyring(cmd int, arg2 int) (err error) = SYS_KEYCTL
|
//sys keyctlRestrictKeyring(cmd int, arg2 int) (err error) = SYS_KEYCTL
|
||||||
|
|
||||||
func recvmsgRaw(fd int, p, oob []byte, flags int, rsa *RawSockaddrAny) (n, oobn int, recvflags int, err error) {
|
func recvmsgRaw(fd int, iov []Iovec, oob []byte, flags int, rsa *RawSockaddrAny) (n, oobn int, recvflags int, err error) {
|
||||||
var msg Msghdr
|
var msg Msghdr
|
||||||
msg.Name = (*byte)(unsafe.Pointer(rsa))
|
msg.Name = (*byte)(unsafe.Pointer(rsa))
|
||||||
msg.Namelen = uint32(SizeofSockaddrAny)
|
msg.Namelen = uint32(SizeofSockaddrAny)
|
||||||
var iov Iovec
|
|
||||||
if len(p) > 0 {
|
|
||||||
iov.Base = &p[0]
|
|
||||||
iov.SetLen(len(p))
|
|
||||||
}
|
|
||||||
var dummy byte
|
var dummy byte
|
||||||
if len(oob) > 0 {
|
if len(oob) > 0 {
|
||||||
if len(p) == 0 {
|
if emptyIovecs(iov) {
|
||||||
var sockType int
|
var sockType int
|
||||||
sockType, err = GetsockoptInt(fd, SOL_SOCKET, SO_TYPE)
|
sockType, err = GetsockoptInt(fd, SOL_SOCKET, SO_TYPE)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1518,15 +1514,19 @@ func recvmsgRaw(fd int, p, oob []byte, flags int, rsa *RawSockaddrAny) (n, oobn
|
||||||
}
|
}
|
||||||
// receive at least one normal byte
|
// receive at least one normal byte
|
||||||
if sockType != SOCK_DGRAM {
|
if sockType != SOCK_DGRAM {
|
||||||
iov.Base = &dummy
|
var iova [1]Iovec
|
||||||
iov.SetLen(1)
|
iova[0].Base = &dummy
|
||||||
|
iova[0].SetLen(1)
|
||||||
|
iov = iova[:]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
msg.Control = &oob[0]
|
msg.Control = &oob[0]
|
||||||
msg.SetControllen(len(oob))
|
msg.SetControllen(len(oob))
|
||||||
}
|
}
|
||||||
msg.Iov = &iov
|
if len(iov) > 0 {
|
||||||
msg.Iovlen = 1
|
msg.Iov = &iov[0]
|
||||||
|
msg.SetIovlen(len(iov))
|
||||||
|
}
|
||||||
if n, err = recvmsg(fd, &msg, flags); err != nil {
|
if n, err = recvmsg(fd, &msg, flags); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1535,18 +1535,15 @@ func recvmsgRaw(fd int, p, oob []byte, flags int, rsa *RawSockaddrAny) (n, oobn
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func sendmsgN(fd int, p, oob []byte, ptr unsafe.Pointer, salen _Socklen, flags int) (n int, err error) {
|
func sendmsgN(fd int, iov []Iovec, oob []byte, ptr unsafe.Pointer, salen _Socklen, flags int) (n int, err error) {
|
||||||
var msg Msghdr
|
var msg Msghdr
|
||||||
msg.Name = (*byte)(ptr)
|
msg.Name = (*byte)(ptr)
|
||||||
msg.Namelen = uint32(salen)
|
msg.Namelen = uint32(salen)
|
||||||
var iov Iovec
|
|
||||||
if len(p) > 0 {
|
|
||||||
iov.Base = &p[0]
|
|
||||||
iov.SetLen(len(p))
|
|
||||||
}
|
|
||||||
var dummy byte
|
var dummy byte
|
||||||
|
var empty bool
|
||||||
if len(oob) > 0 {
|
if len(oob) > 0 {
|
||||||
if len(p) == 0 {
|
empty = emptyIovecs(iov)
|
||||||
|
if empty {
|
||||||
var sockType int
|
var sockType int
|
||||||
sockType, err = GetsockoptInt(fd, SOL_SOCKET, SO_TYPE)
|
sockType, err = GetsockoptInt(fd, SOL_SOCKET, SO_TYPE)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1554,19 +1551,22 @@ func sendmsgN(fd int, p, oob []byte, ptr unsafe.Pointer, salen _Socklen, flags i
|
||||||
}
|
}
|
||||||
// send at least one normal byte
|
// send at least one normal byte
|
||||||
if sockType != SOCK_DGRAM {
|
if sockType != SOCK_DGRAM {
|
||||||
iov.Base = &dummy
|
var iova [1]Iovec
|
||||||
iov.SetLen(1)
|
iova[0].Base = &dummy
|
||||||
|
iova[0].SetLen(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
msg.Control = &oob[0]
|
msg.Control = &oob[0]
|
||||||
msg.SetControllen(len(oob))
|
msg.SetControllen(len(oob))
|
||||||
}
|
}
|
||||||
msg.Iov = &iov
|
if len(iov) > 0 {
|
||||||
msg.Iovlen = 1
|
msg.Iov = &iov[0]
|
||||||
|
msg.SetIovlen(len(iov))
|
||||||
|
}
|
||||||
if n, err = sendmsg(fd, &msg, flags); err != nil {
|
if n, err = sendmsg(fd, &msg, flags); err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
if len(oob) > 0 && len(p) == 0 {
|
if len(oob) > 0 && empty {
|
||||||
n = 0
|
n = 0
|
||||||
}
|
}
|
||||||
return n, nil
|
return n, nil
|
||||||
|
@ -1829,6 +1829,9 @@ func Dup2(oldfd, newfd int) error {
|
||||||
//sys Fremovexattr(fd int, attr string) (err error)
|
//sys Fremovexattr(fd int, attr string) (err error)
|
||||||
//sys Fsetxattr(fd int, attr string, dest []byte, flags int) (err error)
|
//sys Fsetxattr(fd int, attr string, dest []byte, flags int) (err error)
|
||||||
//sys Fsync(fd int) (err error)
|
//sys Fsync(fd int) (err error)
|
||||||
|
//sys Fsmount(fd int, flags int, mountAttrs int) (fsfd int, err error)
|
||||||
|
//sys Fsopen(fsName string, flags int) (fd int, err error)
|
||||||
|
//sys Fspick(dirfd int, pathName string, flags int) (fd int, err error)
|
||||||
//sys Getdents(fd int, buf []byte) (n int, err error) = SYS_GETDENTS64
|
//sys Getdents(fd int, buf []byte) (n int, err error) = SYS_GETDENTS64
|
||||||
//sysnb Getpgid(pid int) (pgid int, err error)
|
//sysnb Getpgid(pid int) (pgid int, err error)
|
||||||
|
|
||||||
|
@ -1889,17 +1892,28 @@ func PrctlRetInt(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uint
|
||||||
return int(ret), nil
|
return int(ret), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// issue 1435.
|
|
||||||
// On linux Setuid and Setgid only affects the current thread, not the process.
|
|
||||||
// This does not match what most callers expect so we must return an error
|
|
||||||
// here rather than letting the caller think that the call succeeded.
|
|
||||||
|
|
||||||
func Setuid(uid int) (err error) {
|
func Setuid(uid int) (err error) {
|
||||||
return EOPNOTSUPP
|
return syscall.Setuid(uid)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Setgid(uid int) (err error) {
|
func Setgid(gid int) (err error) {
|
||||||
return EOPNOTSUPP
|
return syscall.Setgid(gid)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Setreuid(ruid, euid int) (err error) {
|
||||||
|
return syscall.Setreuid(ruid, euid)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Setregid(rgid, egid int) (err error) {
|
||||||
|
return syscall.Setregid(rgid, egid)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Setresuid(ruid, euid, suid int) (err error) {
|
||||||
|
return syscall.Setresuid(ruid, euid, suid)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Setresgid(rgid, egid, sgid int) (err error) {
|
||||||
|
return syscall.Setresgid(rgid, egid, sgid)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetfsgidRetGid sets fsgid for current thread and returns previous fsgid set.
|
// SetfsgidRetGid sets fsgid for current thread and returns previous fsgid set.
|
||||||
|
@ -2186,7 +2200,7 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
|
||||||
gid = Getgid()
|
gid = Getgid()
|
||||||
}
|
}
|
||||||
|
|
||||||
if uint32(gid) == st.Gid || isGroupMember(gid) {
|
if uint32(gid) == st.Gid || isGroupMember(int(st.Gid)) {
|
||||||
fmode = (st.Mode >> 3) & 7
|
fmode = (st.Mode >> 3) & 7
|
||||||
} else {
|
} else {
|
||||||
fmode = st.Mode & 7
|
fmode = st.Mode & 7
|
||||||
|
|
|
@ -41,10 +41,6 @@ func setTimeval(sec, usec int64) Timeval {
|
||||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64
|
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64
|
||||||
//sys setfsgid(gid int) (prev int, err error) = SYS_SETFSGID32
|
//sys setfsgid(gid int) (prev int, err error) = SYS_SETFSGID32
|
||||||
//sys setfsuid(uid int) (prev int, err error) = SYS_SETFSUID32
|
//sys setfsuid(uid int) (prev int, err error) = SYS_SETFSUID32
|
||||||
//sysnb Setregid(rgid int, egid int) (err error) = SYS_SETREGID32
|
|
||||||
//sysnb Setresgid(rgid int, egid int, sgid int) (err error) = SYS_SETRESGID32
|
|
||||||
//sysnb Setresuid(ruid int, euid int, suid int) (err error) = SYS_SETRESUID32
|
|
||||||
//sysnb Setreuid(ruid int, euid int) (err error) = SYS_SETREUID32
|
|
||||||
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error)
|
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error)
|
||||||
//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
|
//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
|
||||||
//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error)
|
//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error)
|
||||||
|
|
|
@ -46,11 +46,7 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err
|
||||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
||||||
//sys setfsgid(gid int) (prev int, err error)
|
//sys setfsgid(gid int) (prev int, err error)
|
||||||
//sys setfsuid(uid 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 Setrlimit(resource int, rlim *Rlimit) (err error)
|
//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
|
||||||
//sysnb Setreuid(ruid int, euid int) (err error)
|
|
||||||
//sys Shutdown(fd int, how int) (err error)
|
//sys Shutdown(fd int, how int) (err error)
|
||||||
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
|
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
|
||||||
|
|
||||||
|
|
|
@ -62,10 +62,6 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
|
||||||
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT
|
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT
|
||||||
//sys setfsgid(gid int) (prev int, err error) = SYS_SETFSGID32
|
//sys setfsgid(gid int) (prev int, err error) = SYS_SETFSGID32
|
||||||
//sys setfsuid(uid int) (prev int, err error) = SYS_SETFSUID32
|
//sys setfsuid(uid int) (prev int, err error) = SYS_SETFSUID32
|
||||||
//sysnb Setregid(rgid int, egid int) (err error) = SYS_SETREGID32
|
|
||||||
//sysnb Setresgid(rgid int, egid int, sgid int) (err error) = SYS_SETRESGID32
|
|
||||||
//sysnb Setresuid(ruid int, euid int, suid int) (err error) = SYS_SETRESUID32
|
|
||||||
//sysnb Setreuid(ruid int, euid int) (err error) = SYS_SETREUID32
|
|
||||||
//sys Shutdown(fd int, how 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 int, err error)
|
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error)
|
||||||
//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
|
//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
|
||||||
|
|
|
@ -39,11 +39,7 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err
|
||||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
||||||
//sys setfsgid(gid int) (prev int, err error)
|
//sys setfsgid(gid int) (prev int, err error)
|
||||||
//sys setfsuid(uid 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 setrlimit(resource int, rlim *Rlimit) (err error)
|
//sysnb setrlimit(resource int, rlim *Rlimit) (err error)
|
||||||
//sysnb Setreuid(ruid int, euid int) (err error)
|
|
||||||
//sys Shutdown(fd int, how int) (err error)
|
//sys Shutdown(fd int, how int) (err error)
|
||||||
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
|
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
|
||||||
|
|
||||||
|
|
|
@ -37,11 +37,7 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err
|
||||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
||||||
//sys setfsgid(gid int) (prev int, err error)
|
//sys setfsgid(gid int) (prev int, err error)
|
||||||
//sys setfsuid(uid 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 Setrlimit(resource int, rlim *Rlimit) (err error)
|
//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
|
||||||
//sysnb Setreuid(ruid int, euid int) (err error)
|
|
||||||
//sys Shutdown(fd int, how int) (err error)
|
//sys Shutdown(fd int, how int) (err error)
|
||||||
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
|
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
|
||||||
//sys Statfs(path string, buf *Statfs_t) (err error)
|
//sys Statfs(path string, buf *Statfs_t) (err error)
|
||||||
|
|
|
@ -32,10 +32,6 @@ func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr,
|
||||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64
|
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64
|
||||||
//sys setfsgid(gid int) (prev int, err error)
|
//sys setfsgid(gid int) (prev int, err error)
|
||||||
//sys setfsuid(uid 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 Shutdown(fd int, how int) (err error)
|
||||||
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error)
|
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error)
|
||||||
//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error)
|
//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error)
|
||||||
|
|
|
@ -34,10 +34,6 @@ import (
|
||||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64
|
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64
|
||||||
//sys setfsgid(gid int) (prev int, err error)
|
//sys setfsgid(gid int) (prev int, err error)
|
||||||
//sys setfsuid(uid 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 Shutdown(fd int, how int) (err error)
|
||||||
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error)
|
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error)
|
||||||
//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
|
//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
|
||||||
|
|
|
@ -34,11 +34,7 @@ package unix
|
||||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
||||||
//sys setfsgid(gid int) (prev int, err error)
|
//sys setfsgid(gid int) (prev int, err error)
|
||||||
//sys setfsuid(uid 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 Setrlimit(resource int, rlim *Rlimit) (err error)
|
//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
|
||||||
//sysnb Setreuid(ruid int, euid int) (err error)
|
|
||||||
//sys Shutdown(fd int, how int) (err error)
|
//sys Shutdown(fd int, how int) (err error)
|
||||||
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
|
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
|
||||||
//sys Stat(path string, stat *Stat_t) (err error)
|
//sys Stat(path string, stat *Stat_t) (err error)
|
||||||
|
|
|
@ -22,6 +22,7 @@ import "unsafe"
|
||||||
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
|
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
|
||||||
//sysnb Getuid() (uid int)
|
//sysnb Getuid() (uid int)
|
||||||
//sys Listen(s int, n int) (err error)
|
//sys Listen(s int, n int) (err error)
|
||||||
|
//sys MemfdSecret(flags int) (fd int, err error)
|
||||||
//sys pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
//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 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
|
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
|
||||||
|
@ -37,11 +38,7 @@ func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err
|
||||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
||||||
//sys setfsgid(gid int) (prev int, err error)
|
//sys setfsgid(gid int) (prev int, err error)
|
||||||
//sys setfsuid(uid 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 Setrlimit(resource int, rlim *Rlimit) (err error)
|
//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
|
||||||
//sysnb Setreuid(ruid int, euid int) (err error)
|
|
||||||
//sys Shutdown(fd int, how int) (err error)
|
//sys Shutdown(fd int, how int) (err error)
|
||||||
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
|
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
|
||||||
|
|
||||||
|
|
|
@ -34,11 +34,7 @@ import (
|
||||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
||||||
//sys setfsgid(gid int) (prev int, err error)
|
//sys setfsgid(gid int) (prev int, err error)
|
||||||
//sys setfsuid(uid 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 Setrlimit(resource int, rlim *Rlimit) (err error)
|
//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
|
||||||
//sysnb Setreuid(ruid int, euid int) (err error)
|
|
||||||
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
|
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
|
||||||
//sys Stat(path string, stat *Stat_t) (err error)
|
//sys Stat(path string, stat *Stat_t) (err error)
|
||||||
//sys Statfs(path string, buf *Statfs_t) (err error)
|
//sys Statfs(path string, buf *Statfs_t) (err error)
|
||||||
|
|
|
@ -31,11 +31,7 @@ package unix
|
||||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)
|
||||||
//sys setfsgid(gid int) (prev int, err error)
|
//sys setfsgid(gid int) (prev int, err error)
|
||||||
//sys setfsuid(uid 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 Setrlimit(resource int, rlim *Rlimit) (err error)
|
//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
|
||||||
//sysnb Setreuid(ruid int, euid int) (err error)
|
|
||||||
//sys Shutdown(fd int, how int) (err error)
|
//sys Shutdown(fd int, how int) (err error)
|
||||||
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
|
//sys Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error)
|
||||||
//sys Stat(path string, stat *Stat_t) (err error)
|
//sys Stat(path string, stat *Stat_t) (err error)
|
||||||
|
|
|
@ -81,6 +81,7 @@ func Pipe(p []int) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//sysnb pipe2(p *[2]_C_int, flags int) (err error)
|
//sysnb pipe2(p *[2]_C_int, flags int) (err error)
|
||||||
|
|
||||||
func Pipe2(p []int, flags int) error {
|
func Pipe2(p []int, flags int) error {
|
||||||
if len(p) != 2 {
|
if len(p) != 2 {
|
||||||
return EINVAL
|
return EINVAL
|
||||||
|
@ -95,6 +96,7 @@ func Pipe2(p []int, flags int) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
//sys Getdents(fd int, buf []byte) (n int, err error)
|
//sys Getdents(fd int, buf []byte) (n int, err error)
|
||||||
|
|
||||||
func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
|
func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
|
||||||
n, err = Getdents(fd, buf)
|
n, err = Getdents(fd, buf)
|
||||||
if err != nil || basep == nil {
|
if err != nil || basep == nil {
|
||||||
|
|
|
@ -26,6 +26,10 @@ func (msghdr *Msghdr) SetControllen(length int) {
|
||||||
msghdr.Controllen = uint32(length)
|
msghdr.Controllen = uint32(length)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (msghdr *Msghdr) SetIovlen(length int) {
|
||||||
|
msghdr.Iovlen = uint32(length)
|
||||||
|
}
|
||||||
|
|
||||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
func (cmsg *Cmsghdr) SetLen(length int) {
|
||||||
cmsg.Len = uint32(length)
|
cmsg.Len = uint32(length)
|
||||||
}
|
}
|
||||||
|
|
|
@ -451,26 +451,25 @@ func Accept(fd int) (nfd int, sa Sockaddr, err error) {
|
||||||
|
|
||||||
//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) = libsocket.__xnet_recvmsg
|
//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) = libsocket.__xnet_recvmsg
|
||||||
|
|
||||||
func recvmsgRaw(fd int, p, oob []byte, flags int, rsa *RawSockaddrAny) (n, oobn int, recvflags int, err error) {
|
func recvmsgRaw(fd int, iov []Iovec, oob []byte, flags int, rsa *RawSockaddrAny) (n, oobn int, recvflags int, err error) {
|
||||||
var msg Msghdr
|
var msg Msghdr
|
||||||
msg.Name = (*byte)(unsafe.Pointer(rsa))
|
msg.Name = (*byte)(unsafe.Pointer(rsa))
|
||||||
msg.Namelen = uint32(SizeofSockaddrAny)
|
msg.Namelen = uint32(SizeofSockaddrAny)
|
||||||
var iov Iovec
|
var dummy byte
|
||||||
if len(p) > 0 {
|
|
||||||
iov.Base = (*int8)(unsafe.Pointer(&p[0]))
|
|
||||||
iov.SetLen(len(p))
|
|
||||||
}
|
|
||||||
var dummy int8
|
|
||||||
if len(oob) > 0 {
|
if len(oob) > 0 {
|
||||||
// receive at least one normal byte
|
// receive at least one normal byte
|
||||||
if len(p) == 0 {
|
if emptyIovecs(iov) {
|
||||||
iov.Base = &dummy
|
var iova [1]Iovec
|
||||||
iov.SetLen(1)
|
iova[0].Base = &dummy
|
||||||
|
iova[0].SetLen(1)
|
||||||
|
iov = iova[:]
|
||||||
}
|
}
|
||||||
msg.Accrightslen = int32(len(oob))
|
msg.Accrightslen = int32(len(oob))
|
||||||
}
|
}
|
||||||
msg.Iov = &iov
|
if len(iov) > 0 {
|
||||||
msg.Iovlen = 1
|
msg.Iov = &iov[0]
|
||||||
|
msg.SetIovlen(len(iov))
|
||||||
|
}
|
||||||
if n, err = recvmsg(fd, &msg, flags); n == -1 {
|
if n, err = recvmsg(fd, &msg, flags); n == -1 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -480,30 +479,31 @@ func recvmsgRaw(fd int, p, oob []byte, flags int, rsa *RawSockaddrAny) (n, oobn
|
||||||
|
|
||||||
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) = libsocket.__xnet_sendmsg
|
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) = libsocket.__xnet_sendmsg
|
||||||
|
|
||||||
func sendmsgN(fd int, p, oob []byte, ptr unsafe.Pointer, salen _Socklen, flags int) (n int, err error) {
|
func sendmsgN(fd int, iov []Iovec, oob []byte, ptr unsafe.Pointer, salen _Socklen, flags int) (n int, err error) {
|
||||||
var msg Msghdr
|
var msg Msghdr
|
||||||
msg.Name = (*byte)(unsafe.Pointer(ptr))
|
msg.Name = (*byte)(unsafe.Pointer(ptr))
|
||||||
msg.Namelen = uint32(salen)
|
msg.Namelen = uint32(salen)
|
||||||
var iov Iovec
|
var dummy byte
|
||||||
if len(p) > 0 {
|
var empty bool
|
||||||
iov.Base = (*int8)(unsafe.Pointer(&p[0]))
|
|
||||||
iov.SetLen(len(p))
|
|
||||||
}
|
|
||||||
var dummy int8
|
|
||||||
if len(oob) > 0 {
|
if len(oob) > 0 {
|
||||||
// send at least one normal byte
|
// send at least one normal byte
|
||||||
if len(p) == 0 {
|
empty = emptyIovecs(iov)
|
||||||
iov.Base = &dummy
|
if empty {
|
||||||
iov.SetLen(1)
|
var iova [1]Iovec
|
||||||
|
iova[0].Base = &dummy
|
||||||
|
iova[0].SetLen(1)
|
||||||
|
iov = iova[:]
|
||||||
}
|
}
|
||||||
msg.Accrightslen = int32(len(oob))
|
msg.Accrightslen = int32(len(oob))
|
||||||
}
|
}
|
||||||
msg.Iov = &iov
|
if len(iov) > 0 {
|
||||||
msg.Iovlen = 1
|
msg.Iov = &iov[0]
|
||||||
|
msg.SetIovlen(len(iov))
|
||||||
|
}
|
||||||
if n, err = sendmsg(fd, &msg, flags); err != nil {
|
if n, err = sendmsg(fd, &msg, flags); err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
if len(oob) > 0 && len(p) == 0 {
|
if len(oob) > 0 && empty {
|
||||||
n = 0
|
n = 0
|
||||||
}
|
}
|
||||||
return n, nil
|
return n, nil
|
||||||
|
@ -618,6 +618,7 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
|
||||||
//sys Getpriority(which int, who int) (n int, err error)
|
//sys Getpriority(which int, who int) (n int, err error)
|
||||||
//sysnb Getrlimit(which int, lim *Rlimit) (err error)
|
//sysnb Getrlimit(which int, lim *Rlimit) (err error)
|
||||||
//sysnb Getrusage(who int, rusage *Rusage) (err error)
|
//sysnb Getrusage(who int, rusage *Rusage) (err error)
|
||||||
|
//sysnb Getsid(pid int) (sid int, err error)
|
||||||
//sysnb Gettimeofday(tv *Timeval) (err error)
|
//sysnb Gettimeofday(tv *Timeval) (err error)
|
||||||
//sysnb Getuid() (uid int)
|
//sysnb Getuid() (uid int)
|
||||||
//sys Kill(pid int, signum syscall.Signal) (err error)
|
//sys Kill(pid int, signum syscall.Signal) (err error)
|
||||||
|
@ -749,8 +750,8 @@ type EventPort struct {
|
||||||
// we should handle things gracefully. To do so, we need to keep an extra
|
// we should handle things gracefully. To do so, we need to keep an extra
|
||||||
// reference to the cookie around until the event is processed
|
// reference to the cookie around until the event is processed
|
||||||
// thus the otherwise seemingly extraneous "cookies" map
|
// thus the otherwise seemingly extraneous "cookies" map
|
||||||
// The key of this map is a pointer to the corresponding &fCookie.cookie
|
// The key of this map is a pointer to the corresponding fCookie
|
||||||
cookies map[*interface{}]*fileObjCookie
|
cookies map[*fileObjCookie]struct{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// PortEvent is an abstraction of the port_event C struct.
|
// PortEvent is an abstraction of the port_event C struct.
|
||||||
|
@ -777,7 +778,7 @@ func NewEventPort() (*EventPort, error) {
|
||||||
port: port,
|
port: port,
|
||||||
fds: make(map[uintptr]*fileObjCookie),
|
fds: make(map[uintptr]*fileObjCookie),
|
||||||
paths: make(map[string]*fileObjCookie),
|
paths: make(map[string]*fileObjCookie),
|
||||||
cookies: make(map[*interface{}]*fileObjCookie),
|
cookies: make(map[*fileObjCookie]struct{}),
|
||||||
}
|
}
|
||||||
return e, nil
|
return e, nil
|
||||||
}
|
}
|
||||||
|
@ -798,6 +799,7 @@ func (e *EventPort) Close() error {
|
||||||
}
|
}
|
||||||
e.fds = nil
|
e.fds = nil
|
||||||
e.paths = nil
|
e.paths = nil
|
||||||
|
e.cookies = nil
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -825,17 +827,16 @@ func (e *EventPort) AssociatePath(path string, stat os.FileInfo, events int, coo
|
||||||
if _, found := e.paths[path]; found {
|
if _, found := e.paths[path]; found {
|
||||||
return fmt.Errorf("%v is already associated with this Event Port", path)
|
return fmt.Errorf("%v is already associated with this Event Port", path)
|
||||||
}
|
}
|
||||||
fobj, err := createFileObj(path, stat)
|
fCookie, err := createFileObjCookie(path, stat, cookie)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fCookie := &fileObjCookie{fobj, cookie}
|
_, err = port_associate(e.port, PORT_SOURCE_FILE, uintptr(unsafe.Pointer(fCookie.fobj)), events, (*byte)(unsafe.Pointer(fCookie)))
|
||||||
_, err = port_associate(e.port, PORT_SOURCE_FILE, uintptr(unsafe.Pointer(fobj)), events, (*byte)(unsafe.Pointer(&fCookie.cookie)))
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
e.paths[path] = fCookie
|
e.paths[path] = fCookie
|
||||||
e.cookies[&fCookie.cookie] = fCookie
|
e.cookies[fCookie] = struct{}{}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -857,7 +858,7 @@ func (e *EventPort) DissociatePath(path string) error {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
// dissociate was successful, safe to delete the cookie
|
// dissociate was successful, safe to delete the cookie
|
||||||
fCookie := e.paths[path]
|
fCookie := e.paths[path]
|
||||||
delete(e.cookies, &fCookie.cookie)
|
delete(e.cookies, fCookie)
|
||||||
}
|
}
|
||||||
delete(e.paths, path)
|
delete(e.paths, path)
|
||||||
return err
|
return err
|
||||||
|
@ -870,13 +871,16 @@ func (e *EventPort) AssociateFd(fd uintptr, events int, cookie interface{}) erro
|
||||||
if _, found := e.fds[fd]; found {
|
if _, found := e.fds[fd]; found {
|
||||||
return fmt.Errorf("%v is already associated with this Event Port", fd)
|
return fmt.Errorf("%v is already associated with this Event Port", fd)
|
||||||
}
|
}
|
||||||
fCookie := &fileObjCookie{nil, cookie}
|
fCookie, err := createFileObjCookie("", nil, cookie)
|
||||||
_, err := port_associate(e.port, PORT_SOURCE_FD, fd, events, (*byte)(unsafe.Pointer(&fCookie.cookie)))
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
_, err = port_associate(e.port, PORT_SOURCE_FD, fd, events, (*byte)(unsafe.Pointer(fCookie)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
e.fds[fd] = fCookie
|
e.fds[fd] = fCookie
|
||||||
e.cookies[&fCookie.cookie] = fCookie
|
e.cookies[fCookie] = struct{}{}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -895,27 +899,31 @@ func (e *EventPort) DissociateFd(fd uintptr) error {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
// dissociate was successful, safe to delete the cookie
|
// dissociate was successful, safe to delete the cookie
|
||||||
fCookie := e.fds[fd]
|
fCookie := e.fds[fd]
|
||||||
delete(e.cookies, &fCookie.cookie)
|
delete(e.cookies, fCookie)
|
||||||
}
|
}
|
||||||
delete(e.fds, fd)
|
delete(e.fds, fd)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func createFileObj(name string, stat os.FileInfo) (*fileObj, error) {
|
func createFileObjCookie(name string, stat os.FileInfo, cookie interface{}) (*fileObjCookie, error) {
|
||||||
fobj := new(fileObj)
|
fCookie := new(fileObjCookie)
|
||||||
|
fCookie.cookie = cookie
|
||||||
|
if name != "" && stat != nil {
|
||||||
|
fCookie.fobj = new(fileObj)
|
||||||
bs, err := ByteSliceFromString(name)
|
bs, err := ByteSliceFromString(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
fobj.Name = (*int8)(unsafe.Pointer(&bs[0]))
|
fCookie.fobj.Name = (*int8)(unsafe.Pointer(&bs[0]))
|
||||||
s := stat.Sys().(*syscall.Stat_t)
|
s := stat.Sys().(*syscall.Stat_t)
|
||||||
fobj.Atim.Sec = s.Atim.Sec
|
fCookie.fobj.Atim.Sec = s.Atim.Sec
|
||||||
fobj.Atim.Nsec = s.Atim.Nsec
|
fCookie.fobj.Atim.Nsec = s.Atim.Nsec
|
||||||
fobj.Mtim.Sec = s.Mtim.Sec
|
fCookie.fobj.Mtim.Sec = s.Mtim.Sec
|
||||||
fobj.Mtim.Nsec = s.Mtim.Nsec
|
fCookie.fobj.Mtim.Nsec = s.Mtim.Nsec
|
||||||
fobj.Ctim.Sec = s.Ctim.Sec
|
fCookie.fobj.Ctim.Sec = s.Ctim.Sec
|
||||||
fobj.Ctim.Nsec = s.Ctim.Nsec
|
fCookie.fobj.Ctim.Nsec = s.Ctim.Nsec
|
||||||
return fobj, nil
|
}
|
||||||
|
return fCookie, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetOne wraps port_get(3c) and returns a single PortEvent.
|
// GetOne wraps port_get(3c) and returns a single PortEvent.
|
||||||
|
@ -928,44 +936,50 @@ func (e *EventPort) GetOne(t *Timespec) (*PortEvent, error) {
|
||||||
p := new(PortEvent)
|
p := new(PortEvent)
|
||||||
e.mu.Lock()
|
e.mu.Lock()
|
||||||
defer e.mu.Unlock()
|
defer e.mu.Unlock()
|
||||||
e.peIntToExt(pe, p)
|
err = e.peIntToExt(pe, p)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
return p, nil
|
return p, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// peIntToExt converts a cgo portEvent struct into the friendlier PortEvent
|
// peIntToExt converts a cgo portEvent struct into the friendlier PortEvent
|
||||||
// NOTE: Always call this function while holding the e.mu mutex
|
// NOTE: Always call this function while holding the e.mu mutex
|
||||||
func (e *EventPort) peIntToExt(peInt *portEvent, peExt *PortEvent) {
|
func (e *EventPort) peIntToExt(peInt *portEvent, peExt *PortEvent) error {
|
||||||
|
if e.cookies == nil {
|
||||||
|
return fmt.Errorf("this EventPort is already closed")
|
||||||
|
}
|
||||||
peExt.Events = peInt.Events
|
peExt.Events = peInt.Events
|
||||||
peExt.Source = peInt.Source
|
peExt.Source = peInt.Source
|
||||||
cookie := (*interface{})(unsafe.Pointer(peInt.User))
|
fCookie := (*fileObjCookie)(unsafe.Pointer(peInt.User))
|
||||||
peExt.Cookie = *cookie
|
_, found := e.cookies[fCookie]
|
||||||
|
|
||||||
|
if !found {
|
||||||
|
panic("unexpected event port address; may be due to kernel bug; see https://go.dev/issue/54254")
|
||||||
|
}
|
||||||
|
peExt.Cookie = fCookie.cookie
|
||||||
|
delete(e.cookies, fCookie)
|
||||||
|
|
||||||
switch peInt.Source {
|
switch peInt.Source {
|
||||||
case PORT_SOURCE_FD:
|
case PORT_SOURCE_FD:
|
||||||
delete(e.cookies, cookie)
|
|
||||||
peExt.Fd = uintptr(peInt.Object)
|
peExt.Fd = uintptr(peInt.Object)
|
||||||
// Only remove the fds entry if it exists and this cookie matches
|
// Only remove the fds entry if it exists and this cookie matches
|
||||||
if fobj, ok := e.fds[peExt.Fd]; ok {
|
if fobj, ok := e.fds[peExt.Fd]; ok {
|
||||||
if &fobj.cookie == cookie {
|
if fobj == fCookie {
|
||||||
delete(e.fds, peExt.Fd)
|
delete(e.fds, peExt.Fd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case PORT_SOURCE_FILE:
|
case PORT_SOURCE_FILE:
|
||||||
if fCookie, ok := e.cookies[cookie]; ok && uintptr(unsafe.Pointer(fCookie.fobj)) == uintptr(peInt.Object) {
|
|
||||||
// Use our stashed reference rather than using unsafe on what we got back
|
|
||||||
// the unsafe version would be (*fileObj)(unsafe.Pointer(uintptr(peInt.Object)))
|
|
||||||
peExt.fobj = fCookie.fobj
|
peExt.fobj = fCookie.fobj
|
||||||
} else {
|
|
||||||
panic("mismanaged memory")
|
|
||||||
}
|
|
||||||
delete(e.cookies, cookie)
|
|
||||||
peExt.Path = BytePtrToString((*byte)(unsafe.Pointer(peExt.fobj.Name)))
|
peExt.Path = BytePtrToString((*byte)(unsafe.Pointer(peExt.fobj.Name)))
|
||||||
// Only remove the paths entry if it exists and this cookie matches
|
// Only remove the paths entry if it exists and this cookie matches
|
||||||
if fobj, ok := e.paths[peExt.Path]; ok {
|
if fobj, ok := e.paths[peExt.Path]; ok {
|
||||||
if &fobj.cookie == cookie {
|
if fobj == fCookie {
|
||||||
delete(e.paths, peExt.Path)
|
delete(e.paths, peExt.Path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pending wraps port_getn(3c) and returns how many events are pending.
|
// Pending wraps port_getn(3c) and returns how many events are pending.
|
||||||
|
@ -989,7 +1003,7 @@ func (e *EventPort) Get(s []PortEvent, min int, timeout *Timespec) (int, error)
|
||||||
got := uint32(min)
|
got := uint32(min)
|
||||||
max := uint32(len(s))
|
max := uint32(len(s))
|
||||||
var err error
|
var err error
|
||||||
ps := make([]portEvent, max, max)
|
ps := make([]portEvent, max)
|
||||||
_, err = port_getn(e.port, &ps[0], max, &got, timeout)
|
_, err = port_getn(e.port, &ps[0], max, &got, timeout)
|
||||||
// got will be trustworthy with ETIME, but not any other error.
|
// got will be trustworthy with ETIME, but not any other error.
|
||||||
if err != nil && err != ETIME {
|
if err != nil && err != ETIME {
|
||||||
|
@ -997,8 +1011,18 @@ func (e *EventPort) Get(s []PortEvent, min int, timeout *Timespec) (int, error)
|
||||||
}
|
}
|
||||||
e.mu.Lock()
|
e.mu.Lock()
|
||||||
defer e.mu.Unlock()
|
defer e.mu.Unlock()
|
||||||
|
valid := 0
|
||||||
for i := 0; i < int(got); i++ {
|
for i := 0; i < int(got); i++ {
|
||||||
e.peIntToExt(&ps[i], &s[i])
|
err2 := e.peIntToExt(&ps[i], &s[i])
|
||||||
|
if err2 != nil {
|
||||||
|
if valid == 0 && err == nil {
|
||||||
|
// If err2 is the only error and there are no valid events
|
||||||
|
// to return, return it to the caller.
|
||||||
|
err = err2
|
||||||
}
|
}
|
||||||
return int(got), err
|
break
|
||||||
|
}
|
||||||
|
valid = i + 1
|
||||||
|
}
|
||||||
|
return valid, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,6 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
"golang.org/x/sys/internal/unsafeheader"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -117,11 +115,7 @@ func (m *mmapper) Mmap(fd int, offset int64, length int, prot int, flags int) (d
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use unsafe to convert addr into a []byte.
|
// Use unsafe to convert addr into a []byte.
|
||||||
var b []byte
|
b := unsafe.Slice((*byte)(unsafe.Pointer(addr)), length)
|
||||||
hdr := (*unsafeheader.Slice)(unsafe.Pointer(&b))
|
|
||||||
hdr.Data = unsafe.Pointer(addr)
|
|
||||||
hdr.Cap = length
|
|
||||||
hdr.Len = length
|
|
||||||
|
|
||||||
// Register mapping in m and return it.
|
// Register mapping in m and return it.
|
||||||
p := &b[cap(b)-1]
|
p := &b[cap(b)-1]
|
||||||
|
@ -338,8 +332,13 @@ func Recvfrom(fd int, p []byte, flags int) (n int, from Sockaddr, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) {
|
func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) {
|
||||||
|
var iov [1]Iovec
|
||||||
|
if len(p) > 0 {
|
||||||
|
iov[0].Base = &p[0]
|
||||||
|
iov[0].SetLen(len(p))
|
||||||
|
}
|
||||||
var rsa RawSockaddrAny
|
var rsa RawSockaddrAny
|
||||||
n, oobn, recvflags, err = recvmsgRaw(fd, p, oob, flags, &rsa)
|
n, oobn, recvflags, err = recvmsgRaw(fd, iov[:], oob, flags, &rsa)
|
||||||
// source address is only specified if the socket is unconnected
|
// source address is only specified if the socket is unconnected
|
||||||
if rsa.Addr.Family != AF_UNSPEC {
|
if rsa.Addr.Family != AF_UNSPEC {
|
||||||
from, err = anyToSockaddr(fd, &rsa)
|
from, err = anyToSockaddr(fd, &rsa)
|
||||||
|
@ -347,12 +346,42 @@ func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RecvmsgBuffers receives a message from a socket using the recvmsg
|
||||||
|
// system call. The flags are passed to recvmsg. Any non-control data
|
||||||
|
// read is scattered into the buffers slices. The results are:
|
||||||
|
// - n is the number of non-control data read into bufs
|
||||||
|
// - oobn is the number of control data read into oob; this may be interpreted using [ParseSocketControlMessage]
|
||||||
|
// - recvflags is flags returned by recvmsg
|
||||||
|
// - from is the address of the sender
|
||||||
|
func RecvmsgBuffers(fd int, buffers [][]byte, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) {
|
||||||
|
iov := make([]Iovec, len(buffers))
|
||||||
|
for i := range buffers {
|
||||||
|
if len(buffers[i]) > 0 {
|
||||||
|
iov[i].Base = &buffers[i][0]
|
||||||
|
iov[i].SetLen(len(buffers[i]))
|
||||||
|
} else {
|
||||||
|
iov[i].Base = (*byte)(unsafe.Pointer(&_zero))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var rsa RawSockaddrAny
|
||||||
|
n, oobn, recvflags, err = recvmsgRaw(fd, iov, oob, flags, &rsa)
|
||||||
|
if err == nil && rsa.Addr.Family != AF_UNSPEC {
|
||||||
|
from, err = anyToSockaddr(fd, &rsa)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func Sendmsg(fd int, p, oob []byte, to Sockaddr, flags int) (err error) {
|
func Sendmsg(fd int, p, oob []byte, to Sockaddr, flags int) (err error) {
|
||||||
_, err = SendmsgN(fd, p, oob, to, flags)
|
_, err = SendmsgN(fd, p, oob, to, flags)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error) {
|
func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error) {
|
||||||
|
var iov [1]Iovec
|
||||||
|
if len(p) > 0 {
|
||||||
|
iov[0].Base = &p[0]
|
||||||
|
iov[0].SetLen(len(p))
|
||||||
|
}
|
||||||
var ptr unsafe.Pointer
|
var ptr unsafe.Pointer
|
||||||
var salen _Socklen
|
var salen _Socklen
|
||||||
if to != nil {
|
if to != nil {
|
||||||
|
@ -361,7 +390,32 @@ func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error)
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return sendmsgN(fd, p, oob, ptr, salen, flags)
|
return sendmsgN(fd, iov[:], oob, ptr, salen, flags)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SendmsgBuffers sends a message on a socket to an address using the sendmsg
|
||||||
|
// system call. The flags are passed to sendmsg. Any non-control data written
|
||||||
|
// is gathered from buffers. The function returns the number of bytes written
|
||||||
|
// to the socket.
|
||||||
|
func SendmsgBuffers(fd int, buffers [][]byte, oob []byte, to Sockaddr, flags int) (n int, err error) {
|
||||||
|
iov := make([]Iovec, len(buffers))
|
||||||
|
for i := range buffers {
|
||||||
|
if len(buffers[i]) > 0 {
|
||||||
|
iov[i].Base = &buffers[i][0]
|
||||||
|
iov[i].SetLen(len(buffers[i]))
|
||||||
|
} else {
|
||||||
|
iov[i].Base = (*byte)(unsafe.Pointer(&_zero))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var ptr unsafe.Pointer
|
||||||
|
var salen _Socklen
|
||||||
|
if to != nil {
|
||||||
|
ptr, salen, err = to.sockaddr()
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sendmsgN(fd, iov, oob, ptr, salen, flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Send(s int, buf []byte, flags int) (err error) {
|
func Send(s int, buf []byte, flags int) (err error) {
|
||||||
|
@ -484,3 +538,13 @@ func Lutimes(path string, tv []Timeval) error {
|
||||||
}
|
}
|
||||||
return UtimesNanoAt(AT_FDCWD, path, ts, AT_SYMLINK_NOFOLLOW)
|
return UtimesNanoAt(AT_FDCWD, path, ts, AT_SYMLINK_NOFOLLOW)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// emptyIovec reports whether there are no bytes in the slice of Iovec.
|
||||||
|
func emptyIovecs(iov []Iovec) bool {
|
||||||
|
for i := range iov {
|
||||||
|
if iov[i].Len > 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
|
@ -7,11 +7,7 @@
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
import (
|
import "unsafe"
|
||||||
"unsafe"
|
|
||||||
|
|
||||||
"golang.org/x/sys/internal/unsafeheader"
|
|
||||||
)
|
|
||||||
|
|
||||||
// SysvShmAttach attaches the Sysv shared memory segment associated with the
|
// SysvShmAttach attaches the Sysv shared memory segment associated with the
|
||||||
// shared memory identifier id.
|
// shared memory identifier id.
|
||||||
|
@ -34,12 +30,7 @@ func SysvShmAttach(id int, addr uintptr, flag int) ([]byte, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use unsafe to convert addr into a []byte.
|
// Use unsafe to convert addr into a []byte.
|
||||||
// TODO: convert to unsafe.Slice once we can assume Go 1.17
|
b := unsafe.Slice((*byte)(unsafe.Pointer(addr)), int(info.Segsz))
|
||||||
var b []byte
|
|
||||||
hdr := (*unsafeheader.Slice)(unsafe.Pointer(&b))
|
|
||||||
hdr.Data = unsafe.Pointer(addr)
|
|
||||||
hdr.Cap = int(info.Segsz)
|
|
||||||
hdr.Len = int(info.Segsz)
|
|
||||||
return b, nil
|
return b, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -151,6 +151,7 @@ const (
|
||||||
BIOCSETF = 0x80084267
|
BIOCSETF = 0x80084267
|
||||||
BIOCSETFNR = 0x80084282
|
BIOCSETFNR = 0x80084282
|
||||||
BIOCSETIF = 0x8020426c
|
BIOCSETIF = 0x8020426c
|
||||||
|
BIOCSETVLANPCP = 0x80044285
|
||||||
BIOCSETWF = 0x8008427b
|
BIOCSETWF = 0x8008427b
|
||||||
BIOCSETZBUF = 0x800c4281
|
BIOCSETZBUF = 0x800c4281
|
||||||
BIOCSHDRCMPLT = 0x80044275
|
BIOCSHDRCMPLT = 0x80044275
|
||||||
|
@ -447,7 +448,7 @@ const (
|
||||||
DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1
|
DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1
|
||||||
DLT_INFINIBAND = 0xf7
|
DLT_INFINIBAND = 0xf7
|
||||||
DLT_IPFILTER = 0x74
|
DLT_IPFILTER = 0x74
|
||||||
DLT_IPMB = 0xc7
|
DLT_IPMB_KONTRON = 0xc7
|
||||||
DLT_IPMB_LINUX = 0xd1
|
DLT_IPMB_LINUX = 0xd1
|
||||||
DLT_IPMI_HPM_2 = 0x104
|
DLT_IPMI_HPM_2 = 0x104
|
||||||
DLT_IPNET = 0xe2
|
DLT_IPNET = 0xe2
|
||||||
|
@ -487,10 +488,11 @@ const (
|
||||||
DLT_LINUX_LAPD = 0xb1
|
DLT_LINUX_LAPD = 0xb1
|
||||||
DLT_LINUX_PPP_WITHDIRECTION = 0xa6
|
DLT_LINUX_PPP_WITHDIRECTION = 0xa6
|
||||||
DLT_LINUX_SLL = 0x71
|
DLT_LINUX_SLL = 0x71
|
||||||
|
DLT_LINUX_SLL2 = 0x114
|
||||||
DLT_LOOP = 0x6c
|
DLT_LOOP = 0x6c
|
||||||
DLT_LORATAP = 0x10e
|
DLT_LORATAP = 0x10e
|
||||||
DLT_LTALK = 0x72
|
DLT_LTALK = 0x72
|
||||||
DLT_MATCHING_MAX = 0x113
|
DLT_MATCHING_MAX = 0x114
|
||||||
DLT_MATCHING_MIN = 0x68
|
DLT_MATCHING_MIN = 0x68
|
||||||
DLT_MFR = 0xb6
|
DLT_MFR = 0xb6
|
||||||
DLT_MOST = 0xd3
|
DLT_MOST = 0xd3
|
||||||
|
@ -734,6 +736,7 @@ const (
|
||||||
IPPROTO_CMTP = 0x26
|
IPPROTO_CMTP = 0x26
|
||||||
IPPROTO_CPHB = 0x49
|
IPPROTO_CPHB = 0x49
|
||||||
IPPROTO_CPNX = 0x48
|
IPPROTO_CPNX = 0x48
|
||||||
|
IPPROTO_DCCP = 0x21
|
||||||
IPPROTO_DDP = 0x25
|
IPPROTO_DDP = 0x25
|
||||||
IPPROTO_DGP = 0x56
|
IPPROTO_DGP = 0x56
|
||||||
IPPROTO_DIVERT = 0x102
|
IPPROTO_DIVERT = 0x102
|
||||||
|
@ -814,7 +817,6 @@ const (
|
||||||
IPPROTO_SCTP = 0x84
|
IPPROTO_SCTP = 0x84
|
||||||
IPPROTO_SDRP = 0x2a
|
IPPROTO_SDRP = 0x2a
|
||||||
IPPROTO_SEND = 0x103
|
IPPROTO_SEND = 0x103
|
||||||
IPPROTO_SEP = 0x21
|
|
||||||
IPPROTO_SHIM6 = 0x8c
|
IPPROTO_SHIM6 = 0x8c
|
||||||
IPPROTO_SKIP = 0x39
|
IPPROTO_SKIP = 0x39
|
||||||
IPPROTO_SPACER = 0x7fff
|
IPPROTO_SPACER = 0x7fff
|
||||||
|
@ -911,6 +913,7 @@ const (
|
||||||
IPV6_V6ONLY = 0x1b
|
IPV6_V6ONLY = 0x1b
|
||||||
IPV6_VERSION = 0x60
|
IPV6_VERSION = 0x60
|
||||||
IPV6_VERSION_MASK = 0xf0
|
IPV6_VERSION_MASK = 0xf0
|
||||||
|
IPV6_VLAN_PCP = 0x4b
|
||||||
IP_ADD_MEMBERSHIP = 0xc
|
IP_ADD_MEMBERSHIP = 0xc
|
||||||
IP_ADD_SOURCE_MEMBERSHIP = 0x46
|
IP_ADD_SOURCE_MEMBERSHIP = 0x46
|
||||||
IP_BINDANY = 0x18
|
IP_BINDANY = 0x18
|
||||||
|
@ -989,8 +992,12 @@ const (
|
||||||
IP_TOS = 0x3
|
IP_TOS = 0x3
|
||||||
IP_TTL = 0x4
|
IP_TTL = 0x4
|
||||||
IP_UNBLOCK_SOURCE = 0x49
|
IP_UNBLOCK_SOURCE = 0x49
|
||||||
|
IP_VLAN_PCP = 0x4b
|
||||||
ISIG = 0x80
|
ISIG = 0x80
|
||||||
ISTRIP = 0x20
|
ISTRIP = 0x20
|
||||||
|
ITIMER_PROF = 0x2
|
||||||
|
ITIMER_REAL = 0x0
|
||||||
|
ITIMER_VIRTUAL = 0x1
|
||||||
IXANY = 0x800
|
IXANY = 0x800
|
||||||
IXOFF = 0x400
|
IXOFF = 0x400
|
||||||
IXON = 0x200
|
IXON = 0x200
|
||||||
|
@ -1000,7 +1007,6 @@ const (
|
||||||
KERN_VERSION = 0x4
|
KERN_VERSION = 0x4
|
||||||
LOCAL_CONNWAIT = 0x4
|
LOCAL_CONNWAIT = 0x4
|
||||||
LOCAL_CREDS = 0x2
|
LOCAL_CREDS = 0x2
|
||||||
LOCAL_CREDS_PERSISTENT = 0x3
|
|
||||||
LOCAL_PEERCRED = 0x1
|
LOCAL_PEERCRED = 0x1
|
||||||
LOCAL_VENDOR = 0x80000000
|
LOCAL_VENDOR = 0x80000000
|
||||||
LOCK_EX = 0x2
|
LOCK_EX = 0x2
|
||||||
|
@ -1179,6 +1185,8 @@ const (
|
||||||
O_NONBLOCK = 0x4
|
O_NONBLOCK = 0x4
|
||||||
O_RDONLY = 0x0
|
O_RDONLY = 0x0
|
||||||
O_RDWR = 0x2
|
O_RDWR = 0x2
|
||||||
|
O_RESOLVE_BENEATH = 0x800000
|
||||||
|
O_SEARCH = 0x40000
|
||||||
O_SHLOCK = 0x10
|
O_SHLOCK = 0x10
|
||||||
O_SYNC = 0x80
|
O_SYNC = 0x80
|
||||||
O_TRUNC = 0x400
|
O_TRUNC = 0x400
|
||||||
|
@ -1189,6 +1197,10 @@ const (
|
||||||
PARMRK = 0x8
|
PARMRK = 0x8
|
||||||
PARODD = 0x2000
|
PARODD = 0x2000
|
||||||
PENDIN = 0x20000000
|
PENDIN = 0x20000000
|
||||||
|
PIOD_READ_D = 0x1
|
||||||
|
PIOD_READ_I = 0x3
|
||||||
|
PIOD_WRITE_D = 0x2
|
||||||
|
PIOD_WRITE_I = 0x4
|
||||||
PRIO_PGRP = 0x1
|
PRIO_PGRP = 0x1
|
||||||
PRIO_PROCESS = 0x0
|
PRIO_PROCESS = 0x0
|
||||||
PRIO_USER = 0x2
|
PRIO_USER = 0x2
|
||||||
|
@ -1196,6 +1208,60 @@ const (
|
||||||
PROT_NONE = 0x0
|
PROT_NONE = 0x0
|
||||||
PROT_READ = 0x1
|
PROT_READ = 0x1
|
||||||
PROT_WRITE = 0x2
|
PROT_WRITE = 0x2
|
||||||
|
PTRACE_DEFAULT = 0x1
|
||||||
|
PTRACE_EXEC = 0x1
|
||||||
|
PTRACE_FORK = 0x8
|
||||||
|
PTRACE_LWP = 0x10
|
||||||
|
PTRACE_SCE = 0x2
|
||||||
|
PTRACE_SCX = 0x4
|
||||||
|
PTRACE_SYSCALL = 0x6
|
||||||
|
PTRACE_VFORK = 0x20
|
||||||
|
PT_ATTACH = 0xa
|
||||||
|
PT_CLEARSTEP = 0x10
|
||||||
|
PT_CONTINUE = 0x7
|
||||||
|
PT_DETACH = 0xb
|
||||||
|
PT_FIRSTMACH = 0x40
|
||||||
|
PT_FOLLOW_FORK = 0x17
|
||||||
|
PT_GETDBREGS = 0x25
|
||||||
|
PT_GETFPREGS = 0x23
|
||||||
|
PT_GETFSBASE = 0x47
|
||||||
|
PT_GETGSBASE = 0x49
|
||||||
|
PT_GETLWPLIST = 0xf
|
||||||
|
PT_GETNUMLWPS = 0xe
|
||||||
|
PT_GETREGS = 0x21
|
||||||
|
PT_GETXMMREGS = 0x40
|
||||||
|
PT_GETXSTATE = 0x45
|
||||||
|
PT_GETXSTATE_INFO = 0x44
|
||||||
|
PT_GET_EVENT_MASK = 0x19
|
||||||
|
PT_GET_SC_ARGS = 0x1b
|
||||||
|
PT_GET_SC_RET = 0x1c
|
||||||
|
PT_IO = 0xc
|
||||||
|
PT_KILL = 0x8
|
||||||
|
PT_LWPINFO = 0xd
|
||||||
|
PT_LWP_EVENTS = 0x18
|
||||||
|
PT_READ_D = 0x2
|
||||||
|
PT_READ_I = 0x1
|
||||||
|
PT_RESUME = 0x13
|
||||||
|
PT_SETDBREGS = 0x26
|
||||||
|
PT_SETFPREGS = 0x24
|
||||||
|
PT_SETFSBASE = 0x48
|
||||||
|
PT_SETGSBASE = 0x4a
|
||||||
|
PT_SETREGS = 0x22
|
||||||
|
PT_SETSTEP = 0x11
|
||||||
|
PT_SETXMMREGS = 0x41
|
||||||
|
PT_SETXSTATE = 0x46
|
||||||
|
PT_SET_EVENT_MASK = 0x1a
|
||||||
|
PT_STEP = 0x9
|
||||||
|
PT_SUSPEND = 0x12
|
||||||
|
PT_SYSCALL = 0x16
|
||||||
|
PT_TO_SCE = 0x14
|
||||||
|
PT_TO_SCX = 0x15
|
||||||
|
PT_TRACE_ME = 0x0
|
||||||
|
PT_VM_ENTRY = 0x29
|
||||||
|
PT_VM_TIMESTAMP = 0x28
|
||||||
|
PT_WRITE_D = 0x5
|
||||||
|
PT_WRITE_I = 0x4
|
||||||
|
P_ZONEID = 0xc
|
||||||
RLIMIT_AS = 0xa
|
RLIMIT_AS = 0xa
|
||||||
RLIMIT_CORE = 0x4
|
RLIMIT_CORE = 0x4
|
||||||
RLIMIT_CPU = 0x0
|
RLIMIT_CPU = 0x0
|
||||||
|
@ -1320,10 +1386,12 @@ const (
|
||||||
SIOCGHWADDR = 0xc020693e
|
SIOCGHWADDR = 0xc020693e
|
||||||
SIOCGI2C = 0xc020693d
|
SIOCGI2C = 0xc020693d
|
||||||
SIOCGIFADDR = 0xc0206921
|
SIOCGIFADDR = 0xc0206921
|
||||||
|
SIOCGIFALIAS = 0xc044692d
|
||||||
SIOCGIFBRDADDR = 0xc0206923
|
SIOCGIFBRDADDR = 0xc0206923
|
||||||
SIOCGIFCAP = 0xc020691f
|
SIOCGIFCAP = 0xc020691f
|
||||||
SIOCGIFCONF = 0xc0086924
|
SIOCGIFCONF = 0xc0086924
|
||||||
SIOCGIFDESCR = 0xc020692a
|
SIOCGIFDESCR = 0xc020692a
|
||||||
|
SIOCGIFDOWNREASON = 0xc058699a
|
||||||
SIOCGIFDSTADDR = 0xc0206922
|
SIOCGIFDSTADDR = 0xc0206922
|
||||||
SIOCGIFFIB = 0xc020695c
|
SIOCGIFFIB = 0xc020695c
|
||||||
SIOCGIFFLAGS = 0xc0206911
|
SIOCGIFFLAGS = 0xc0206911
|
||||||
|
@ -1414,6 +1482,7 @@ const (
|
||||||
SO_RCVBUF = 0x1002
|
SO_RCVBUF = 0x1002
|
||||||
SO_RCVLOWAT = 0x1004
|
SO_RCVLOWAT = 0x1004
|
||||||
SO_RCVTIMEO = 0x1006
|
SO_RCVTIMEO = 0x1006
|
||||||
|
SO_RERROR = 0x20000
|
||||||
SO_REUSEADDR = 0x4
|
SO_REUSEADDR = 0x4
|
||||||
SO_REUSEPORT = 0x200
|
SO_REUSEPORT = 0x200
|
||||||
SO_REUSEPORT_LB = 0x10000
|
SO_REUSEPORT_LB = 0x10000
|
||||||
|
@ -1472,22 +1541,40 @@ const (
|
||||||
TCOFLUSH = 0x2
|
TCOFLUSH = 0x2
|
||||||
TCOOFF = 0x1
|
TCOOFF = 0x1
|
||||||
TCOON = 0x2
|
TCOON = 0x2
|
||||||
|
TCPOPT_EOL = 0x0
|
||||||
|
TCPOPT_FAST_OPEN = 0x22
|
||||||
|
TCPOPT_MAXSEG = 0x2
|
||||||
|
TCPOPT_NOP = 0x1
|
||||||
|
TCPOPT_PAD = 0x0
|
||||||
|
TCPOPT_SACK = 0x5
|
||||||
|
TCPOPT_SACK_PERMITTED = 0x4
|
||||||
|
TCPOPT_SIGNATURE = 0x13
|
||||||
|
TCPOPT_TIMESTAMP = 0x8
|
||||||
|
TCPOPT_WINDOW = 0x3
|
||||||
TCP_BBR_ACK_COMP_ALG = 0x448
|
TCP_BBR_ACK_COMP_ALG = 0x448
|
||||||
|
TCP_BBR_ALGORITHM = 0x43b
|
||||||
TCP_BBR_DRAIN_INC_EXTRA = 0x43c
|
TCP_BBR_DRAIN_INC_EXTRA = 0x43c
|
||||||
TCP_BBR_DRAIN_PG = 0x42e
|
TCP_BBR_DRAIN_PG = 0x42e
|
||||||
TCP_BBR_EXTRA_GAIN = 0x449
|
TCP_BBR_EXTRA_GAIN = 0x449
|
||||||
|
TCP_BBR_EXTRA_STATE = 0x453
|
||||||
|
TCP_BBR_FLOOR_MIN_TSO = 0x454
|
||||||
|
TCP_BBR_HDWR_PACE = 0x451
|
||||||
|
TCP_BBR_HOLD_TARGET = 0x436
|
||||||
TCP_BBR_IWINTSO = 0x42b
|
TCP_BBR_IWINTSO = 0x42b
|
||||||
TCP_BBR_LOWGAIN_FD = 0x436
|
TCP_BBR_LOWGAIN_FD = 0x436
|
||||||
TCP_BBR_LOWGAIN_HALF = 0x435
|
TCP_BBR_LOWGAIN_HALF = 0x435
|
||||||
TCP_BBR_LOWGAIN_THRESH = 0x434
|
TCP_BBR_LOWGAIN_THRESH = 0x434
|
||||||
TCP_BBR_MAX_RTO = 0x439
|
TCP_BBR_MAX_RTO = 0x439
|
||||||
TCP_BBR_MIN_RTO = 0x438
|
TCP_BBR_MIN_RTO = 0x438
|
||||||
|
TCP_BBR_MIN_TOPACEOUT = 0x455
|
||||||
TCP_BBR_ONE_RETRAN = 0x431
|
TCP_BBR_ONE_RETRAN = 0x431
|
||||||
TCP_BBR_PACE_CROSS = 0x442
|
TCP_BBR_PACE_CROSS = 0x442
|
||||||
TCP_BBR_PACE_DEL_TAR = 0x43f
|
TCP_BBR_PACE_DEL_TAR = 0x43f
|
||||||
|
TCP_BBR_PACE_OH = 0x435
|
||||||
TCP_BBR_PACE_PER_SEC = 0x43e
|
TCP_BBR_PACE_PER_SEC = 0x43e
|
||||||
TCP_BBR_PACE_SEG_MAX = 0x440
|
TCP_BBR_PACE_SEG_MAX = 0x440
|
||||||
TCP_BBR_PACE_SEG_MIN = 0x441
|
TCP_BBR_PACE_SEG_MIN = 0x441
|
||||||
|
TCP_BBR_POLICER_DETECT = 0x457
|
||||||
TCP_BBR_PROBE_RTT_GAIN = 0x44d
|
TCP_BBR_PROBE_RTT_GAIN = 0x44d
|
||||||
TCP_BBR_PROBE_RTT_INT = 0x430
|
TCP_BBR_PROBE_RTT_INT = 0x430
|
||||||
TCP_BBR_PROBE_RTT_LEN = 0x44e
|
TCP_BBR_PROBE_RTT_LEN = 0x44e
|
||||||
|
@ -1496,12 +1583,18 @@ const (
|
||||||
TCP_BBR_REC_OVER_HPTS = 0x43a
|
TCP_BBR_REC_OVER_HPTS = 0x43a
|
||||||
TCP_BBR_RETRAN_WTSO = 0x44b
|
TCP_BBR_RETRAN_WTSO = 0x44b
|
||||||
TCP_BBR_RWND_IS_APP = 0x42f
|
TCP_BBR_RWND_IS_APP = 0x42f
|
||||||
|
TCP_BBR_SEND_IWND_IN_TSO = 0x44f
|
||||||
TCP_BBR_STARTUP_EXIT_EPOCH = 0x43d
|
TCP_BBR_STARTUP_EXIT_EPOCH = 0x43d
|
||||||
TCP_BBR_STARTUP_LOSS_EXIT = 0x432
|
TCP_BBR_STARTUP_LOSS_EXIT = 0x432
|
||||||
TCP_BBR_STARTUP_PG = 0x42d
|
TCP_BBR_STARTUP_PG = 0x42d
|
||||||
|
TCP_BBR_TMR_PACE_OH = 0x448
|
||||||
|
TCP_BBR_TSLIMITS = 0x434
|
||||||
|
TCP_BBR_TSTMP_RAISES = 0x456
|
||||||
TCP_BBR_UNLIMITED = 0x43b
|
TCP_BBR_UNLIMITED = 0x43b
|
||||||
TCP_BBR_USEDEL_RATE = 0x437
|
TCP_BBR_USEDEL_RATE = 0x437
|
||||||
TCP_BBR_USE_LOWGAIN = 0x433
|
TCP_BBR_USE_LOWGAIN = 0x433
|
||||||
|
TCP_BBR_USE_RACK_CHEAT = 0x450
|
||||||
|
TCP_BBR_UTTER_MAX_TSO = 0x452
|
||||||
TCP_CA_NAME_MAX = 0x10
|
TCP_CA_NAME_MAX = 0x10
|
||||||
TCP_CCALGOOPT = 0x41
|
TCP_CCALGOOPT = 0x41
|
||||||
TCP_CONGESTION = 0x40
|
TCP_CONGESTION = 0x40
|
||||||
|
@ -1541,6 +1634,7 @@ const (
|
||||||
TCP_PCAP_OUT = 0x800
|
TCP_PCAP_OUT = 0x800
|
||||||
TCP_RACK_EARLY_RECOV = 0x423
|
TCP_RACK_EARLY_RECOV = 0x423
|
||||||
TCP_RACK_EARLY_SEG = 0x424
|
TCP_RACK_EARLY_SEG = 0x424
|
||||||
|
TCP_RACK_GP_INCREASE = 0x446
|
||||||
TCP_RACK_IDLE_REDUCE_HIGH = 0x444
|
TCP_RACK_IDLE_REDUCE_HIGH = 0x444
|
||||||
TCP_RACK_MIN_PACE = 0x445
|
TCP_RACK_MIN_PACE = 0x445
|
||||||
TCP_RACK_MIN_PACE_SEG = 0x446
|
TCP_RACK_MIN_PACE_SEG = 0x446
|
||||||
|
@ -1554,7 +1648,6 @@ const (
|
||||||
TCP_RACK_PRR_SENDALOT = 0x421
|
TCP_RACK_PRR_SENDALOT = 0x421
|
||||||
TCP_RACK_REORD_FADE = 0x426
|
TCP_RACK_REORD_FADE = 0x426
|
||||||
TCP_RACK_REORD_THRESH = 0x425
|
TCP_RACK_REORD_THRESH = 0x425
|
||||||
TCP_RACK_SESS_CWV = 0x42a
|
|
||||||
TCP_RACK_TLP_INC_VAR = 0x429
|
TCP_RACK_TLP_INC_VAR = 0x429
|
||||||
TCP_RACK_TLP_REDUCE = 0x41c
|
TCP_RACK_TLP_REDUCE = 0x41c
|
||||||
TCP_RACK_TLP_THRESH = 0x427
|
TCP_RACK_TLP_THRESH = 0x427
|
||||||
|
@ -1694,12 +1787,13 @@ const (
|
||||||
EIDRM = syscall.Errno(0x52)
|
EIDRM = syscall.Errno(0x52)
|
||||||
EILSEQ = syscall.Errno(0x56)
|
EILSEQ = syscall.Errno(0x56)
|
||||||
EINPROGRESS = syscall.Errno(0x24)
|
EINPROGRESS = syscall.Errno(0x24)
|
||||||
|
EINTEGRITY = syscall.Errno(0x61)
|
||||||
EINTR = syscall.Errno(0x4)
|
EINTR = syscall.Errno(0x4)
|
||||||
EINVAL = syscall.Errno(0x16)
|
EINVAL = syscall.Errno(0x16)
|
||||||
EIO = syscall.Errno(0x5)
|
EIO = syscall.Errno(0x5)
|
||||||
EISCONN = syscall.Errno(0x38)
|
EISCONN = syscall.Errno(0x38)
|
||||||
EISDIR = syscall.Errno(0x15)
|
EISDIR = syscall.Errno(0x15)
|
||||||
ELAST = syscall.Errno(0x60)
|
ELAST = syscall.Errno(0x61)
|
||||||
ELOOP = syscall.Errno(0x3e)
|
ELOOP = syscall.Errno(0x3e)
|
||||||
EMFILE = syscall.Errno(0x18)
|
EMFILE = syscall.Errno(0x18)
|
||||||
EMLINK = syscall.Errno(0x1f)
|
EMLINK = syscall.Errno(0x1f)
|
||||||
|
@ -1842,7 +1936,7 @@ var errorList = [...]struct {
|
||||||
{32, "EPIPE", "broken pipe"},
|
{32, "EPIPE", "broken pipe"},
|
||||||
{33, "EDOM", "numerical argument out of domain"},
|
{33, "EDOM", "numerical argument out of domain"},
|
||||||
{34, "ERANGE", "result too large"},
|
{34, "ERANGE", "result too large"},
|
||||||
{35, "EAGAIN", "resource temporarily unavailable"},
|
{35, "EWOULDBLOCK", "resource temporarily unavailable"},
|
||||||
{36, "EINPROGRESS", "operation now in progress"},
|
{36, "EINPROGRESS", "operation now in progress"},
|
||||||
{37, "EALREADY", "operation already in progress"},
|
{37, "EALREADY", "operation already in progress"},
|
||||||
{38, "ENOTSOCK", "socket operation on non-socket"},
|
{38, "ENOTSOCK", "socket operation on non-socket"},
|
||||||
|
@ -1904,6 +1998,7 @@ var errorList = [...]struct {
|
||||||
{94, "ECAPMODE", "not permitted in capability mode"},
|
{94, "ECAPMODE", "not permitted in capability mode"},
|
||||||
{95, "ENOTRECOVERABLE", "state not recoverable"},
|
{95, "ENOTRECOVERABLE", "state not recoverable"},
|
||||||
{96, "EOWNERDEAD", "previous owner died"},
|
{96, "EOWNERDEAD", "previous owner died"},
|
||||||
|
{97, "EINTEGRITY", "integrity check failed"},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Signal table
|
// Signal table
|
||||||
|
|
|
@ -151,6 +151,7 @@ const (
|
||||||
BIOCSETF = 0x80104267
|
BIOCSETF = 0x80104267
|
||||||
BIOCSETFNR = 0x80104282
|
BIOCSETFNR = 0x80104282
|
||||||
BIOCSETIF = 0x8020426c
|
BIOCSETIF = 0x8020426c
|
||||||
|
BIOCSETVLANPCP = 0x80044285
|
||||||
BIOCSETWF = 0x8010427b
|
BIOCSETWF = 0x8010427b
|
||||||
BIOCSETZBUF = 0x80184281
|
BIOCSETZBUF = 0x80184281
|
||||||
BIOCSHDRCMPLT = 0x80044275
|
BIOCSHDRCMPLT = 0x80044275
|
||||||
|
@ -447,7 +448,7 @@ const (
|
||||||
DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1
|
DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1
|
||||||
DLT_INFINIBAND = 0xf7
|
DLT_INFINIBAND = 0xf7
|
||||||
DLT_IPFILTER = 0x74
|
DLT_IPFILTER = 0x74
|
||||||
DLT_IPMB = 0xc7
|
DLT_IPMB_KONTRON = 0xc7
|
||||||
DLT_IPMB_LINUX = 0xd1
|
DLT_IPMB_LINUX = 0xd1
|
||||||
DLT_IPMI_HPM_2 = 0x104
|
DLT_IPMI_HPM_2 = 0x104
|
||||||
DLT_IPNET = 0xe2
|
DLT_IPNET = 0xe2
|
||||||
|
@ -487,10 +488,11 @@ const (
|
||||||
DLT_LINUX_LAPD = 0xb1
|
DLT_LINUX_LAPD = 0xb1
|
||||||
DLT_LINUX_PPP_WITHDIRECTION = 0xa6
|
DLT_LINUX_PPP_WITHDIRECTION = 0xa6
|
||||||
DLT_LINUX_SLL = 0x71
|
DLT_LINUX_SLL = 0x71
|
||||||
|
DLT_LINUX_SLL2 = 0x114
|
||||||
DLT_LOOP = 0x6c
|
DLT_LOOP = 0x6c
|
||||||
DLT_LORATAP = 0x10e
|
DLT_LORATAP = 0x10e
|
||||||
DLT_LTALK = 0x72
|
DLT_LTALK = 0x72
|
||||||
DLT_MATCHING_MAX = 0x113
|
DLT_MATCHING_MAX = 0x114
|
||||||
DLT_MATCHING_MIN = 0x68
|
DLT_MATCHING_MIN = 0x68
|
||||||
DLT_MFR = 0xb6
|
DLT_MFR = 0xb6
|
||||||
DLT_MOST = 0xd3
|
DLT_MOST = 0xd3
|
||||||
|
@ -734,6 +736,7 @@ const (
|
||||||
IPPROTO_CMTP = 0x26
|
IPPROTO_CMTP = 0x26
|
||||||
IPPROTO_CPHB = 0x49
|
IPPROTO_CPHB = 0x49
|
||||||
IPPROTO_CPNX = 0x48
|
IPPROTO_CPNX = 0x48
|
||||||
|
IPPROTO_DCCP = 0x21
|
||||||
IPPROTO_DDP = 0x25
|
IPPROTO_DDP = 0x25
|
||||||
IPPROTO_DGP = 0x56
|
IPPROTO_DGP = 0x56
|
||||||
IPPROTO_DIVERT = 0x102
|
IPPROTO_DIVERT = 0x102
|
||||||
|
@ -814,7 +817,6 @@ const (
|
||||||
IPPROTO_SCTP = 0x84
|
IPPROTO_SCTP = 0x84
|
||||||
IPPROTO_SDRP = 0x2a
|
IPPROTO_SDRP = 0x2a
|
||||||
IPPROTO_SEND = 0x103
|
IPPROTO_SEND = 0x103
|
||||||
IPPROTO_SEP = 0x21
|
|
||||||
IPPROTO_SHIM6 = 0x8c
|
IPPROTO_SHIM6 = 0x8c
|
||||||
IPPROTO_SKIP = 0x39
|
IPPROTO_SKIP = 0x39
|
||||||
IPPROTO_SPACER = 0x7fff
|
IPPROTO_SPACER = 0x7fff
|
||||||
|
@ -911,6 +913,7 @@ const (
|
||||||
IPV6_V6ONLY = 0x1b
|
IPV6_V6ONLY = 0x1b
|
||||||
IPV6_VERSION = 0x60
|
IPV6_VERSION = 0x60
|
||||||
IPV6_VERSION_MASK = 0xf0
|
IPV6_VERSION_MASK = 0xf0
|
||||||
|
IPV6_VLAN_PCP = 0x4b
|
||||||
IP_ADD_MEMBERSHIP = 0xc
|
IP_ADD_MEMBERSHIP = 0xc
|
||||||
IP_ADD_SOURCE_MEMBERSHIP = 0x46
|
IP_ADD_SOURCE_MEMBERSHIP = 0x46
|
||||||
IP_BINDANY = 0x18
|
IP_BINDANY = 0x18
|
||||||
|
@ -989,8 +992,12 @@ const (
|
||||||
IP_TOS = 0x3
|
IP_TOS = 0x3
|
||||||
IP_TTL = 0x4
|
IP_TTL = 0x4
|
||||||
IP_UNBLOCK_SOURCE = 0x49
|
IP_UNBLOCK_SOURCE = 0x49
|
||||||
|
IP_VLAN_PCP = 0x4b
|
||||||
ISIG = 0x80
|
ISIG = 0x80
|
||||||
ISTRIP = 0x20
|
ISTRIP = 0x20
|
||||||
|
ITIMER_PROF = 0x2
|
||||||
|
ITIMER_REAL = 0x0
|
||||||
|
ITIMER_VIRTUAL = 0x1
|
||||||
IXANY = 0x800
|
IXANY = 0x800
|
||||||
IXOFF = 0x400
|
IXOFF = 0x400
|
||||||
IXON = 0x200
|
IXON = 0x200
|
||||||
|
@ -1000,7 +1007,6 @@ const (
|
||||||
KERN_VERSION = 0x4
|
KERN_VERSION = 0x4
|
||||||
LOCAL_CONNWAIT = 0x4
|
LOCAL_CONNWAIT = 0x4
|
||||||
LOCAL_CREDS = 0x2
|
LOCAL_CREDS = 0x2
|
||||||
LOCAL_CREDS_PERSISTENT = 0x3
|
|
||||||
LOCAL_PEERCRED = 0x1
|
LOCAL_PEERCRED = 0x1
|
||||||
LOCAL_VENDOR = 0x80000000
|
LOCAL_VENDOR = 0x80000000
|
||||||
LOCK_EX = 0x2
|
LOCK_EX = 0x2
|
||||||
|
@ -1180,6 +1186,8 @@ const (
|
||||||
O_NONBLOCK = 0x4
|
O_NONBLOCK = 0x4
|
||||||
O_RDONLY = 0x0
|
O_RDONLY = 0x0
|
||||||
O_RDWR = 0x2
|
O_RDWR = 0x2
|
||||||
|
O_RESOLVE_BENEATH = 0x800000
|
||||||
|
O_SEARCH = 0x40000
|
||||||
O_SHLOCK = 0x10
|
O_SHLOCK = 0x10
|
||||||
O_SYNC = 0x80
|
O_SYNC = 0x80
|
||||||
O_TRUNC = 0x400
|
O_TRUNC = 0x400
|
||||||
|
@ -1190,6 +1198,10 @@ const (
|
||||||
PARMRK = 0x8
|
PARMRK = 0x8
|
||||||
PARODD = 0x2000
|
PARODD = 0x2000
|
||||||
PENDIN = 0x20000000
|
PENDIN = 0x20000000
|
||||||
|
PIOD_READ_D = 0x1
|
||||||
|
PIOD_READ_I = 0x3
|
||||||
|
PIOD_WRITE_D = 0x2
|
||||||
|
PIOD_WRITE_I = 0x4
|
||||||
PRIO_PGRP = 0x1
|
PRIO_PGRP = 0x1
|
||||||
PRIO_PROCESS = 0x0
|
PRIO_PROCESS = 0x0
|
||||||
PRIO_USER = 0x2
|
PRIO_USER = 0x2
|
||||||
|
@ -1197,6 +1209,58 @@ const (
|
||||||
PROT_NONE = 0x0
|
PROT_NONE = 0x0
|
||||||
PROT_READ = 0x1
|
PROT_READ = 0x1
|
||||||
PROT_WRITE = 0x2
|
PROT_WRITE = 0x2
|
||||||
|
PTRACE_DEFAULT = 0x1
|
||||||
|
PTRACE_EXEC = 0x1
|
||||||
|
PTRACE_FORK = 0x8
|
||||||
|
PTRACE_LWP = 0x10
|
||||||
|
PTRACE_SCE = 0x2
|
||||||
|
PTRACE_SCX = 0x4
|
||||||
|
PTRACE_SYSCALL = 0x6
|
||||||
|
PTRACE_VFORK = 0x20
|
||||||
|
PT_ATTACH = 0xa
|
||||||
|
PT_CLEARSTEP = 0x10
|
||||||
|
PT_CONTINUE = 0x7
|
||||||
|
PT_DETACH = 0xb
|
||||||
|
PT_FIRSTMACH = 0x40
|
||||||
|
PT_FOLLOW_FORK = 0x17
|
||||||
|
PT_GETDBREGS = 0x25
|
||||||
|
PT_GETFPREGS = 0x23
|
||||||
|
PT_GETFSBASE = 0x47
|
||||||
|
PT_GETGSBASE = 0x49
|
||||||
|
PT_GETLWPLIST = 0xf
|
||||||
|
PT_GETNUMLWPS = 0xe
|
||||||
|
PT_GETREGS = 0x21
|
||||||
|
PT_GETXSTATE = 0x45
|
||||||
|
PT_GETXSTATE_INFO = 0x44
|
||||||
|
PT_GET_EVENT_MASK = 0x19
|
||||||
|
PT_GET_SC_ARGS = 0x1b
|
||||||
|
PT_GET_SC_RET = 0x1c
|
||||||
|
PT_IO = 0xc
|
||||||
|
PT_KILL = 0x8
|
||||||
|
PT_LWPINFO = 0xd
|
||||||
|
PT_LWP_EVENTS = 0x18
|
||||||
|
PT_READ_D = 0x2
|
||||||
|
PT_READ_I = 0x1
|
||||||
|
PT_RESUME = 0x13
|
||||||
|
PT_SETDBREGS = 0x26
|
||||||
|
PT_SETFPREGS = 0x24
|
||||||
|
PT_SETFSBASE = 0x48
|
||||||
|
PT_SETGSBASE = 0x4a
|
||||||
|
PT_SETREGS = 0x22
|
||||||
|
PT_SETSTEP = 0x11
|
||||||
|
PT_SETXSTATE = 0x46
|
||||||
|
PT_SET_EVENT_MASK = 0x1a
|
||||||
|
PT_STEP = 0x9
|
||||||
|
PT_SUSPEND = 0x12
|
||||||
|
PT_SYSCALL = 0x16
|
||||||
|
PT_TO_SCE = 0x14
|
||||||
|
PT_TO_SCX = 0x15
|
||||||
|
PT_TRACE_ME = 0x0
|
||||||
|
PT_VM_ENTRY = 0x29
|
||||||
|
PT_VM_TIMESTAMP = 0x28
|
||||||
|
PT_WRITE_D = 0x5
|
||||||
|
PT_WRITE_I = 0x4
|
||||||
|
P_ZONEID = 0xc
|
||||||
RLIMIT_AS = 0xa
|
RLIMIT_AS = 0xa
|
||||||
RLIMIT_CORE = 0x4
|
RLIMIT_CORE = 0x4
|
||||||
RLIMIT_CPU = 0x0
|
RLIMIT_CPU = 0x0
|
||||||
|
@ -1321,10 +1385,12 @@ const (
|
||||||
SIOCGHWADDR = 0xc020693e
|
SIOCGHWADDR = 0xc020693e
|
||||||
SIOCGI2C = 0xc020693d
|
SIOCGI2C = 0xc020693d
|
||||||
SIOCGIFADDR = 0xc0206921
|
SIOCGIFADDR = 0xc0206921
|
||||||
|
SIOCGIFALIAS = 0xc044692d
|
||||||
SIOCGIFBRDADDR = 0xc0206923
|
SIOCGIFBRDADDR = 0xc0206923
|
||||||
SIOCGIFCAP = 0xc020691f
|
SIOCGIFCAP = 0xc020691f
|
||||||
SIOCGIFCONF = 0xc0106924
|
SIOCGIFCONF = 0xc0106924
|
||||||
SIOCGIFDESCR = 0xc020692a
|
SIOCGIFDESCR = 0xc020692a
|
||||||
|
SIOCGIFDOWNREASON = 0xc058699a
|
||||||
SIOCGIFDSTADDR = 0xc0206922
|
SIOCGIFDSTADDR = 0xc0206922
|
||||||
SIOCGIFFIB = 0xc020695c
|
SIOCGIFFIB = 0xc020695c
|
||||||
SIOCGIFFLAGS = 0xc0206911
|
SIOCGIFFLAGS = 0xc0206911
|
||||||
|
@ -1415,6 +1481,7 @@ const (
|
||||||
SO_RCVBUF = 0x1002
|
SO_RCVBUF = 0x1002
|
||||||
SO_RCVLOWAT = 0x1004
|
SO_RCVLOWAT = 0x1004
|
||||||
SO_RCVTIMEO = 0x1006
|
SO_RCVTIMEO = 0x1006
|
||||||
|
SO_RERROR = 0x20000
|
||||||
SO_REUSEADDR = 0x4
|
SO_REUSEADDR = 0x4
|
||||||
SO_REUSEPORT = 0x200
|
SO_REUSEPORT = 0x200
|
||||||
SO_REUSEPORT_LB = 0x10000
|
SO_REUSEPORT_LB = 0x10000
|
||||||
|
@ -1473,22 +1540,40 @@ const (
|
||||||
TCOFLUSH = 0x2
|
TCOFLUSH = 0x2
|
||||||
TCOOFF = 0x1
|
TCOOFF = 0x1
|
||||||
TCOON = 0x2
|
TCOON = 0x2
|
||||||
|
TCPOPT_EOL = 0x0
|
||||||
|
TCPOPT_FAST_OPEN = 0x22
|
||||||
|
TCPOPT_MAXSEG = 0x2
|
||||||
|
TCPOPT_NOP = 0x1
|
||||||
|
TCPOPT_PAD = 0x0
|
||||||
|
TCPOPT_SACK = 0x5
|
||||||
|
TCPOPT_SACK_PERMITTED = 0x4
|
||||||
|
TCPOPT_SIGNATURE = 0x13
|
||||||
|
TCPOPT_TIMESTAMP = 0x8
|
||||||
|
TCPOPT_WINDOW = 0x3
|
||||||
TCP_BBR_ACK_COMP_ALG = 0x448
|
TCP_BBR_ACK_COMP_ALG = 0x448
|
||||||
|
TCP_BBR_ALGORITHM = 0x43b
|
||||||
TCP_BBR_DRAIN_INC_EXTRA = 0x43c
|
TCP_BBR_DRAIN_INC_EXTRA = 0x43c
|
||||||
TCP_BBR_DRAIN_PG = 0x42e
|
TCP_BBR_DRAIN_PG = 0x42e
|
||||||
TCP_BBR_EXTRA_GAIN = 0x449
|
TCP_BBR_EXTRA_GAIN = 0x449
|
||||||
|
TCP_BBR_EXTRA_STATE = 0x453
|
||||||
|
TCP_BBR_FLOOR_MIN_TSO = 0x454
|
||||||
|
TCP_BBR_HDWR_PACE = 0x451
|
||||||
|
TCP_BBR_HOLD_TARGET = 0x436
|
||||||
TCP_BBR_IWINTSO = 0x42b
|
TCP_BBR_IWINTSO = 0x42b
|
||||||
TCP_BBR_LOWGAIN_FD = 0x436
|
TCP_BBR_LOWGAIN_FD = 0x436
|
||||||
TCP_BBR_LOWGAIN_HALF = 0x435
|
TCP_BBR_LOWGAIN_HALF = 0x435
|
||||||
TCP_BBR_LOWGAIN_THRESH = 0x434
|
TCP_BBR_LOWGAIN_THRESH = 0x434
|
||||||
TCP_BBR_MAX_RTO = 0x439
|
TCP_BBR_MAX_RTO = 0x439
|
||||||
TCP_BBR_MIN_RTO = 0x438
|
TCP_BBR_MIN_RTO = 0x438
|
||||||
|
TCP_BBR_MIN_TOPACEOUT = 0x455
|
||||||
TCP_BBR_ONE_RETRAN = 0x431
|
TCP_BBR_ONE_RETRAN = 0x431
|
||||||
TCP_BBR_PACE_CROSS = 0x442
|
TCP_BBR_PACE_CROSS = 0x442
|
||||||
TCP_BBR_PACE_DEL_TAR = 0x43f
|
TCP_BBR_PACE_DEL_TAR = 0x43f
|
||||||
|
TCP_BBR_PACE_OH = 0x435
|
||||||
TCP_BBR_PACE_PER_SEC = 0x43e
|
TCP_BBR_PACE_PER_SEC = 0x43e
|
||||||
TCP_BBR_PACE_SEG_MAX = 0x440
|
TCP_BBR_PACE_SEG_MAX = 0x440
|
||||||
TCP_BBR_PACE_SEG_MIN = 0x441
|
TCP_BBR_PACE_SEG_MIN = 0x441
|
||||||
|
TCP_BBR_POLICER_DETECT = 0x457
|
||||||
TCP_BBR_PROBE_RTT_GAIN = 0x44d
|
TCP_BBR_PROBE_RTT_GAIN = 0x44d
|
||||||
TCP_BBR_PROBE_RTT_INT = 0x430
|
TCP_BBR_PROBE_RTT_INT = 0x430
|
||||||
TCP_BBR_PROBE_RTT_LEN = 0x44e
|
TCP_BBR_PROBE_RTT_LEN = 0x44e
|
||||||
|
@ -1497,12 +1582,18 @@ const (
|
||||||
TCP_BBR_REC_OVER_HPTS = 0x43a
|
TCP_BBR_REC_OVER_HPTS = 0x43a
|
||||||
TCP_BBR_RETRAN_WTSO = 0x44b
|
TCP_BBR_RETRAN_WTSO = 0x44b
|
||||||
TCP_BBR_RWND_IS_APP = 0x42f
|
TCP_BBR_RWND_IS_APP = 0x42f
|
||||||
|
TCP_BBR_SEND_IWND_IN_TSO = 0x44f
|
||||||
TCP_BBR_STARTUP_EXIT_EPOCH = 0x43d
|
TCP_BBR_STARTUP_EXIT_EPOCH = 0x43d
|
||||||
TCP_BBR_STARTUP_LOSS_EXIT = 0x432
|
TCP_BBR_STARTUP_LOSS_EXIT = 0x432
|
||||||
TCP_BBR_STARTUP_PG = 0x42d
|
TCP_BBR_STARTUP_PG = 0x42d
|
||||||
|
TCP_BBR_TMR_PACE_OH = 0x448
|
||||||
|
TCP_BBR_TSLIMITS = 0x434
|
||||||
|
TCP_BBR_TSTMP_RAISES = 0x456
|
||||||
TCP_BBR_UNLIMITED = 0x43b
|
TCP_BBR_UNLIMITED = 0x43b
|
||||||
TCP_BBR_USEDEL_RATE = 0x437
|
TCP_BBR_USEDEL_RATE = 0x437
|
||||||
TCP_BBR_USE_LOWGAIN = 0x433
|
TCP_BBR_USE_LOWGAIN = 0x433
|
||||||
|
TCP_BBR_USE_RACK_CHEAT = 0x450
|
||||||
|
TCP_BBR_UTTER_MAX_TSO = 0x452
|
||||||
TCP_CA_NAME_MAX = 0x10
|
TCP_CA_NAME_MAX = 0x10
|
||||||
TCP_CCALGOOPT = 0x41
|
TCP_CCALGOOPT = 0x41
|
||||||
TCP_CONGESTION = 0x40
|
TCP_CONGESTION = 0x40
|
||||||
|
@ -1542,6 +1633,7 @@ const (
|
||||||
TCP_PCAP_OUT = 0x800
|
TCP_PCAP_OUT = 0x800
|
||||||
TCP_RACK_EARLY_RECOV = 0x423
|
TCP_RACK_EARLY_RECOV = 0x423
|
||||||
TCP_RACK_EARLY_SEG = 0x424
|
TCP_RACK_EARLY_SEG = 0x424
|
||||||
|
TCP_RACK_GP_INCREASE = 0x446
|
||||||
TCP_RACK_IDLE_REDUCE_HIGH = 0x444
|
TCP_RACK_IDLE_REDUCE_HIGH = 0x444
|
||||||
TCP_RACK_MIN_PACE = 0x445
|
TCP_RACK_MIN_PACE = 0x445
|
||||||
TCP_RACK_MIN_PACE_SEG = 0x446
|
TCP_RACK_MIN_PACE_SEG = 0x446
|
||||||
|
@ -1555,7 +1647,6 @@ const (
|
||||||
TCP_RACK_PRR_SENDALOT = 0x421
|
TCP_RACK_PRR_SENDALOT = 0x421
|
||||||
TCP_RACK_REORD_FADE = 0x426
|
TCP_RACK_REORD_FADE = 0x426
|
||||||
TCP_RACK_REORD_THRESH = 0x425
|
TCP_RACK_REORD_THRESH = 0x425
|
||||||
TCP_RACK_SESS_CWV = 0x42a
|
|
||||||
TCP_RACK_TLP_INC_VAR = 0x429
|
TCP_RACK_TLP_INC_VAR = 0x429
|
||||||
TCP_RACK_TLP_REDUCE = 0x41c
|
TCP_RACK_TLP_REDUCE = 0x41c
|
||||||
TCP_RACK_TLP_THRESH = 0x427
|
TCP_RACK_TLP_THRESH = 0x427
|
||||||
|
@ -1693,12 +1784,13 @@ const (
|
||||||
EIDRM = syscall.Errno(0x52)
|
EIDRM = syscall.Errno(0x52)
|
||||||
EILSEQ = syscall.Errno(0x56)
|
EILSEQ = syscall.Errno(0x56)
|
||||||
EINPROGRESS = syscall.Errno(0x24)
|
EINPROGRESS = syscall.Errno(0x24)
|
||||||
|
EINTEGRITY = syscall.Errno(0x61)
|
||||||
EINTR = syscall.Errno(0x4)
|
EINTR = syscall.Errno(0x4)
|
||||||
EINVAL = syscall.Errno(0x16)
|
EINVAL = syscall.Errno(0x16)
|
||||||
EIO = syscall.Errno(0x5)
|
EIO = syscall.Errno(0x5)
|
||||||
EISCONN = syscall.Errno(0x38)
|
EISCONN = syscall.Errno(0x38)
|
||||||
EISDIR = syscall.Errno(0x15)
|
EISDIR = syscall.Errno(0x15)
|
||||||
ELAST = syscall.Errno(0x60)
|
ELAST = syscall.Errno(0x61)
|
||||||
ELOOP = syscall.Errno(0x3e)
|
ELOOP = syscall.Errno(0x3e)
|
||||||
EMFILE = syscall.Errno(0x18)
|
EMFILE = syscall.Errno(0x18)
|
||||||
EMLINK = syscall.Errno(0x1f)
|
EMLINK = syscall.Errno(0x1f)
|
||||||
|
@ -1841,7 +1933,7 @@ var errorList = [...]struct {
|
||||||
{32, "EPIPE", "broken pipe"},
|
{32, "EPIPE", "broken pipe"},
|
||||||
{33, "EDOM", "numerical argument out of domain"},
|
{33, "EDOM", "numerical argument out of domain"},
|
||||||
{34, "ERANGE", "result too large"},
|
{34, "ERANGE", "result too large"},
|
||||||
{35, "EAGAIN", "resource temporarily unavailable"},
|
{35, "EWOULDBLOCK", "resource temporarily unavailable"},
|
||||||
{36, "EINPROGRESS", "operation now in progress"},
|
{36, "EINPROGRESS", "operation now in progress"},
|
||||||
{37, "EALREADY", "operation already in progress"},
|
{37, "EALREADY", "operation already in progress"},
|
||||||
{38, "ENOTSOCK", "socket operation on non-socket"},
|
{38, "ENOTSOCK", "socket operation on non-socket"},
|
||||||
|
@ -1903,6 +1995,7 @@ var errorList = [...]struct {
|
||||||
{94, "ECAPMODE", "not permitted in capability mode"},
|
{94, "ECAPMODE", "not permitted in capability mode"},
|
||||||
{95, "ENOTRECOVERABLE", "state not recoverable"},
|
{95, "ENOTRECOVERABLE", "state not recoverable"},
|
||||||
{96, "EOWNERDEAD", "previous owner died"},
|
{96, "EOWNERDEAD", "previous owner died"},
|
||||||
|
{97, "EINTEGRITY", "integrity check failed"},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Signal table
|
// Signal table
|
||||||
|
|
|
@ -151,6 +151,7 @@ const (
|
||||||
BIOCSETF = 0x80084267
|
BIOCSETF = 0x80084267
|
||||||
BIOCSETFNR = 0x80084282
|
BIOCSETFNR = 0x80084282
|
||||||
BIOCSETIF = 0x8020426c
|
BIOCSETIF = 0x8020426c
|
||||||
|
BIOCSETVLANPCP = 0x80044285
|
||||||
BIOCSETWF = 0x8008427b
|
BIOCSETWF = 0x8008427b
|
||||||
BIOCSETZBUF = 0x800c4281
|
BIOCSETZBUF = 0x800c4281
|
||||||
BIOCSHDRCMPLT = 0x80044275
|
BIOCSHDRCMPLT = 0x80044275
|
||||||
|
@ -362,7 +363,7 @@ const (
|
||||||
CTL_KERN = 0x1
|
CTL_KERN = 0x1
|
||||||
CTL_MAXNAME = 0x18
|
CTL_MAXNAME = 0x18
|
||||||
CTL_NET = 0x4
|
CTL_NET = 0x4
|
||||||
DIOCGATTR = 0xc144648e
|
DIOCGATTR = 0xc148648e
|
||||||
DIOCGDELETE = 0x80106488
|
DIOCGDELETE = 0x80106488
|
||||||
DIOCGFLUSH = 0x20006487
|
DIOCGFLUSH = 0x20006487
|
||||||
DIOCGFRONTSTUFF = 0x40086486
|
DIOCGFRONTSTUFF = 0x40086486
|
||||||
|
@ -377,7 +378,7 @@ const (
|
||||||
DIOCGSTRIPESIZE = 0x4008648b
|
DIOCGSTRIPESIZE = 0x4008648b
|
||||||
DIOCSKERNELDUMP = 0x804c6490
|
DIOCSKERNELDUMP = 0x804c6490
|
||||||
DIOCSKERNELDUMP_FREEBSD11 = 0x80046485
|
DIOCSKERNELDUMP_FREEBSD11 = 0x80046485
|
||||||
DIOCZONECMD = 0xc06c648f
|
DIOCZONECMD = 0xc078648f
|
||||||
DLT_A429 = 0xb8
|
DLT_A429 = 0xb8
|
||||||
DLT_A653_ICM = 0xb9
|
DLT_A653_ICM = 0xb9
|
||||||
DLT_AIRONET_HEADER = 0x78
|
DLT_AIRONET_HEADER = 0x78
|
||||||
|
@ -407,7 +408,9 @@ const (
|
||||||
DLT_C_HDLC_WITH_DIR = 0xcd
|
DLT_C_HDLC_WITH_DIR = 0xcd
|
||||||
DLT_DBUS = 0xe7
|
DLT_DBUS = 0xe7
|
||||||
DLT_DECT = 0xdd
|
DLT_DECT = 0xdd
|
||||||
|
DLT_DISPLAYPORT_AUX = 0x113
|
||||||
DLT_DOCSIS = 0x8f
|
DLT_DOCSIS = 0x8f
|
||||||
|
DLT_DOCSIS31_XRA31 = 0x111
|
||||||
DLT_DVB_CI = 0xeb
|
DLT_DVB_CI = 0xeb
|
||||||
DLT_ECONET = 0x73
|
DLT_ECONET = 0x73
|
||||||
DLT_EN10MB = 0x1
|
DLT_EN10MB = 0x1
|
||||||
|
@ -417,6 +420,7 @@ const (
|
||||||
DLT_ERF = 0xc5
|
DLT_ERF = 0xc5
|
||||||
DLT_ERF_ETH = 0xaf
|
DLT_ERF_ETH = 0xaf
|
||||||
DLT_ERF_POS = 0xb0
|
DLT_ERF_POS = 0xb0
|
||||||
|
DLT_ETHERNET_MPACKET = 0x112
|
||||||
DLT_FC_2 = 0xe0
|
DLT_FC_2 = 0xe0
|
||||||
DLT_FC_2_WITH_FRAME_DELIMS = 0xe1
|
DLT_FC_2_WITH_FRAME_DELIMS = 0xe1
|
||||||
DLT_FDDI = 0xa
|
DLT_FDDI = 0xa
|
||||||
|
@ -444,7 +448,7 @@ const (
|
||||||
DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1
|
DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1
|
||||||
DLT_INFINIBAND = 0xf7
|
DLT_INFINIBAND = 0xf7
|
||||||
DLT_IPFILTER = 0x74
|
DLT_IPFILTER = 0x74
|
||||||
DLT_IPMB = 0xc7
|
DLT_IPMB_KONTRON = 0xc7
|
||||||
DLT_IPMB_LINUX = 0xd1
|
DLT_IPMB_LINUX = 0xd1
|
||||||
DLT_IPMI_HPM_2 = 0x104
|
DLT_IPMI_HPM_2 = 0x104
|
||||||
DLT_IPNET = 0xe2
|
DLT_IPNET = 0xe2
|
||||||
|
@ -484,9 +488,11 @@ const (
|
||||||
DLT_LINUX_LAPD = 0xb1
|
DLT_LINUX_LAPD = 0xb1
|
||||||
DLT_LINUX_PPP_WITHDIRECTION = 0xa6
|
DLT_LINUX_PPP_WITHDIRECTION = 0xa6
|
||||||
DLT_LINUX_SLL = 0x71
|
DLT_LINUX_SLL = 0x71
|
||||||
|
DLT_LINUX_SLL2 = 0x114
|
||||||
DLT_LOOP = 0x6c
|
DLT_LOOP = 0x6c
|
||||||
|
DLT_LORATAP = 0x10e
|
||||||
DLT_LTALK = 0x72
|
DLT_LTALK = 0x72
|
||||||
DLT_MATCHING_MAX = 0x109
|
DLT_MATCHING_MAX = 0x114
|
||||||
DLT_MATCHING_MIN = 0x68
|
DLT_MATCHING_MIN = 0x68
|
||||||
DLT_MFR = 0xb6
|
DLT_MFR = 0xb6
|
||||||
DLT_MOST = 0xd3
|
DLT_MOST = 0xd3
|
||||||
|
@ -502,7 +508,9 @@ const (
|
||||||
DLT_NFC_LLCP = 0xf5
|
DLT_NFC_LLCP = 0xf5
|
||||||
DLT_NFLOG = 0xef
|
DLT_NFLOG = 0xef
|
||||||
DLT_NG40 = 0xf4
|
DLT_NG40 = 0xf4
|
||||||
|
DLT_NORDIC_BLE = 0x110
|
||||||
DLT_NULL = 0x0
|
DLT_NULL = 0x0
|
||||||
|
DLT_OPENFLOW = 0x10b
|
||||||
DLT_PCI_EXP = 0x7d
|
DLT_PCI_EXP = 0x7d
|
||||||
DLT_PFLOG = 0x75
|
DLT_PFLOG = 0x75
|
||||||
DLT_PFSYNC = 0x79
|
DLT_PFSYNC = 0x79
|
||||||
|
@ -526,15 +534,18 @@ const (
|
||||||
DLT_RTAC_SERIAL = 0xfa
|
DLT_RTAC_SERIAL = 0xfa
|
||||||
DLT_SCCP = 0x8e
|
DLT_SCCP = 0x8e
|
||||||
DLT_SCTP = 0xf8
|
DLT_SCTP = 0xf8
|
||||||
|
DLT_SDLC = 0x10c
|
||||||
DLT_SITA = 0xc4
|
DLT_SITA = 0xc4
|
||||||
DLT_SLIP = 0x8
|
DLT_SLIP = 0x8
|
||||||
DLT_SLIP_BSDOS = 0xd
|
DLT_SLIP_BSDOS = 0xd
|
||||||
DLT_STANAG_5066_D_PDU = 0xed
|
DLT_STANAG_5066_D_PDU = 0xed
|
||||||
DLT_SUNATM = 0x7b
|
DLT_SUNATM = 0x7b
|
||||||
DLT_SYMANTEC_FIREWALL = 0x63
|
DLT_SYMANTEC_FIREWALL = 0x63
|
||||||
|
DLT_TI_LLN_SNIFFER = 0x10d
|
||||||
DLT_TZSP = 0x80
|
DLT_TZSP = 0x80
|
||||||
DLT_USB = 0xba
|
DLT_USB = 0xba
|
||||||
DLT_USBPCAP = 0xf9
|
DLT_USBPCAP = 0xf9
|
||||||
|
DLT_USB_DARWIN = 0x10a
|
||||||
DLT_USB_FREEBSD = 0xba
|
DLT_USB_FREEBSD = 0xba
|
||||||
DLT_USB_LINUX = 0xbd
|
DLT_USB_LINUX = 0xbd
|
||||||
DLT_USB_LINUX_MMAPPED = 0xdc
|
DLT_USB_LINUX_MMAPPED = 0xdc
|
||||||
|
@ -554,6 +565,7 @@ const (
|
||||||
DLT_USER7 = 0x9a
|
DLT_USER7 = 0x9a
|
||||||
DLT_USER8 = 0x9b
|
DLT_USER8 = 0x9b
|
||||||
DLT_USER9 = 0x9c
|
DLT_USER9 = 0x9c
|
||||||
|
DLT_VSOCK = 0x10f
|
||||||
DLT_WATTSTOPPER_DLM = 0x107
|
DLT_WATTSTOPPER_DLM = 0x107
|
||||||
DLT_WIHART = 0xdf
|
DLT_WIHART = 0xdf
|
||||||
DLT_WIRESHARK_UPPER_PDU = 0xfc
|
DLT_WIRESHARK_UPPER_PDU = 0xfc
|
||||||
|
@ -578,6 +590,7 @@ const (
|
||||||
ECHONL = 0x10
|
ECHONL = 0x10
|
||||||
ECHOPRT = 0x20
|
ECHOPRT = 0x20
|
||||||
EVFILT_AIO = -0x3
|
EVFILT_AIO = -0x3
|
||||||
|
EVFILT_EMPTY = -0xd
|
||||||
EVFILT_FS = -0x9
|
EVFILT_FS = -0x9
|
||||||
EVFILT_LIO = -0xa
|
EVFILT_LIO = -0xa
|
||||||
EVFILT_PROC = -0x5
|
EVFILT_PROC = -0x5
|
||||||
|
@ -585,11 +598,12 @@ const (
|
||||||
EVFILT_READ = -0x1
|
EVFILT_READ = -0x1
|
||||||
EVFILT_SENDFILE = -0xc
|
EVFILT_SENDFILE = -0xc
|
||||||
EVFILT_SIGNAL = -0x6
|
EVFILT_SIGNAL = -0x6
|
||||||
EVFILT_SYSCOUNT = 0xc
|
EVFILT_SYSCOUNT = 0xd
|
||||||
EVFILT_TIMER = -0x7
|
EVFILT_TIMER = -0x7
|
||||||
EVFILT_USER = -0xb
|
EVFILT_USER = -0xb
|
||||||
EVFILT_VNODE = -0x4
|
EVFILT_VNODE = -0x4
|
||||||
EVFILT_WRITE = -0x2
|
EVFILT_WRITE = -0x2
|
||||||
|
EVNAMEMAP_NAME_SIZE = 0x40
|
||||||
EV_ADD = 0x1
|
EV_ADD = 0x1
|
||||||
EV_CLEAR = 0x20
|
EV_CLEAR = 0x20
|
||||||
EV_DELETE = 0x2
|
EV_DELETE = 0x2
|
||||||
|
@ -606,6 +620,7 @@ const (
|
||||||
EV_RECEIPT = 0x40
|
EV_RECEIPT = 0x40
|
||||||
EV_SYSFLAGS = 0xf000
|
EV_SYSFLAGS = 0xf000
|
||||||
EXTA = 0x4b00
|
EXTA = 0x4b00
|
||||||
|
EXTATTR_MAXNAMELEN = 0xff
|
||||||
EXTATTR_NAMESPACE_EMPTY = 0x0
|
EXTATTR_NAMESPACE_EMPTY = 0x0
|
||||||
EXTATTR_NAMESPACE_SYSTEM = 0x2
|
EXTATTR_NAMESPACE_SYSTEM = 0x2
|
||||||
EXTATTR_NAMESPACE_USER = 0x1
|
EXTATTR_NAMESPACE_USER = 0x1
|
||||||
|
@ -647,6 +662,7 @@ const (
|
||||||
IEXTEN = 0x400
|
IEXTEN = 0x400
|
||||||
IFAN_ARRIVAL = 0x0
|
IFAN_ARRIVAL = 0x0
|
||||||
IFAN_DEPARTURE = 0x1
|
IFAN_DEPARTURE = 0x1
|
||||||
|
IFCAP_WOL_MAGIC = 0x2000
|
||||||
IFF_ALLMULTI = 0x200
|
IFF_ALLMULTI = 0x200
|
||||||
IFF_ALTPHYS = 0x4000
|
IFF_ALTPHYS = 0x4000
|
||||||
IFF_BROADCAST = 0x2
|
IFF_BROADCAST = 0x2
|
||||||
|
@ -663,6 +679,7 @@ const (
|
||||||
IFF_MONITOR = 0x40000
|
IFF_MONITOR = 0x40000
|
||||||
IFF_MULTICAST = 0x8000
|
IFF_MULTICAST = 0x8000
|
||||||
IFF_NOARP = 0x80
|
IFF_NOARP = 0x80
|
||||||
|
IFF_NOGROUP = 0x800000
|
||||||
IFF_OACTIVE = 0x400
|
IFF_OACTIVE = 0x400
|
||||||
IFF_POINTOPOINT = 0x10
|
IFF_POINTOPOINT = 0x10
|
||||||
IFF_PPROMISC = 0x20000
|
IFF_PPROMISC = 0x20000
|
||||||
|
@ -719,6 +736,7 @@ const (
|
||||||
IPPROTO_CMTP = 0x26
|
IPPROTO_CMTP = 0x26
|
||||||
IPPROTO_CPHB = 0x49
|
IPPROTO_CPHB = 0x49
|
||||||
IPPROTO_CPNX = 0x48
|
IPPROTO_CPNX = 0x48
|
||||||
|
IPPROTO_DCCP = 0x21
|
||||||
IPPROTO_DDP = 0x25
|
IPPROTO_DDP = 0x25
|
||||||
IPPROTO_DGP = 0x56
|
IPPROTO_DGP = 0x56
|
||||||
IPPROTO_DIVERT = 0x102
|
IPPROTO_DIVERT = 0x102
|
||||||
|
@ -799,7 +817,6 @@ const (
|
||||||
IPPROTO_SCTP = 0x84
|
IPPROTO_SCTP = 0x84
|
||||||
IPPROTO_SDRP = 0x2a
|
IPPROTO_SDRP = 0x2a
|
||||||
IPPROTO_SEND = 0x103
|
IPPROTO_SEND = 0x103
|
||||||
IPPROTO_SEP = 0x21
|
|
||||||
IPPROTO_SHIM6 = 0x8c
|
IPPROTO_SHIM6 = 0x8c
|
||||||
IPPROTO_SKIP = 0x39
|
IPPROTO_SKIP = 0x39
|
||||||
IPPROTO_SPACER = 0x7fff
|
IPPROTO_SPACER = 0x7fff
|
||||||
|
@ -837,6 +854,7 @@ const (
|
||||||
IPV6_DSTOPTS = 0x32
|
IPV6_DSTOPTS = 0x32
|
||||||
IPV6_FLOWID = 0x43
|
IPV6_FLOWID = 0x43
|
||||||
IPV6_FLOWINFO_MASK = 0xffffff0f
|
IPV6_FLOWINFO_MASK = 0xffffff0f
|
||||||
|
IPV6_FLOWLABEL_LEN = 0x14
|
||||||
IPV6_FLOWLABEL_MASK = 0xffff0f00
|
IPV6_FLOWLABEL_MASK = 0xffff0f00
|
||||||
IPV6_FLOWTYPE = 0x44
|
IPV6_FLOWTYPE = 0x44
|
||||||
IPV6_FRAGTTL = 0x78
|
IPV6_FRAGTTL = 0x78
|
||||||
|
@ -857,13 +875,13 @@ const (
|
||||||
IPV6_MAX_GROUP_SRC_FILTER = 0x200
|
IPV6_MAX_GROUP_SRC_FILTER = 0x200
|
||||||
IPV6_MAX_MEMBERSHIPS = 0xfff
|
IPV6_MAX_MEMBERSHIPS = 0xfff
|
||||||
IPV6_MAX_SOCK_SRC_FILTER = 0x80
|
IPV6_MAX_SOCK_SRC_FILTER = 0x80
|
||||||
IPV6_MIN_MEMBERSHIPS = 0x1f
|
|
||||||
IPV6_MMTU = 0x500
|
IPV6_MMTU = 0x500
|
||||||
IPV6_MSFILTER = 0x4a
|
IPV6_MSFILTER = 0x4a
|
||||||
IPV6_MULTICAST_HOPS = 0xa
|
IPV6_MULTICAST_HOPS = 0xa
|
||||||
IPV6_MULTICAST_IF = 0x9
|
IPV6_MULTICAST_IF = 0x9
|
||||||
IPV6_MULTICAST_LOOP = 0xb
|
IPV6_MULTICAST_LOOP = 0xb
|
||||||
IPV6_NEXTHOP = 0x30
|
IPV6_NEXTHOP = 0x30
|
||||||
|
IPV6_ORIGDSTADDR = 0x48
|
||||||
IPV6_PATHMTU = 0x2c
|
IPV6_PATHMTU = 0x2c
|
||||||
IPV6_PKTINFO = 0x2e
|
IPV6_PKTINFO = 0x2e
|
||||||
IPV6_PORTRANGE = 0xe
|
IPV6_PORTRANGE = 0xe
|
||||||
|
@ -875,6 +893,7 @@ const (
|
||||||
IPV6_RECVFLOWID = 0x46
|
IPV6_RECVFLOWID = 0x46
|
||||||
IPV6_RECVHOPLIMIT = 0x25
|
IPV6_RECVHOPLIMIT = 0x25
|
||||||
IPV6_RECVHOPOPTS = 0x27
|
IPV6_RECVHOPOPTS = 0x27
|
||||||
|
IPV6_RECVORIGDSTADDR = 0x48
|
||||||
IPV6_RECVPATHMTU = 0x2b
|
IPV6_RECVPATHMTU = 0x2b
|
||||||
IPV6_RECVPKTINFO = 0x24
|
IPV6_RECVPKTINFO = 0x24
|
||||||
IPV6_RECVRSSBUCKETID = 0x47
|
IPV6_RECVRSSBUCKETID = 0x47
|
||||||
|
@ -894,6 +913,7 @@ const (
|
||||||
IPV6_V6ONLY = 0x1b
|
IPV6_V6ONLY = 0x1b
|
||||||
IPV6_VERSION = 0x60
|
IPV6_VERSION = 0x60
|
||||||
IPV6_VERSION_MASK = 0xf0
|
IPV6_VERSION_MASK = 0xf0
|
||||||
|
IPV6_VLAN_PCP = 0x4b
|
||||||
IP_ADD_MEMBERSHIP = 0xc
|
IP_ADD_MEMBERSHIP = 0xc
|
||||||
IP_ADD_SOURCE_MEMBERSHIP = 0x46
|
IP_ADD_SOURCE_MEMBERSHIP = 0x46
|
||||||
IP_BINDANY = 0x18
|
IP_BINDANY = 0x18
|
||||||
|
@ -935,10 +955,8 @@ const (
|
||||||
IP_MAX_MEMBERSHIPS = 0xfff
|
IP_MAX_MEMBERSHIPS = 0xfff
|
||||||
IP_MAX_SOCK_MUTE_FILTER = 0x80
|
IP_MAX_SOCK_MUTE_FILTER = 0x80
|
||||||
IP_MAX_SOCK_SRC_FILTER = 0x80
|
IP_MAX_SOCK_SRC_FILTER = 0x80
|
||||||
IP_MAX_SOURCE_FILTER = 0x400
|
|
||||||
IP_MF = 0x2000
|
IP_MF = 0x2000
|
||||||
IP_MINTTL = 0x42
|
IP_MINTTL = 0x42
|
||||||
IP_MIN_MEMBERSHIPS = 0x1f
|
|
||||||
IP_MSFILTER = 0x4a
|
IP_MSFILTER = 0x4a
|
||||||
IP_MSS = 0x240
|
IP_MSS = 0x240
|
||||||
IP_MULTICAST_IF = 0x9
|
IP_MULTICAST_IF = 0x9
|
||||||
|
@ -948,6 +966,7 @@ const (
|
||||||
IP_OFFMASK = 0x1fff
|
IP_OFFMASK = 0x1fff
|
||||||
IP_ONESBCAST = 0x17
|
IP_ONESBCAST = 0x17
|
||||||
IP_OPTIONS = 0x1
|
IP_OPTIONS = 0x1
|
||||||
|
IP_ORIGDSTADDR = 0x1b
|
||||||
IP_PORTRANGE = 0x13
|
IP_PORTRANGE = 0x13
|
||||||
IP_PORTRANGE_DEFAULT = 0x0
|
IP_PORTRANGE_DEFAULT = 0x0
|
||||||
IP_PORTRANGE_HIGH = 0x1
|
IP_PORTRANGE_HIGH = 0x1
|
||||||
|
@ -956,6 +975,7 @@ const (
|
||||||
IP_RECVFLOWID = 0x5d
|
IP_RECVFLOWID = 0x5d
|
||||||
IP_RECVIF = 0x14
|
IP_RECVIF = 0x14
|
||||||
IP_RECVOPTS = 0x5
|
IP_RECVOPTS = 0x5
|
||||||
|
IP_RECVORIGDSTADDR = 0x1b
|
||||||
IP_RECVRETOPTS = 0x6
|
IP_RECVRETOPTS = 0x6
|
||||||
IP_RECVRSSBUCKETID = 0x5e
|
IP_RECVRSSBUCKETID = 0x5e
|
||||||
IP_RECVTOS = 0x44
|
IP_RECVTOS = 0x44
|
||||||
|
@ -972,8 +992,12 @@ const (
|
||||||
IP_TOS = 0x3
|
IP_TOS = 0x3
|
||||||
IP_TTL = 0x4
|
IP_TTL = 0x4
|
||||||
IP_UNBLOCK_SOURCE = 0x49
|
IP_UNBLOCK_SOURCE = 0x49
|
||||||
|
IP_VLAN_PCP = 0x4b
|
||||||
ISIG = 0x80
|
ISIG = 0x80
|
||||||
ISTRIP = 0x20
|
ISTRIP = 0x20
|
||||||
|
ITIMER_PROF = 0x2
|
||||||
|
ITIMER_REAL = 0x0
|
||||||
|
ITIMER_VIRTUAL = 0x1
|
||||||
IXANY = 0x800
|
IXANY = 0x800
|
||||||
IXOFF = 0x400
|
IXOFF = 0x400
|
||||||
IXON = 0x200
|
IXON = 0x200
|
||||||
|
@ -983,7 +1007,6 @@ const (
|
||||||
KERN_VERSION = 0x4
|
KERN_VERSION = 0x4
|
||||||
LOCAL_CONNWAIT = 0x4
|
LOCAL_CONNWAIT = 0x4
|
||||||
LOCAL_CREDS = 0x2
|
LOCAL_CREDS = 0x2
|
||||||
LOCAL_CREDS_PERSISTENT = 0x3
|
|
||||||
LOCAL_PEERCRED = 0x1
|
LOCAL_PEERCRED = 0x1
|
||||||
LOCAL_VENDOR = 0x80000000
|
LOCAL_VENDOR = 0x80000000
|
||||||
LOCK_EX = 0x2
|
LOCK_EX = 0x2
|
||||||
|
@ -1071,10 +1094,12 @@ const (
|
||||||
MNT_SUSPEND = 0x4
|
MNT_SUSPEND = 0x4
|
||||||
MNT_SYNCHRONOUS = 0x2
|
MNT_SYNCHRONOUS = 0x2
|
||||||
MNT_UNION = 0x20
|
MNT_UNION = 0x20
|
||||||
|
MNT_UNTRUSTED = 0x800000000
|
||||||
MNT_UPDATE = 0x10000
|
MNT_UPDATE = 0x10000
|
||||||
MNT_UPDATEMASK = 0x2d8d0807e
|
MNT_UPDATEMASK = 0xad8d0807e
|
||||||
MNT_USER = 0x8000
|
MNT_USER = 0x8000
|
||||||
MNT_VISFLAGMASK = 0x3fef0ffff
|
MNT_VERIFIED = 0x400000000
|
||||||
|
MNT_VISFLAGMASK = 0xffef0ffff
|
||||||
MNT_WAIT = 0x1
|
MNT_WAIT = 0x1
|
||||||
MSG_CMSG_CLOEXEC = 0x40000
|
MSG_CMSG_CLOEXEC = 0x40000
|
||||||
MSG_COMPAT = 0x8000
|
MSG_COMPAT = 0x8000
|
||||||
|
@ -1103,6 +1128,7 @@ const (
|
||||||
NFDBITS = 0x20
|
NFDBITS = 0x20
|
||||||
NOFLSH = 0x80000000
|
NOFLSH = 0x80000000
|
||||||
NOKERNINFO = 0x2000000
|
NOKERNINFO = 0x2000000
|
||||||
|
NOTE_ABSTIME = 0x10
|
||||||
NOTE_ATTRIB = 0x8
|
NOTE_ATTRIB = 0x8
|
||||||
NOTE_CHILD = 0x4
|
NOTE_CHILD = 0x4
|
||||||
NOTE_CLOSE = 0x100
|
NOTE_CLOSE = 0x100
|
||||||
|
@ -1159,6 +1185,8 @@ const (
|
||||||
O_NONBLOCK = 0x4
|
O_NONBLOCK = 0x4
|
||||||
O_RDONLY = 0x0
|
O_RDONLY = 0x0
|
||||||
O_RDWR = 0x2
|
O_RDWR = 0x2
|
||||||
|
O_RESOLVE_BENEATH = 0x800000
|
||||||
|
O_SEARCH = 0x40000
|
||||||
O_SHLOCK = 0x10
|
O_SHLOCK = 0x10
|
||||||
O_SYNC = 0x80
|
O_SYNC = 0x80
|
||||||
O_TRUNC = 0x400
|
O_TRUNC = 0x400
|
||||||
|
@ -1169,6 +1197,10 @@ const (
|
||||||
PARMRK = 0x8
|
PARMRK = 0x8
|
||||||
PARODD = 0x2000
|
PARODD = 0x2000
|
||||||
PENDIN = 0x20000000
|
PENDIN = 0x20000000
|
||||||
|
PIOD_READ_D = 0x1
|
||||||
|
PIOD_READ_I = 0x3
|
||||||
|
PIOD_WRITE_D = 0x2
|
||||||
|
PIOD_WRITE_I = 0x4
|
||||||
PRIO_PGRP = 0x1
|
PRIO_PGRP = 0x1
|
||||||
PRIO_PROCESS = 0x0
|
PRIO_PROCESS = 0x0
|
||||||
PRIO_USER = 0x2
|
PRIO_USER = 0x2
|
||||||
|
@ -1176,6 +1208,53 @@ const (
|
||||||
PROT_NONE = 0x0
|
PROT_NONE = 0x0
|
||||||
PROT_READ = 0x1
|
PROT_READ = 0x1
|
||||||
PROT_WRITE = 0x2
|
PROT_WRITE = 0x2
|
||||||
|
PTRACE_DEFAULT = 0x1
|
||||||
|
PTRACE_EXEC = 0x1
|
||||||
|
PTRACE_FORK = 0x8
|
||||||
|
PTRACE_LWP = 0x10
|
||||||
|
PTRACE_SCE = 0x2
|
||||||
|
PTRACE_SCX = 0x4
|
||||||
|
PTRACE_SYSCALL = 0x6
|
||||||
|
PTRACE_VFORK = 0x20
|
||||||
|
PT_ATTACH = 0xa
|
||||||
|
PT_CLEARSTEP = 0x10
|
||||||
|
PT_CONTINUE = 0x7
|
||||||
|
PT_DETACH = 0xb
|
||||||
|
PT_FIRSTMACH = 0x40
|
||||||
|
PT_FOLLOW_FORK = 0x17
|
||||||
|
PT_GETDBREGS = 0x25
|
||||||
|
PT_GETFPREGS = 0x23
|
||||||
|
PT_GETLWPLIST = 0xf
|
||||||
|
PT_GETNUMLWPS = 0xe
|
||||||
|
PT_GETREGS = 0x21
|
||||||
|
PT_GETVFPREGS = 0x40
|
||||||
|
PT_GET_EVENT_MASK = 0x19
|
||||||
|
PT_GET_SC_ARGS = 0x1b
|
||||||
|
PT_GET_SC_RET = 0x1c
|
||||||
|
PT_IO = 0xc
|
||||||
|
PT_KILL = 0x8
|
||||||
|
PT_LWPINFO = 0xd
|
||||||
|
PT_LWP_EVENTS = 0x18
|
||||||
|
PT_READ_D = 0x2
|
||||||
|
PT_READ_I = 0x1
|
||||||
|
PT_RESUME = 0x13
|
||||||
|
PT_SETDBREGS = 0x26
|
||||||
|
PT_SETFPREGS = 0x24
|
||||||
|
PT_SETREGS = 0x22
|
||||||
|
PT_SETSTEP = 0x11
|
||||||
|
PT_SETVFPREGS = 0x41
|
||||||
|
PT_SET_EVENT_MASK = 0x1a
|
||||||
|
PT_STEP = 0x9
|
||||||
|
PT_SUSPEND = 0x12
|
||||||
|
PT_SYSCALL = 0x16
|
||||||
|
PT_TO_SCE = 0x14
|
||||||
|
PT_TO_SCX = 0x15
|
||||||
|
PT_TRACE_ME = 0x0
|
||||||
|
PT_VM_ENTRY = 0x29
|
||||||
|
PT_VM_TIMESTAMP = 0x28
|
||||||
|
PT_WRITE_D = 0x5
|
||||||
|
PT_WRITE_I = 0x4
|
||||||
|
P_ZONEID = 0xc
|
||||||
RLIMIT_AS = 0xa
|
RLIMIT_AS = 0xa
|
||||||
RLIMIT_CORE = 0x4
|
RLIMIT_CORE = 0x4
|
||||||
RLIMIT_CPU = 0x0
|
RLIMIT_CPU = 0x0
|
||||||
|
@ -1257,7 +1336,6 @@ const (
|
||||||
RTV_WEIGHT = 0x100
|
RTV_WEIGHT = 0x100
|
||||||
RT_ALL_FIBS = -0x1
|
RT_ALL_FIBS = -0x1
|
||||||
RT_BLACKHOLE = 0x40
|
RT_BLACKHOLE = 0x40
|
||||||
RT_CACHING_CONTEXT = 0x1
|
|
||||||
RT_DEFAULT_FIB = 0x0
|
RT_DEFAULT_FIB = 0x0
|
||||||
RT_HAS_GW = 0x80
|
RT_HAS_GW = 0x80
|
||||||
RT_HAS_HEADER = 0x10
|
RT_HAS_HEADER = 0x10
|
||||||
|
@ -1267,15 +1345,17 @@ const (
|
||||||
RT_LLE_CACHE = 0x100
|
RT_LLE_CACHE = 0x100
|
||||||
RT_MAY_LOOP = 0x8
|
RT_MAY_LOOP = 0x8
|
||||||
RT_MAY_LOOP_BIT = 0x3
|
RT_MAY_LOOP_BIT = 0x3
|
||||||
RT_NORTREF = 0x2
|
|
||||||
RT_REJECT = 0x20
|
RT_REJECT = 0x20
|
||||||
RUSAGE_CHILDREN = -0x1
|
RUSAGE_CHILDREN = -0x1
|
||||||
RUSAGE_SELF = 0x0
|
RUSAGE_SELF = 0x0
|
||||||
RUSAGE_THREAD = 0x1
|
RUSAGE_THREAD = 0x1
|
||||||
SCM_BINTIME = 0x4
|
SCM_BINTIME = 0x4
|
||||||
SCM_CREDS = 0x3
|
SCM_CREDS = 0x3
|
||||||
|
SCM_MONOTONIC = 0x6
|
||||||
|
SCM_REALTIME = 0x5
|
||||||
SCM_RIGHTS = 0x1
|
SCM_RIGHTS = 0x1
|
||||||
SCM_TIMESTAMP = 0x2
|
SCM_TIMESTAMP = 0x2
|
||||||
|
SCM_TIME_INFO = 0x7
|
||||||
SEEK_CUR = 0x1
|
SEEK_CUR = 0x1
|
||||||
SEEK_DATA = 0x3
|
SEEK_DATA = 0x3
|
||||||
SEEK_END = 0x2
|
SEEK_END = 0x2
|
||||||
|
@ -1299,10 +1379,12 @@ const (
|
||||||
SIOCGHWADDR = 0xc020693e
|
SIOCGHWADDR = 0xc020693e
|
||||||
SIOCGI2C = 0xc020693d
|
SIOCGI2C = 0xc020693d
|
||||||
SIOCGIFADDR = 0xc0206921
|
SIOCGIFADDR = 0xc0206921
|
||||||
|
SIOCGIFALIAS = 0xc044692d
|
||||||
SIOCGIFBRDADDR = 0xc0206923
|
SIOCGIFBRDADDR = 0xc0206923
|
||||||
SIOCGIFCAP = 0xc020691f
|
SIOCGIFCAP = 0xc020691f
|
||||||
SIOCGIFCONF = 0xc0086924
|
SIOCGIFCONF = 0xc0086924
|
||||||
SIOCGIFDESCR = 0xc020692a
|
SIOCGIFDESCR = 0xc020692a
|
||||||
|
SIOCGIFDOWNREASON = 0xc058699a
|
||||||
SIOCGIFDSTADDR = 0xc0206922
|
SIOCGIFDSTADDR = 0xc0206922
|
||||||
SIOCGIFFIB = 0xc020695c
|
SIOCGIFFIB = 0xc020695c
|
||||||
SIOCGIFFLAGS = 0xc0206911
|
SIOCGIFFLAGS = 0xc0206911
|
||||||
|
@ -1318,8 +1400,11 @@ const (
|
||||||
SIOCGIFPDSTADDR = 0xc0206948
|
SIOCGIFPDSTADDR = 0xc0206948
|
||||||
SIOCGIFPHYS = 0xc0206935
|
SIOCGIFPHYS = 0xc0206935
|
||||||
SIOCGIFPSRCADDR = 0xc0206947
|
SIOCGIFPSRCADDR = 0xc0206947
|
||||||
|
SIOCGIFRSSHASH = 0xc0186997
|
||||||
|
SIOCGIFRSSKEY = 0xc0946996
|
||||||
SIOCGIFSTATUS = 0xc331693b
|
SIOCGIFSTATUS = 0xc331693b
|
||||||
SIOCGIFXMEDIA = 0xc028698b
|
SIOCGIFXMEDIA = 0xc028698b
|
||||||
|
SIOCGLANPCP = 0xc0206998
|
||||||
SIOCGLOWAT = 0x40047303
|
SIOCGLOWAT = 0x40047303
|
||||||
SIOCGPGRP = 0x40047309
|
SIOCGPGRP = 0x40047309
|
||||||
SIOCGPRIVATE_0 = 0xc0206950
|
SIOCGPRIVATE_0 = 0xc0206950
|
||||||
|
@ -1350,6 +1435,7 @@ const (
|
||||||
SIOCSIFPHYS = 0x80206936
|
SIOCSIFPHYS = 0x80206936
|
||||||
SIOCSIFRVNET = 0xc020695b
|
SIOCSIFRVNET = 0xc020695b
|
||||||
SIOCSIFVNET = 0xc020695a
|
SIOCSIFVNET = 0xc020695a
|
||||||
|
SIOCSLANPCP = 0x80206999
|
||||||
SIOCSLOWAT = 0x80047302
|
SIOCSLOWAT = 0x80047302
|
||||||
SIOCSPGRP = 0x80047308
|
SIOCSPGRP = 0x80047308
|
||||||
SIOCSTUNFIB = 0x8020695f
|
SIOCSTUNFIB = 0x8020695f
|
||||||
|
@ -1369,6 +1455,7 @@ const (
|
||||||
SO_BINTIME = 0x2000
|
SO_BINTIME = 0x2000
|
||||||
SO_BROADCAST = 0x20
|
SO_BROADCAST = 0x20
|
||||||
SO_DEBUG = 0x1
|
SO_DEBUG = 0x1
|
||||||
|
SO_DOMAIN = 0x1019
|
||||||
SO_DONTROUTE = 0x10
|
SO_DONTROUTE = 0x10
|
||||||
SO_ERROR = 0x1007
|
SO_ERROR = 0x1007
|
||||||
SO_KEEPALIVE = 0x8
|
SO_KEEPALIVE = 0x8
|
||||||
|
@ -1377,6 +1464,7 @@ const (
|
||||||
SO_LISTENINCQLEN = 0x1013
|
SO_LISTENINCQLEN = 0x1013
|
||||||
SO_LISTENQLEN = 0x1012
|
SO_LISTENQLEN = 0x1012
|
||||||
SO_LISTENQLIMIT = 0x1011
|
SO_LISTENQLIMIT = 0x1011
|
||||||
|
SO_MAX_PACING_RATE = 0x1018
|
||||||
SO_NOSIGPIPE = 0x800
|
SO_NOSIGPIPE = 0x800
|
||||||
SO_NO_DDP = 0x8000
|
SO_NO_DDP = 0x8000
|
||||||
SO_NO_OFFLOAD = 0x4000
|
SO_NO_OFFLOAD = 0x4000
|
||||||
|
@ -1387,13 +1475,22 @@ const (
|
||||||
SO_RCVBUF = 0x1002
|
SO_RCVBUF = 0x1002
|
||||||
SO_RCVLOWAT = 0x1004
|
SO_RCVLOWAT = 0x1004
|
||||||
SO_RCVTIMEO = 0x1006
|
SO_RCVTIMEO = 0x1006
|
||||||
|
SO_RERROR = 0x20000
|
||||||
SO_REUSEADDR = 0x4
|
SO_REUSEADDR = 0x4
|
||||||
SO_REUSEPORT = 0x200
|
SO_REUSEPORT = 0x200
|
||||||
|
SO_REUSEPORT_LB = 0x10000
|
||||||
SO_SETFIB = 0x1014
|
SO_SETFIB = 0x1014
|
||||||
SO_SNDBUF = 0x1001
|
SO_SNDBUF = 0x1001
|
||||||
SO_SNDLOWAT = 0x1003
|
SO_SNDLOWAT = 0x1003
|
||||||
SO_SNDTIMEO = 0x1005
|
SO_SNDTIMEO = 0x1005
|
||||||
SO_TIMESTAMP = 0x400
|
SO_TIMESTAMP = 0x400
|
||||||
|
SO_TS_BINTIME = 0x1
|
||||||
|
SO_TS_CLOCK = 0x1017
|
||||||
|
SO_TS_CLOCK_MAX = 0x3
|
||||||
|
SO_TS_DEFAULT = 0x0
|
||||||
|
SO_TS_MONOTONIC = 0x3
|
||||||
|
SO_TS_REALTIME = 0x2
|
||||||
|
SO_TS_REALTIME_MICRO = 0x0
|
||||||
SO_TYPE = 0x1008
|
SO_TYPE = 0x1008
|
||||||
SO_USELOOPBACK = 0x40
|
SO_USELOOPBACK = 0x40
|
||||||
SO_USER_COOKIE = 0x1015
|
SO_USER_COOKIE = 0x1015
|
||||||
|
@ -1437,10 +1534,69 @@ const (
|
||||||
TCOFLUSH = 0x2
|
TCOFLUSH = 0x2
|
||||||
TCOOFF = 0x1
|
TCOOFF = 0x1
|
||||||
TCOON = 0x2
|
TCOON = 0x2
|
||||||
|
TCPOPT_EOL = 0x0
|
||||||
|
TCPOPT_FAST_OPEN = 0x22
|
||||||
|
TCPOPT_MAXSEG = 0x2
|
||||||
|
TCPOPT_NOP = 0x1
|
||||||
|
TCPOPT_PAD = 0x0
|
||||||
|
TCPOPT_SACK = 0x5
|
||||||
|
TCPOPT_SACK_PERMITTED = 0x4
|
||||||
|
TCPOPT_SIGNATURE = 0x13
|
||||||
|
TCPOPT_TIMESTAMP = 0x8
|
||||||
|
TCPOPT_WINDOW = 0x3
|
||||||
|
TCP_BBR_ACK_COMP_ALG = 0x448
|
||||||
|
TCP_BBR_ALGORITHM = 0x43b
|
||||||
|
TCP_BBR_DRAIN_INC_EXTRA = 0x43c
|
||||||
|
TCP_BBR_DRAIN_PG = 0x42e
|
||||||
|
TCP_BBR_EXTRA_GAIN = 0x449
|
||||||
|
TCP_BBR_EXTRA_STATE = 0x453
|
||||||
|
TCP_BBR_FLOOR_MIN_TSO = 0x454
|
||||||
|
TCP_BBR_HDWR_PACE = 0x451
|
||||||
|
TCP_BBR_HOLD_TARGET = 0x436
|
||||||
|
TCP_BBR_IWINTSO = 0x42b
|
||||||
|
TCP_BBR_LOWGAIN_FD = 0x436
|
||||||
|
TCP_BBR_LOWGAIN_HALF = 0x435
|
||||||
|
TCP_BBR_LOWGAIN_THRESH = 0x434
|
||||||
|
TCP_BBR_MAX_RTO = 0x439
|
||||||
|
TCP_BBR_MIN_RTO = 0x438
|
||||||
|
TCP_BBR_MIN_TOPACEOUT = 0x455
|
||||||
|
TCP_BBR_ONE_RETRAN = 0x431
|
||||||
|
TCP_BBR_PACE_CROSS = 0x442
|
||||||
|
TCP_BBR_PACE_DEL_TAR = 0x43f
|
||||||
|
TCP_BBR_PACE_OH = 0x435
|
||||||
|
TCP_BBR_PACE_PER_SEC = 0x43e
|
||||||
|
TCP_BBR_PACE_SEG_MAX = 0x440
|
||||||
|
TCP_BBR_PACE_SEG_MIN = 0x441
|
||||||
|
TCP_BBR_POLICER_DETECT = 0x457
|
||||||
|
TCP_BBR_PROBE_RTT_GAIN = 0x44d
|
||||||
|
TCP_BBR_PROBE_RTT_INT = 0x430
|
||||||
|
TCP_BBR_PROBE_RTT_LEN = 0x44e
|
||||||
|
TCP_BBR_RACK_RTT_USE = 0x44a
|
||||||
|
TCP_BBR_RECFORCE = 0x42c
|
||||||
|
TCP_BBR_REC_OVER_HPTS = 0x43a
|
||||||
|
TCP_BBR_RETRAN_WTSO = 0x44b
|
||||||
|
TCP_BBR_RWND_IS_APP = 0x42f
|
||||||
|
TCP_BBR_SEND_IWND_IN_TSO = 0x44f
|
||||||
|
TCP_BBR_STARTUP_EXIT_EPOCH = 0x43d
|
||||||
|
TCP_BBR_STARTUP_LOSS_EXIT = 0x432
|
||||||
|
TCP_BBR_STARTUP_PG = 0x42d
|
||||||
|
TCP_BBR_TMR_PACE_OH = 0x448
|
||||||
|
TCP_BBR_TSLIMITS = 0x434
|
||||||
|
TCP_BBR_TSTMP_RAISES = 0x456
|
||||||
|
TCP_BBR_UNLIMITED = 0x43b
|
||||||
|
TCP_BBR_USEDEL_RATE = 0x437
|
||||||
|
TCP_BBR_USE_LOWGAIN = 0x433
|
||||||
|
TCP_BBR_USE_RACK_CHEAT = 0x450
|
||||||
|
TCP_BBR_UTTER_MAX_TSO = 0x452
|
||||||
TCP_CA_NAME_MAX = 0x10
|
TCP_CA_NAME_MAX = 0x10
|
||||||
TCP_CCALGOOPT = 0x41
|
TCP_CCALGOOPT = 0x41
|
||||||
TCP_CONGESTION = 0x40
|
TCP_CONGESTION = 0x40
|
||||||
|
TCP_DATA_AFTER_CLOSE = 0x44c
|
||||||
|
TCP_DELACK = 0x48
|
||||||
TCP_FASTOPEN = 0x401
|
TCP_FASTOPEN = 0x401
|
||||||
|
TCP_FASTOPEN_MAX_COOKIE_LEN = 0x10
|
||||||
|
TCP_FASTOPEN_MIN_COOKIE_LEN = 0x4
|
||||||
|
TCP_FASTOPEN_PSK_LEN = 0x10
|
||||||
TCP_FUNCTION_BLK = 0x2000
|
TCP_FUNCTION_BLK = 0x2000
|
||||||
TCP_FUNCTION_NAME_LEN_MAX = 0x20
|
TCP_FUNCTION_NAME_LEN_MAX = 0x20
|
||||||
TCP_INFO = 0x20
|
TCP_INFO = 0x20
|
||||||
|
@ -1448,6 +1604,12 @@ const (
|
||||||
TCP_KEEPIDLE = 0x100
|
TCP_KEEPIDLE = 0x100
|
||||||
TCP_KEEPINIT = 0x80
|
TCP_KEEPINIT = 0x80
|
||||||
TCP_KEEPINTVL = 0x200
|
TCP_KEEPINTVL = 0x200
|
||||||
|
TCP_LOG = 0x22
|
||||||
|
TCP_LOGBUF = 0x23
|
||||||
|
TCP_LOGDUMP = 0x25
|
||||||
|
TCP_LOGDUMPID = 0x26
|
||||||
|
TCP_LOGID = 0x24
|
||||||
|
TCP_LOG_ID_LEN = 0x40
|
||||||
TCP_MAXBURST = 0x4
|
TCP_MAXBURST = 0x4
|
||||||
TCP_MAXHLEN = 0x3c
|
TCP_MAXHLEN = 0x3c
|
||||||
TCP_MAXOLEN = 0x28
|
TCP_MAXOLEN = 0x28
|
||||||
|
@ -1463,8 +1625,30 @@ const (
|
||||||
TCP_NOPUSH = 0x4
|
TCP_NOPUSH = 0x4
|
||||||
TCP_PCAP_IN = 0x1000
|
TCP_PCAP_IN = 0x1000
|
||||||
TCP_PCAP_OUT = 0x800
|
TCP_PCAP_OUT = 0x800
|
||||||
|
TCP_RACK_EARLY_RECOV = 0x423
|
||||||
|
TCP_RACK_EARLY_SEG = 0x424
|
||||||
|
TCP_RACK_GP_INCREASE = 0x446
|
||||||
|
TCP_RACK_IDLE_REDUCE_HIGH = 0x444
|
||||||
|
TCP_RACK_MIN_PACE = 0x445
|
||||||
|
TCP_RACK_MIN_PACE_SEG = 0x446
|
||||||
|
TCP_RACK_MIN_TO = 0x422
|
||||||
|
TCP_RACK_PACE_ALWAYS = 0x41f
|
||||||
|
TCP_RACK_PACE_MAX_SEG = 0x41e
|
||||||
|
TCP_RACK_PACE_REDUCE = 0x41d
|
||||||
|
TCP_RACK_PKT_DELAY = 0x428
|
||||||
|
TCP_RACK_PROP = 0x41b
|
||||||
|
TCP_RACK_PROP_RATE = 0x420
|
||||||
|
TCP_RACK_PRR_SENDALOT = 0x421
|
||||||
|
TCP_RACK_REORD_FADE = 0x426
|
||||||
|
TCP_RACK_REORD_THRESH = 0x425
|
||||||
|
TCP_RACK_TLP_INC_VAR = 0x429
|
||||||
|
TCP_RACK_TLP_REDUCE = 0x41c
|
||||||
|
TCP_RACK_TLP_THRESH = 0x427
|
||||||
|
TCP_RACK_TLP_USE = 0x447
|
||||||
TCP_VENDOR = 0x80000000
|
TCP_VENDOR = 0x80000000
|
||||||
TCSAFLUSH = 0x2
|
TCSAFLUSH = 0x2
|
||||||
|
TIMER_ABSTIME = 0x1
|
||||||
|
TIMER_RELTIME = 0x0
|
||||||
TIOCCBRK = 0x2000747a
|
TIOCCBRK = 0x2000747a
|
||||||
TIOCCDTR = 0x20007478
|
TIOCCDTR = 0x20007478
|
||||||
TIOCCONS = 0x80047462
|
TIOCCONS = 0x80047462
|
||||||
|
@ -1528,6 +1712,8 @@ const (
|
||||||
TIOCTIMESTAMP = 0x40107459
|
TIOCTIMESTAMP = 0x40107459
|
||||||
TIOCUCNTL = 0x80047466
|
TIOCUCNTL = 0x80047466
|
||||||
TOSTOP = 0x400000
|
TOSTOP = 0x400000
|
||||||
|
UTIME_NOW = -0x1
|
||||||
|
UTIME_OMIT = -0x2
|
||||||
VDISCARD = 0xf
|
VDISCARD = 0xf
|
||||||
VDSUSP = 0xb
|
VDSUSP = 0xb
|
||||||
VEOF = 0x0
|
VEOF = 0x0
|
||||||
|
@ -1592,12 +1778,13 @@ const (
|
||||||
EIDRM = syscall.Errno(0x52)
|
EIDRM = syscall.Errno(0x52)
|
||||||
EILSEQ = syscall.Errno(0x56)
|
EILSEQ = syscall.Errno(0x56)
|
||||||
EINPROGRESS = syscall.Errno(0x24)
|
EINPROGRESS = syscall.Errno(0x24)
|
||||||
|
EINTEGRITY = syscall.Errno(0x61)
|
||||||
EINTR = syscall.Errno(0x4)
|
EINTR = syscall.Errno(0x4)
|
||||||
EINVAL = syscall.Errno(0x16)
|
EINVAL = syscall.Errno(0x16)
|
||||||
EIO = syscall.Errno(0x5)
|
EIO = syscall.Errno(0x5)
|
||||||
EISCONN = syscall.Errno(0x38)
|
EISCONN = syscall.Errno(0x38)
|
||||||
EISDIR = syscall.Errno(0x15)
|
EISDIR = syscall.Errno(0x15)
|
||||||
ELAST = syscall.Errno(0x60)
|
ELAST = syscall.Errno(0x61)
|
||||||
ELOOP = syscall.Errno(0x3e)
|
ELOOP = syscall.Errno(0x3e)
|
||||||
EMFILE = syscall.Errno(0x18)
|
EMFILE = syscall.Errno(0x18)
|
||||||
EMLINK = syscall.Errno(0x1f)
|
EMLINK = syscall.Errno(0x1f)
|
||||||
|
@ -1740,7 +1927,7 @@ var errorList = [...]struct {
|
||||||
{32, "EPIPE", "broken pipe"},
|
{32, "EPIPE", "broken pipe"},
|
||||||
{33, "EDOM", "numerical argument out of domain"},
|
{33, "EDOM", "numerical argument out of domain"},
|
||||||
{34, "ERANGE", "result too large"},
|
{34, "ERANGE", "result too large"},
|
||||||
{35, "EAGAIN", "resource temporarily unavailable"},
|
{35, "EWOULDBLOCK", "resource temporarily unavailable"},
|
||||||
{36, "EINPROGRESS", "operation now in progress"},
|
{36, "EINPROGRESS", "operation now in progress"},
|
||||||
{37, "EALREADY", "operation already in progress"},
|
{37, "EALREADY", "operation already in progress"},
|
||||||
{38, "ENOTSOCK", "socket operation on non-socket"},
|
{38, "ENOTSOCK", "socket operation on non-socket"},
|
||||||
|
@ -1802,6 +1989,7 @@ var errorList = [...]struct {
|
||||||
{94, "ECAPMODE", "not permitted in capability mode"},
|
{94, "ECAPMODE", "not permitted in capability mode"},
|
||||||
{95, "ENOTRECOVERABLE", "state not recoverable"},
|
{95, "ENOTRECOVERABLE", "state not recoverable"},
|
||||||
{96, "EOWNERDEAD", "previous owner died"},
|
{96, "EOWNERDEAD", "previous owner died"},
|
||||||
|
{97, "EINTEGRITY", "integrity check failed"},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Signal table
|
// Signal table
|
||||||
|
|
|
@ -151,6 +151,7 @@ const (
|
||||||
BIOCSETF = 0x80104267
|
BIOCSETF = 0x80104267
|
||||||
BIOCSETFNR = 0x80104282
|
BIOCSETFNR = 0x80104282
|
||||||
BIOCSETIF = 0x8020426c
|
BIOCSETIF = 0x8020426c
|
||||||
|
BIOCSETVLANPCP = 0x80044285
|
||||||
BIOCSETWF = 0x8010427b
|
BIOCSETWF = 0x8010427b
|
||||||
BIOCSETZBUF = 0x80184281
|
BIOCSETZBUF = 0x80184281
|
||||||
BIOCSHDRCMPLT = 0x80044275
|
BIOCSHDRCMPLT = 0x80044275
|
||||||
|
@ -447,7 +448,7 @@ const (
|
||||||
DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1
|
DLT_IEEE802_16_MAC_CPS_RADIO = 0xc1
|
||||||
DLT_INFINIBAND = 0xf7
|
DLT_INFINIBAND = 0xf7
|
||||||
DLT_IPFILTER = 0x74
|
DLT_IPFILTER = 0x74
|
||||||
DLT_IPMB = 0xc7
|
DLT_IPMB_KONTRON = 0xc7
|
||||||
DLT_IPMB_LINUX = 0xd1
|
DLT_IPMB_LINUX = 0xd1
|
||||||
DLT_IPMI_HPM_2 = 0x104
|
DLT_IPMI_HPM_2 = 0x104
|
||||||
DLT_IPNET = 0xe2
|
DLT_IPNET = 0xe2
|
||||||
|
@ -487,10 +488,11 @@ const (
|
||||||
DLT_LINUX_LAPD = 0xb1
|
DLT_LINUX_LAPD = 0xb1
|
||||||
DLT_LINUX_PPP_WITHDIRECTION = 0xa6
|
DLT_LINUX_PPP_WITHDIRECTION = 0xa6
|
||||||
DLT_LINUX_SLL = 0x71
|
DLT_LINUX_SLL = 0x71
|
||||||
|
DLT_LINUX_SLL2 = 0x114
|
||||||
DLT_LOOP = 0x6c
|
DLT_LOOP = 0x6c
|
||||||
DLT_LORATAP = 0x10e
|
DLT_LORATAP = 0x10e
|
||||||
DLT_LTALK = 0x72
|
DLT_LTALK = 0x72
|
||||||
DLT_MATCHING_MAX = 0x113
|
DLT_MATCHING_MAX = 0x114
|
||||||
DLT_MATCHING_MIN = 0x68
|
DLT_MATCHING_MIN = 0x68
|
||||||
DLT_MFR = 0xb6
|
DLT_MFR = 0xb6
|
||||||
DLT_MOST = 0xd3
|
DLT_MOST = 0xd3
|
||||||
|
@ -734,6 +736,7 @@ const (
|
||||||
IPPROTO_CMTP = 0x26
|
IPPROTO_CMTP = 0x26
|
||||||
IPPROTO_CPHB = 0x49
|
IPPROTO_CPHB = 0x49
|
||||||
IPPROTO_CPNX = 0x48
|
IPPROTO_CPNX = 0x48
|
||||||
|
IPPROTO_DCCP = 0x21
|
||||||
IPPROTO_DDP = 0x25
|
IPPROTO_DDP = 0x25
|
||||||
IPPROTO_DGP = 0x56
|
IPPROTO_DGP = 0x56
|
||||||
IPPROTO_DIVERT = 0x102
|
IPPROTO_DIVERT = 0x102
|
||||||
|
@ -814,7 +817,6 @@ const (
|
||||||
IPPROTO_SCTP = 0x84
|
IPPROTO_SCTP = 0x84
|
||||||
IPPROTO_SDRP = 0x2a
|
IPPROTO_SDRP = 0x2a
|
||||||
IPPROTO_SEND = 0x103
|
IPPROTO_SEND = 0x103
|
||||||
IPPROTO_SEP = 0x21
|
|
||||||
IPPROTO_SHIM6 = 0x8c
|
IPPROTO_SHIM6 = 0x8c
|
||||||
IPPROTO_SKIP = 0x39
|
IPPROTO_SKIP = 0x39
|
||||||
IPPROTO_SPACER = 0x7fff
|
IPPROTO_SPACER = 0x7fff
|
||||||
|
@ -911,6 +913,7 @@ const (
|
||||||
IPV6_V6ONLY = 0x1b
|
IPV6_V6ONLY = 0x1b
|
||||||
IPV6_VERSION = 0x60
|
IPV6_VERSION = 0x60
|
||||||
IPV6_VERSION_MASK = 0xf0
|
IPV6_VERSION_MASK = 0xf0
|
||||||
|
IPV6_VLAN_PCP = 0x4b
|
||||||
IP_ADD_MEMBERSHIP = 0xc
|
IP_ADD_MEMBERSHIP = 0xc
|
||||||
IP_ADD_SOURCE_MEMBERSHIP = 0x46
|
IP_ADD_SOURCE_MEMBERSHIP = 0x46
|
||||||
IP_BINDANY = 0x18
|
IP_BINDANY = 0x18
|
||||||
|
@ -989,8 +992,12 @@ const (
|
||||||
IP_TOS = 0x3
|
IP_TOS = 0x3
|
||||||
IP_TTL = 0x4
|
IP_TTL = 0x4
|
||||||
IP_UNBLOCK_SOURCE = 0x49
|
IP_UNBLOCK_SOURCE = 0x49
|
||||||
|
IP_VLAN_PCP = 0x4b
|
||||||
ISIG = 0x80
|
ISIG = 0x80
|
||||||
ISTRIP = 0x20
|
ISTRIP = 0x20
|
||||||
|
ITIMER_PROF = 0x2
|
||||||
|
ITIMER_REAL = 0x0
|
||||||
|
ITIMER_VIRTUAL = 0x1
|
||||||
IXANY = 0x800
|
IXANY = 0x800
|
||||||
IXOFF = 0x400
|
IXOFF = 0x400
|
||||||
IXON = 0x200
|
IXON = 0x200
|
||||||
|
@ -1000,7 +1007,6 @@ const (
|
||||||
KERN_VERSION = 0x4
|
KERN_VERSION = 0x4
|
||||||
LOCAL_CONNWAIT = 0x4
|
LOCAL_CONNWAIT = 0x4
|
||||||
LOCAL_CREDS = 0x2
|
LOCAL_CREDS = 0x2
|
||||||
LOCAL_CREDS_PERSISTENT = 0x3
|
|
||||||
LOCAL_PEERCRED = 0x1
|
LOCAL_PEERCRED = 0x1
|
||||||
LOCAL_VENDOR = 0x80000000
|
LOCAL_VENDOR = 0x80000000
|
||||||
LOCK_EX = 0x2
|
LOCK_EX = 0x2
|
||||||
|
@ -1180,6 +1186,8 @@ const (
|
||||||
O_NONBLOCK = 0x4
|
O_NONBLOCK = 0x4
|
||||||
O_RDONLY = 0x0
|
O_RDONLY = 0x0
|
||||||
O_RDWR = 0x2
|
O_RDWR = 0x2
|
||||||
|
O_RESOLVE_BENEATH = 0x800000
|
||||||
|
O_SEARCH = 0x40000
|
||||||
O_SHLOCK = 0x10
|
O_SHLOCK = 0x10
|
||||||
O_SYNC = 0x80
|
O_SYNC = 0x80
|
||||||
O_TRUNC = 0x400
|
O_TRUNC = 0x400
|
||||||
|
@ -1190,6 +1198,10 @@ const (
|
||||||
PARMRK = 0x8
|
PARMRK = 0x8
|
||||||
PARODD = 0x2000
|
PARODD = 0x2000
|
||||||
PENDIN = 0x20000000
|
PENDIN = 0x20000000
|
||||||
|
PIOD_READ_D = 0x1
|
||||||
|
PIOD_READ_I = 0x3
|
||||||
|
PIOD_WRITE_D = 0x2
|
||||||
|
PIOD_WRITE_I = 0x4
|
||||||
PRIO_PGRP = 0x1
|
PRIO_PGRP = 0x1
|
||||||
PRIO_PROCESS = 0x0
|
PRIO_PROCESS = 0x0
|
||||||
PRIO_USER = 0x2
|
PRIO_USER = 0x2
|
||||||
|
@ -1197,6 +1209,51 @@ const (
|
||||||
PROT_NONE = 0x0
|
PROT_NONE = 0x0
|
||||||
PROT_READ = 0x1
|
PROT_READ = 0x1
|
||||||
PROT_WRITE = 0x2
|
PROT_WRITE = 0x2
|
||||||
|
PTRACE_DEFAULT = 0x1
|
||||||
|
PTRACE_EXEC = 0x1
|
||||||
|
PTRACE_FORK = 0x8
|
||||||
|
PTRACE_LWP = 0x10
|
||||||
|
PTRACE_SCE = 0x2
|
||||||
|
PTRACE_SCX = 0x4
|
||||||
|
PTRACE_SYSCALL = 0x6
|
||||||
|
PTRACE_VFORK = 0x20
|
||||||
|
PT_ATTACH = 0xa
|
||||||
|
PT_CLEARSTEP = 0x10
|
||||||
|
PT_CONTINUE = 0x7
|
||||||
|
PT_DETACH = 0xb
|
||||||
|
PT_FIRSTMACH = 0x40
|
||||||
|
PT_FOLLOW_FORK = 0x17
|
||||||
|
PT_GETDBREGS = 0x25
|
||||||
|
PT_GETFPREGS = 0x23
|
||||||
|
PT_GETLWPLIST = 0xf
|
||||||
|
PT_GETNUMLWPS = 0xe
|
||||||
|
PT_GETREGS = 0x21
|
||||||
|
PT_GET_EVENT_MASK = 0x19
|
||||||
|
PT_GET_SC_ARGS = 0x1b
|
||||||
|
PT_GET_SC_RET = 0x1c
|
||||||
|
PT_IO = 0xc
|
||||||
|
PT_KILL = 0x8
|
||||||
|
PT_LWPINFO = 0xd
|
||||||
|
PT_LWP_EVENTS = 0x18
|
||||||
|
PT_READ_D = 0x2
|
||||||
|
PT_READ_I = 0x1
|
||||||
|
PT_RESUME = 0x13
|
||||||
|
PT_SETDBREGS = 0x26
|
||||||
|
PT_SETFPREGS = 0x24
|
||||||
|
PT_SETREGS = 0x22
|
||||||
|
PT_SETSTEP = 0x11
|
||||||
|
PT_SET_EVENT_MASK = 0x1a
|
||||||
|
PT_STEP = 0x9
|
||||||
|
PT_SUSPEND = 0x12
|
||||||
|
PT_SYSCALL = 0x16
|
||||||
|
PT_TO_SCE = 0x14
|
||||||
|
PT_TO_SCX = 0x15
|
||||||
|
PT_TRACE_ME = 0x0
|
||||||
|
PT_VM_ENTRY = 0x29
|
||||||
|
PT_VM_TIMESTAMP = 0x28
|
||||||
|
PT_WRITE_D = 0x5
|
||||||
|
PT_WRITE_I = 0x4
|
||||||
|
P_ZONEID = 0xc
|
||||||
RLIMIT_AS = 0xa
|
RLIMIT_AS = 0xa
|
||||||
RLIMIT_CORE = 0x4
|
RLIMIT_CORE = 0x4
|
||||||
RLIMIT_CPU = 0x0
|
RLIMIT_CPU = 0x0
|
||||||
|
@ -1321,10 +1378,12 @@ const (
|
||||||
SIOCGHWADDR = 0xc020693e
|
SIOCGHWADDR = 0xc020693e
|
||||||
SIOCGI2C = 0xc020693d
|
SIOCGI2C = 0xc020693d
|
||||||
SIOCGIFADDR = 0xc0206921
|
SIOCGIFADDR = 0xc0206921
|
||||||
|
SIOCGIFALIAS = 0xc044692d
|
||||||
SIOCGIFBRDADDR = 0xc0206923
|
SIOCGIFBRDADDR = 0xc0206923
|
||||||
SIOCGIFCAP = 0xc020691f
|
SIOCGIFCAP = 0xc020691f
|
||||||
SIOCGIFCONF = 0xc0106924
|
SIOCGIFCONF = 0xc0106924
|
||||||
SIOCGIFDESCR = 0xc020692a
|
SIOCGIFDESCR = 0xc020692a
|
||||||
|
SIOCGIFDOWNREASON = 0xc058699a
|
||||||
SIOCGIFDSTADDR = 0xc0206922
|
SIOCGIFDSTADDR = 0xc0206922
|
||||||
SIOCGIFFIB = 0xc020695c
|
SIOCGIFFIB = 0xc020695c
|
||||||
SIOCGIFFLAGS = 0xc0206911
|
SIOCGIFFLAGS = 0xc0206911
|
||||||
|
@ -1415,6 +1474,7 @@ const (
|
||||||
SO_RCVBUF = 0x1002
|
SO_RCVBUF = 0x1002
|
||||||
SO_RCVLOWAT = 0x1004
|
SO_RCVLOWAT = 0x1004
|
||||||
SO_RCVTIMEO = 0x1006
|
SO_RCVTIMEO = 0x1006
|
||||||
|
SO_RERROR = 0x20000
|
||||||
SO_REUSEADDR = 0x4
|
SO_REUSEADDR = 0x4
|
||||||
SO_REUSEPORT = 0x200
|
SO_REUSEPORT = 0x200
|
||||||
SO_REUSEPORT_LB = 0x10000
|
SO_REUSEPORT_LB = 0x10000
|
||||||
|
@ -1473,22 +1533,40 @@ const (
|
||||||
TCOFLUSH = 0x2
|
TCOFLUSH = 0x2
|
||||||
TCOOFF = 0x1
|
TCOOFF = 0x1
|
||||||
TCOON = 0x2
|
TCOON = 0x2
|
||||||
|
TCPOPT_EOL = 0x0
|
||||||
|
TCPOPT_FAST_OPEN = 0x22
|
||||||
|
TCPOPT_MAXSEG = 0x2
|
||||||
|
TCPOPT_NOP = 0x1
|
||||||
|
TCPOPT_PAD = 0x0
|
||||||
|
TCPOPT_SACK = 0x5
|
||||||
|
TCPOPT_SACK_PERMITTED = 0x4
|
||||||
|
TCPOPT_SIGNATURE = 0x13
|
||||||
|
TCPOPT_TIMESTAMP = 0x8
|
||||||
|
TCPOPT_WINDOW = 0x3
|
||||||
TCP_BBR_ACK_COMP_ALG = 0x448
|
TCP_BBR_ACK_COMP_ALG = 0x448
|
||||||
|
TCP_BBR_ALGORITHM = 0x43b
|
||||||
TCP_BBR_DRAIN_INC_EXTRA = 0x43c
|
TCP_BBR_DRAIN_INC_EXTRA = 0x43c
|
||||||
TCP_BBR_DRAIN_PG = 0x42e
|
TCP_BBR_DRAIN_PG = 0x42e
|
||||||
TCP_BBR_EXTRA_GAIN = 0x449
|
TCP_BBR_EXTRA_GAIN = 0x449
|
||||||
|
TCP_BBR_EXTRA_STATE = 0x453
|
||||||
|
TCP_BBR_FLOOR_MIN_TSO = 0x454
|
||||||
|
TCP_BBR_HDWR_PACE = 0x451
|
||||||
|
TCP_BBR_HOLD_TARGET = 0x436
|
||||||
TCP_BBR_IWINTSO = 0x42b
|
TCP_BBR_IWINTSO = 0x42b
|
||||||
TCP_BBR_LOWGAIN_FD = 0x436
|
TCP_BBR_LOWGAIN_FD = 0x436
|
||||||
TCP_BBR_LOWGAIN_HALF = 0x435
|
TCP_BBR_LOWGAIN_HALF = 0x435
|
||||||
TCP_BBR_LOWGAIN_THRESH = 0x434
|
TCP_BBR_LOWGAIN_THRESH = 0x434
|
||||||
TCP_BBR_MAX_RTO = 0x439
|
TCP_BBR_MAX_RTO = 0x439
|
||||||
TCP_BBR_MIN_RTO = 0x438
|
TCP_BBR_MIN_RTO = 0x438
|
||||||
|
TCP_BBR_MIN_TOPACEOUT = 0x455
|
||||||
TCP_BBR_ONE_RETRAN = 0x431
|
TCP_BBR_ONE_RETRAN = 0x431
|
||||||
TCP_BBR_PACE_CROSS = 0x442
|
TCP_BBR_PACE_CROSS = 0x442
|
||||||
TCP_BBR_PACE_DEL_TAR = 0x43f
|
TCP_BBR_PACE_DEL_TAR = 0x43f
|
||||||
|
TCP_BBR_PACE_OH = 0x435
|
||||||
TCP_BBR_PACE_PER_SEC = 0x43e
|
TCP_BBR_PACE_PER_SEC = 0x43e
|
||||||
TCP_BBR_PACE_SEG_MAX = 0x440
|
TCP_BBR_PACE_SEG_MAX = 0x440
|
||||||
TCP_BBR_PACE_SEG_MIN = 0x441
|
TCP_BBR_PACE_SEG_MIN = 0x441
|
||||||
|
TCP_BBR_POLICER_DETECT = 0x457
|
||||||
TCP_BBR_PROBE_RTT_GAIN = 0x44d
|
TCP_BBR_PROBE_RTT_GAIN = 0x44d
|
||||||
TCP_BBR_PROBE_RTT_INT = 0x430
|
TCP_BBR_PROBE_RTT_INT = 0x430
|
||||||
TCP_BBR_PROBE_RTT_LEN = 0x44e
|
TCP_BBR_PROBE_RTT_LEN = 0x44e
|
||||||
|
@ -1497,12 +1575,18 @@ const (
|
||||||
TCP_BBR_REC_OVER_HPTS = 0x43a
|
TCP_BBR_REC_OVER_HPTS = 0x43a
|
||||||
TCP_BBR_RETRAN_WTSO = 0x44b
|
TCP_BBR_RETRAN_WTSO = 0x44b
|
||||||
TCP_BBR_RWND_IS_APP = 0x42f
|
TCP_BBR_RWND_IS_APP = 0x42f
|
||||||
|
TCP_BBR_SEND_IWND_IN_TSO = 0x44f
|
||||||
TCP_BBR_STARTUP_EXIT_EPOCH = 0x43d
|
TCP_BBR_STARTUP_EXIT_EPOCH = 0x43d
|
||||||
TCP_BBR_STARTUP_LOSS_EXIT = 0x432
|
TCP_BBR_STARTUP_LOSS_EXIT = 0x432
|
||||||
TCP_BBR_STARTUP_PG = 0x42d
|
TCP_BBR_STARTUP_PG = 0x42d
|
||||||
|
TCP_BBR_TMR_PACE_OH = 0x448
|
||||||
|
TCP_BBR_TSLIMITS = 0x434
|
||||||
|
TCP_BBR_TSTMP_RAISES = 0x456
|
||||||
TCP_BBR_UNLIMITED = 0x43b
|
TCP_BBR_UNLIMITED = 0x43b
|
||||||
TCP_BBR_USEDEL_RATE = 0x437
|
TCP_BBR_USEDEL_RATE = 0x437
|
||||||
TCP_BBR_USE_LOWGAIN = 0x433
|
TCP_BBR_USE_LOWGAIN = 0x433
|
||||||
|
TCP_BBR_USE_RACK_CHEAT = 0x450
|
||||||
|
TCP_BBR_UTTER_MAX_TSO = 0x452
|
||||||
TCP_CA_NAME_MAX = 0x10
|
TCP_CA_NAME_MAX = 0x10
|
||||||
TCP_CCALGOOPT = 0x41
|
TCP_CCALGOOPT = 0x41
|
||||||
TCP_CONGESTION = 0x40
|
TCP_CONGESTION = 0x40
|
||||||
|
@ -1542,6 +1626,7 @@ const (
|
||||||
TCP_PCAP_OUT = 0x800
|
TCP_PCAP_OUT = 0x800
|
||||||
TCP_RACK_EARLY_RECOV = 0x423
|
TCP_RACK_EARLY_RECOV = 0x423
|
||||||
TCP_RACK_EARLY_SEG = 0x424
|
TCP_RACK_EARLY_SEG = 0x424
|
||||||
|
TCP_RACK_GP_INCREASE = 0x446
|
||||||
TCP_RACK_IDLE_REDUCE_HIGH = 0x444
|
TCP_RACK_IDLE_REDUCE_HIGH = 0x444
|
||||||
TCP_RACK_MIN_PACE = 0x445
|
TCP_RACK_MIN_PACE = 0x445
|
||||||
TCP_RACK_MIN_PACE_SEG = 0x446
|
TCP_RACK_MIN_PACE_SEG = 0x446
|
||||||
|
@ -1555,7 +1640,6 @@ const (
|
||||||
TCP_RACK_PRR_SENDALOT = 0x421
|
TCP_RACK_PRR_SENDALOT = 0x421
|
||||||
TCP_RACK_REORD_FADE = 0x426
|
TCP_RACK_REORD_FADE = 0x426
|
||||||
TCP_RACK_REORD_THRESH = 0x425
|
TCP_RACK_REORD_THRESH = 0x425
|
||||||
TCP_RACK_SESS_CWV = 0x42a
|
|
||||||
TCP_RACK_TLP_INC_VAR = 0x429
|
TCP_RACK_TLP_INC_VAR = 0x429
|
||||||
TCP_RACK_TLP_REDUCE = 0x41c
|
TCP_RACK_TLP_REDUCE = 0x41c
|
||||||
TCP_RACK_TLP_THRESH = 0x427
|
TCP_RACK_TLP_THRESH = 0x427
|
||||||
|
@ -1694,12 +1778,13 @@ const (
|
||||||
EIDRM = syscall.Errno(0x52)
|
EIDRM = syscall.Errno(0x52)
|
||||||
EILSEQ = syscall.Errno(0x56)
|
EILSEQ = syscall.Errno(0x56)
|
||||||
EINPROGRESS = syscall.Errno(0x24)
|
EINPROGRESS = syscall.Errno(0x24)
|
||||||
|
EINTEGRITY = syscall.Errno(0x61)
|
||||||
EINTR = syscall.Errno(0x4)
|
EINTR = syscall.Errno(0x4)
|
||||||
EINVAL = syscall.Errno(0x16)
|
EINVAL = syscall.Errno(0x16)
|
||||||
EIO = syscall.Errno(0x5)
|
EIO = syscall.Errno(0x5)
|
||||||
EISCONN = syscall.Errno(0x38)
|
EISCONN = syscall.Errno(0x38)
|
||||||
EISDIR = syscall.Errno(0x15)
|
EISDIR = syscall.Errno(0x15)
|
||||||
ELAST = syscall.Errno(0x60)
|
ELAST = syscall.Errno(0x61)
|
||||||
ELOOP = syscall.Errno(0x3e)
|
ELOOP = syscall.Errno(0x3e)
|
||||||
EMFILE = syscall.Errno(0x18)
|
EMFILE = syscall.Errno(0x18)
|
||||||
EMLINK = syscall.Errno(0x1f)
|
EMLINK = syscall.Errno(0x1f)
|
||||||
|
@ -1842,7 +1927,7 @@ var errorList = [...]struct {
|
||||||
{32, "EPIPE", "broken pipe"},
|
{32, "EPIPE", "broken pipe"},
|
||||||
{33, "EDOM", "numerical argument out of domain"},
|
{33, "EDOM", "numerical argument out of domain"},
|
||||||
{34, "ERANGE", "result too large"},
|
{34, "ERANGE", "result too large"},
|
||||||
{35, "EAGAIN", "resource temporarily unavailable"},
|
{35, "EWOULDBLOCK", "resource temporarily unavailable"},
|
||||||
{36, "EINPROGRESS", "operation now in progress"},
|
{36, "EINPROGRESS", "operation now in progress"},
|
||||||
{37, "EALREADY", "operation already in progress"},
|
{37, "EALREADY", "operation already in progress"},
|
||||||
{38, "ENOTSOCK", "socket operation on non-socket"},
|
{38, "ENOTSOCK", "socket operation on non-socket"},
|
||||||
|
@ -1904,6 +1989,7 @@ var errorList = [...]struct {
|
||||||
{94, "ECAPMODE", "not permitted in capability mode"},
|
{94, "ECAPMODE", "not permitted in capability mode"},
|
||||||
{95, "ENOTRECOVERABLE", "state not recoverable"},
|
{95, "ENOTRECOVERABLE", "state not recoverable"},
|
||||||
{96, "EOWNERDEAD", "previous owner died"},
|
{96, "EOWNERDEAD", "previous owner died"},
|
||||||
|
{97, "EINTEGRITY", "integrity check failed"},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Signal table
|
// Signal table
|
||||||
|
|
|
@ -140,6 +140,306 @@ const (
|
||||||
ARPHRD_VOID = 0xffff
|
ARPHRD_VOID = 0xffff
|
||||||
ARPHRD_VSOCKMON = 0x33a
|
ARPHRD_VSOCKMON = 0x33a
|
||||||
ARPHRD_X25 = 0x10f
|
ARPHRD_X25 = 0x10f
|
||||||
|
AUDIT_ADD = 0x3eb
|
||||||
|
AUDIT_ADD_RULE = 0x3f3
|
||||||
|
AUDIT_ALWAYS = 0x2
|
||||||
|
AUDIT_ANOM_ABEND = 0x6a5
|
||||||
|
AUDIT_ANOM_CREAT = 0x6a7
|
||||||
|
AUDIT_ANOM_LINK = 0x6a6
|
||||||
|
AUDIT_ANOM_PROMISCUOUS = 0x6a4
|
||||||
|
AUDIT_ARCH = 0xb
|
||||||
|
AUDIT_ARCH_AARCH64 = 0xc00000b7
|
||||||
|
AUDIT_ARCH_ALPHA = 0xc0009026
|
||||||
|
AUDIT_ARCH_ARCOMPACT = 0x4000005d
|
||||||
|
AUDIT_ARCH_ARCOMPACTBE = 0x5d
|
||||||
|
AUDIT_ARCH_ARCV2 = 0x400000c3
|
||||||
|
AUDIT_ARCH_ARCV2BE = 0xc3
|
||||||
|
AUDIT_ARCH_ARM = 0x40000028
|
||||||
|
AUDIT_ARCH_ARMEB = 0x28
|
||||||
|
AUDIT_ARCH_C6X = 0x4000008c
|
||||||
|
AUDIT_ARCH_C6XBE = 0x8c
|
||||||
|
AUDIT_ARCH_CRIS = 0x4000004c
|
||||||
|
AUDIT_ARCH_CSKY = 0x400000fc
|
||||||
|
AUDIT_ARCH_FRV = 0x5441
|
||||||
|
AUDIT_ARCH_H8300 = 0x2e
|
||||||
|
AUDIT_ARCH_HEXAGON = 0xa4
|
||||||
|
AUDIT_ARCH_I386 = 0x40000003
|
||||||
|
AUDIT_ARCH_IA64 = 0xc0000032
|
||||||
|
AUDIT_ARCH_LOONGARCH32 = 0x40000102
|
||||||
|
AUDIT_ARCH_LOONGARCH64 = 0xc0000102
|
||||||
|
AUDIT_ARCH_M32R = 0x58
|
||||||
|
AUDIT_ARCH_M68K = 0x4
|
||||||
|
AUDIT_ARCH_MICROBLAZE = 0xbd
|
||||||
|
AUDIT_ARCH_MIPS = 0x8
|
||||||
|
AUDIT_ARCH_MIPS64 = 0x80000008
|
||||||
|
AUDIT_ARCH_MIPS64N32 = 0xa0000008
|
||||||
|
AUDIT_ARCH_MIPSEL = 0x40000008
|
||||||
|
AUDIT_ARCH_MIPSEL64 = 0xc0000008
|
||||||
|
AUDIT_ARCH_MIPSEL64N32 = 0xe0000008
|
||||||
|
AUDIT_ARCH_NDS32 = 0x400000a7
|
||||||
|
AUDIT_ARCH_NDS32BE = 0xa7
|
||||||
|
AUDIT_ARCH_NIOS2 = 0x40000071
|
||||||
|
AUDIT_ARCH_OPENRISC = 0x5c
|
||||||
|
AUDIT_ARCH_PARISC = 0xf
|
||||||
|
AUDIT_ARCH_PARISC64 = 0x8000000f
|
||||||
|
AUDIT_ARCH_PPC = 0x14
|
||||||
|
AUDIT_ARCH_PPC64 = 0x80000015
|
||||||
|
AUDIT_ARCH_PPC64LE = 0xc0000015
|
||||||
|
AUDIT_ARCH_RISCV32 = 0x400000f3
|
||||||
|
AUDIT_ARCH_RISCV64 = 0xc00000f3
|
||||||
|
AUDIT_ARCH_S390 = 0x16
|
||||||
|
AUDIT_ARCH_S390X = 0x80000016
|
||||||
|
AUDIT_ARCH_SH = 0x2a
|
||||||
|
AUDIT_ARCH_SH64 = 0x8000002a
|
||||||
|
AUDIT_ARCH_SHEL = 0x4000002a
|
||||||
|
AUDIT_ARCH_SHEL64 = 0xc000002a
|
||||||
|
AUDIT_ARCH_SPARC = 0x2
|
||||||
|
AUDIT_ARCH_SPARC64 = 0x8000002b
|
||||||
|
AUDIT_ARCH_TILEGX = 0xc00000bf
|
||||||
|
AUDIT_ARCH_TILEGX32 = 0x400000bf
|
||||||
|
AUDIT_ARCH_TILEPRO = 0x400000bc
|
||||||
|
AUDIT_ARCH_UNICORE = 0x4000006e
|
||||||
|
AUDIT_ARCH_X86_64 = 0xc000003e
|
||||||
|
AUDIT_ARCH_XTENSA = 0x5e
|
||||||
|
AUDIT_ARG0 = 0xc8
|
||||||
|
AUDIT_ARG1 = 0xc9
|
||||||
|
AUDIT_ARG2 = 0xca
|
||||||
|
AUDIT_ARG3 = 0xcb
|
||||||
|
AUDIT_AVC = 0x578
|
||||||
|
AUDIT_AVC_PATH = 0x57a
|
||||||
|
AUDIT_BITMASK_SIZE = 0x40
|
||||||
|
AUDIT_BIT_MASK = 0x8000000
|
||||||
|
AUDIT_BIT_TEST = 0x48000000
|
||||||
|
AUDIT_BPF = 0x536
|
||||||
|
AUDIT_BPRM_FCAPS = 0x529
|
||||||
|
AUDIT_CAPSET = 0x52a
|
||||||
|
AUDIT_CLASS_CHATTR = 0x2
|
||||||
|
AUDIT_CLASS_CHATTR_32 = 0x3
|
||||||
|
AUDIT_CLASS_DIR_WRITE = 0x0
|
||||||
|
AUDIT_CLASS_DIR_WRITE_32 = 0x1
|
||||||
|
AUDIT_CLASS_READ = 0x4
|
||||||
|
AUDIT_CLASS_READ_32 = 0x5
|
||||||
|
AUDIT_CLASS_SIGNAL = 0x8
|
||||||
|
AUDIT_CLASS_SIGNAL_32 = 0x9
|
||||||
|
AUDIT_CLASS_WRITE = 0x6
|
||||||
|
AUDIT_CLASS_WRITE_32 = 0x7
|
||||||
|
AUDIT_COMPARE_AUID_TO_EUID = 0x10
|
||||||
|
AUDIT_COMPARE_AUID_TO_FSUID = 0xe
|
||||||
|
AUDIT_COMPARE_AUID_TO_OBJ_UID = 0x5
|
||||||
|
AUDIT_COMPARE_AUID_TO_SUID = 0xf
|
||||||
|
AUDIT_COMPARE_EGID_TO_FSGID = 0x17
|
||||||
|
AUDIT_COMPARE_EGID_TO_OBJ_GID = 0x4
|
||||||
|
AUDIT_COMPARE_EGID_TO_SGID = 0x18
|
||||||
|
AUDIT_COMPARE_EUID_TO_FSUID = 0x12
|
||||||
|
AUDIT_COMPARE_EUID_TO_OBJ_UID = 0x3
|
||||||
|
AUDIT_COMPARE_EUID_TO_SUID = 0x11
|
||||||
|
AUDIT_COMPARE_FSGID_TO_OBJ_GID = 0x9
|
||||||
|
AUDIT_COMPARE_FSUID_TO_OBJ_UID = 0x8
|
||||||
|
AUDIT_COMPARE_GID_TO_EGID = 0x14
|
||||||
|
AUDIT_COMPARE_GID_TO_FSGID = 0x15
|
||||||
|
AUDIT_COMPARE_GID_TO_OBJ_GID = 0x2
|
||||||
|
AUDIT_COMPARE_GID_TO_SGID = 0x16
|
||||||
|
AUDIT_COMPARE_SGID_TO_FSGID = 0x19
|
||||||
|
AUDIT_COMPARE_SGID_TO_OBJ_GID = 0x7
|
||||||
|
AUDIT_COMPARE_SUID_TO_FSUID = 0x13
|
||||||
|
AUDIT_COMPARE_SUID_TO_OBJ_UID = 0x6
|
||||||
|
AUDIT_COMPARE_UID_TO_AUID = 0xa
|
||||||
|
AUDIT_COMPARE_UID_TO_EUID = 0xb
|
||||||
|
AUDIT_COMPARE_UID_TO_FSUID = 0xc
|
||||||
|
AUDIT_COMPARE_UID_TO_OBJ_UID = 0x1
|
||||||
|
AUDIT_COMPARE_UID_TO_SUID = 0xd
|
||||||
|
AUDIT_CONFIG_CHANGE = 0x519
|
||||||
|
AUDIT_CWD = 0x51b
|
||||||
|
AUDIT_DAEMON_ABORT = 0x4b2
|
||||||
|
AUDIT_DAEMON_CONFIG = 0x4b3
|
||||||
|
AUDIT_DAEMON_END = 0x4b1
|
||||||
|
AUDIT_DAEMON_START = 0x4b0
|
||||||
|
AUDIT_DEL = 0x3ec
|
||||||
|
AUDIT_DEL_RULE = 0x3f4
|
||||||
|
AUDIT_DEVMAJOR = 0x64
|
||||||
|
AUDIT_DEVMINOR = 0x65
|
||||||
|
AUDIT_DIR = 0x6b
|
||||||
|
AUDIT_DM_CTRL = 0x53a
|
||||||
|
AUDIT_DM_EVENT = 0x53b
|
||||||
|
AUDIT_EGID = 0x6
|
||||||
|
AUDIT_EOE = 0x528
|
||||||
|
AUDIT_EQUAL = 0x40000000
|
||||||
|
AUDIT_EUID = 0x2
|
||||||
|
AUDIT_EVENT_LISTENER = 0x537
|
||||||
|
AUDIT_EXE = 0x70
|
||||||
|
AUDIT_EXECVE = 0x51d
|
||||||
|
AUDIT_EXIT = 0x67
|
||||||
|
AUDIT_FAIL_PANIC = 0x2
|
||||||
|
AUDIT_FAIL_PRINTK = 0x1
|
||||||
|
AUDIT_FAIL_SILENT = 0x0
|
||||||
|
AUDIT_FANOTIFY = 0x533
|
||||||
|
AUDIT_FD_PAIR = 0x525
|
||||||
|
AUDIT_FEATURE_BITMAP_ALL = 0x7f
|
||||||
|
AUDIT_FEATURE_BITMAP_BACKLOG_LIMIT = 0x1
|
||||||
|
AUDIT_FEATURE_BITMAP_BACKLOG_WAIT_TIME = 0x2
|
||||||
|
AUDIT_FEATURE_BITMAP_EXCLUDE_EXTEND = 0x8
|
||||||
|
AUDIT_FEATURE_BITMAP_EXECUTABLE_PATH = 0x4
|
||||||
|
AUDIT_FEATURE_BITMAP_FILTER_FS = 0x40
|
||||||
|
AUDIT_FEATURE_BITMAP_LOST_RESET = 0x20
|
||||||
|
AUDIT_FEATURE_BITMAP_SESSIONID_FILTER = 0x10
|
||||||
|
AUDIT_FEATURE_CHANGE = 0x530
|
||||||
|
AUDIT_FEATURE_LOGINUID_IMMUTABLE = 0x1
|
||||||
|
AUDIT_FEATURE_ONLY_UNSET_LOGINUID = 0x0
|
||||||
|
AUDIT_FEATURE_VERSION = 0x1
|
||||||
|
AUDIT_FIELD_COMPARE = 0x6f
|
||||||
|
AUDIT_FILETYPE = 0x6c
|
||||||
|
AUDIT_FILTERKEY = 0xd2
|
||||||
|
AUDIT_FILTER_ENTRY = 0x2
|
||||||
|
AUDIT_FILTER_EXCLUDE = 0x5
|
||||||
|
AUDIT_FILTER_EXIT = 0x4
|
||||||
|
AUDIT_FILTER_FS = 0x6
|
||||||
|
AUDIT_FILTER_PREPEND = 0x10
|
||||||
|
AUDIT_FILTER_TASK = 0x1
|
||||||
|
AUDIT_FILTER_TYPE = 0x5
|
||||||
|
AUDIT_FILTER_URING_EXIT = 0x7
|
||||||
|
AUDIT_FILTER_USER = 0x0
|
||||||
|
AUDIT_FILTER_WATCH = 0x3
|
||||||
|
AUDIT_FIRST_KERN_ANOM_MSG = 0x6a4
|
||||||
|
AUDIT_FIRST_USER_MSG = 0x44c
|
||||||
|
AUDIT_FIRST_USER_MSG2 = 0x834
|
||||||
|
AUDIT_FSGID = 0x8
|
||||||
|
AUDIT_FSTYPE = 0x1a
|
||||||
|
AUDIT_FSUID = 0x4
|
||||||
|
AUDIT_GET = 0x3e8
|
||||||
|
AUDIT_GET_FEATURE = 0x3fb
|
||||||
|
AUDIT_GID = 0x5
|
||||||
|
AUDIT_GREATER_THAN = 0x20000000
|
||||||
|
AUDIT_GREATER_THAN_OR_EQUAL = 0x60000000
|
||||||
|
AUDIT_INODE = 0x66
|
||||||
|
AUDIT_INTEGRITY_DATA = 0x708
|
||||||
|
AUDIT_INTEGRITY_EVM_XATTR = 0x70e
|
||||||
|
AUDIT_INTEGRITY_HASH = 0x70b
|
||||||
|
AUDIT_INTEGRITY_METADATA = 0x709
|
||||||
|
AUDIT_INTEGRITY_PCR = 0x70c
|
||||||
|
AUDIT_INTEGRITY_POLICY_RULE = 0x70f
|
||||||
|
AUDIT_INTEGRITY_RULE = 0x70d
|
||||||
|
AUDIT_INTEGRITY_STATUS = 0x70a
|
||||||
|
AUDIT_IPC = 0x517
|
||||||
|
AUDIT_IPC_SET_PERM = 0x51f
|
||||||
|
AUDIT_KERNEL = 0x7d0
|
||||||
|
AUDIT_KERNEL_OTHER = 0x524
|
||||||
|
AUDIT_KERN_MODULE = 0x532
|
||||||
|
AUDIT_LAST_FEATURE = 0x1
|
||||||
|
AUDIT_LAST_KERN_ANOM_MSG = 0x707
|
||||||
|
AUDIT_LAST_USER_MSG = 0x4af
|
||||||
|
AUDIT_LAST_USER_MSG2 = 0xbb7
|
||||||
|
AUDIT_LESS_THAN = 0x10000000
|
||||||
|
AUDIT_LESS_THAN_OR_EQUAL = 0x50000000
|
||||||
|
AUDIT_LIST = 0x3ea
|
||||||
|
AUDIT_LIST_RULES = 0x3f5
|
||||||
|
AUDIT_LOGIN = 0x3ee
|
||||||
|
AUDIT_LOGINUID = 0x9
|
||||||
|
AUDIT_LOGINUID_SET = 0x18
|
||||||
|
AUDIT_MAC_CALIPSO_ADD = 0x58a
|
||||||
|
AUDIT_MAC_CALIPSO_DEL = 0x58b
|
||||||
|
AUDIT_MAC_CIPSOV4_ADD = 0x57f
|
||||||
|
AUDIT_MAC_CIPSOV4_DEL = 0x580
|
||||||
|
AUDIT_MAC_CONFIG_CHANGE = 0x57d
|
||||||
|
AUDIT_MAC_IPSEC_ADDSA = 0x583
|
||||||
|
AUDIT_MAC_IPSEC_ADDSPD = 0x585
|
||||||
|
AUDIT_MAC_IPSEC_DELSA = 0x584
|
||||||
|
AUDIT_MAC_IPSEC_DELSPD = 0x586
|
||||||
|
AUDIT_MAC_IPSEC_EVENT = 0x587
|
||||||
|
AUDIT_MAC_MAP_ADD = 0x581
|
||||||
|
AUDIT_MAC_MAP_DEL = 0x582
|
||||||
|
AUDIT_MAC_POLICY_LOAD = 0x57b
|
||||||
|
AUDIT_MAC_STATUS = 0x57c
|
||||||
|
AUDIT_MAC_UNLBL_ALLOW = 0x57e
|
||||||
|
AUDIT_MAC_UNLBL_STCADD = 0x588
|
||||||
|
AUDIT_MAC_UNLBL_STCDEL = 0x589
|
||||||
|
AUDIT_MAKE_EQUIV = 0x3f7
|
||||||
|
AUDIT_MAX_FIELDS = 0x40
|
||||||
|
AUDIT_MAX_FIELD_COMPARE = 0x19
|
||||||
|
AUDIT_MAX_KEY_LEN = 0x100
|
||||||
|
AUDIT_MESSAGE_TEXT_MAX = 0x2170
|
||||||
|
AUDIT_MMAP = 0x52b
|
||||||
|
AUDIT_MQ_GETSETATTR = 0x523
|
||||||
|
AUDIT_MQ_NOTIFY = 0x522
|
||||||
|
AUDIT_MQ_OPEN = 0x520
|
||||||
|
AUDIT_MQ_SENDRECV = 0x521
|
||||||
|
AUDIT_MSGTYPE = 0xc
|
||||||
|
AUDIT_NEGATE = 0x80000000
|
||||||
|
AUDIT_NETFILTER_CFG = 0x52d
|
||||||
|
AUDIT_NETFILTER_PKT = 0x52c
|
||||||
|
AUDIT_NEVER = 0x0
|
||||||
|
AUDIT_NLGRP_MAX = 0x1
|
||||||
|
AUDIT_NOT_EQUAL = 0x30000000
|
||||||
|
AUDIT_NR_FILTERS = 0x8
|
||||||
|
AUDIT_OBJ_GID = 0x6e
|
||||||
|
AUDIT_OBJ_LEV_HIGH = 0x17
|
||||||
|
AUDIT_OBJ_LEV_LOW = 0x16
|
||||||
|
AUDIT_OBJ_PID = 0x526
|
||||||
|
AUDIT_OBJ_ROLE = 0x14
|
||||||
|
AUDIT_OBJ_TYPE = 0x15
|
||||||
|
AUDIT_OBJ_UID = 0x6d
|
||||||
|
AUDIT_OBJ_USER = 0x13
|
||||||
|
AUDIT_OPENAT2 = 0x539
|
||||||
|
AUDIT_OPERATORS = 0x78000000
|
||||||
|
AUDIT_PATH = 0x516
|
||||||
|
AUDIT_PERM = 0x6a
|
||||||
|
AUDIT_PERM_ATTR = 0x8
|
||||||
|
AUDIT_PERM_EXEC = 0x1
|
||||||
|
AUDIT_PERM_READ = 0x4
|
||||||
|
AUDIT_PERM_WRITE = 0x2
|
||||||
|
AUDIT_PERS = 0xa
|
||||||
|
AUDIT_PID = 0x0
|
||||||
|
AUDIT_POSSIBLE = 0x1
|
||||||
|
AUDIT_PPID = 0x12
|
||||||
|
AUDIT_PROCTITLE = 0x52f
|
||||||
|
AUDIT_REPLACE = 0x531
|
||||||
|
AUDIT_SADDR_FAM = 0x71
|
||||||
|
AUDIT_SECCOMP = 0x52e
|
||||||
|
AUDIT_SELINUX_ERR = 0x579
|
||||||
|
AUDIT_SESSIONID = 0x19
|
||||||
|
AUDIT_SET = 0x3e9
|
||||||
|
AUDIT_SET_FEATURE = 0x3fa
|
||||||
|
AUDIT_SGID = 0x7
|
||||||
|
AUDIT_SID_UNSET = 0xffffffff
|
||||||
|
AUDIT_SIGNAL_INFO = 0x3f2
|
||||||
|
AUDIT_SOCKADDR = 0x51a
|
||||||
|
AUDIT_SOCKETCALL = 0x518
|
||||||
|
AUDIT_STATUS_BACKLOG_LIMIT = 0x10
|
||||||
|
AUDIT_STATUS_BACKLOG_WAIT_TIME = 0x20
|
||||||
|
AUDIT_STATUS_BACKLOG_WAIT_TIME_ACTUAL = 0x80
|
||||||
|
AUDIT_STATUS_ENABLED = 0x1
|
||||||
|
AUDIT_STATUS_FAILURE = 0x2
|
||||||
|
AUDIT_STATUS_LOST = 0x40
|
||||||
|
AUDIT_STATUS_PID = 0x4
|
||||||
|
AUDIT_STATUS_RATE_LIMIT = 0x8
|
||||||
|
AUDIT_SUBJ_CLR = 0x11
|
||||||
|
AUDIT_SUBJ_ROLE = 0xe
|
||||||
|
AUDIT_SUBJ_SEN = 0x10
|
||||||
|
AUDIT_SUBJ_TYPE = 0xf
|
||||||
|
AUDIT_SUBJ_USER = 0xd
|
||||||
|
AUDIT_SUCCESS = 0x68
|
||||||
|
AUDIT_SUID = 0x3
|
||||||
|
AUDIT_SYSCALL = 0x514
|
||||||
|
AUDIT_SYSCALL_CLASSES = 0x10
|
||||||
|
AUDIT_TIME_ADJNTPVAL = 0x535
|
||||||
|
AUDIT_TIME_INJOFFSET = 0x534
|
||||||
|
AUDIT_TRIM = 0x3f6
|
||||||
|
AUDIT_TTY = 0x527
|
||||||
|
AUDIT_TTY_GET = 0x3f8
|
||||||
|
AUDIT_TTY_SET = 0x3f9
|
||||||
|
AUDIT_UID = 0x1
|
||||||
|
AUDIT_UID_UNSET = 0xffffffff
|
||||||
|
AUDIT_UNUSED_BITS = 0x7fffc00
|
||||||
|
AUDIT_URINGOP = 0x538
|
||||||
|
AUDIT_USER = 0x3ed
|
||||||
|
AUDIT_USER_AVC = 0x453
|
||||||
|
AUDIT_USER_TTY = 0x464
|
||||||
|
AUDIT_VERSION_BACKLOG_LIMIT = 0x1
|
||||||
|
AUDIT_VERSION_BACKLOG_WAIT_TIME = 0x2
|
||||||
|
AUDIT_VERSION_LATEST = 0x7f
|
||||||
|
AUDIT_WATCH = 0x69
|
||||||
|
AUDIT_WATCH_INS = 0x3ef
|
||||||
|
AUDIT_WATCH_LIST = 0x3f1
|
||||||
|
AUDIT_WATCH_REM = 0x3f0
|
||||||
AUTOFS_SUPER_MAGIC = 0x187
|
AUTOFS_SUPER_MAGIC = 0x187
|
||||||
B0 = 0x0
|
B0 = 0x0
|
||||||
B110 = 0x3
|
B110 = 0x3
|
||||||
|
@ -184,6 +484,7 @@ const (
|
||||||
BPF_F_ALLOW_MULTI = 0x2
|
BPF_F_ALLOW_MULTI = 0x2
|
||||||
BPF_F_ALLOW_OVERRIDE = 0x1
|
BPF_F_ALLOW_OVERRIDE = 0x1
|
||||||
BPF_F_ANY_ALIGNMENT = 0x2
|
BPF_F_ANY_ALIGNMENT = 0x2
|
||||||
|
BPF_F_KPROBE_MULTI_RETURN = 0x1
|
||||||
BPF_F_QUERY_EFFECTIVE = 0x1
|
BPF_F_QUERY_EFFECTIVE = 0x1
|
||||||
BPF_F_REPLACE = 0x4
|
BPF_F_REPLACE = 0x4
|
||||||
BPF_F_SLEEPABLE = 0x10
|
BPF_F_SLEEPABLE = 0x10
|
||||||
|
@ -191,6 +492,8 @@ const (
|
||||||
BPF_F_TEST_RND_HI32 = 0x4
|
BPF_F_TEST_RND_HI32 = 0x4
|
||||||
BPF_F_TEST_RUN_ON_CPU = 0x1
|
BPF_F_TEST_RUN_ON_CPU = 0x1
|
||||||
BPF_F_TEST_STATE_FREQ = 0x8
|
BPF_F_TEST_STATE_FREQ = 0x8
|
||||||
|
BPF_F_TEST_XDP_LIVE_FRAMES = 0x2
|
||||||
|
BPF_F_XDP_HAS_FRAGS = 0x20
|
||||||
BPF_H = 0x8
|
BPF_H = 0x8
|
||||||
BPF_IMM = 0x0
|
BPF_IMM = 0x0
|
||||||
BPF_IND = 0x40
|
BPF_IND = 0x40
|
||||||
|
@ -517,9 +820,9 @@ const (
|
||||||
DM_UUID_FLAG = 0x4000
|
DM_UUID_FLAG = 0x4000
|
||||||
DM_UUID_LEN = 0x81
|
DM_UUID_LEN = 0x81
|
||||||
DM_VERSION = 0xc138fd00
|
DM_VERSION = 0xc138fd00
|
||||||
DM_VERSION_EXTRA = "-ioctl (2021-03-22)"
|
DM_VERSION_EXTRA = "-ioctl (2022-02-22)"
|
||||||
DM_VERSION_MAJOR = 0x4
|
DM_VERSION_MAJOR = 0x4
|
||||||
DM_VERSION_MINOR = 0x2d
|
DM_VERSION_MINOR = 0x2e
|
||||||
DM_VERSION_PATCHLEVEL = 0x0
|
DM_VERSION_PATCHLEVEL = 0x0
|
||||||
DT_BLK = 0x6
|
DT_BLK = 0x6
|
||||||
DT_CHR = 0x2
|
DT_CHR = 0x2
|
||||||
|
@ -535,6 +838,55 @@ const (
|
||||||
EFD_SEMAPHORE = 0x1
|
EFD_SEMAPHORE = 0x1
|
||||||
EFIVARFS_MAGIC = 0xde5e81e4
|
EFIVARFS_MAGIC = 0xde5e81e4
|
||||||
EFS_SUPER_MAGIC = 0x414a53
|
EFS_SUPER_MAGIC = 0x414a53
|
||||||
|
EM_386 = 0x3
|
||||||
|
EM_486 = 0x6
|
||||||
|
EM_68K = 0x4
|
||||||
|
EM_860 = 0x7
|
||||||
|
EM_88K = 0x5
|
||||||
|
EM_AARCH64 = 0xb7
|
||||||
|
EM_ALPHA = 0x9026
|
||||||
|
EM_ALTERA_NIOS2 = 0x71
|
||||||
|
EM_ARCOMPACT = 0x5d
|
||||||
|
EM_ARCV2 = 0xc3
|
||||||
|
EM_ARM = 0x28
|
||||||
|
EM_BLACKFIN = 0x6a
|
||||||
|
EM_BPF = 0xf7
|
||||||
|
EM_CRIS = 0x4c
|
||||||
|
EM_CSKY = 0xfc
|
||||||
|
EM_CYGNUS_M32R = 0x9041
|
||||||
|
EM_CYGNUS_MN10300 = 0xbeef
|
||||||
|
EM_FRV = 0x5441
|
||||||
|
EM_H8_300 = 0x2e
|
||||||
|
EM_HEXAGON = 0xa4
|
||||||
|
EM_IA_64 = 0x32
|
||||||
|
EM_LOONGARCH = 0x102
|
||||||
|
EM_M32 = 0x1
|
||||||
|
EM_M32R = 0x58
|
||||||
|
EM_MICROBLAZE = 0xbd
|
||||||
|
EM_MIPS = 0x8
|
||||||
|
EM_MIPS_RS3_LE = 0xa
|
||||||
|
EM_MIPS_RS4_BE = 0xa
|
||||||
|
EM_MN10300 = 0x59
|
||||||
|
EM_NDS32 = 0xa7
|
||||||
|
EM_NONE = 0x0
|
||||||
|
EM_OPENRISC = 0x5c
|
||||||
|
EM_PARISC = 0xf
|
||||||
|
EM_PPC = 0x14
|
||||||
|
EM_PPC64 = 0x15
|
||||||
|
EM_RISCV = 0xf3
|
||||||
|
EM_S390 = 0x16
|
||||||
|
EM_S390_OLD = 0xa390
|
||||||
|
EM_SH = 0x2a
|
||||||
|
EM_SPARC = 0x2
|
||||||
|
EM_SPARC32PLUS = 0x12
|
||||||
|
EM_SPARCV9 = 0x2b
|
||||||
|
EM_SPU = 0x17
|
||||||
|
EM_TILEGX = 0xbf
|
||||||
|
EM_TILEPRO = 0xbc
|
||||||
|
EM_TI_C6000 = 0x8c
|
||||||
|
EM_UNICORE = 0x6e
|
||||||
|
EM_X86_64 = 0x3e
|
||||||
|
EM_XTENSA = 0x5e
|
||||||
ENCODING_DEFAULT = 0x0
|
ENCODING_DEFAULT = 0x0
|
||||||
ENCODING_FM_MARK = 0x3
|
ENCODING_FM_MARK = 0x3
|
||||||
ENCODING_FM_SPACE = 0x4
|
ENCODING_FM_SPACE = 0x4
|
||||||
|
@ -712,6 +1064,7 @@ const (
|
||||||
ETH_P_EDSA = 0xdada
|
ETH_P_EDSA = 0xdada
|
||||||
ETH_P_ERSPAN = 0x88be
|
ETH_P_ERSPAN = 0x88be
|
||||||
ETH_P_ERSPAN2 = 0x22eb
|
ETH_P_ERSPAN2 = 0x22eb
|
||||||
|
ETH_P_ETHERCAT = 0x88a4
|
||||||
ETH_P_FCOE = 0x8906
|
ETH_P_FCOE = 0x8906
|
||||||
ETH_P_FIP = 0x8914
|
ETH_P_FIP = 0x8914
|
||||||
ETH_P_HDLC = 0x19
|
ETH_P_HDLC = 0x19
|
||||||
|
@ -749,6 +1102,7 @@ const (
|
||||||
ETH_P_PPP_MP = 0x8
|
ETH_P_PPP_MP = 0x8
|
||||||
ETH_P_PPP_SES = 0x8864
|
ETH_P_PPP_SES = 0x8864
|
||||||
ETH_P_PREAUTH = 0x88c7
|
ETH_P_PREAUTH = 0x88c7
|
||||||
|
ETH_P_PROFINET = 0x8892
|
||||||
ETH_P_PRP = 0x88fb
|
ETH_P_PRP = 0x88fb
|
||||||
ETH_P_PUP = 0x200
|
ETH_P_PUP = 0x200
|
||||||
ETH_P_PUPAT = 0x201
|
ETH_P_PUPAT = 0x201
|
||||||
|
@ -837,6 +1191,7 @@ const (
|
||||||
FAN_FS_ERROR = 0x8000
|
FAN_FS_ERROR = 0x8000
|
||||||
FAN_MARK_ADD = 0x1
|
FAN_MARK_ADD = 0x1
|
||||||
FAN_MARK_DONT_FOLLOW = 0x4
|
FAN_MARK_DONT_FOLLOW = 0x4
|
||||||
|
FAN_MARK_EVICTABLE = 0x200
|
||||||
FAN_MARK_FILESYSTEM = 0x100
|
FAN_MARK_FILESYSTEM = 0x100
|
||||||
FAN_MARK_FLUSH = 0x80
|
FAN_MARK_FLUSH = 0x80
|
||||||
FAN_MARK_IGNORED_MASK = 0x20
|
FAN_MARK_IGNORED_MASK = 0x20
|
||||||
|
@ -1055,7 +1410,7 @@ const (
|
||||||
IFA_F_STABLE_PRIVACY = 0x800
|
IFA_F_STABLE_PRIVACY = 0x800
|
||||||
IFA_F_TEMPORARY = 0x1
|
IFA_F_TEMPORARY = 0x1
|
||||||
IFA_F_TENTATIVE = 0x40
|
IFA_F_TENTATIVE = 0x40
|
||||||
IFA_MAX = 0xa
|
IFA_MAX = 0xb
|
||||||
IFF_ALLMULTI = 0x200
|
IFF_ALLMULTI = 0x200
|
||||||
IFF_ATTACH_QUEUE = 0x200
|
IFF_ATTACH_QUEUE = 0x200
|
||||||
IFF_AUTOMEDIA = 0x4000
|
IFF_AUTOMEDIA = 0x4000
|
||||||
|
@ -1310,6 +1665,7 @@ const (
|
||||||
KEXEC_ARCH_ARM = 0x280000
|
KEXEC_ARCH_ARM = 0x280000
|
||||||
KEXEC_ARCH_DEFAULT = 0x0
|
KEXEC_ARCH_DEFAULT = 0x0
|
||||||
KEXEC_ARCH_IA_64 = 0x320000
|
KEXEC_ARCH_IA_64 = 0x320000
|
||||||
|
KEXEC_ARCH_LOONGARCH = 0x1020000
|
||||||
KEXEC_ARCH_MASK = 0xffff0000
|
KEXEC_ARCH_MASK = 0xffff0000
|
||||||
KEXEC_ARCH_MIPS = 0x80000
|
KEXEC_ARCH_MIPS = 0x80000
|
||||||
KEXEC_ARCH_MIPS_LE = 0xa0000
|
KEXEC_ARCH_MIPS_LE = 0xa0000
|
||||||
|
@ -1402,6 +1758,7 @@ const (
|
||||||
LANDLOCK_ACCESS_FS_MAKE_SYM = 0x1000
|
LANDLOCK_ACCESS_FS_MAKE_SYM = 0x1000
|
||||||
LANDLOCK_ACCESS_FS_READ_DIR = 0x8
|
LANDLOCK_ACCESS_FS_READ_DIR = 0x8
|
||||||
LANDLOCK_ACCESS_FS_READ_FILE = 0x4
|
LANDLOCK_ACCESS_FS_READ_FILE = 0x4
|
||||||
|
LANDLOCK_ACCESS_FS_REFER = 0x2000
|
||||||
LANDLOCK_ACCESS_FS_REMOVE_DIR = 0x10
|
LANDLOCK_ACCESS_FS_REMOVE_DIR = 0x10
|
||||||
LANDLOCK_ACCESS_FS_REMOVE_FILE = 0x20
|
LANDLOCK_ACCESS_FS_REMOVE_FILE = 0x20
|
||||||
LANDLOCK_ACCESS_FS_WRITE_FILE = 0x2
|
LANDLOCK_ACCESS_FS_WRITE_FILE = 0x2
|
||||||
|
@ -1757,6 +2114,7 @@ const (
|
||||||
NLM_F_ACK_TLVS = 0x200
|
NLM_F_ACK_TLVS = 0x200
|
||||||
NLM_F_APPEND = 0x800
|
NLM_F_APPEND = 0x800
|
||||||
NLM_F_ATOMIC = 0x400
|
NLM_F_ATOMIC = 0x400
|
||||||
|
NLM_F_BULK = 0x200
|
||||||
NLM_F_CAPPED = 0x100
|
NLM_F_CAPPED = 0x100
|
||||||
NLM_F_CREATE = 0x400
|
NLM_F_CREATE = 0x400
|
||||||
NLM_F_DUMP = 0x300
|
NLM_F_DUMP = 0x300
|
||||||
|
@ -2074,6 +2432,11 @@ const (
|
||||||
PR_SET_UNALIGN = 0x6
|
PR_SET_UNALIGN = 0x6
|
||||||
PR_SET_VMA = 0x53564d41
|
PR_SET_VMA = 0x53564d41
|
||||||
PR_SET_VMA_ANON_NAME = 0x0
|
PR_SET_VMA_ANON_NAME = 0x0
|
||||||
|
PR_SME_GET_VL = 0x40
|
||||||
|
PR_SME_SET_VL = 0x3f
|
||||||
|
PR_SME_SET_VL_ONEXEC = 0x40000
|
||||||
|
PR_SME_VL_INHERIT = 0x20000
|
||||||
|
PR_SME_VL_LEN_MASK = 0xffff
|
||||||
PR_SPEC_DISABLE = 0x4
|
PR_SPEC_DISABLE = 0x4
|
||||||
PR_SPEC_DISABLE_NOEXEC = 0x10
|
PR_SPEC_DISABLE_NOEXEC = 0x10
|
||||||
PR_SPEC_ENABLE = 0x2
|
PR_SPEC_ENABLE = 0x2
|
||||||
|
@ -2226,8 +2589,9 @@ const (
|
||||||
RTC_FEATURE_ALARM = 0x0
|
RTC_FEATURE_ALARM = 0x0
|
||||||
RTC_FEATURE_ALARM_RES_2S = 0x3
|
RTC_FEATURE_ALARM_RES_2S = 0x3
|
||||||
RTC_FEATURE_ALARM_RES_MINUTE = 0x1
|
RTC_FEATURE_ALARM_RES_MINUTE = 0x1
|
||||||
|
RTC_FEATURE_ALARM_WAKEUP_ONLY = 0x7
|
||||||
RTC_FEATURE_BACKUP_SWITCH_MODE = 0x6
|
RTC_FEATURE_BACKUP_SWITCH_MODE = 0x6
|
||||||
RTC_FEATURE_CNT = 0x7
|
RTC_FEATURE_CNT = 0x8
|
||||||
RTC_FEATURE_CORRECTION = 0x5
|
RTC_FEATURE_CORRECTION = 0x5
|
||||||
RTC_FEATURE_NEED_WEEK_DAY = 0x2
|
RTC_FEATURE_NEED_WEEK_DAY = 0x2
|
||||||
RTC_FEATURE_UPDATE_INTERRUPT = 0x4
|
RTC_FEATURE_UPDATE_INTERRUPT = 0x4
|
||||||
|
@ -2301,6 +2665,7 @@ const (
|
||||||
RTM_DELRULE = 0x21
|
RTM_DELRULE = 0x21
|
||||||
RTM_DELTCLASS = 0x29
|
RTM_DELTCLASS = 0x29
|
||||||
RTM_DELTFILTER = 0x2d
|
RTM_DELTFILTER = 0x2d
|
||||||
|
RTM_DELTUNNEL = 0x79
|
||||||
RTM_DELVLAN = 0x71
|
RTM_DELVLAN = 0x71
|
||||||
RTM_F_CLONED = 0x200
|
RTM_F_CLONED = 0x200
|
||||||
RTM_F_EQUALIZE = 0x400
|
RTM_F_EQUALIZE = 0x400
|
||||||
|
@ -2333,8 +2698,9 @@ const (
|
||||||
RTM_GETSTATS = 0x5e
|
RTM_GETSTATS = 0x5e
|
||||||
RTM_GETTCLASS = 0x2a
|
RTM_GETTCLASS = 0x2a
|
||||||
RTM_GETTFILTER = 0x2e
|
RTM_GETTFILTER = 0x2e
|
||||||
|
RTM_GETTUNNEL = 0x7a
|
||||||
RTM_GETVLAN = 0x72
|
RTM_GETVLAN = 0x72
|
||||||
RTM_MAX = 0x77
|
RTM_MAX = 0x7b
|
||||||
RTM_NEWACTION = 0x30
|
RTM_NEWACTION = 0x30
|
||||||
RTM_NEWADDR = 0x14
|
RTM_NEWADDR = 0x14
|
||||||
RTM_NEWADDRLABEL = 0x48
|
RTM_NEWADDRLABEL = 0x48
|
||||||
|
@ -2358,11 +2724,13 @@ const (
|
||||||
RTM_NEWSTATS = 0x5c
|
RTM_NEWSTATS = 0x5c
|
||||||
RTM_NEWTCLASS = 0x28
|
RTM_NEWTCLASS = 0x28
|
||||||
RTM_NEWTFILTER = 0x2c
|
RTM_NEWTFILTER = 0x2c
|
||||||
RTM_NR_FAMILIES = 0x1a
|
RTM_NEWTUNNEL = 0x78
|
||||||
RTM_NR_MSGTYPES = 0x68
|
RTM_NR_FAMILIES = 0x1b
|
||||||
|
RTM_NR_MSGTYPES = 0x6c
|
||||||
RTM_SETDCB = 0x4f
|
RTM_SETDCB = 0x4f
|
||||||
RTM_SETLINK = 0x13
|
RTM_SETLINK = 0x13
|
||||||
RTM_SETNEIGHTBL = 0x43
|
RTM_SETNEIGHTBL = 0x43
|
||||||
|
RTM_SETSTATS = 0x5f
|
||||||
RTNH_ALIGNTO = 0x4
|
RTNH_ALIGNTO = 0x4
|
||||||
RTNH_COMPARE_MASK = 0x59
|
RTNH_COMPARE_MASK = 0x59
|
||||||
RTNH_F_DEAD = 0x1
|
RTNH_F_DEAD = 0x1
|
||||||
|
@ -2543,6 +2911,9 @@ const (
|
||||||
SOCK_RDM = 0x4
|
SOCK_RDM = 0x4
|
||||||
SOCK_SEQPACKET = 0x5
|
SOCK_SEQPACKET = 0x5
|
||||||
SOCK_SNDBUF_LOCK = 0x1
|
SOCK_SNDBUF_LOCK = 0x1
|
||||||
|
SOCK_TXREHASH_DEFAULT = 0xff
|
||||||
|
SOCK_TXREHASH_DISABLED = 0x0
|
||||||
|
SOCK_TXREHASH_ENABLED = 0x1
|
||||||
SOL_AAL = 0x109
|
SOL_AAL = 0x109
|
||||||
SOL_ALG = 0x117
|
SOL_ALG = 0x117
|
||||||
SOL_ATM = 0x108
|
SOL_ATM = 0x108
|
||||||
|
@ -2558,6 +2929,8 @@ const (
|
||||||
SOL_IUCV = 0x115
|
SOL_IUCV = 0x115
|
||||||
SOL_KCM = 0x119
|
SOL_KCM = 0x119
|
||||||
SOL_LLC = 0x10c
|
SOL_LLC = 0x10c
|
||||||
|
SOL_MCTP = 0x11d
|
||||||
|
SOL_MPTCP = 0x11c
|
||||||
SOL_NETBEUI = 0x10b
|
SOL_NETBEUI = 0x10b
|
||||||
SOL_NETLINK = 0x10e
|
SOL_NETLINK = 0x10e
|
||||||
SOL_NFC = 0x118
|
SOL_NFC = 0x118
|
||||||
|
@ -2567,6 +2940,7 @@ const (
|
||||||
SOL_RAW = 0xff
|
SOL_RAW = 0xff
|
||||||
SOL_RDS = 0x114
|
SOL_RDS = 0x114
|
||||||
SOL_RXRPC = 0x110
|
SOL_RXRPC = 0x110
|
||||||
|
SOL_SMC = 0x11e
|
||||||
SOL_TCP = 0x6
|
SOL_TCP = 0x6
|
||||||
SOL_TIPC = 0x10f
|
SOL_TIPC = 0x10f
|
||||||
SOL_TLS = 0x11a
|
SOL_TLS = 0x11a
|
||||||
|
@ -2673,7 +3047,7 @@ const (
|
||||||
TASKSTATS_GENL_NAME = "TASKSTATS"
|
TASKSTATS_GENL_NAME = "TASKSTATS"
|
||||||
TASKSTATS_GENL_VERSION = 0x1
|
TASKSTATS_GENL_VERSION = 0x1
|
||||||
TASKSTATS_TYPE_MAX = 0x6
|
TASKSTATS_TYPE_MAX = 0x6
|
||||||
TASKSTATS_VERSION = 0xb
|
TASKSTATS_VERSION = 0xd
|
||||||
TCIFLUSH = 0x0
|
TCIFLUSH = 0x0
|
||||||
TCIOFF = 0x2
|
TCIOFF = 0x2
|
||||||
TCIOFLUSH = 0x2
|
TCIOFLUSH = 0x2
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
// mkerrors.sh -Wall -Werror -static -I/tmp/include -m32
|
// mkerrors.sh -Wall -Werror -static -I/tmp/386/include -m32
|
||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build 386 && linux
|
//go:build 386 && linux
|
||||||
// +build 386,linux
|
// +build 386,linux
|
||||||
|
|
||||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
// 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/386/include -m32 _const.go
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
@ -326,6 +326,7 @@ const (
|
||||||
SO_RCVBUF = 0x8
|
SO_RCVBUF = 0x8
|
||||||
SO_RCVBUFFORCE = 0x21
|
SO_RCVBUFFORCE = 0x21
|
||||||
SO_RCVLOWAT = 0x12
|
SO_RCVLOWAT = 0x12
|
||||||
|
SO_RCVMARK = 0x4b
|
||||||
SO_RCVTIMEO = 0x14
|
SO_RCVTIMEO = 0x14
|
||||||
SO_RCVTIMEO_NEW = 0x42
|
SO_RCVTIMEO_NEW = 0x42
|
||||||
SO_RCVTIMEO_OLD = 0x14
|
SO_RCVTIMEO_OLD = 0x14
|
||||||
|
@ -350,6 +351,7 @@ const (
|
||||||
SO_TIMESTAMPNS_NEW = 0x40
|
SO_TIMESTAMPNS_NEW = 0x40
|
||||||
SO_TIMESTAMPNS_OLD = 0x23
|
SO_TIMESTAMPNS_OLD = 0x23
|
||||||
SO_TIMESTAMP_NEW = 0x3f
|
SO_TIMESTAMP_NEW = 0x3f
|
||||||
|
SO_TXREHASH = 0x4a
|
||||||
SO_TXTIME = 0x3d
|
SO_TXTIME = 0x3d
|
||||||
SO_TYPE = 0x3
|
SO_TYPE = 0x3
|
||||||
SO_WIFI_STATUS = 0x29
|
SO_WIFI_STATUS = 0x29
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
// mkerrors.sh -Wall -Werror -static -I/tmp/include -m64
|
// mkerrors.sh -Wall -Werror -static -I/tmp/amd64/include -m64
|
||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build amd64 && linux
|
//go:build amd64 && linux
|
||||||
// +build amd64,linux
|
// +build amd64,linux
|
||||||
|
|
||||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
// 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/amd64/include -m64 _const.go
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
@ -327,6 +327,7 @@ const (
|
||||||
SO_RCVBUF = 0x8
|
SO_RCVBUF = 0x8
|
||||||
SO_RCVBUFFORCE = 0x21
|
SO_RCVBUFFORCE = 0x21
|
||||||
SO_RCVLOWAT = 0x12
|
SO_RCVLOWAT = 0x12
|
||||||
|
SO_RCVMARK = 0x4b
|
||||||
SO_RCVTIMEO = 0x14
|
SO_RCVTIMEO = 0x14
|
||||||
SO_RCVTIMEO_NEW = 0x42
|
SO_RCVTIMEO_NEW = 0x42
|
||||||
SO_RCVTIMEO_OLD = 0x14
|
SO_RCVTIMEO_OLD = 0x14
|
||||||
|
@ -351,6 +352,7 @@ const (
|
||||||
SO_TIMESTAMPNS_NEW = 0x40
|
SO_TIMESTAMPNS_NEW = 0x40
|
||||||
SO_TIMESTAMPNS_OLD = 0x23
|
SO_TIMESTAMPNS_OLD = 0x23
|
||||||
SO_TIMESTAMP_NEW = 0x3f
|
SO_TIMESTAMP_NEW = 0x3f
|
||||||
|
SO_TXREHASH = 0x4a
|
||||||
SO_TXTIME = 0x3d
|
SO_TXTIME = 0x3d
|
||||||
SO_TYPE = 0x3
|
SO_TYPE = 0x3
|
||||||
SO_WIFI_STATUS = 0x29
|
SO_WIFI_STATUS = 0x29
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
// mkerrors.sh -Wall -Werror -static -I/tmp/include
|
// mkerrors.sh -Wall -Werror -static -I/tmp/arm/include
|
||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build arm && linux
|
//go:build arm && linux
|
||||||
// +build arm,linux
|
// +build arm,linux
|
||||||
|
|
||||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
// 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/arm/include _const.go
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
@ -333,6 +333,7 @@ const (
|
||||||
SO_RCVBUF = 0x8
|
SO_RCVBUF = 0x8
|
||||||
SO_RCVBUFFORCE = 0x21
|
SO_RCVBUFFORCE = 0x21
|
||||||
SO_RCVLOWAT = 0x12
|
SO_RCVLOWAT = 0x12
|
||||||
|
SO_RCVMARK = 0x4b
|
||||||
SO_RCVTIMEO = 0x14
|
SO_RCVTIMEO = 0x14
|
||||||
SO_RCVTIMEO_NEW = 0x42
|
SO_RCVTIMEO_NEW = 0x42
|
||||||
SO_RCVTIMEO_OLD = 0x14
|
SO_RCVTIMEO_OLD = 0x14
|
||||||
|
@ -357,6 +358,7 @@ const (
|
||||||
SO_TIMESTAMPNS_NEW = 0x40
|
SO_TIMESTAMPNS_NEW = 0x40
|
||||||
SO_TIMESTAMPNS_OLD = 0x23
|
SO_TIMESTAMPNS_OLD = 0x23
|
||||||
SO_TIMESTAMP_NEW = 0x3f
|
SO_TIMESTAMP_NEW = 0x3f
|
||||||
|
SO_TXREHASH = 0x4a
|
||||||
SO_TXTIME = 0x3d
|
SO_TXTIME = 0x3d
|
||||||
SO_TYPE = 0x3
|
SO_TYPE = 0x3
|
||||||
SO_WIFI_STATUS = 0x29
|
SO_WIFI_STATUS = 0x29
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
// mkerrors.sh -Wall -Werror -static -I/tmp/include -fsigned-char
|
// mkerrors.sh -Wall -Werror -static -I/tmp/arm64/include -fsigned-char
|
||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build arm64 && linux
|
//go:build arm64 && linux
|
||||||
// +build arm64,linux
|
// +build arm64,linux
|
||||||
|
|
||||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
// 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/arm64/include -fsigned-char _const.go
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
@ -323,6 +323,7 @@ const (
|
||||||
SO_RCVBUF = 0x8
|
SO_RCVBUF = 0x8
|
||||||
SO_RCVBUFFORCE = 0x21
|
SO_RCVBUFFORCE = 0x21
|
||||||
SO_RCVLOWAT = 0x12
|
SO_RCVLOWAT = 0x12
|
||||||
|
SO_RCVMARK = 0x4b
|
||||||
SO_RCVTIMEO = 0x14
|
SO_RCVTIMEO = 0x14
|
||||||
SO_RCVTIMEO_NEW = 0x42
|
SO_RCVTIMEO_NEW = 0x42
|
||||||
SO_RCVTIMEO_OLD = 0x14
|
SO_RCVTIMEO_OLD = 0x14
|
||||||
|
@ -347,6 +348,7 @@ const (
|
||||||
SO_TIMESTAMPNS_NEW = 0x40
|
SO_TIMESTAMPNS_NEW = 0x40
|
||||||
SO_TIMESTAMPNS_OLD = 0x23
|
SO_TIMESTAMPNS_OLD = 0x23
|
||||||
SO_TIMESTAMP_NEW = 0x3f
|
SO_TIMESTAMP_NEW = 0x3f
|
||||||
|
SO_TXREHASH = 0x4a
|
||||||
SO_TXTIME = 0x3d
|
SO_TXTIME = 0x3d
|
||||||
SO_TYPE = 0x3
|
SO_TYPE = 0x3
|
||||||
SO_WIFI_STATUS = 0x29
|
SO_WIFI_STATUS = 0x29
|
||||||
|
@ -511,6 +513,7 @@ const (
|
||||||
WORDSIZE = 0x40
|
WORDSIZE = 0x40
|
||||||
XCASE = 0x4
|
XCASE = 0x4
|
||||||
XTABS = 0x1800
|
XTABS = 0x1800
|
||||||
|
ZA_MAGIC = 0x54366345
|
||||||
_HIDIOCGRAWNAME = 0x80804804
|
_HIDIOCGRAWNAME = 0x80804804
|
||||||
_HIDIOCGRAWPHYS = 0x80404805
|
_HIDIOCGRAWPHYS = 0x80404805
|
||||||
_HIDIOCGRAWUNIQ = 0x80404808
|
_HIDIOCGRAWUNIQ = 0x80404808
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
// mkerrors.sh -Wall -Werror -static -I/tmp/include
|
// mkerrors.sh -Wall -Werror -static -I/tmp/mips/include
|
||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build mips && linux
|
//go:build mips && linux
|
||||||
// +build mips,linux
|
// +build mips,linux
|
||||||
|
|
||||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
// 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/mips/include _const.go
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
@ -326,6 +326,7 @@ const (
|
||||||
SO_RCVBUF = 0x1002
|
SO_RCVBUF = 0x1002
|
||||||
SO_RCVBUFFORCE = 0x21
|
SO_RCVBUFFORCE = 0x21
|
||||||
SO_RCVLOWAT = 0x1004
|
SO_RCVLOWAT = 0x1004
|
||||||
|
SO_RCVMARK = 0x4b
|
||||||
SO_RCVTIMEO = 0x1006
|
SO_RCVTIMEO = 0x1006
|
||||||
SO_RCVTIMEO_NEW = 0x42
|
SO_RCVTIMEO_NEW = 0x42
|
||||||
SO_RCVTIMEO_OLD = 0x1006
|
SO_RCVTIMEO_OLD = 0x1006
|
||||||
|
@ -351,6 +352,7 @@ const (
|
||||||
SO_TIMESTAMPNS_NEW = 0x40
|
SO_TIMESTAMPNS_NEW = 0x40
|
||||||
SO_TIMESTAMPNS_OLD = 0x23
|
SO_TIMESTAMPNS_OLD = 0x23
|
||||||
SO_TIMESTAMP_NEW = 0x3f
|
SO_TIMESTAMP_NEW = 0x3f
|
||||||
|
SO_TXREHASH = 0x4a
|
||||||
SO_TXTIME = 0x3d
|
SO_TXTIME = 0x3d
|
||||||
SO_TYPE = 0x1008
|
SO_TYPE = 0x1008
|
||||||
SO_WIFI_STATUS = 0x29
|
SO_WIFI_STATUS = 0x29
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
// mkerrors.sh -Wall -Werror -static -I/tmp/include
|
// mkerrors.sh -Wall -Werror -static -I/tmp/mips64/include
|
||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build mips64 && linux
|
//go:build mips64 && linux
|
||||||
// +build mips64,linux
|
// +build mips64,linux
|
||||||
|
|
||||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
// 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/mips64/include _const.go
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
@ -326,6 +326,7 @@ const (
|
||||||
SO_RCVBUF = 0x1002
|
SO_RCVBUF = 0x1002
|
||||||
SO_RCVBUFFORCE = 0x21
|
SO_RCVBUFFORCE = 0x21
|
||||||
SO_RCVLOWAT = 0x1004
|
SO_RCVLOWAT = 0x1004
|
||||||
|
SO_RCVMARK = 0x4b
|
||||||
SO_RCVTIMEO = 0x1006
|
SO_RCVTIMEO = 0x1006
|
||||||
SO_RCVTIMEO_NEW = 0x42
|
SO_RCVTIMEO_NEW = 0x42
|
||||||
SO_RCVTIMEO_OLD = 0x1006
|
SO_RCVTIMEO_OLD = 0x1006
|
||||||
|
@ -351,6 +352,7 @@ const (
|
||||||
SO_TIMESTAMPNS_NEW = 0x40
|
SO_TIMESTAMPNS_NEW = 0x40
|
||||||
SO_TIMESTAMPNS_OLD = 0x23
|
SO_TIMESTAMPNS_OLD = 0x23
|
||||||
SO_TIMESTAMP_NEW = 0x3f
|
SO_TIMESTAMP_NEW = 0x3f
|
||||||
|
SO_TXREHASH = 0x4a
|
||||||
SO_TXTIME = 0x3d
|
SO_TXTIME = 0x3d
|
||||||
SO_TYPE = 0x1008
|
SO_TYPE = 0x1008
|
||||||
SO_WIFI_STATUS = 0x29
|
SO_WIFI_STATUS = 0x29
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
// mkerrors.sh -Wall -Werror -static -I/tmp/include
|
// mkerrors.sh -Wall -Werror -static -I/tmp/mips64le/include
|
||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build mips64le && linux
|
//go:build mips64le && linux
|
||||||
// +build mips64le,linux
|
// +build mips64le,linux
|
||||||
|
|
||||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
// 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/mips64le/include _const.go
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
@ -326,6 +326,7 @@ const (
|
||||||
SO_RCVBUF = 0x1002
|
SO_RCVBUF = 0x1002
|
||||||
SO_RCVBUFFORCE = 0x21
|
SO_RCVBUFFORCE = 0x21
|
||||||
SO_RCVLOWAT = 0x1004
|
SO_RCVLOWAT = 0x1004
|
||||||
|
SO_RCVMARK = 0x4b
|
||||||
SO_RCVTIMEO = 0x1006
|
SO_RCVTIMEO = 0x1006
|
||||||
SO_RCVTIMEO_NEW = 0x42
|
SO_RCVTIMEO_NEW = 0x42
|
||||||
SO_RCVTIMEO_OLD = 0x1006
|
SO_RCVTIMEO_OLD = 0x1006
|
||||||
|
@ -351,6 +352,7 @@ const (
|
||||||
SO_TIMESTAMPNS_NEW = 0x40
|
SO_TIMESTAMPNS_NEW = 0x40
|
||||||
SO_TIMESTAMPNS_OLD = 0x23
|
SO_TIMESTAMPNS_OLD = 0x23
|
||||||
SO_TIMESTAMP_NEW = 0x3f
|
SO_TIMESTAMP_NEW = 0x3f
|
||||||
|
SO_TXREHASH = 0x4a
|
||||||
SO_TXTIME = 0x3d
|
SO_TXTIME = 0x3d
|
||||||
SO_TYPE = 0x1008
|
SO_TYPE = 0x1008
|
||||||
SO_WIFI_STATUS = 0x29
|
SO_WIFI_STATUS = 0x29
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
// mkerrors.sh -Wall -Werror -static -I/tmp/include
|
// mkerrors.sh -Wall -Werror -static -I/tmp/mipsle/include
|
||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build mipsle && linux
|
//go:build mipsle && linux
|
||||||
// +build mipsle,linux
|
// +build mipsle,linux
|
||||||
|
|
||||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
// 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/mipsle/include _const.go
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
@ -326,6 +326,7 @@ const (
|
||||||
SO_RCVBUF = 0x1002
|
SO_RCVBUF = 0x1002
|
||||||
SO_RCVBUFFORCE = 0x21
|
SO_RCVBUFFORCE = 0x21
|
||||||
SO_RCVLOWAT = 0x1004
|
SO_RCVLOWAT = 0x1004
|
||||||
|
SO_RCVMARK = 0x4b
|
||||||
SO_RCVTIMEO = 0x1006
|
SO_RCVTIMEO = 0x1006
|
||||||
SO_RCVTIMEO_NEW = 0x42
|
SO_RCVTIMEO_NEW = 0x42
|
||||||
SO_RCVTIMEO_OLD = 0x1006
|
SO_RCVTIMEO_OLD = 0x1006
|
||||||
|
@ -351,6 +352,7 @@ const (
|
||||||
SO_TIMESTAMPNS_NEW = 0x40
|
SO_TIMESTAMPNS_NEW = 0x40
|
||||||
SO_TIMESTAMPNS_OLD = 0x23
|
SO_TIMESTAMPNS_OLD = 0x23
|
||||||
SO_TIMESTAMP_NEW = 0x3f
|
SO_TIMESTAMP_NEW = 0x3f
|
||||||
|
SO_TXREHASH = 0x4a
|
||||||
SO_TXTIME = 0x3d
|
SO_TXTIME = 0x3d
|
||||||
SO_TYPE = 0x1008
|
SO_TYPE = 0x1008
|
||||||
SO_WIFI_STATUS = 0x29
|
SO_WIFI_STATUS = 0x29
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
// mkerrors.sh -Wall -Werror -static -I/tmp/include
|
// mkerrors.sh -Wall -Werror -static -I/tmp/ppc/include
|
||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build ppc && linux
|
//go:build ppc && linux
|
||||||
// +build ppc,linux
|
// +build ppc,linux
|
||||||
|
|
||||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
// 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/ppc/include _const.go
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
@ -381,6 +381,7 @@ const (
|
||||||
SO_RCVBUF = 0x8
|
SO_RCVBUF = 0x8
|
||||||
SO_RCVBUFFORCE = 0x21
|
SO_RCVBUFFORCE = 0x21
|
||||||
SO_RCVLOWAT = 0x10
|
SO_RCVLOWAT = 0x10
|
||||||
|
SO_RCVMARK = 0x4b
|
||||||
SO_RCVTIMEO = 0x12
|
SO_RCVTIMEO = 0x12
|
||||||
SO_RCVTIMEO_NEW = 0x42
|
SO_RCVTIMEO_NEW = 0x42
|
||||||
SO_RCVTIMEO_OLD = 0x12
|
SO_RCVTIMEO_OLD = 0x12
|
||||||
|
@ -405,6 +406,7 @@ const (
|
||||||
SO_TIMESTAMPNS_NEW = 0x40
|
SO_TIMESTAMPNS_NEW = 0x40
|
||||||
SO_TIMESTAMPNS_OLD = 0x23
|
SO_TIMESTAMPNS_OLD = 0x23
|
||||||
SO_TIMESTAMP_NEW = 0x3f
|
SO_TIMESTAMP_NEW = 0x3f
|
||||||
|
SO_TXREHASH = 0x4a
|
||||||
SO_TXTIME = 0x3d
|
SO_TXTIME = 0x3d
|
||||||
SO_TYPE = 0x3
|
SO_TYPE = 0x3
|
||||||
SO_WIFI_STATUS = 0x29
|
SO_WIFI_STATUS = 0x29
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
// mkerrors.sh -Wall -Werror -static -I/tmp/include
|
// mkerrors.sh -Wall -Werror -static -I/tmp/ppc64/include
|
||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build ppc64 && linux
|
//go:build ppc64 && linux
|
||||||
// +build ppc64,linux
|
// +build ppc64,linux
|
||||||
|
|
||||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
// 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/ppc64/include _const.go
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
@ -385,6 +385,7 @@ const (
|
||||||
SO_RCVBUF = 0x8
|
SO_RCVBUF = 0x8
|
||||||
SO_RCVBUFFORCE = 0x21
|
SO_RCVBUFFORCE = 0x21
|
||||||
SO_RCVLOWAT = 0x10
|
SO_RCVLOWAT = 0x10
|
||||||
|
SO_RCVMARK = 0x4b
|
||||||
SO_RCVTIMEO = 0x12
|
SO_RCVTIMEO = 0x12
|
||||||
SO_RCVTIMEO_NEW = 0x42
|
SO_RCVTIMEO_NEW = 0x42
|
||||||
SO_RCVTIMEO_OLD = 0x12
|
SO_RCVTIMEO_OLD = 0x12
|
||||||
|
@ -409,6 +410,7 @@ const (
|
||||||
SO_TIMESTAMPNS_NEW = 0x40
|
SO_TIMESTAMPNS_NEW = 0x40
|
||||||
SO_TIMESTAMPNS_OLD = 0x23
|
SO_TIMESTAMPNS_OLD = 0x23
|
||||||
SO_TIMESTAMP_NEW = 0x3f
|
SO_TIMESTAMP_NEW = 0x3f
|
||||||
|
SO_TXREHASH = 0x4a
|
||||||
SO_TXTIME = 0x3d
|
SO_TXTIME = 0x3d
|
||||||
SO_TYPE = 0x3
|
SO_TYPE = 0x3
|
||||||
SO_WIFI_STATUS = 0x29
|
SO_WIFI_STATUS = 0x29
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
// mkerrors.sh -Wall -Werror -static -I/tmp/include
|
// mkerrors.sh -Wall -Werror -static -I/tmp/ppc64le/include
|
||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build ppc64le && linux
|
//go:build ppc64le && linux
|
||||||
// +build ppc64le,linux
|
// +build ppc64le,linux
|
||||||
|
|
||||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
// 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/ppc64le/include _const.go
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
@ -385,6 +385,7 @@ const (
|
||||||
SO_RCVBUF = 0x8
|
SO_RCVBUF = 0x8
|
||||||
SO_RCVBUFFORCE = 0x21
|
SO_RCVBUFFORCE = 0x21
|
||||||
SO_RCVLOWAT = 0x10
|
SO_RCVLOWAT = 0x10
|
||||||
|
SO_RCVMARK = 0x4b
|
||||||
SO_RCVTIMEO = 0x12
|
SO_RCVTIMEO = 0x12
|
||||||
SO_RCVTIMEO_NEW = 0x42
|
SO_RCVTIMEO_NEW = 0x42
|
||||||
SO_RCVTIMEO_OLD = 0x12
|
SO_RCVTIMEO_OLD = 0x12
|
||||||
|
@ -409,6 +410,7 @@ const (
|
||||||
SO_TIMESTAMPNS_NEW = 0x40
|
SO_TIMESTAMPNS_NEW = 0x40
|
||||||
SO_TIMESTAMPNS_OLD = 0x23
|
SO_TIMESTAMPNS_OLD = 0x23
|
||||||
SO_TIMESTAMP_NEW = 0x3f
|
SO_TIMESTAMP_NEW = 0x3f
|
||||||
|
SO_TXREHASH = 0x4a
|
||||||
SO_TXTIME = 0x3d
|
SO_TXTIME = 0x3d
|
||||||
SO_TYPE = 0x3
|
SO_TYPE = 0x3
|
||||||
SO_WIFI_STATUS = 0x29
|
SO_WIFI_STATUS = 0x29
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
// mkerrors.sh -Wall -Werror -static -I/tmp/include
|
// mkerrors.sh -Wall -Werror -static -I/tmp/riscv64/include
|
||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build riscv64 && linux
|
//go:build riscv64 && linux
|
||||||
// +build riscv64,linux
|
// +build riscv64,linux
|
||||||
|
|
||||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
// 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/riscv64/include _const.go
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
@ -314,6 +314,7 @@ const (
|
||||||
SO_RCVBUF = 0x8
|
SO_RCVBUF = 0x8
|
||||||
SO_RCVBUFFORCE = 0x21
|
SO_RCVBUFFORCE = 0x21
|
||||||
SO_RCVLOWAT = 0x12
|
SO_RCVLOWAT = 0x12
|
||||||
|
SO_RCVMARK = 0x4b
|
||||||
SO_RCVTIMEO = 0x14
|
SO_RCVTIMEO = 0x14
|
||||||
SO_RCVTIMEO_NEW = 0x42
|
SO_RCVTIMEO_NEW = 0x42
|
||||||
SO_RCVTIMEO_OLD = 0x14
|
SO_RCVTIMEO_OLD = 0x14
|
||||||
|
@ -338,6 +339,7 @@ const (
|
||||||
SO_TIMESTAMPNS_NEW = 0x40
|
SO_TIMESTAMPNS_NEW = 0x40
|
||||||
SO_TIMESTAMPNS_OLD = 0x23
|
SO_TIMESTAMPNS_OLD = 0x23
|
||||||
SO_TIMESTAMP_NEW = 0x3f
|
SO_TIMESTAMP_NEW = 0x3f
|
||||||
|
SO_TXREHASH = 0x4a
|
||||||
SO_TXTIME = 0x3d
|
SO_TXTIME = 0x3d
|
||||||
SO_TYPE = 0x3
|
SO_TYPE = 0x3
|
||||||
SO_WIFI_STATUS = 0x29
|
SO_WIFI_STATUS = 0x29
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
// mkerrors.sh -Wall -Werror -static -I/tmp/include -fsigned-char
|
// mkerrors.sh -Wall -Werror -static -I/tmp/s390x/include -fsigned-char
|
||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||||
|
|
||||||
//go:build s390x && linux
|
//go:build s390x && linux
|
||||||
// +build s390x,linux
|
// +build s390x,linux
|
||||||
|
|
||||||
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
|
// 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/s390x/include -fsigned-char _const.go
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
@ -389,6 +389,7 @@ const (
|
||||||
SO_RCVBUF = 0x8
|
SO_RCVBUF = 0x8
|
||||||
SO_RCVBUFFORCE = 0x21
|
SO_RCVBUFFORCE = 0x21
|
||||||
SO_RCVLOWAT = 0x12
|
SO_RCVLOWAT = 0x12
|
||||||
|
SO_RCVMARK = 0x4b
|
||||||
SO_RCVTIMEO = 0x14
|
SO_RCVTIMEO = 0x14
|
||||||
SO_RCVTIMEO_NEW = 0x42
|
SO_RCVTIMEO_NEW = 0x42
|
||||||
SO_RCVTIMEO_OLD = 0x14
|
SO_RCVTIMEO_OLD = 0x14
|
||||||
|
@ -413,6 +414,7 @@ const (
|
||||||
SO_TIMESTAMPNS_NEW = 0x40
|
SO_TIMESTAMPNS_NEW = 0x40
|
||||||
SO_TIMESTAMPNS_OLD = 0x23
|
SO_TIMESTAMPNS_OLD = 0x23
|
||||||
SO_TIMESTAMP_NEW = 0x3f
|
SO_TIMESTAMP_NEW = 0x3f
|
||||||
|
SO_TXREHASH = 0x4a
|
||||||
SO_TXTIME = 0x3d
|
SO_TXTIME = 0x3d
|
||||||
SO_TYPE = 0x3
|
SO_TYPE = 0x3
|
||||||
SO_WIFI_STATUS = 0x29
|
SO_WIFI_STATUS = 0x29
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue