зеркало из https://github.com/Azure/ARO-RP.git
modified login command to include host key (#2911)
This commit is contained in:
Родитель
6c32510ab5
Коммит
bc7e1a1889
16
go.mod
16
go.mod
|
@ -59,12 +59,12 @@ require (
|
||||||
github.com/stretchr/testify v1.7.1
|
github.com/stretchr/testify v1.7.1
|
||||||
github.com/tebeka/selenium v0.9.9
|
github.com/tebeka/selenium v0.9.9
|
||||||
github.com/ugorji/go/codec v1.2.7
|
github.com/ugorji/go/codec v1.2.7
|
||||||
golang.org/x/crypto v0.6.0
|
golang.org/x/crypto v0.9.0
|
||||||
golang.org/x/net v0.7.0
|
golang.org/x/net v0.10.0
|
||||||
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5
|
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5
|
||||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4
|
golang.org/x/sync v0.1.0
|
||||||
golang.org/x/text v0.7.0
|
golang.org/x/text v0.9.0
|
||||||
golang.org/x/tools v0.2.0
|
golang.org/x/tools v0.6.0
|
||||||
k8s.io/api v0.24.1
|
k8s.io/api v0.24.1
|
||||||
k8s.io/apiextensions-apiserver v0.24.1
|
k8s.io/apiextensions-apiserver v0.24.1
|
||||||
k8s.io/apimachinery v0.24.1
|
k8s.io/apimachinery v0.24.1
|
||||||
|
@ -231,9 +231,9 @@ require (
|
||||||
go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352 // indirect
|
go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352 // indirect
|
||||||
go.opencensus.io v0.23.0 // indirect
|
go.opencensus.io v0.23.0 // indirect
|
||||||
go.starlark.net v0.0.0-20220328144851-d1966c6b9fcd // indirect
|
go.starlark.net v0.0.0-20220328144851-d1966c6b9fcd // indirect
|
||||||
golang.org/x/mod v0.6.0 // indirect
|
golang.org/x/mod v0.8.0 // indirect
|
||||||
golang.org/x/sys v0.5.0 // indirect
|
golang.org/x/sys v0.8.0 // indirect
|
||||||
golang.org/x/term v0.5.0 // indirect
|
golang.org/x/term v0.8.0 // indirect
|
||||||
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 // indirect
|
golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 // indirect
|
||||||
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
|
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
|
||||||
google.golang.org/api v0.74.0 // indirect
|
google.golang.org/api v0.74.0 // indirect
|
||||||
|
|
32
go.sum
32
go.sum
|
@ -1750,8 +1750,8 @@ golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5y
|
||||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
golang.org/x/crypto v0.0.0-20211202192323-5770296d904e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
golang.org/x/crypto v0.0.0-20211202192323-5770296d904e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||||
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||||
golang.org/x/crypto v0.6.0 h1:qfktjS5LUO+fFKeJXZ+ikTRijMmljikvG68fpMMruSc=
|
golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g=
|
||||||
golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58=
|
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
|
||||||
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
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=
|
||||||
|
@ -1801,8 +1801,8 @@ golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||||
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||||
golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
|
golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
|
||||||
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY=
|
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY=
|
||||||
golang.org/x/mod v0.6.0 h1:b9gGHsz9/HhJ3HF5DHQytPpuwocVTChQJK3AvoLRD5I=
|
golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8=
|
||||||
golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI=
|
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||||
|
@ -1876,8 +1876,8 @@ golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qx
|
||||||
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||||
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||||
golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||||
golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
|
golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
|
||||||
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
golang.org/x/oauth2 v0.0.0-20181017192945-9dcd33a902f4/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||||
|
@ -1916,8 +1916,8 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ
|
||||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 h1:uVc8UZUe6tr40fFVnUP5Oj+veunVezqYl9z7DYw9xzw=
|
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
|
||||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20180903190138-2b024373dcd9/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180903190138-2b024373dcd9/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
@ -2048,16 +2048,16 @@ golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||||
golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220330033206-e17cdc41300f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220330033206-e17cdc41300f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
|
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
|
||||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/term v0.0.0-20210503060354-a79de5458b56/go.mod h1:tfny5GFUkzUvx4ps4ajbZsCe5lw1metzhBm9T3x7oIY=
|
golang.org/x/term v0.0.0-20210503060354-a79de5458b56/go.mod h1:tfny5GFUkzUvx4ps4ajbZsCe5lw1metzhBm9T3x7oIY=
|
||||||
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||||
golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY=
|
golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols=
|
||||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
|
||||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/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.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
@ -2067,8 +2067,8 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||||
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
|
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
|
||||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||||
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
|
@ -2164,8 +2164,8 @@ golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||||
golang.org/x/tools v0.1.6-0.20210820212750-d4cc65f0b2ff/go.mod h1:YD9qOF0M9xpSpdWTBbzEl5e/RnCefISl8E5Noe10jFM=
|
golang.org/x/tools v0.1.6-0.20210820212750-d4cc65f0b2ff/go.mod h1:YD9qOF0M9xpSpdWTBbzEl5e/RnCefISl8E5Noe10jFM=
|
||||||
golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU=
|
golang.org/x/tools v0.1.8/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU=
|
||||||
golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E=
|
golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E=
|
||||||
golang.org/x/tools v0.2.0 h1:G6AHpWxTMGY1KyEYoAQ5WTtIekUUvDNjan3ugu60JvE=
|
golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM=
|
||||||
golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA=
|
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
|
|
@ -4,6 +4,7 @@ package ssh
|
||||||
// Licensed under the Apache License 2.0.
|
// Licensed under the Apache License 2.0.
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"crypto/rsa"
|
"crypto/rsa"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
@ -11,10 +12,12 @@ import (
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
"text/template"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
cryptossh "golang.org/x/crypto/ssh"
|
cryptossh "golang.org/x/crypto/ssh"
|
||||||
|
"golang.org/x/crypto/ssh/knownhosts"
|
||||||
|
|
||||||
"github.com/Azure/ARO-RP/pkg/api"
|
"github.com/Azure/ARO-RP/pkg/api"
|
||||||
"github.com/Azure/ARO-RP/pkg/api/validate"
|
"github.com/Azure/ARO-RP/pkg/api/validate"
|
||||||
|
@ -42,6 +45,8 @@ type SSH struct {
|
||||||
dialer proxy.Dialer
|
dialer proxy.Dialer
|
||||||
|
|
||||||
baseServerConfig *cryptossh.ServerConfig
|
baseServerConfig *cryptossh.ServerConfig
|
||||||
|
|
||||||
|
hostPubKey cryptossh.PublicKey
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(env env.Core,
|
func New(env env.Core,
|
||||||
|
@ -54,6 +59,11 @@ func New(env env.Core,
|
||||||
dbPortal database.Portal,
|
dbPortal database.Portal,
|
||||||
dialer proxy.Dialer,
|
dialer proxy.Dialer,
|
||||||
) (*SSH, error) {
|
) (*SSH, error) {
|
||||||
|
hostPubKey, err := cryptossh.NewPublicKey(&hostKey.PublicKey)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
s := &SSH{
|
s := &SSH{
|
||||||
env: env,
|
env: env,
|
||||||
log: log,
|
log: log,
|
||||||
|
@ -68,6 +78,8 @@ func New(env env.Core,
|
||||||
dialer: dialer,
|
dialer: dialer,
|
||||||
|
|
||||||
baseServerConfig: &cryptossh.ServerConfig{},
|
baseServerConfig: &cryptossh.ServerConfig{},
|
||||||
|
|
||||||
|
hostPubKey: hostPubKey,
|
||||||
}
|
}
|
||||||
|
|
||||||
signer, err := cryptossh.NewSignerFromSigner(hostKey)
|
signer, err := cryptossh.NewSignerFromSigner(hostKey)
|
||||||
|
@ -122,9 +134,7 @@ func (s *SSH) New(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
elevated := len(middleware.GroupsIntersect(s.elevatedGroupIDs, ctx.Value(middleware.ContextKeyGroups).([]string))) > 0
|
elevated := len(middleware.GroupsIntersect(s.elevatedGroupIDs, ctx.Value(middleware.ContextKeyGroups).([]string))) > 0
|
||||||
if !elevated {
|
if !elevated {
|
||||||
s.sendResponse(w, &response{
|
s.sendResponse(w, "", "", "", "Elevated access is required.", s.env.IsLocalDevelopmentMode())
|
||||||
Error: "Elevated access is required.",
|
|
||||||
})
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,29 +169,58 @@ func (s *SSH) New(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
port := ""
|
s.sendResponse(w, host, username, password, "", s.env.IsLocalDevelopmentMode())
|
||||||
if s.env.IsLocalDevelopmentMode() {
|
|
||||||
port = "-p 2222 "
|
|
||||||
}
|
|
||||||
|
|
||||||
s.sendResponse(w, &response{
|
|
||||||
Command: fmt.Sprintf("ssh %s%s@%s", port, username, host),
|
|
||||||
Password: password,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SSH) sendResponse(w http.ResponseWriter, resp *response) {
|
func (s *SSH) sendResponse(w http.ResponseWriter, hostname, username, password, error string, isLocalDevelopmentMode bool) {
|
||||||
b, err := json.MarshalIndent(resp, "", " ")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
if err != nil {
|
|
||||||
s.internalServerError(w, err)
|
enc := json.NewEncoder(w)
|
||||||
|
enc.SetEscapeHTML(false)
|
||||||
|
enc.SetIndent("", " ")
|
||||||
|
|
||||||
|
if error != "" {
|
||||||
|
err := enc.Encode(response{Error: error})
|
||||||
|
if err != nil {
|
||||||
|
s.internalServerError(w, err)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
command, err := createLoginCommand(isLocalDevelopmentMode, username, hostname, s.hostPubKey)
|
||||||
w.Header().Set("Content-Type", "application/json")
|
resp := response{Command: command, Password: password}
|
||||||
_, _ = w.Write(b)
|
if err != nil {
|
||||||
|
s.internalServerError(w, err)
|
||||||
|
}
|
||||||
|
err = enc.Encode(resp)
|
||||||
|
if err != nil {
|
||||||
|
s.internalServerError(w, err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SSH) internalServerError(w http.ResponseWriter, err error) {
|
func (s *SSH) internalServerError(w http.ResponseWriter, err error) {
|
||||||
s.log.Warn(err)
|
s.log.Warn(err)
|
||||||
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
|
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
sshCommand = "echo '{{ .KnownHostLine }}' > {{.Hostname}}_known_host ; " +
|
||||||
|
"ssh -o UserKnownHostsFile={{.Hostname}}_known_host{{if .IsLocalDevelopmentMode}} -p 2222{{end}} {{.User}}@{{.Hostname}}"
|
||||||
|
)
|
||||||
|
|
||||||
|
func createLoginCommand(isLocalDevelopmentMode bool, user, host string, publicKey cryptossh.PublicKey) (string, error) {
|
||||||
|
line := knownhosts.Line([]string{host}, publicKey)
|
||||||
|
tmp := template.New("command")
|
||||||
|
tmp, err := tmp.Parse(sshCommand)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
type fields struct {
|
||||||
|
User string
|
||||||
|
Hostname string
|
||||||
|
KnownHostLine string
|
||||||
|
IsLocalDevelopmentMode bool
|
||||||
|
}
|
||||||
|
var buff bytes.Buffer
|
||||||
|
err = tmp.Execute(&buff, fields{user, host, line, isLocalDevelopmentMode})
|
||||||
|
return buff.String(), err
|
||||||
|
}
|
||||||
|
|
|
@ -15,6 +15,8 @@ import (
|
||||||
"github.com/golang/mock/gomock"
|
"github.com/golang/mock/gomock"
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
cryptossh "golang.org/x/crypto/ssh"
|
||||||
|
"golang.org/x/crypto/ssh/knownhosts"
|
||||||
|
|
||||||
"github.com/Azure/ARO-RP/pkg/api"
|
"github.com/Azure/ARO-RP/pkg/api"
|
||||||
"github.com/Azure/ARO-RP/pkg/database/cosmosdb"
|
"github.com/Azure/ARO-RP/pkg/database/cosmosdb"
|
||||||
|
@ -36,6 +38,11 @@ func TestNew(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
hostPubKey, err := cryptossh.NewPublicKey(&hostKey.PublicKey)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
khline := knownhosts.Line([]string{"localhost"}, hostPubKey)
|
||||||
|
|
||||||
for _, tt := range []struct {
|
for _, tt := range []struct {
|
||||||
name string
|
name string
|
||||||
|
@ -60,7 +67,11 @@ func TestNew(t *testing.T) {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
wantStatusCode: http.StatusOK,
|
wantStatusCode: http.StatusOK,
|
||||||
wantBody: "{\n \"command\": \"ssh username@localhost\",\n \"password\": \"03030303-0303-0303-0303-030303030001\"\n}",
|
wantBody: `{
|
||||||
|
"command": "echo '` + khline + `' > localhost_known_host ; ssh -o UserKnownHostsFile=localhost_known_host username@localhost",
|
||||||
|
"password": "03030303-0303-0303-0303-030303030001"
|
||||||
|
}
|
||||||
|
`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "bad path",
|
name: "bad path",
|
||||||
|
@ -100,7 +111,7 @@ func TestNew(t *testing.T) {
|
||||||
*r = *r.WithContext(context.WithValue(r.Context(), middleware.ContextKeyGroups, []string{}))
|
*r = *r.WithContext(context.WithValue(r.Context(), middleware.ContextKeyGroups, []string{}))
|
||||||
},
|
},
|
||||||
wantStatusCode: http.StatusOK,
|
wantStatusCode: http.StatusOK,
|
||||||
wantBody: "{\n \"error\": \"Elevated access is required.\"\n}",
|
wantBody: "{\n \"error\": \"Elevated access is required.\"\n}\n",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "sad database",
|
name: "sad database",
|
||||||
|
@ -180,7 +191,7 @@ func TestNew(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if string(b) != tt.wantBody {
|
if string(b) != tt.wantBody {
|
||||||
t.Errorf("%q", string(b))
|
t.Errorf("wanted %s but got %s", tt.wantBody, string(b))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,71 +5,18 @@
|
||||||
// Package curve25519 provides an implementation of the X25519 function, which
|
// Package curve25519 provides an implementation of the X25519 function, which
|
||||||
// performs scalar multiplication on the elliptic curve known as Curve25519.
|
// performs scalar multiplication on the elliptic curve known as Curve25519.
|
||||||
// See RFC 7748.
|
// See RFC 7748.
|
||||||
|
//
|
||||||
|
// Starting in Go 1.20, this package is a wrapper for the X25519 implementation
|
||||||
|
// in the crypto/ecdh package.
|
||||||
package curve25519 // import "golang.org/x/crypto/curve25519"
|
package curve25519 // import "golang.org/x/crypto/curve25519"
|
||||||
|
|
||||||
import (
|
|
||||||
"crypto/subtle"
|
|
||||||
"errors"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"golang.org/x/crypto/curve25519/internal/field"
|
|
||||||
)
|
|
||||||
|
|
||||||
// ScalarMult sets dst to the product scalar * point.
|
// ScalarMult sets dst to the product scalar * point.
|
||||||
//
|
//
|
||||||
// Deprecated: when provided a low-order point, ScalarMult will set dst to all
|
// Deprecated: when provided a low-order point, ScalarMult will set dst to all
|
||||||
// zeroes, irrespective of the scalar. Instead, use the X25519 function, which
|
// zeroes, irrespective of the scalar. Instead, use the X25519 function, which
|
||||||
// will return an error.
|
// will return an error.
|
||||||
func ScalarMult(dst, scalar, point *[32]byte) {
|
func ScalarMult(dst, scalar, point *[32]byte) {
|
||||||
var e [32]byte
|
scalarMult(dst, scalar, point)
|
||||||
|
|
||||||
copy(e[:], scalar[:])
|
|
||||||
e[0] &= 248
|
|
||||||
e[31] &= 127
|
|
||||||
e[31] |= 64
|
|
||||||
|
|
||||||
var x1, x2, z2, x3, z3, tmp0, tmp1 field.Element
|
|
||||||
x1.SetBytes(point[:])
|
|
||||||
x2.One()
|
|
||||||
x3.Set(&x1)
|
|
||||||
z3.One()
|
|
||||||
|
|
||||||
swap := 0
|
|
||||||
for pos := 254; pos >= 0; pos-- {
|
|
||||||
b := e[pos/8] >> uint(pos&7)
|
|
||||||
b &= 1
|
|
||||||
swap ^= int(b)
|
|
||||||
x2.Swap(&x3, swap)
|
|
||||||
z2.Swap(&z3, swap)
|
|
||||||
swap = int(b)
|
|
||||||
|
|
||||||
tmp0.Subtract(&x3, &z3)
|
|
||||||
tmp1.Subtract(&x2, &z2)
|
|
||||||
x2.Add(&x2, &z2)
|
|
||||||
z2.Add(&x3, &z3)
|
|
||||||
z3.Multiply(&tmp0, &x2)
|
|
||||||
z2.Multiply(&z2, &tmp1)
|
|
||||||
tmp0.Square(&tmp1)
|
|
||||||
tmp1.Square(&x2)
|
|
||||||
x3.Add(&z3, &z2)
|
|
||||||
z2.Subtract(&z3, &z2)
|
|
||||||
x2.Multiply(&tmp1, &tmp0)
|
|
||||||
tmp1.Subtract(&tmp1, &tmp0)
|
|
||||||
z2.Square(&z2)
|
|
||||||
|
|
||||||
z3.Mult32(&tmp1, 121666)
|
|
||||||
x3.Square(&x3)
|
|
||||||
tmp0.Add(&tmp0, &z3)
|
|
||||||
z3.Multiply(&x1, &z2)
|
|
||||||
z2.Multiply(&tmp1, &tmp0)
|
|
||||||
}
|
|
||||||
|
|
||||||
x2.Swap(&x3, swap)
|
|
||||||
z2.Swap(&z3, swap)
|
|
||||||
|
|
||||||
z2.Invert(&z2)
|
|
||||||
x2.Multiply(&x2, &z2)
|
|
||||||
copy(dst[:], x2.Bytes())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ScalarBaseMult sets dst to the product scalar * base where base is the
|
// ScalarBaseMult sets dst to the product scalar * base where base is the
|
||||||
|
@ -78,7 +25,7 @@ func ScalarMult(dst, scalar, point *[32]byte) {
|
||||||
// It is recommended to use the X25519 function with Basepoint instead, as
|
// It is recommended to use the X25519 function with Basepoint instead, as
|
||||||
// copying into fixed size arrays can lead to unexpected bugs.
|
// copying into fixed size arrays can lead to unexpected bugs.
|
||||||
func ScalarBaseMult(dst, scalar *[32]byte) {
|
func ScalarBaseMult(dst, scalar *[32]byte) {
|
||||||
ScalarMult(dst, scalar, &basePoint)
|
scalarBaseMult(dst, scalar)
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -91,21 +38,10 @@ const (
|
||||||
// Basepoint is the canonical Curve25519 generator.
|
// Basepoint is the canonical Curve25519 generator.
|
||||||
var Basepoint []byte
|
var Basepoint []byte
|
||||||
|
|
||||||
var basePoint = [32]byte{9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
var basePoint = [32]byte{9}
|
||||||
|
|
||||||
func init() { Basepoint = basePoint[:] }
|
func init() { Basepoint = basePoint[:] }
|
||||||
|
|
||||||
func checkBasepoint() {
|
|
||||||
if subtle.ConstantTimeCompare(Basepoint, []byte{
|
|
||||||
0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
}) != 1 {
|
|
||||||
panic("curve25519: global Basepoint value was modified")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// X25519 returns the result of the scalar multiplication (scalar * point),
|
// X25519 returns the result of the scalar multiplication (scalar * point),
|
||||||
// according to RFC 7748, Section 5. scalar, point and the return value are
|
// according to RFC 7748, Section 5. scalar, point and the return value are
|
||||||
// slices of 32 bytes.
|
// slices of 32 bytes.
|
||||||
|
@ -121,26 +57,3 @@ func X25519(scalar, point []byte) ([]byte, error) {
|
||||||
var dst [32]byte
|
var dst [32]byte
|
||||||
return x25519(&dst, scalar, point)
|
return x25519(&dst, scalar, point)
|
||||||
}
|
}
|
||||||
|
|
||||||
func x25519(dst *[32]byte, scalar, point []byte) ([]byte, error) {
|
|
||||||
var in [32]byte
|
|
||||||
if l := len(scalar); l != 32 {
|
|
||||||
return nil, errors.New("bad scalar length: " + strconv.Itoa(l) + ", expected 32")
|
|
||||||
}
|
|
||||||
if l := len(point); l != 32 {
|
|
||||||
return nil, errors.New("bad point length: " + strconv.Itoa(l) + ", expected 32")
|
|
||||||
}
|
|
||||||
copy(in[:], scalar)
|
|
||||||
if &point[0] == &Basepoint[0] {
|
|
||||||
checkBasepoint()
|
|
||||||
ScalarBaseMult(dst, &in)
|
|
||||||
} else {
|
|
||||||
var base, zero [32]byte
|
|
||||||
copy(base[:], point)
|
|
||||||
ScalarMult(dst, &in, &base)
|
|
||||||
if subtle.ConstantTimeCompare(dst[:], zero[:]) == 1 {
|
|
||||||
return nil, errors.New("bad input point: low order point")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return dst[:], nil
|
|
||||||
}
|
|
||||||
|
|
105
vendor/golang.org/x/crypto/curve25519/curve25519_compat.go
сгенерированный
поставляемый
Normal file
105
vendor/golang.org/x/crypto/curve25519/curve25519_compat.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,105 @@
|
||||||
|
// Copyright 2019 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build !go1.20
|
||||||
|
|
||||||
|
package curve25519
|
||||||
|
|
||||||
|
import (
|
||||||
|
"crypto/subtle"
|
||||||
|
"errors"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"golang.org/x/crypto/curve25519/internal/field"
|
||||||
|
)
|
||||||
|
|
||||||
|
func scalarMult(dst, scalar, point *[32]byte) {
|
||||||
|
var e [32]byte
|
||||||
|
|
||||||
|
copy(e[:], scalar[:])
|
||||||
|
e[0] &= 248
|
||||||
|
e[31] &= 127
|
||||||
|
e[31] |= 64
|
||||||
|
|
||||||
|
var x1, x2, z2, x3, z3, tmp0, tmp1 field.Element
|
||||||
|
x1.SetBytes(point[:])
|
||||||
|
x2.One()
|
||||||
|
x3.Set(&x1)
|
||||||
|
z3.One()
|
||||||
|
|
||||||
|
swap := 0
|
||||||
|
for pos := 254; pos >= 0; pos-- {
|
||||||
|
b := e[pos/8] >> uint(pos&7)
|
||||||
|
b &= 1
|
||||||
|
swap ^= int(b)
|
||||||
|
x2.Swap(&x3, swap)
|
||||||
|
z2.Swap(&z3, swap)
|
||||||
|
swap = int(b)
|
||||||
|
|
||||||
|
tmp0.Subtract(&x3, &z3)
|
||||||
|
tmp1.Subtract(&x2, &z2)
|
||||||
|
x2.Add(&x2, &z2)
|
||||||
|
z2.Add(&x3, &z3)
|
||||||
|
z3.Multiply(&tmp0, &x2)
|
||||||
|
z2.Multiply(&z2, &tmp1)
|
||||||
|
tmp0.Square(&tmp1)
|
||||||
|
tmp1.Square(&x2)
|
||||||
|
x3.Add(&z3, &z2)
|
||||||
|
z2.Subtract(&z3, &z2)
|
||||||
|
x2.Multiply(&tmp1, &tmp0)
|
||||||
|
tmp1.Subtract(&tmp1, &tmp0)
|
||||||
|
z2.Square(&z2)
|
||||||
|
|
||||||
|
z3.Mult32(&tmp1, 121666)
|
||||||
|
x3.Square(&x3)
|
||||||
|
tmp0.Add(&tmp0, &z3)
|
||||||
|
z3.Multiply(&x1, &z2)
|
||||||
|
z2.Multiply(&tmp1, &tmp0)
|
||||||
|
}
|
||||||
|
|
||||||
|
x2.Swap(&x3, swap)
|
||||||
|
z2.Swap(&z3, swap)
|
||||||
|
|
||||||
|
z2.Invert(&z2)
|
||||||
|
x2.Multiply(&x2, &z2)
|
||||||
|
copy(dst[:], x2.Bytes())
|
||||||
|
}
|
||||||
|
|
||||||
|
func scalarBaseMult(dst, scalar *[32]byte) {
|
||||||
|
checkBasepoint()
|
||||||
|
scalarMult(dst, scalar, &basePoint)
|
||||||
|
}
|
||||||
|
|
||||||
|
func x25519(dst *[32]byte, scalar, point []byte) ([]byte, error) {
|
||||||
|
var in [32]byte
|
||||||
|
if l := len(scalar); l != 32 {
|
||||||
|
return nil, errors.New("bad scalar length: " + strconv.Itoa(l) + ", expected 32")
|
||||||
|
}
|
||||||
|
if l := len(point); l != 32 {
|
||||||
|
return nil, errors.New("bad point length: " + strconv.Itoa(l) + ", expected 32")
|
||||||
|
}
|
||||||
|
copy(in[:], scalar)
|
||||||
|
if &point[0] == &Basepoint[0] {
|
||||||
|
scalarBaseMult(dst, &in)
|
||||||
|
} else {
|
||||||
|
var base, zero [32]byte
|
||||||
|
copy(base[:], point)
|
||||||
|
scalarMult(dst, &in, &base)
|
||||||
|
if subtle.ConstantTimeCompare(dst[:], zero[:]) == 1 {
|
||||||
|
return nil, errors.New("bad input point: low order point")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dst[:], nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func checkBasepoint() {
|
||||||
|
if subtle.ConstantTimeCompare(Basepoint, []byte{
|
||||||
|
0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
|
}) != 1 {
|
||||||
|
panic("curve25519: global Basepoint value was modified")
|
||||||
|
}
|
||||||
|
}
|
46
vendor/golang.org/x/crypto/curve25519/curve25519_go120.go
сгенерированный
поставляемый
Normal file
46
vendor/golang.org/x/crypto/curve25519/curve25519_go120.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
// Copyright 2022 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build go1.20
|
||||||
|
|
||||||
|
package curve25519
|
||||||
|
|
||||||
|
import "crypto/ecdh"
|
||||||
|
|
||||||
|
func x25519(dst *[32]byte, scalar, point []byte) ([]byte, error) {
|
||||||
|
curve := ecdh.X25519()
|
||||||
|
pub, err := curve.NewPublicKey(point)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
priv, err := curve.NewPrivateKey(scalar)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
out, err := priv.ECDH(pub)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
copy(dst[:], out)
|
||||||
|
return dst[:], nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func scalarMult(dst, scalar, point *[32]byte) {
|
||||||
|
if _, err := x25519(dst, scalar[:], point[:]); err != nil {
|
||||||
|
// The only error condition for x25519 when the inputs are 32 bytes long
|
||||||
|
// is if the output would have been the all-zero value.
|
||||||
|
for i := range dst {
|
||||||
|
dst[i] = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func scalarBaseMult(dst, scalar *[32]byte) {
|
||||||
|
curve := ecdh.X25519()
|
||||||
|
priv, err := curve.NewPrivateKey(scalar[:])
|
||||||
|
if err != nil {
|
||||||
|
panic("curve25519: internal error: scalarBaseMult was not 32 bytes")
|
||||||
|
}
|
||||||
|
copy(dst[:], priv.PublicKey().Bytes())
|
||||||
|
}
|
|
@ -60,7 +60,7 @@ func (c *Compressed) parse(r io.Reader) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// compressedWriterCloser represents the serialized compression stream
|
// compressedWriteCloser represents the serialized compression stream
|
||||||
// header and the compressor. Its Close() method ensures that both the
|
// header and the compressor. Its Close() method ensures that both the
|
||||||
// compressor and serialized stream header are closed. Its Write()
|
// compressor and serialized stream header are closed. Its Write()
|
||||||
// method writes to the compressor.
|
// method writes to the compressor.
|
||||||
|
|
|
@ -20,7 +20,7 @@ import (
|
||||||
"golang.org/x/crypto/ssh"
|
"golang.org/x/crypto/ssh"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Server wraps an Agent and uses it to implement the agent side of
|
// server wraps an Agent and uses it to implement the agent side of
|
||||||
// the SSH-agent, wire protocol.
|
// the SSH-agent, wire protocol.
|
||||||
type server struct {
|
type server struct {
|
||||||
agent Agent
|
agent Agent
|
||||||
|
|
|
@ -114,7 +114,8 @@ var cipherModes = map[string]*cipherMode{
|
||||||
"arcfour": {16, 0, streamCipherMode(0, newRC4)},
|
"arcfour": {16, 0, streamCipherMode(0, newRC4)},
|
||||||
|
|
||||||
// AEAD ciphers
|
// AEAD ciphers
|
||||||
gcmCipherID: {16, 12, newGCMCipher},
|
gcm128CipherID: {16, 12, newGCMCipher},
|
||||||
|
gcm256CipherID: {32, 12, newGCMCipher},
|
||||||
chacha20Poly1305ID: {64, 0, newChaCha20Cipher},
|
chacha20Poly1305ID: {64, 0, newChaCha20Cipher},
|
||||||
|
|
||||||
// CBC mode is insecure and so is not included in the default config.
|
// CBC mode is insecure and so is not included in the default config.
|
||||||
|
|
|
@ -28,7 +28,7 @@ const (
|
||||||
// supportedCiphers lists ciphers we support but might not recommend.
|
// supportedCiphers lists ciphers we support but might not recommend.
|
||||||
var supportedCiphers = []string{
|
var supportedCiphers = []string{
|
||||||
"aes128-ctr", "aes192-ctr", "aes256-ctr",
|
"aes128-ctr", "aes192-ctr", "aes256-ctr",
|
||||||
"aes128-gcm@openssh.com",
|
"aes128-gcm@openssh.com", gcm256CipherID,
|
||||||
chacha20Poly1305ID,
|
chacha20Poly1305ID,
|
||||||
"arcfour256", "arcfour128", "arcfour",
|
"arcfour256", "arcfour128", "arcfour",
|
||||||
aes128cbcID,
|
aes128cbcID,
|
||||||
|
@ -37,7 +37,7 @@ var supportedCiphers = []string{
|
||||||
|
|
||||||
// preferredCiphers specifies the default preference for ciphers.
|
// preferredCiphers specifies the default preference for ciphers.
|
||||||
var preferredCiphers = []string{
|
var preferredCiphers = []string{
|
||||||
"aes128-gcm@openssh.com",
|
"aes128-gcm@openssh.com", gcm256CipherID,
|
||||||
chacha20Poly1305ID,
|
chacha20Poly1305ID,
|
||||||
"aes128-ctr", "aes192-ctr", "aes256-ctr",
|
"aes128-ctr", "aes192-ctr", "aes256-ctr",
|
||||||
}
|
}
|
||||||
|
@ -168,7 +168,7 @@ func (a *directionAlgorithms) rekeyBytes() int64 {
|
||||||
// 2^(BLOCKSIZE/4) blocks. For all AES flavors BLOCKSIZE is
|
// 2^(BLOCKSIZE/4) blocks. For all AES flavors BLOCKSIZE is
|
||||||
// 128.
|
// 128.
|
||||||
switch a.Cipher {
|
switch a.Cipher {
|
||||||
case "aes128-ctr", "aes192-ctr", "aes256-ctr", gcmCipherID, aes128cbcID:
|
case "aes128-ctr", "aes192-ctr", "aes256-ctr", gcm128CipherID, gcm256CipherID, aes128cbcID:
|
||||||
return 16 * (1 << 32)
|
return 16 * (1 << 32)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,8 @@ func (a *directionAlgorithms) rekeyBytes() int64 {
|
||||||
}
|
}
|
||||||
|
|
||||||
var aeadCiphers = map[string]bool{
|
var aeadCiphers = map[string]bool{
|
||||||
gcmCipherID: true,
|
gcm128CipherID: true,
|
||||||
|
gcm256CipherID: true,
|
||||||
chacha20Poly1305ID: true,
|
chacha20Poly1305ID: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ func (c *connection) Close() error {
|
||||||
return c.sshConn.conn.Close()
|
return c.sshConn.conn.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
// sshconn provides net.Conn metadata, but disallows direct reads and
|
// sshConn provides net.Conn metadata, but disallows direct reads and
|
||||||
// writes.
|
// writes.
|
||||||
type sshConn struct {
|
type sshConn struct {
|
||||||
conn net.Conn
|
conn net.Conn
|
||||||
|
|
|
@ -1087,9 +1087,9 @@ func (*PassphraseMissingError) Error() string {
|
||||||
return "ssh: this private key is passphrase protected"
|
return "ssh: this private key is passphrase protected"
|
||||||
}
|
}
|
||||||
|
|
||||||
// ParseRawPrivateKey returns a private key from a PEM encoded private key. It
|
// ParseRawPrivateKey returns a private key from a PEM encoded private key. It supports
|
||||||
// supports RSA (PKCS#1), PKCS#8, DSA (OpenSSL), and ECDSA private keys. If the
|
// RSA, DSA, ECDSA, and Ed25519 private keys in PKCS#1, PKCS#8, OpenSSL, and OpenSSH
|
||||||
// private key is encrypted, it will return a PassphraseMissingError.
|
// formats. If the private key is encrypted, it will return a PassphraseMissingError.
|
||||||
func ParseRawPrivateKey(pemBytes []byte) (interface{}, error) {
|
func ParseRawPrivateKey(pemBytes []byte) (interface{}, error) {
|
||||||
block, _ := pem.Decode(pemBytes)
|
block, _ := pem.Decode(pemBytes)
|
||||||
if block == nil {
|
if block == nil {
|
||||||
|
|
540
vendor/golang.org/x/crypto/ssh/knownhosts/knownhosts.go
сгенерированный
поставляемый
Normal file
540
vendor/golang.org/x/crypto/ssh/knownhosts/knownhosts.go
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,540 @@
|
||||||
|
// 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 knownhosts implements a parser for the OpenSSH known_hosts
|
||||||
|
// host key database, and provides utility functions for writing
|
||||||
|
// OpenSSH compliant known_hosts files.
|
||||||
|
package knownhosts
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bufio"
|
||||||
|
"bytes"
|
||||||
|
"crypto/hmac"
|
||||||
|
"crypto/rand"
|
||||||
|
"crypto/sha1"
|
||||||
|
"encoding/base64"
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"net"
|
||||||
|
"os"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"golang.org/x/crypto/ssh"
|
||||||
|
)
|
||||||
|
|
||||||
|
// See the sshd manpage
|
||||||
|
// (http://man.openbsd.org/sshd#SSH_KNOWN_HOSTS_FILE_FORMAT) for
|
||||||
|
// background.
|
||||||
|
|
||||||
|
type addr struct{ host, port string }
|
||||||
|
|
||||||
|
func (a *addr) String() string {
|
||||||
|
h := a.host
|
||||||
|
if strings.Contains(h, ":") {
|
||||||
|
h = "[" + h + "]"
|
||||||
|
}
|
||||||
|
return h + ":" + a.port
|
||||||
|
}
|
||||||
|
|
||||||
|
type matcher interface {
|
||||||
|
match(addr) bool
|
||||||
|
}
|
||||||
|
|
||||||
|
type hostPattern struct {
|
||||||
|
negate bool
|
||||||
|
addr addr
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *hostPattern) String() string {
|
||||||
|
n := ""
|
||||||
|
if p.negate {
|
||||||
|
n = "!"
|
||||||
|
}
|
||||||
|
|
||||||
|
return n + p.addr.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
type hostPatterns []hostPattern
|
||||||
|
|
||||||
|
func (ps hostPatterns) match(a addr) bool {
|
||||||
|
matched := false
|
||||||
|
for _, p := range ps {
|
||||||
|
if !p.match(a) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if p.negate {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
matched = true
|
||||||
|
}
|
||||||
|
return matched
|
||||||
|
}
|
||||||
|
|
||||||
|
// See
|
||||||
|
// https://android.googlesource.com/platform/external/openssh/+/ab28f5495c85297e7a597c1ba62e996416da7c7e/addrmatch.c
|
||||||
|
// The matching of * has no regard for separators, unlike filesystem globs
|
||||||
|
func wildcardMatch(pat []byte, str []byte) bool {
|
||||||
|
for {
|
||||||
|
if len(pat) == 0 {
|
||||||
|
return len(str) == 0
|
||||||
|
}
|
||||||
|
if len(str) == 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if pat[0] == '*' {
|
||||||
|
if len(pat) == 1 {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
for j := range str {
|
||||||
|
if wildcardMatch(pat[1:], str[j:]) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if pat[0] == '?' || pat[0] == str[0] {
|
||||||
|
pat = pat[1:]
|
||||||
|
str = str[1:]
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *hostPattern) match(a addr) bool {
|
||||||
|
return wildcardMatch([]byte(p.addr.host), []byte(a.host)) && p.addr.port == a.port
|
||||||
|
}
|
||||||
|
|
||||||
|
type keyDBLine struct {
|
||||||
|
cert bool
|
||||||
|
matcher matcher
|
||||||
|
knownKey KnownKey
|
||||||
|
}
|
||||||
|
|
||||||
|
func serialize(k ssh.PublicKey) string {
|
||||||
|
return k.Type() + " " + base64.StdEncoding.EncodeToString(k.Marshal())
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *keyDBLine) match(a addr) bool {
|
||||||
|
return l.matcher.match(a)
|
||||||
|
}
|
||||||
|
|
||||||
|
type hostKeyDB struct {
|
||||||
|
// Serialized version of revoked keys
|
||||||
|
revoked map[string]*KnownKey
|
||||||
|
lines []keyDBLine
|
||||||
|
}
|
||||||
|
|
||||||
|
func newHostKeyDB() *hostKeyDB {
|
||||||
|
db := &hostKeyDB{
|
||||||
|
revoked: make(map[string]*KnownKey),
|
||||||
|
}
|
||||||
|
|
||||||
|
return db
|
||||||
|
}
|
||||||
|
|
||||||
|
func keyEq(a, b ssh.PublicKey) bool {
|
||||||
|
return bytes.Equal(a.Marshal(), b.Marshal())
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsHostAuthority can be used as a callback in ssh.CertChecker
|
||||||
|
func (db *hostKeyDB) IsHostAuthority(remote ssh.PublicKey, address string) bool {
|
||||||
|
h, p, err := net.SplitHostPort(address)
|
||||||
|
if err != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
a := addr{host: h, port: p}
|
||||||
|
|
||||||
|
for _, l := range db.lines {
|
||||||
|
if l.cert && keyEq(l.knownKey.Key, remote) && l.match(a) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsRevoked can be used as a callback in ssh.CertChecker
|
||||||
|
func (db *hostKeyDB) IsRevoked(key *ssh.Certificate) bool {
|
||||||
|
_, ok := db.revoked[string(key.Marshal())]
|
||||||
|
return ok
|
||||||
|
}
|
||||||
|
|
||||||
|
const markerCert = "@cert-authority"
|
||||||
|
const markerRevoked = "@revoked"
|
||||||
|
|
||||||
|
func nextWord(line []byte) (string, []byte) {
|
||||||
|
i := bytes.IndexAny(line, "\t ")
|
||||||
|
if i == -1 {
|
||||||
|
return string(line), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return string(line[:i]), bytes.TrimSpace(line[i:])
|
||||||
|
}
|
||||||
|
|
||||||
|
func parseLine(line []byte) (marker, host string, key ssh.PublicKey, err error) {
|
||||||
|
if w, next := nextWord(line); w == markerCert || w == markerRevoked {
|
||||||
|
marker = w
|
||||||
|
line = next
|
||||||
|
}
|
||||||
|
|
||||||
|
host, line = nextWord(line)
|
||||||
|
if len(line) == 0 {
|
||||||
|
return "", "", nil, errors.New("knownhosts: missing host pattern")
|
||||||
|
}
|
||||||
|
|
||||||
|
// ignore the keytype as it's in the key blob anyway.
|
||||||
|
_, line = nextWord(line)
|
||||||
|
if len(line) == 0 {
|
||||||
|
return "", "", nil, errors.New("knownhosts: missing key type pattern")
|
||||||
|
}
|
||||||
|
|
||||||
|
keyBlob, _ := nextWord(line)
|
||||||
|
|
||||||
|
keyBytes, err := base64.StdEncoding.DecodeString(keyBlob)
|
||||||
|
if err != nil {
|
||||||
|
return "", "", nil, err
|
||||||
|
}
|
||||||
|
key, err = ssh.ParsePublicKey(keyBytes)
|
||||||
|
if err != nil {
|
||||||
|
return "", "", nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return marker, host, key, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (db *hostKeyDB) parseLine(line []byte, filename string, linenum int) error {
|
||||||
|
marker, pattern, key, err := parseLine(line)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if marker == markerRevoked {
|
||||||
|
db.revoked[string(key.Marshal())] = &KnownKey{
|
||||||
|
Key: key,
|
||||||
|
Filename: filename,
|
||||||
|
Line: linenum,
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
entry := keyDBLine{
|
||||||
|
cert: marker == markerCert,
|
||||||
|
knownKey: KnownKey{
|
||||||
|
Filename: filename,
|
||||||
|
Line: linenum,
|
||||||
|
Key: key,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
if pattern[0] == '|' {
|
||||||
|
entry.matcher, err = newHashedHost(pattern)
|
||||||
|
} else {
|
||||||
|
entry.matcher, err = newHostnameMatcher(pattern)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
db.lines = append(db.lines, entry)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func newHostnameMatcher(pattern string) (matcher, error) {
|
||||||
|
var hps hostPatterns
|
||||||
|
for _, p := range strings.Split(pattern, ",") {
|
||||||
|
if len(p) == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
var a addr
|
||||||
|
var negate bool
|
||||||
|
if p[0] == '!' {
|
||||||
|
negate = true
|
||||||
|
p = p[1:]
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(p) == 0 {
|
||||||
|
return nil, errors.New("knownhosts: negation without following hostname")
|
||||||
|
}
|
||||||
|
|
||||||
|
var err error
|
||||||
|
if p[0] == '[' {
|
||||||
|
a.host, a.port, err = net.SplitHostPort(p)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
a.host, a.port, err = net.SplitHostPort(p)
|
||||||
|
if err != nil {
|
||||||
|
a.host = p
|
||||||
|
a.port = "22"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hps = append(hps, hostPattern{
|
||||||
|
negate: negate,
|
||||||
|
addr: a,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return hps, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// KnownKey represents a key declared in a known_hosts file.
|
||||||
|
type KnownKey struct {
|
||||||
|
Key ssh.PublicKey
|
||||||
|
Filename string
|
||||||
|
Line int
|
||||||
|
}
|
||||||
|
|
||||||
|
func (k *KnownKey) String() string {
|
||||||
|
return fmt.Sprintf("%s:%d: %s", k.Filename, k.Line, serialize(k.Key))
|
||||||
|
}
|
||||||
|
|
||||||
|
// KeyError is returned if we did not find the key in the host key
|
||||||
|
// database, or there was a mismatch. Typically, in batch
|
||||||
|
// applications, this should be interpreted as failure. Interactive
|
||||||
|
// applications can offer an interactive prompt to the user.
|
||||||
|
type KeyError struct {
|
||||||
|
// Want holds the accepted host keys. For each key algorithm,
|
||||||
|
// there can be one hostkey. If Want is empty, the host is
|
||||||
|
// unknown. If Want is non-empty, there was a mismatch, which
|
||||||
|
// can signify a MITM attack.
|
||||||
|
Want []KnownKey
|
||||||
|
}
|
||||||
|
|
||||||
|
func (u *KeyError) Error() string {
|
||||||
|
if len(u.Want) == 0 {
|
||||||
|
return "knownhosts: key is unknown"
|
||||||
|
}
|
||||||
|
return "knownhosts: key mismatch"
|
||||||
|
}
|
||||||
|
|
||||||
|
// RevokedError is returned if we found a key that was revoked.
|
||||||
|
type RevokedError struct {
|
||||||
|
Revoked KnownKey
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *RevokedError) Error() string {
|
||||||
|
return "knownhosts: key is revoked"
|
||||||
|
}
|
||||||
|
|
||||||
|
// check checks a key against the host database. This should not be
|
||||||
|
// used for verifying certificates.
|
||||||
|
func (db *hostKeyDB) check(address string, remote net.Addr, remoteKey ssh.PublicKey) error {
|
||||||
|
if revoked := db.revoked[string(remoteKey.Marshal())]; revoked != nil {
|
||||||
|
return &RevokedError{Revoked: *revoked}
|
||||||
|
}
|
||||||
|
|
||||||
|
host, port, err := net.SplitHostPort(remote.String())
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("knownhosts: SplitHostPort(%s): %v", remote, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
hostToCheck := addr{host, port}
|
||||||
|
if address != "" {
|
||||||
|
// Give preference to the hostname if available.
|
||||||
|
host, port, err := net.SplitHostPort(address)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("knownhosts: SplitHostPort(%s): %v", address, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
hostToCheck = addr{host, port}
|
||||||
|
}
|
||||||
|
|
||||||
|
return db.checkAddr(hostToCheck, remoteKey)
|
||||||
|
}
|
||||||
|
|
||||||
|
// checkAddr checks if we can find the given public key for the
|
||||||
|
// given address. If we only find an entry for the IP address,
|
||||||
|
// or only the hostname, then this still succeeds.
|
||||||
|
func (db *hostKeyDB) checkAddr(a addr, remoteKey ssh.PublicKey) error {
|
||||||
|
// TODO(hanwen): are these the right semantics? What if there
|
||||||
|
// is just a key for the IP address, but not for the
|
||||||
|
// hostname?
|
||||||
|
|
||||||
|
// Algorithm => key.
|
||||||
|
knownKeys := map[string]KnownKey{}
|
||||||
|
for _, l := range db.lines {
|
||||||
|
if l.match(a) {
|
||||||
|
typ := l.knownKey.Key.Type()
|
||||||
|
if _, ok := knownKeys[typ]; !ok {
|
||||||
|
knownKeys[typ] = l.knownKey
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
keyErr := &KeyError{}
|
||||||
|
for _, v := range knownKeys {
|
||||||
|
keyErr.Want = append(keyErr.Want, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unknown remote host.
|
||||||
|
if len(knownKeys) == 0 {
|
||||||
|
return keyErr
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the remote host starts using a different, unknown key type, we
|
||||||
|
// also interpret that as a mismatch.
|
||||||
|
if known, ok := knownKeys[remoteKey.Type()]; !ok || !keyEq(known.Key, remoteKey) {
|
||||||
|
return keyErr
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// The Read function parses file contents.
|
||||||
|
func (db *hostKeyDB) Read(r io.Reader, filename string) error {
|
||||||
|
scanner := bufio.NewScanner(r)
|
||||||
|
|
||||||
|
lineNum := 0
|
||||||
|
for scanner.Scan() {
|
||||||
|
lineNum++
|
||||||
|
line := scanner.Bytes()
|
||||||
|
line = bytes.TrimSpace(line)
|
||||||
|
if len(line) == 0 || line[0] == '#' {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := db.parseLine(line, filename, lineNum); err != nil {
|
||||||
|
return fmt.Errorf("knownhosts: %s:%d: %v", filename, lineNum, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return scanner.Err()
|
||||||
|
}
|
||||||
|
|
||||||
|
// New creates a host key callback from the given OpenSSH host key
|
||||||
|
// files. The returned callback is for use in
|
||||||
|
// ssh.ClientConfig.HostKeyCallback. By preference, the key check
|
||||||
|
// operates on the hostname if available, i.e. if a server changes its
|
||||||
|
// IP address, the host key check will still succeed, even though a
|
||||||
|
// record of the new IP address is not available.
|
||||||
|
func New(files ...string) (ssh.HostKeyCallback, error) {
|
||||||
|
db := newHostKeyDB()
|
||||||
|
for _, fn := range files {
|
||||||
|
f, err := os.Open(fn)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer f.Close()
|
||||||
|
if err := db.Read(f, fn); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var certChecker ssh.CertChecker
|
||||||
|
certChecker.IsHostAuthority = db.IsHostAuthority
|
||||||
|
certChecker.IsRevoked = db.IsRevoked
|
||||||
|
certChecker.HostKeyFallback = db.check
|
||||||
|
|
||||||
|
return certChecker.CheckHostKey, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Normalize normalizes an address into the form used in known_hosts
|
||||||
|
func Normalize(address string) string {
|
||||||
|
host, port, err := net.SplitHostPort(address)
|
||||||
|
if err != nil {
|
||||||
|
host = address
|
||||||
|
port = "22"
|
||||||
|
}
|
||||||
|
entry := host
|
||||||
|
if port != "22" {
|
||||||
|
entry = "[" + entry + "]:" + port
|
||||||
|
} else if strings.Contains(host, ":") && !strings.HasPrefix(host, "[") {
|
||||||
|
entry = "[" + entry + "]"
|
||||||
|
}
|
||||||
|
return entry
|
||||||
|
}
|
||||||
|
|
||||||
|
// Line returns a line to add append to the known_hosts files.
|
||||||
|
func Line(addresses []string, key ssh.PublicKey) string {
|
||||||
|
var trimmed []string
|
||||||
|
for _, a := range addresses {
|
||||||
|
trimmed = append(trimmed, Normalize(a))
|
||||||
|
}
|
||||||
|
|
||||||
|
return strings.Join(trimmed, ",") + " " + serialize(key)
|
||||||
|
}
|
||||||
|
|
||||||
|
// HashHostname hashes the given hostname. The hostname is not
|
||||||
|
// normalized before hashing.
|
||||||
|
func HashHostname(hostname string) string {
|
||||||
|
// TODO(hanwen): check if we can safely normalize this always.
|
||||||
|
salt := make([]byte, sha1.Size)
|
||||||
|
|
||||||
|
_, err := rand.Read(salt)
|
||||||
|
if err != nil {
|
||||||
|
panic(fmt.Sprintf("crypto/rand failure %v", err))
|
||||||
|
}
|
||||||
|
|
||||||
|
hash := hashHost(hostname, salt)
|
||||||
|
return encodeHash(sha1HashType, salt, hash)
|
||||||
|
}
|
||||||
|
|
||||||
|
func decodeHash(encoded string) (hashType string, salt, hash []byte, err error) {
|
||||||
|
if len(encoded) == 0 || encoded[0] != '|' {
|
||||||
|
err = errors.New("knownhosts: hashed host must start with '|'")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
components := strings.Split(encoded, "|")
|
||||||
|
if len(components) != 4 {
|
||||||
|
err = fmt.Errorf("knownhosts: got %d components, want 3", len(components))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
hashType = components[1]
|
||||||
|
if salt, err = base64.StdEncoding.DecodeString(components[2]); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if hash, err = base64.StdEncoding.DecodeString(components[3]); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func encodeHash(typ string, salt []byte, hash []byte) string {
|
||||||
|
return strings.Join([]string{"",
|
||||||
|
typ,
|
||||||
|
base64.StdEncoding.EncodeToString(salt),
|
||||||
|
base64.StdEncoding.EncodeToString(hash),
|
||||||
|
}, "|")
|
||||||
|
}
|
||||||
|
|
||||||
|
// See https://android.googlesource.com/platform/external/openssh/+/ab28f5495c85297e7a597c1ba62e996416da7c7e/hostfile.c#120
|
||||||
|
func hashHost(hostname string, salt []byte) []byte {
|
||||||
|
mac := hmac.New(sha1.New, salt)
|
||||||
|
mac.Write([]byte(hostname))
|
||||||
|
return mac.Sum(nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
type hashedHost struct {
|
||||||
|
salt []byte
|
||||||
|
hash []byte
|
||||||
|
}
|
||||||
|
|
||||||
|
const sha1HashType = "1"
|
||||||
|
|
||||||
|
func newHashedHost(encoded string) (*hashedHost, error) {
|
||||||
|
typ, salt, hash, err := decodeHash(encoded)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// The type field seems for future algorithm agility, but it's
|
||||||
|
// actually hardcoded in openssh currently, see
|
||||||
|
// https://android.googlesource.com/platform/external/openssh/+/ab28f5495c85297e7a597c1ba62e996416da7c7e/hostfile.c#120
|
||||||
|
if typ != sha1HashType {
|
||||||
|
return nil, fmt.Errorf("knownhosts: got hash type %s, must be '1'", typ)
|
||||||
|
}
|
||||||
|
|
||||||
|
return &hashedHost{salt: salt, hash: hash}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (h *hashedHost) match(a addr) bool {
|
||||||
|
return bytes.Equal(hashHost(Normalize(a.String()), h.salt), h.hash)
|
||||||
|
}
|
|
@ -17,7 +17,8 @@ import (
|
||||||
const debugTransport = false
|
const debugTransport = false
|
||||||
|
|
||||||
const (
|
const (
|
||||||
gcmCipherID = "aes128-gcm@openssh.com"
|
gcm128CipherID = "aes128-gcm@openssh.com"
|
||||||
|
gcm256CipherID = "aes256-gcm@openssh.com"
|
||||||
aes128cbcID = "aes128-cbc"
|
aes128cbcID = "aes128-cbc"
|
||||||
tripledescbcID = "3des-cbc"
|
tripledescbcID = "3des-cbc"
|
||||||
)
|
)
|
||||||
|
|
|
@ -92,6 +92,27 @@ example, to process each anchor node in depth-first order:
|
||||||
The relevant specifications include:
|
The relevant specifications include:
|
||||||
https://html.spec.whatwg.org/multipage/syntax.html and
|
https://html.spec.whatwg.org/multipage/syntax.html and
|
||||||
https://html.spec.whatwg.org/multipage/syntax.html#tokenization
|
https://html.spec.whatwg.org/multipage/syntax.html#tokenization
|
||||||
|
|
||||||
|
# Security Considerations
|
||||||
|
|
||||||
|
Care should be taken when parsing and interpreting HTML, whether full documents
|
||||||
|
or fragments, within the framework of the HTML specification, especially with
|
||||||
|
regard to untrusted inputs.
|
||||||
|
|
||||||
|
This package provides both a tokenizer and a parser, which implement the
|
||||||
|
tokenization, and tokenization and tree construction stages of the WHATWG HTML
|
||||||
|
parsing specification respectively. While the tokenizer parses and normalizes
|
||||||
|
individual HTML tokens, only the parser constructs the DOM tree from the
|
||||||
|
tokenized HTML, as described in the tree construction stage of the
|
||||||
|
specification, dynamically modifying or extending the docuemnt's DOM tree.
|
||||||
|
|
||||||
|
If your use case requires semantically well-formed HTML documents, as defined by
|
||||||
|
the WHATWG specification, the parser should be used rather than the tokenizer.
|
||||||
|
|
||||||
|
In security contexts, if trust decisions are being made using the tokenized or
|
||||||
|
parsed content, the input must be re-serialized (for instance by using Render or
|
||||||
|
Token.String) in order for those trust decisions to hold, as the process of
|
||||||
|
tokenization or parsing may alter the content.
|
||||||
*/
|
*/
|
||||||
package html // import "golang.org/x/net/html"
|
package html // import "golang.org/x/net/html"
|
||||||
|
|
||||||
|
|
|
@ -193,6 +193,87 @@ func lower(b []byte) []byte {
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// escapeComment is like func escape but escapes its input bytes less often.
|
||||||
|
// Per https://github.com/golang/go/issues/58246 some HTML comments are (1)
|
||||||
|
// meaningful and (2) contain angle brackets that we'd like to avoid escaping
|
||||||
|
// unless we have to.
|
||||||
|
//
|
||||||
|
// "We have to" includes the '&' byte, since that introduces other escapes.
|
||||||
|
//
|
||||||
|
// It also includes those bytes (not including EOF) that would otherwise end
|
||||||
|
// the comment. Per the summary table at the bottom of comment_test.go, this is
|
||||||
|
// the '>' byte that, per above, we'd like to avoid escaping unless we have to.
|
||||||
|
//
|
||||||
|
// Studying the summary table (and T actions in its '>' column) closely, we
|
||||||
|
// only need to escape in states 43, 44, 49, 51 and 52. State 43 is at the
|
||||||
|
// start of the comment data. State 52 is after a '!'. The other three states
|
||||||
|
// are after a '-'.
|
||||||
|
//
|
||||||
|
// Our algorithm is thus to escape every '&' and to escape '>' if and only if:
|
||||||
|
// - The '>' is after a '!' or '-' (in the unescaped data) or
|
||||||
|
// - The '>' is at the start of the comment data (after the opening "<!--").
|
||||||
|
func escapeComment(w writer, s string) error {
|
||||||
|
// When modifying this function, consider manually increasing the
|
||||||
|
// maxSuffixLen constant in func TestComments, from 6 to e.g. 9 or more.
|
||||||
|
// That increase should only be temporary, not committed, as it
|
||||||
|
// exponentially affects the test running time.
|
||||||
|
|
||||||
|
if len(s) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Loop:
|
||||||
|
// - Grow j such that s[i:j] does not need escaping.
|
||||||
|
// - If s[j] does need escaping, output s[i:j] and an escaped s[j],
|
||||||
|
// resetting i and j to point past that s[j] byte.
|
||||||
|
i := 0
|
||||||
|
for j := 0; j < len(s); j++ {
|
||||||
|
escaped := ""
|
||||||
|
switch s[j] {
|
||||||
|
case '&':
|
||||||
|
escaped = "&"
|
||||||
|
|
||||||
|
case '>':
|
||||||
|
if j > 0 {
|
||||||
|
if prev := s[j-1]; (prev != '!') && (prev != '-') {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
escaped = ">"
|
||||||
|
|
||||||
|
default:
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if i < j {
|
||||||
|
if _, err := w.WriteString(s[i:j]); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if _, err := w.WriteString(escaped); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
i = j + 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if i < len(s) {
|
||||||
|
if _, err := w.WriteString(s[i:]); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// escapeCommentString is to EscapeString as escapeComment is to escape.
|
||||||
|
func escapeCommentString(s string) string {
|
||||||
|
if strings.IndexAny(s, "&>") == -1 {
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
var buf bytes.Buffer
|
||||||
|
escapeComment(&buf, s)
|
||||||
|
return buf.String()
|
||||||
|
}
|
||||||
|
|
||||||
const escapedChars = "&'<>\"\r"
|
const escapedChars = "&'<>\"\r"
|
||||||
|
|
||||||
func escape(w writer, s string) error {
|
func escape(w writer, s string) error {
|
||||||
|
|
|
@ -85,7 +85,7 @@ func render1(w writer, n *Node) error {
|
||||||
if _, err := w.WriteString("<!--"); err != nil {
|
if _, err := w.WriteString("<!--"); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := escape(w, n.Data); err != nil {
|
if err := escapeComment(w, n.Data); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if _, err := w.WriteString("-->"); err != nil {
|
if _, err := w.WriteString("-->"); err != nil {
|
||||||
|
|
|
@ -110,7 +110,7 @@ func (t Token) String() string {
|
||||||
case SelfClosingTagToken:
|
case SelfClosingTagToken:
|
||||||
return "<" + t.tagString() + "/>"
|
return "<" + t.tagString() + "/>"
|
||||||
case CommentToken:
|
case CommentToken:
|
||||||
return "<!--" + EscapeString(t.Data) + "-->"
|
return "<!--" + escapeCommentString(t.Data) + "-->"
|
||||||
case DoctypeToken:
|
case DoctypeToken:
|
||||||
return "<!DOCTYPE " + EscapeString(t.Data) + ">"
|
return "<!DOCTYPE " + EscapeString(t.Data) + ">"
|
||||||
}
|
}
|
||||||
|
@ -598,10 +598,10 @@ scriptDataDoubleEscapeEnd:
|
||||||
// readComment reads the next comment token starting with "<!--". The opening
|
// readComment reads the next comment token starting with "<!--". The opening
|
||||||
// "<!--" has already been consumed.
|
// "<!--" has already been consumed.
|
||||||
func (z *Tokenizer) readComment() {
|
func (z *Tokenizer) readComment() {
|
||||||
// When modifying this function, consider manually increasing the suffixLen
|
// When modifying this function, consider manually increasing the
|
||||||
// constant in func TestComments, from 6 to e.g. 9 or more. That increase
|
// maxSuffixLen constant in func TestComments, from 6 to e.g. 9 or more.
|
||||||
// should only be temporary, not committed, as it exponentially affects the
|
// That increase should only be temporary, not committed, as it
|
||||||
// test running time.
|
// exponentially affects the test running time.
|
||||||
|
|
||||||
z.data.start = z.raw.end
|
z.data.start = z.raw.end
|
||||||
defer func() {
|
defer func() {
|
||||||
|
|
|
@ -88,13 +88,9 @@ func (p *pipe) Write(d []byte) (n int, err error) {
|
||||||
p.c.L = &p.mu
|
p.c.L = &p.mu
|
||||||
}
|
}
|
||||||
defer p.c.Signal()
|
defer p.c.Signal()
|
||||||
if p.err != nil {
|
if p.err != nil || p.breakErr != nil {
|
||||||
return 0, errClosedPipeWrite
|
return 0, errClosedPipeWrite
|
||||||
}
|
}
|
||||||
if p.breakErr != nil {
|
|
||||||
p.unread += len(d)
|
|
||||||
return len(d), nil // discard when there is no reader
|
|
||||||
}
|
|
||||||
return p.b.Write(d)
|
return p.b.Write(d)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1822,15 +1822,18 @@ func (sc *serverConn) processData(f *DataFrame) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(data) > 0 {
|
if len(data) > 0 {
|
||||||
|
st.bodyBytes += int64(len(data))
|
||||||
wrote, err := st.body.Write(data)
|
wrote, err := st.body.Write(data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
// The handler has closed the request body.
|
||||||
|
// Return the connection-level flow control for the discarded data,
|
||||||
|
// but not the stream-level flow control.
|
||||||
sc.sendWindowUpdate(nil, int(f.Length)-wrote)
|
sc.sendWindowUpdate(nil, int(f.Length)-wrote)
|
||||||
return sc.countError("body_write_err", streamError(id, ErrCodeStreamClosed))
|
return nil
|
||||||
}
|
}
|
||||||
if wrote != len(data) {
|
if wrote != len(data) {
|
||||||
panic("internal error: bad Writer")
|
panic("internal error: bad Writer")
|
||||||
}
|
}
|
||||||
st.bodyBytes += int64(len(data))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return any padded flow control now, since we won't
|
// Return any padded flow control now, since we won't
|
||||||
|
|
|
@ -560,10 +560,11 @@ func (t *Transport) RoundTripOpt(req *http.Request, opt RoundTripOpt) (*http.Res
|
||||||
traceGotConn(req, cc, reused)
|
traceGotConn(req, cc, reused)
|
||||||
res, err := cc.RoundTrip(req)
|
res, err := cc.RoundTrip(req)
|
||||||
if err != nil && retry <= 6 {
|
if err != nil && retry <= 6 {
|
||||||
|
roundTripErr := err
|
||||||
if req, err = shouldRetryRequest(req, err); err == nil {
|
if req, err = shouldRetryRequest(req, err); err == nil {
|
||||||
// After the first retry, do exponential backoff with 10% jitter.
|
// After the first retry, do exponential backoff with 10% jitter.
|
||||||
if retry == 0 {
|
if retry == 0 {
|
||||||
t.vlogf("RoundTrip retrying after failure: %v", err)
|
t.vlogf("RoundTrip retrying after failure: %v", roundTripErr)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
backoff := float64(uint(1) << (uint(retry) - 1))
|
backoff := float64(uint(1) << (uint(retry) - 1))
|
||||||
|
@ -572,7 +573,7 @@ func (t *Transport) RoundTripOpt(req *http.Request, opt RoundTripOpt) (*http.Res
|
||||||
timer := backoffNewTimer(d)
|
timer := backoffNewTimer(d)
|
||||||
select {
|
select {
|
||||||
case <-timer.C:
|
case <-timer.C:
|
||||||
t.vlogf("RoundTrip retrying after failure: %v", err)
|
t.vlogf("RoundTrip retrying after failure: %v", roundTripErr)
|
||||||
continue
|
continue
|
||||||
case <-req.Context().Done():
|
case <-req.Context().Done():
|
||||||
timer.Stop()
|
timer.Stop()
|
||||||
|
@ -1265,6 +1266,27 @@ func (cc *ClientConn) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cancelRequest := func(cs *clientStream, err error) error {
|
||||||
|
cs.cc.mu.Lock()
|
||||||
|
defer cs.cc.mu.Unlock()
|
||||||
|
cs.abortStreamLocked(err)
|
||||||
|
if cs.ID != 0 {
|
||||||
|
// This request may have failed because of a problem with the connection,
|
||||||
|
// or for some unrelated reason. (For example, the user might have canceled
|
||||||
|
// the request without waiting for a response.) Mark the connection as
|
||||||
|
// not reusable, since trying to reuse a dead connection is worse than
|
||||||
|
// unnecessarily creating a new one.
|
||||||
|
//
|
||||||
|
// If cs.ID is 0, then the request was never allocated a stream ID and
|
||||||
|
// whatever went wrong was unrelated to the connection. We might have
|
||||||
|
// timed out waiting for a stream slot when StrictMaxConcurrentStreams
|
||||||
|
// is set, for example, in which case retrying on a different connection
|
||||||
|
// will not help.
|
||||||
|
cs.cc.doNotReuse = true
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-cs.respHeaderRecv:
|
case <-cs.respHeaderRecv:
|
||||||
|
@ -1279,15 +1301,12 @@ func (cc *ClientConn) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||||
return handleResponseHeaders()
|
return handleResponseHeaders()
|
||||||
default:
|
default:
|
||||||
waitDone()
|
waitDone()
|
||||||
return nil, cs.abortErr
|
return nil, cancelRequest(cs, cs.abortErr)
|
||||||
}
|
}
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
err := ctx.Err()
|
return nil, cancelRequest(cs, ctx.Err())
|
||||||
cs.abortStream(err)
|
|
||||||
return nil, err
|
|
||||||
case <-cs.reqCancel:
|
case <-cs.reqCancel:
|
||||||
cs.abortStream(errRequestCanceled)
|
return nil, cancelRequest(cs, errRequestCanceled)
|
||||||
return nil, errRequestCanceled
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2555,6 +2574,9 @@ func (b transportResponseBody) Close() error {
|
||||||
cs := b.cs
|
cs := b.cs
|
||||||
cc := cs.cc
|
cc := cs.cc
|
||||||
|
|
||||||
|
cs.bufPipe.BreakWithError(errClosedResponseBody)
|
||||||
|
cs.abortStream(errClosedResponseBody)
|
||||||
|
|
||||||
unread := cs.bufPipe.Len()
|
unread := cs.bufPipe.Len()
|
||||||
if unread > 0 {
|
if unread > 0 {
|
||||||
cc.mu.Lock()
|
cc.mu.Lock()
|
||||||
|
@ -2573,9 +2595,6 @@ func (b transportResponseBody) Close() error {
|
||||||
cc.wmu.Unlock()
|
cc.wmu.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
cs.bufPipe.BreakWithError(errClosedResponseBody)
|
|
||||||
cs.abortStream(errClosedResponseBody)
|
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-cs.donec:
|
case <-cs.donec:
|
||||||
case <-cs.ctx.Done():
|
case <-cs.ctx.Done():
|
||||||
|
|
|
@ -289,7 +289,7 @@ func (up *UsernamePassword) Authenticate(ctx context.Context, rw io.ReadWriter,
|
||||||
case AuthMethodNotRequired:
|
case AuthMethodNotRequired:
|
||||||
return nil
|
return nil
|
||||||
case AuthMethodUsernamePassword:
|
case AuthMethodUsernamePassword:
|
||||||
if len(up.Username) == 0 || len(up.Username) > 255 || len(up.Password) == 0 || len(up.Password) > 255 {
|
if len(up.Username) == 0 || len(up.Username) > 255 || len(up.Password) > 255 {
|
||||||
return errors.New("invalid username/password")
|
return errors.New("invalid username/password")
|
||||||
}
|
}
|
||||||
b := []byte{authUsernamePasswordVersion}
|
b := []byte{authUsernamePasswordVersion}
|
||||||
|
|
|
@ -61,8 +61,8 @@ func (g *Group) Wait() error {
|
||||||
// It blocks until the new goroutine can be added without the number of
|
// It blocks until the new goroutine can be added without the number of
|
||||||
// active goroutines in the group exceeding the configured limit.
|
// active goroutines in the group exceeding the configured limit.
|
||||||
//
|
//
|
||||||
// The first call to return a non-nil error cancels the group; its error will be
|
// The first call to return a non-nil error cancels the group's context, if the
|
||||||
// returned by Wait.
|
// group was created by calling WithContext. The error will be returned by Wait.
|
||||||
func (g *Group) Go(f func() error) {
|
func (g *Group) Go(f func() error) {
|
||||||
if g.sem != nil {
|
if g.sem != nil {
|
||||||
g.sem <- token{}
|
g.sem <- token{}
|
||||||
|
|
|
@ -24,6 +24,21 @@ var hwCap uint
|
||||||
var hwCap2 uint
|
var hwCap2 uint
|
||||||
|
|
||||||
func readHWCAP() error {
|
func readHWCAP() error {
|
||||||
|
// For Go 1.21+, get auxv from the Go runtime.
|
||||||
|
if a := getAuxv(); len(a) > 0 {
|
||||||
|
for len(a) >= 2 {
|
||||||
|
tag, val := a[0], uint(a[1])
|
||||||
|
a = a[2:]
|
||||||
|
switch tag {
|
||||||
|
case _AT_HWCAP:
|
||||||
|
hwCap = val
|
||||||
|
case _AT_HWCAP2:
|
||||||
|
hwCap2 = val
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
buf, err := ioutil.ReadFile(procAuxv)
|
buf, err := ioutil.ReadFile(procAuxv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// e.g. on android /proc/self/auxv is not accessible, so silently
|
// e.g. on android /proc/self/auxv is not accessible, so silently
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
// Copyright 2023 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package cpu
|
||||||
|
|
||||||
|
// getAuxvFn is non-nil on Go 1.21+ (via runtime_auxv_go121.go init)
|
||||||
|
// on platforms that use auxv.
|
||||||
|
var getAuxvFn func() []uintptr
|
||||||
|
|
||||||
|
func getAuxv() []uintptr {
|
||||||
|
if getAuxvFn == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return getAuxvFn()
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
// Copyright 2023 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build go1.21
|
||||||
|
// +build go1.21
|
||||||
|
|
||||||
|
package cpu
|
||||||
|
|
||||||
|
import (
|
||||||
|
_ "unsafe" // for linkname
|
||||||
|
)
|
||||||
|
|
||||||
|
//go:linkname runtime_getAuxv runtime.getAuxv
|
||||||
|
func runtime_getAuxv() []uintptr
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
getAuxvFn = runtime_getAuxv
|
||||||
|
}
|
|
@ -63,7 +63,7 @@ func LookPath(file string) (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func fixCmd(name string, cmd *exec.Cmd) {
|
func fixCmd(name string, cmd *exec.Cmd) {
|
||||||
if filepath.Base(name) == name && !filepath.IsAbs(cmd.Path) {
|
if filepath.Base(name) == name && !filepath.IsAbs(cmd.Path) && !isGo119ErrFieldSet(cmd) {
|
||||||
// exec.Command was called with a bare binary name and
|
// exec.Command was called with a bare binary name and
|
||||||
// exec.LookPath returned a path which is not absolute.
|
// exec.LookPath returned a path which is not absolute.
|
||||||
// Set cmd.lookPathErr and clear cmd.Path so that it
|
// Set cmd.lookPathErr and clear cmd.Path so that it
|
||||||
|
|
|
@ -7,6 +7,12 @@
|
||||||
|
|
||||||
package execabs
|
package execabs
|
||||||
|
|
||||||
|
import "os/exec"
|
||||||
|
|
||||||
func isGo119ErrDot(err error) bool {
|
func isGo119ErrDot(err error) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func isGo119ErrFieldSet(cmd *exec.Cmd) bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
|
@ -15,3 +15,7 @@ import (
|
||||||
func isGo119ErrDot(err error) bool {
|
func isGo119ErrDot(err error) bool {
|
||||||
return errors.Is(err, exec.ErrDot)
|
return errors.Is(err, exec.ErrDot)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func isGo119ErrFieldSet(cmd *exec.Cmd) bool {
|
||||||
|
return cmd.Err != nil
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,70 @@
|
||||||
|
// 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 aix || solaris
|
||||||
|
// +build aix solaris
|
||||||
|
|
||||||
|
package unix
|
||||||
|
|
||||||
|
import (
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ioctl itself should not be exposed directly, but additional get/set
|
||||||
|
// functions for specific types are permissible.
|
||||||
|
|
||||||
|
// IoctlSetInt performs an ioctl operation which sets an integer value
|
||||||
|
// on fd, using the specified request number.
|
||||||
|
func IoctlSetInt(fd int, req int, value int) error {
|
||||||
|
return ioctl(fd, req, uintptr(value))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlSetPointerInt performs an ioctl operation which sets an
|
||||||
|
// integer value on fd, using the specified request number. The ioctl
|
||||||
|
// argument is called with a pointer to the integer value, rather than
|
||||||
|
// passing the integer value directly.
|
||||||
|
func IoctlSetPointerInt(fd int, req int, value int) error {
|
||||||
|
v := int32(value)
|
||||||
|
return ioctlPtr(fd, req, unsafe.Pointer(&v))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlSetWinsize performs an ioctl on fd with a *Winsize argument.
|
||||||
|
//
|
||||||
|
// To change fd's window size, the req argument should be TIOCSWINSZ.
|
||||||
|
func IoctlSetWinsize(fd int, req int, value *Winsize) error {
|
||||||
|
// TODO: if we get the chance, remove the req parameter and
|
||||||
|
// hardcode TIOCSWINSZ.
|
||||||
|
return ioctlPtr(fd, req, unsafe.Pointer(value))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlSetTermios performs an ioctl on fd with a *Termios.
|
||||||
|
//
|
||||||
|
// The req value will usually be TCSETA or TIOCSETA.
|
||||||
|
func IoctlSetTermios(fd int, req int, value *Termios) error {
|
||||||
|
// TODO: if we get the chance, remove the req parameter.
|
||||||
|
return ioctlPtr(fd, req, unsafe.Pointer(value))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlGetInt performs an ioctl operation which gets an integer value
|
||||||
|
// from fd, using the specified request number.
|
||||||
|
//
|
||||||
|
// A few ioctl requests use the return value as an output parameter;
|
||||||
|
// for those, IoctlRetInt should be used instead of this function.
|
||||||
|
func IoctlGetInt(fd int, req int) (int, error) {
|
||||||
|
var value int
|
||||||
|
err := ioctlPtr(fd, req, unsafe.Pointer(&value))
|
||||||
|
return value, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func IoctlGetWinsize(fd int, req int) (*Winsize, error) {
|
||||||
|
var value Winsize
|
||||||
|
err := ioctlPtr(fd, req, unsafe.Pointer(&value))
|
||||||
|
return &value, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func IoctlGetTermios(fd int, req int) (*Termios, error) {
|
||||||
|
var value Termios
|
||||||
|
err := ioctlPtr(fd, req, unsafe.Pointer(&value))
|
||||||
|
return &value, err
|
||||||
|
}
|
21
vendor/golang.org/x/sys/unix/ioctl.go → vendor/golang.org/x/sys/unix/ioctl_unsigned.go
сгенерированный
поставляемый
21
vendor/golang.org/x/sys/unix/ioctl.go → vendor/golang.org/x/sys/unix/ioctl_unsigned.go
сгенерированный
поставляемый
|
@ -2,13 +2,12 @@
|
||||||
// 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 aix || darwin || dragonfly || freebsd || hurd || linux || netbsd || openbsd || solaris
|
//go:build darwin || dragonfly || freebsd || hurd || linux || netbsd || openbsd
|
||||||
// +build aix darwin dragonfly freebsd hurd linux netbsd openbsd solaris
|
// +build darwin dragonfly freebsd hurd linux netbsd openbsd
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"runtime"
|
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -27,7 +26,7 @@ func IoctlSetInt(fd int, req uint, value int) error {
|
||||||
// passing the integer value directly.
|
// passing the integer value directly.
|
||||||
func IoctlSetPointerInt(fd int, req uint, value int) error {
|
func IoctlSetPointerInt(fd int, req uint, value int) error {
|
||||||
v := int32(value)
|
v := int32(value)
|
||||||
return ioctl(fd, req, uintptr(unsafe.Pointer(&v)))
|
return ioctlPtr(fd, req, unsafe.Pointer(&v))
|
||||||
}
|
}
|
||||||
|
|
||||||
// IoctlSetWinsize performs an ioctl on fd with a *Winsize argument.
|
// IoctlSetWinsize performs an ioctl on fd with a *Winsize argument.
|
||||||
|
@ -36,9 +35,7 @@ func IoctlSetPointerInt(fd int, req uint, value int) error {
|
||||||
func IoctlSetWinsize(fd int, req uint, value *Winsize) error {
|
func IoctlSetWinsize(fd int, req uint, value *Winsize) error {
|
||||||
// TODO: if we get the chance, remove the req parameter and
|
// TODO: if we get the chance, remove the req parameter and
|
||||||
// hardcode TIOCSWINSZ.
|
// hardcode TIOCSWINSZ.
|
||||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
return ioctlPtr(fd, req, unsafe.Pointer(value))
|
||||||
runtime.KeepAlive(value)
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// IoctlSetTermios performs an ioctl on fd with a *Termios.
|
// IoctlSetTermios performs an ioctl on fd with a *Termios.
|
||||||
|
@ -46,9 +43,7 @@ func IoctlSetWinsize(fd int, req uint, value *Winsize) error {
|
||||||
// The req value will usually be TCSETA or TIOCSETA.
|
// The req value will usually be TCSETA or TIOCSETA.
|
||||||
func IoctlSetTermios(fd int, req uint, value *Termios) error {
|
func IoctlSetTermios(fd int, req uint, value *Termios) error {
|
||||||
// TODO: if we get the chance, remove the req parameter.
|
// TODO: if we get the chance, remove the req parameter.
|
||||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
return ioctlPtr(fd, req, unsafe.Pointer(value))
|
||||||
runtime.KeepAlive(value)
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// IoctlGetInt performs an ioctl operation which gets an integer value
|
// IoctlGetInt performs an ioctl operation which gets an integer value
|
||||||
|
@ -58,18 +53,18 @@ func IoctlSetTermios(fd int, req uint, value *Termios) error {
|
||||||
// for those, IoctlRetInt should be used instead of this function.
|
// for those, IoctlRetInt should be used instead of this function.
|
||||||
func IoctlGetInt(fd int, req uint) (int, error) {
|
func IoctlGetInt(fd int, req uint) (int, error) {
|
||||||
var value int
|
var value int
|
||||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
|
err := ioctlPtr(fd, req, unsafe.Pointer(&value))
|
||||||
return value, err
|
return value, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func IoctlGetWinsize(fd int, req uint) (*Winsize, error) {
|
func IoctlGetWinsize(fd int, req uint) (*Winsize, error) {
|
||||||
var value Winsize
|
var value Winsize
|
||||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
|
err := ioctlPtr(fd, req, unsafe.Pointer(&value))
|
||||||
return &value, err
|
return &value, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||||
var value Termios
|
var value Termios
|
||||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
|
err := ioctlPtr(fd, req, unsafe.Pointer(&value))
|
||||||
return &value, err
|
return &value, err
|
||||||
}
|
}
|
|
@ -17,25 +17,23 @@ import (
|
||||||
|
|
||||||
// IoctlSetInt performs an ioctl operation which sets an integer value
|
// IoctlSetInt performs an ioctl operation which sets an integer value
|
||||||
// on fd, using the specified request number.
|
// on fd, using the specified request number.
|
||||||
func IoctlSetInt(fd int, req uint, value int) error {
|
func IoctlSetInt(fd int, req int, value int) error {
|
||||||
return ioctl(fd, req, uintptr(value))
|
return ioctl(fd, req, uintptr(value))
|
||||||
}
|
}
|
||||||
|
|
||||||
// IoctlSetWinsize performs an ioctl on fd with a *Winsize argument.
|
// IoctlSetWinsize performs an ioctl on fd with a *Winsize argument.
|
||||||
//
|
//
|
||||||
// To change fd's window size, the req argument should be TIOCSWINSZ.
|
// To change fd's window size, the req argument should be TIOCSWINSZ.
|
||||||
func IoctlSetWinsize(fd int, req uint, value *Winsize) error {
|
func IoctlSetWinsize(fd int, req int, value *Winsize) error {
|
||||||
// TODO: if we get the chance, remove the req parameter and
|
// TODO: if we get the chance, remove the req parameter and
|
||||||
// hardcode TIOCSWINSZ.
|
// hardcode TIOCSWINSZ.
|
||||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
return ioctlPtr(fd, req, unsafe.Pointer(value))
|
||||||
runtime.KeepAlive(value)
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// IoctlSetTermios performs an ioctl on fd with a *Termios.
|
// IoctlSetTermios performs an ioctl on fd with a *Termios.
|
||||||
//
|
//
|
||||||
// The req value is expected to be TCSETS, TCSETSW, or TCSETSF
|
// The req value is expected to be TCSETS, TCSETSW, or TCSETSF
|
||||||
func IoctlSetTermios(fd int, req uint, value *Termios) error {
|
func IoctlSetTermios(fd int, req int, value *Termios) error {
|
||||||
if (req != TCSETS) && (req != TCSETSW) && (req != TCSETSF) {
|
if (req != TCSETS) && (req != TCSETSW) && (req != TCSETSF) {
|
||||||
return ENOSYS
|
return ENOSYS
|
||||||
}
|
}
|
||||||
|
@ -49,22 +47,22 @@ func IoctlSetTermios(fd int, req uint, value *Termios) error {
|
||||||
//
|
//
|
||||||
// A few ioctl requests use the return value as an output parameter;
|
// A few ioctl requests use the return value as an output parameter;
|
||||||
// for those, IoctlRetInt should be used instead of this function.
|
// for those, IoctlRetInt should be used instead of this function.
|
||||||
func IoctlGetInt(fd int, req uint) (int, error) {
|
func IoctlGetInt(fd int, req int) (int, error) {
|
||||||
var value int
|
var value int
|
||||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
|
err := ioctlPtr(fd, req, unsafe.Pointer(&value))
|
||||||
return value, err
|
return value, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func IoctlGetWinsize(fd int, req uint) (*Winsize, error) {
|
func IoctlGetWinsize(fd int, req int) (*Winsize, error) {
|
||||||
var value Winsize
|
var value Winsize
|
||||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
|
err := ioctlPtr(fd, req, unsafe.Pointer(&value))
|
||||||
return &value, err
|
return &value, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// IoctlGetTermios performs an ioctl on fd with a *Termios.
|
// IoctlGetTermios performs an ioctl on fd with a *Termios.
|
||||||
//
|
//
|
||||||
// The req value is expected to be TCGETS
|
// The req value is expected to be TCGETS
|
||||||
func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
func IoctlGetTermios(fd int, req int) (*Termios, error) {
|
||||||
var value Termios
|
var value Termios
|
||||||
if req != TCGETS {
|
if req != TCGETS {
|
||||||
return &value, ENOSYS
|
return &value, ENOSYS
|
||||||
|
|
|
@ -66,6 +66,7 @@ includes_Darwin='
|
||||||
#include <sys/ptrace.h>
|
#include <sys/ptrace.h>
|
||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
#include <sys/un.h>
|
#include <sys/un.h>
|
||||||
#include <sys/sockio.h>
|
#include <sys/sockio.h>
|
||||||
#include <sys/sys_domain.h>
|
#include <sys/sys_domain.h>
|
||||||
|
@ -203,6 +204,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 <netinet/udp.h>
|
||||||
#include <linux/audit.h>
|
#include <linux/audit.h>
|
||||||
#include <linux/bpf.h>
|
#include <linux/bpf.h>
|
||||||
#include <linux/can.h>
|
#include <linux/can.h>
|
||||||
|
@ -517,10 +519,11 @@ ccflags="$@"
|
||||||
$2 ~ /^LOCK_(SH|EX|NB|UN)$/ ||
|
$2 ~ /^LOCK_(SH|EX|NB|UN)$/ ||
|
||||||
$2 ~ /^LO_(KEY|NAME)_SIZE$/ ||
|
$2 ~ /^LO_(KEY|NAME)_SIZE$/ ||
|
||||||
$2 ~ /^LOOP_(CLR|CTL|GET|SET)_/ ||
|
$2 ~ /^LOOP_(CLR|CTL|GET|SET)_/ ||
|
||||||
$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL|TCPOPT)_/ ||
|
$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL|TCPOPT|UDP)_/ ||
|
||||||
$2 ~ /^NFC_(GENL|PROTO|COMM|RF|SE|DIRECTION|LLCP|SOCKPROTO)_/ ||
|
$2 ~ /^NFC_(GENL|PROTO|COMM|RF|SE|DIRECTION|LLCP|SOCKPROTO)_/ ||
|
||||||
$2 ~ /^NFC_.*_(MAX)?SIZE$/ ||
|
$2 ~ /^NFC_.*_(MAX)?SIZE$/ ||
|
||||||
$2 ~ /^RAW_PAYLOAD_/ ||
|
$2 ~ /^RAW_PAYLOAD_/ ||
|
||||||
|
$2 ~ /^[US]F_/ ||
|
||||||
$2 ~ /^TP_STATUS_/ ||
|
$2 ~ /^TP_STATUS_/ ||
|
||||||
$2 ~ /^FALLOC_/ ||
|
$2 ~ /^FALLOC_/ ||
|
||||||
$2 ~ /^ICMPV?6?_(FILTER|SEC)/ ||
|
$2 ~ /^ICMPV?6?_(FILTER|SEC)/ ||
|
||||||
|
|
|
@ -7,6 +7,12 @@
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
import "unsafe"
|
||||||
|
|
||||||
func ptrace(request int, pid int, addr uintptr, data uintptr) error {
|
func ptrace(request int, pid int, addr uintptr, data uintptr) error {
|
||||||
return ptrace1(request, pid, addr, data)
|
return ptrace1(request, pid, addr, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ptracePtr(request int, pid int, addr uintptr, data unsafe.Pointer) error {
|
||||||
|
return ptrace1Ptr(request, pid, addr, data)
|
||||||
|
}
|
||||||
|
|
|
@ -7,6 +7,12 @@
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
import "unsafe"
|
||||||
|
|
||||||
func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
|
func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
|
||||||
return ENOTSUP
|
return ENOTSUP
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ptracePtr(request int, pid int, addr uintptr, data unsafe.Pointer) (err error) {
|
||||||
|
return ENOTSUP
|
||||||
|
}
|
||||||
|
|
|
@ -292,9 +292,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
sa.Name = string(unsafe.Slice((*byte)(unsafe.Pointer(&pp.Path[0])), n))
|
||||||
bytes := (*[len(pp.Path)]byte)(unsafe.Pointer(&pp.Path[0]))[0:n]
|
|
||||||
sa.Name = string(bytes)
|
|
||||||
return sa, nil
|
return sa, nil
|
||||||
|
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
|
@ -410,7 +408,8 @@ func (w WaitStatus) CoreDump() bool { return w&0x80 == 0x80 }
|
||||||
|
|
||||||
func (w WaitStatus) TrapCause() int { return -1 }
|
func (w WaitStatus) TrapCause() int { return -1 }
|
||||||
|
|
||||||
//sys ioctl(fd int, req uint, arg uintptr) (err error)
|
//sys ioctl(fd int, req int, arg uintptr) (err error)
|
||||||
|
//sys ioctlPtr(fd int, req int, arg unsafe.Pointer) (err error) = ioctl
|
||||||
|
|
||||||
// fcntl must never be called with cmd=F_DUP2FD because it doesn't work on AIX
|
// fcntl must never be called with cmd=F_DUP2FD because it doesn't work on AIX
|
||||||
// There is no way to create a custom fcntl and to keep //sys fcntl easily,
|
// There is no way to create a custom fcntl and to keep //sys fcntl easily,
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error) = getrlimit64
|
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error) = getrlimit64
|
||||||
//sysnb Setrlimit(resource int, rlim *Rlimit) (err error) = setrlimit64
|
|
||||||
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = lseek64
|
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = lseek64
|
||||||
|
|
||||||
//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
|
//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
|
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
|
||||||
//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
|
|
||||||
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = lseek
|
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = lseek
|
||||||
|
|
||||||
//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) = mmap64
|
//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) = mmap64
|
||||||
|
|
|
@ -245,8 +245,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bytes := (*[len(pp.Path)]byte)(unsafe.Pointer(&pp.Path[0]))[0:n]
|
sa.Name = string(unsafe.Slice((*byte)(unsafe.Pointer(&pp.Path[0])), n))
|
||||||
sa.Name = string(bytes)
|
|
||||||
return sa, nil
|
return sa, nil
|
||||||
|
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
|
|
|
@ -14,7 +14,6 @@ package unix
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"runtime"
|
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
@ -376,11 +375,10 @@ func Flistxattr(fd int, dest []byte) (sz int, err error) {
|
||||||
func Kill(pid int, signum syscall.Signal) (err error) { return kill(pid, int(signum), 1) }
|
func Kill(pid int, signum syscall.Signal) (err error) { return kill(pid, int(signum), 1) }
|
||||||
|
|
||||||
//sys ioctl(fd int, req uint, arg uintptr) (err error)
|
//sys ioctl(fd int, req uint, arg uintptr) (err error)
|
||||||
|
//sys ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) = SYS_IOCTL
|
||||||
|
|
||||||
func IoctlCtlInfo(fd int, ctlInfo *CtlInfo) error {
|
func IoctlCtlInfo(fd int, ctlInfo *CtlInfo) error {
|
||||||
err := ioctl(fd, CTLIOCGINFO, uintptr(unsafe.Pointer(ctlInfo)))
|
return ioctlPtr(fd, CTLIOCGINFO, unsafe.Pointer(ctlInfo))
|
||||||
runtime.KeepAlive(ctlInfo)
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// IfreqMTU is struct ifreq used to get or set a network device's MTU.
|
// IfreqMTU is struct ifreq used to get or set a network device's MTU.
|
||||||
|
@ -394,16 +392,14 @@ type IfreqMTU struct {
|
||||||
func IoctlGetIfreqMTU(fd int, ifname string) (*IfreqMTU, error) {
|
func IoctlGetIfreqMTU(fd int, ifname string) (*IfreqMTU, error) {
|
||||||
var ifreq IfreqMTU
|
var ifreq IfreqMTU
|
||||||
copy(ifreq.Name[:], ifname)
|
copy(ifreq.Name[:], ifname)
|
||||||
err := ioctl(fd, SIOCGIFMTU, uintptr(unsafe.Pointer(&ifreq)))
|
err := ioctlPtr(fd, SIOCGIFMTU, unsafe.Pointer(&ifreq))
|
||||||
return &ifreq, err
|
return &ifreq, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// IoctlSetIfreqMTU performs the SIOCSIFMTU ioctl operation on fd to set the MTU
|
// IoctlSetIfreqMTU performs the SIOCSIFMTU ioctl operation on fd to set the MTU
|
||||||
// of the network device specified by ifreq.Name.
|
// of the network device specified by ifreq.Name.
|
||||||
func IoctlSetIfreqMTU(fd int, ifreq *IfreqMTU) error {
|
func IoctlSetIfreqMTU(fd int, ifreq *IfreqMTU) error {
|
||||||
err := ioctl(fd, SIOCSIFMTU, uintptr(unsafe.Pointer(ifreq)))
|
return ioctlPtr(fd, SIOCSIFMTU, unsafe.Pointer(ifreq))
|
||||||
runtime.KeepAlive(ifreq)
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS_SYSCTL
|
//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS_SYSCTL
|
||||||
|
@ -617,6 +613,7 @@ func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, error) {
|
||||||
//sys Rmdir(path string) (err error)
|
//sys Rmdir(path string) (err error)
|
||||||
//sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK
|
//sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK
|
||||||
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
|
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
|
||||||
|
//sys Setattrlist(path string, attrlist *Attrlist, attrBuf []byte, options int) (err error)
|
||||||
//sys Setegid(egid int) (err error)
|
//sys Setegid(egid int) (err error)
|
||||||
//sysnb Seteuid(euid int) (err error)
|
//sysnb Seteuid(euid int) (err error)
|
||||||
//sysnb Setgid(gid int) (err error)
|
//sysnb Setgid(gid int) (err error)
|
||||||
|
@ -626,7 +623,6 @@ func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, error) {
|
||||||
//sys Setprivexec(flag int) (err error)
|
//sys Setprivexec(flag int) (err error)
|
||||||
//sysnb Setregid(rgid int, egid int) (err error)
|
//sysnb Setregid(rgid int, egid int) (err error)
|
||||||
//sysnb Setreuid(ruid int, euid int) (err error)
|
//sysnb Setreuid(ruid int, euid int) (err error)
|
||||||
//sysnb Setrlimit(which int, lim *Rlimit) (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)
|
||||||
|
@ -680,7 +676,6 @@ func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, error) {
|
||||||
// Kqueue_from_portset_np
|
// Kqueue_from_portset_np
|
||||||
// Kqueue_portset
|
// Kqueue_portset
|
||||||
// Getattrlist
|
// Getattrlist
|
||||||
// Setattrlist
|
|
||||||
// Getdirentriesattr
|
// Getdirentriesattr
|
||||||
// Searchfs
|
// Searchfs
|
||||||
// Delete
|
// Delete
|
||||||
|
|
|
@ -47,5 +47,6 @@ func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr,
|
||||||
//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64
|
//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64
|
||||||
//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
|
//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
|
||||||
//sys ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) = SYS_ptrace
|
//sys ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) = SYS_ptrace
|
||||||
|
//sys ptrace1Ptr(request int, pid int, addr unsafe.Pointer, data uintptr) (err error) = SYS_ptrace
|
||||||
//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
|
//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
|
||||||
//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64
|
//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64
|
||||||
|
|
|
@ -47,5 +47,6 @@ func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr,
|
||||||
//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT
|
//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT
|
||||||
//sys Lstat(path string, stat *Stat_t) (err error)
|
//sys Lstat(path string, stat *Stat_t) (err error)
|
||||||
//sys ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) = SYS_ptrace
|
//sys ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) = SYS_ptrace
|
||||||
|
//sys ptrace1Ptr(request int, pid int, addr unsafe.Pointer, data uintptr) (err error) = SYS_ptrace
|
||||||
//sys Stat(path string, stat *Stat_t) (err error)
|
//sys Stat(path string, stat *Stat_t) (err error)
|
||||||
//sys Statfs(path string, stat *Statfs_t) (err error)
|
//sys Statfs(path string, stat *Statfs_t) (err error)
|
||||||
|
|
|
@ -172,6 +172,7 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//sys ioctl(fd int, req uint, arg uintptr) (err error)
|
//sys ioctl(fd int, req uint, arg uintptr) (err error)
|
||||||
|
//sys ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) = SYS_IOCTL
|
||||||
|
|
||||||
//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
|
//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
|
||||||
|
|
||||||
|
@ -325,7 +326,6 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
|
||||||
//sysnb Setreuid(ruid int, euid int) (err error)
|
//sysnb Setreuid(ruid int, euid int) (err error)
|
||||||
//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
|
//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
|
||||||
//sysnb Setresuid(ruid int, euid int, suid int) (err error)
|
//sysnb Setresuid(ruid int, euid int, suid int) (err error)
|
||||||
//sysnb Setrlimit(which int, lim *Rlimit) (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)
|
||||||
|
|
|
@ -161,7 +161,8 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//sys ioctl(fd int, req uint, arg uintptr) (err error)
|
//sys ioctl(fd int, req uint, arg uintptr) (err error) = SYS_IOCTL
|
||||||
|
//sys ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) = SYS_IOCTL
|
||||||
|
|
||||||
//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
|
//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
|
||||||
|
|
||||||
|
@ -253,6 +254,7 @@ 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)
|
||||||
|
//sys ptracePtr(request int, pid int, addr unsafe.Pointer, data int) (err error) = SYS_PTRACE
|
||||||
|
|
||||||
func PtraceAttach(pid int) (err error) {
|
func PtraceAttach(pid int) (err error) {
|
||||||
return ptrace(PT_ATTACH, pid, 0, 0)
|
return ptrace(PT_ATTACH, pid, 0, 0)
|
||||||
|
@ -267,19 +269,36 @@ func PtraceDetach(pid int) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func PtraceGetFpRegs(pid int, fpregsout *FpReg) (err error) {
|
func PtraceGetFpRegs(pid int, fpregsout *FpReg) (err error) {
|
||||||
return ptrace(PT_GETFPREGS, pid, uintptr(unsafe.Pointer(fpregsout)), 0)
|
return ptracePtr(PT_GETFPREGS, pid, unsafe.Pointer(fpregsout), 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func PtraceGetRegs(pid int, regsout *Reg) (err error) {
|
func PtraceGetRegs(pid int, regsout *Reg) (err error) {
|
||||||
return ptrace(PT_GETREGS, pid, uintptr(unsafe.Pointer(regsout)), 0)
|
return ptracePtr(PT_GETREGS, pid, unsafe.Pointer(regsout), 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func PtraceIO(req int, pid int, offs uintptr, out []byte, countin int) (count int, err error) {
|
||||||
|
ioDesc := PtraceIoDesc{
|
||||||
|
Op: int32(req),
|
||||||
|
Offs: offs,
|
||||||
|
}
|
||||||
|
if countin > 0 {
|
||||||
|
_ = out[:countin] // check bounds
|
||||||
|
ioDesc.Addr = &out[0]
|
||||||
|
} else if out != nil {
|
||||||
|
ioDesc.Addr = (*byte)(unsafe.Pointer(&_zero))
|
||||||
|
}
|
||||||
|
ioDesc.SetLen(countin)
|
||||||
|
|
||||||
|
err = ptracePtr(PT_IO, pid, unsafe.Pointer(&ioDesc), 0)
|
||||||
|
return int(ioDesc.Len), err
|
||||||
}
|
}
|
||||||
|
|
||||||
func PtraceLwpEvents(pid int, enable int) (err error) {
|
func PtraceLwpEvents(pid int, enable int) (err error) {
|
||||||
return ptrace(PT_LWP_EVENTS, pid, 0, enable)
|
return ptrace(PT_LWP_EVENTS, pid, 0, enable)
|
||||||
}
|
}
|
||||||
|
|
||||||
func PtraceLwpInfo(pid int, info uintptr) (err error) {
|
func PtraceLwpInfo(pid int, info *PtraceLwpInfoStruct) (err error) {
|
||||||
return ptrace(PT_LWPINFO, pid, info, int(unsafe.Sizeof(PtraceLwpInfoStruct{})))
|
return ptracePtr(PT_LWPINFO, pid, unsafe.Pointer(info), int(unsafe.Sizeof(*info)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func PtracePeekData(pid int, addr uintptr, out []byte) (count int, err error) {
|
func PtracePeekData(pid int, addr uintptr, out []byte) (count int, err error) {
|
||||||
|
@ -299,13 +318,25 @@ 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(PT_SETREGS, pid, uintptr(unsafe.Pointer(regs)), 0)
|
return ptracePtr(PT_SETREGS, pid, unsafe.Pointer(regs), 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func PtraceSingleStep(pid int) (err error) {
|
func PtraceSingleStep(pid int) (err error) {
|
||||||
return ptrace(PT_STEP, pid, 1, 0)
|
return ptrace(PT_STEP, pid, 1, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Dup3(oldfd, newfd, flags int) error {
|
||||||
|
if oldfd == newfd || flags&^O_CLOEXEC != 0 {
|
||||||
|
return EINVAL
|
||||||
|
}
|
||||||
|
how := F_DUP2FD
|
||||||
|
if flags&O_CLOEXEC != 0 {
|
||||||
|
how = F_DUP2FD_CLOEXEC
|
||||||
|
}
|
||||||
|
_, err := fcntl(oldfd, how, newfd)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Exposed directly
|
* Exposed directly
|
||||||
*/
|
*/
|
||||||
|
@ -402,7 +433,6 @@ func PtraceSingleStep(pid int) (err error) {
|
||||||
//sysnb Setreuid(ruid int, euid int) (err error)
|
//sysnb Setreuid(ruid int, euid int) (err error)
|
||||||
//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
|
//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
|
||||||
//sysnb Setresuid(ruid int, euid int, suid int) (err error)
|
//sysnb Setresuid(ruid int, euid int, suid int) (err error)
|
||||||
//sysnb Setrlimit(which int, lim *Rlimit) (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)
|
||||||
|
|
|
@ -42,6 +42,10 @@ func (cmsg *Cmsghdr) SetLen(length int) {
|
||||||
cmsg.Len = uint32(length)
|
cmsg.Len = uint32(length)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *PtraceIoDesc) SetLen(length int) {
|
||||||
|
d.Len = uint32(length)
|
||||||
|
}
|
||||||
|
|
||||||
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) {
|
||||||
var writtenOut uint64 = 0
|
var writtenOut uint64 = 0
|
||||||
_, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0)
|
_, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0)
|
||||||
|
@ -57,16 +61,5 @@ 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(PT_GETFSBASE, pid, uintptr(unsafe.Pointer(fsbase)), 0)
|
return ptracePtr(PT_GETFSBASE, pid, unsafe.Pointer(fsbase), 0)
|
||||||
}
|
|
||||||
|
|
||||||
func PtraceIO(req int, pid int, offs uintptr, out []byte, countin int) (count int, err error) {
|
|
||||||
ioDesc := PtraceIoDesc{
|
|
||||||
Op: int32(req),
|
|
||||||
Offs: offs,
|
|
||||||
Addr: uintptr(unsafe.Pointer(&out[0])), // TODO(#58351): this is not safe.
|
|
||||||
Len: uint32(countin),
|
|
||||||
}
|
|
||||||
err = ptrace(PT_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0)
|
|
||||||
return int(ioDesc.Len), err
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,10 @@ func (cmsg *Cmsghdr) SetLen(length int) {
|
||||||
cmsg.Len = uint32(length)
|
cmsg.Len = uint32(length)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *PtraceIoDesc) SetLen(length int) {
|
||||||
|
d.Len = uint64(length)
|
||||||
|
}
|
||||||
|
|
||||||
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) {
|
||||||
var writtenOut uint64 = 0
|
var writtenOut uint64 = 0
|
||||||
_, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0)
|
_, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0)
|
||||||
|
@ -57,16 +61,5 @@ 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(PT_GETFSBASE, pid, uintptr(unsafe.Pointer(fsbase)), 0)
|
return ptracePtr(PT_GETFSBASE, pid, unsafe.Pointer(fsbase), 0)
|
||||||
}
|
|
||||||
|
|
||||||
func PtraceIO(req int, pid int, offs uintptr, out []byte, countin int) (count int, err error) {
|
|
||||||
ioDesc := PtraceIoDesc{
|
|
||||||
Op: int32(req),
|
|
||||||
Offs: offs,
|
|
||||||
Addr: uintptr(unsafe.Pointer(&out[0])), // TODO(#58351): this is not safe.
|
|
||||||
Len: uint64(countin),
|
|
||||||
}
|
|
||||||
err = ptrace(PT_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0)
|
|
||||||
return int(ioDesc.Len), err
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,10 @@ func (cmsg *Cmsghdr) SetLen(length int) {
|
||||||
cmsg.Len = uint32(length)
|
cmsg.Len = uint32(length)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *PtraceIoDesc) SetLen(length int) {
|
||||||
|
d.Len = uint32(length)
|
||||||
|
}
|
||||||
|
|
||||||
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) {
|
||||||
var writtenOut uint64 = 0
|
var writtenOut uint64 = 0
|
||||||
_, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0)
|
_, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr((*offset)>>32), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0)
|
||||||
|
@ -55,14 +59,3 @@ 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, offs uintptr, out []byte, countin int) (count int, err error) {
|
|
||||||
ioDesc := PtraceIoDesc{
|
|
||||||
Op: int32(req),
|
|
||||||
Offs: offs,
|
|
||||||
Addr: uintptr(unsafe.Pointer(&out[0])), // TODO(#58351): this is not safe.
|
|
||||||
Len: uint32(countin),
|
|
||||||
}
|
|
||||||
err = ptrace(PT_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0)
|
|
||||||
return int(ioDesc.Len), err
|
|
||||||
}
|
|
||||||
|
|
|
@ -42,6 +42,10 @@ func (cmsg *Cmsghdr) SetLen(length int) {
|
||||||
cmsg.Len = uint32(length)
|
cmsg.Len = uint32(length)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *PtraceIoDesc) SetLen(length int) {
|
||||||
|
d.Len = uint64(length)
|
||||||
|
}
|
||||||
|
|
||||||
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) {
|
||||||
var writtenOut uint64 = 0
|
var writtenOut uint64 = 0
|
||||||
_, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0)
|
_, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0)
|
||||||
|
@ -55,14 +59,3 @@ 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, offs uintptr, out []byte, countin int) (count int, err error) {
|
|
||||||
ioDesc := PtraceIoDesc{
|
|
||||||
Op: int32(req),
|
|
||||||
Offs: offs,
|
|
||||||
Addr: uintptr(unsafe.Pointer(&out[0])), // TODO(#58351): this is not safe.
|
|
||||||
Len: uint64(countin),
|
|
||||||
}
|
|
||||||
err = ptrace(PT_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0)
|
|
||||||
return int(ioDesc.Len), err
|
|
||||||
}
|
|
||||||
|
|
|
@ -42,6 +42,10 @@ func (cmsg *Cmsghdr) SetLen(length int) {
|
||||||
cmsg.Len = uint32(length)
|
cmsg.Len = uint32(length)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *PtraceIoDesc) SetLen(length int) {
|
||||||
|
d.Len = uint64(length)
|
||||||
|
}
|
||||||
|
|
||||||
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) {
|
||||||
var writtenOut uint64 = 0
|
var writtenOut uint64 = 0
|
||||||
_, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0)
|
_, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0)
|
||||||
|
@ -55,14 +59,3 @@ 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, offs uintptr, out []byte, countin int) (count int, err error) {
|
|
||||||
ioDesc := PtraceIoDesc{
|
|
||||||
Op: int32(req),
|
|
||||||
Offs: offs,
|
|
||||||
Addr: uintptr(unsafe.Pointer(&out[0])), // TODO(#58351): this is not safe.
|
|
||||||
Len: uint64(countin),
|
|
||||||
}
|
|
||||||
err = ptrace(PT_IO, pid, uintptr(unsafe.Pointer(&ioDesc)), 0)
|
|
||||||
return int(ioDesc.Len), err
|
|
||||||
}
|
|
||||||
|
|
|
@ -20,3 +20,11 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) {
|
||||||
|
r0, er := C.ioctl(C.int(fd), C.ulong(req), C.uintptr_t(uintptr(arg)))
|
||||||
|
if r0 == -1 && er != nil {
|
||||||
|
err = er
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
|
@ -1015,8 +1015,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||||
for n < len(pp.Path) && pp.Path[n] != 0 {
|
for n < len(pp.Path) && pp.Path[n] != 0 {
|
||||||
n++
|
n++
|
||||||
}
|
}
|
||||||
bytes := (*[len(pp.Path)]byte)(unsafe.Pointer(&pp.Path[0]))[0:n]
|
sa.Name = string(unsafe.Slice((*byte)(unsafe.Pointer(&pp.Path[0])), n))
|
||||||
sa.Name = string(bytes)
|
|
||||||
return sa, nil
|
return sa, nil
|
||||||
|
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
|
@ -1365,6 +1364,10 @@ func SetsockoptTCPRepairOpt(fd, level, opt int, o []TCPRepairOpt) (err error) {
|
||||||
return setsockopt(fd, level, opt, unsafe.Pointer(&o[0]), uintptr(SizeofTCPRepairOpt*len(o)))
|
return setsockopt(fd, level, opt, unsafe.Pointer(&o[0]), uintptr(SizeofTCPRepairOpt*len(o)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SetsockoptTCPMD5Sig(fd, level, opt int, s *TCPMD5Sig) error {
|
||||||
|
return setsockopt(fd, level, opt, unsafe.Pointer(s), unsafe.Sizeof(*s))
|
||||||
|
}
|
||||||
|
|
||||||
// Keyctl Commands (http://man7.org/linux/man-pages/man2/keyctl.2.html)
|
// Keyctl Commands (http://man7.org/linux/man-pages/man2/keyctl.2.html)
|
||||||
|
|
||||||
// KeyctlInt calls keyctl commands in which each argument is an int.
|
// KeyctlInt calls keyctl commands in which each argument is an int.
|
||||||
|
@ -1579,6 +1582,7 @@ func BindToDevice(fd int, device string) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//sys ptrace(request int, pid int, addr uintptr, data uintptr) (err error)
|
//sys ptrace(request int, pid int, addr uintptr, data uintptr) (err error)
|
||||||
|
//sys ptracePtr(request int, pid int, addr uintptr, data unsafe.Pointer) (err error) = SYS_PTRACE
|
||||||
|
|
||||||
func ptracePeek(req int, pid int, addr uintptr, out []byte) (count int, err error) {
|
func ptracePeek(req int, pid int, addr uintptr, out []byte) (count int, err error) {
|
||||||
// The peek requests are machine-size oriented, so we wrap it
|
// The peek requests are machine-size oriented, so we wrap it
|
||||||
|
@ -1596,7 +1600,7 @@ func ptracePeek(req int, pid int, addr uintptr, out []byte) (count int, err erro
|
||||||
// boundary.
|
// boundary.
|
||||||
n := 0
|
n := 0
|
||||||
if addr%SizeofPtr != 0 {
|
if addr%SizeofPtr != 0 {
|
||||||
err = ptrace(req, pid, addr-addr%SizeofPtr, uintptr(unsafe.Pointer(&buf[0])))
|
err = ptracePtr(req, pid, addr-addr%SizeofPtr, unsafe.Pointer(&buf[0]))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
@ -1608,7 +1612,7 @@ func ptracePeek(req int, pid int, addr uintptr, out []byte) (count int, err erro
|
||||||
for len(out) > 0 {
|
for len(out) > 0 {
|
||||||
// We use an internal buffer to guarantee alignment.
|
// We use an internal buffer to guarantee alignment.
|
||||||
// It's not documented if this is necessary, but we're paranoid.
|
// It's not documented if this is necessary, but we're paranoid.
|
||||||
err = ptrace(req, pid, addr+uintptr(n), uintptr(unsafe.Pointer(&buf[0])))
|
err = ptracePtr(req, pid, addr+uintptr(n), unsafe.Pointer(&buf[0]))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return n, err
|
return n, err
|
||||||
}
|
}
|
||||||
|
@ -1640,7 +1644,7 @@ func ptracePoke(pokeReq int, peekReq int, pid int, addr uintptr, data []byte) (c
|
||||||
n := 0
|
n := 0
|
||||||
if addr%SizeofPtr != 0 {
|
if addr%SizeofPtr != 0 {
|
||||||
var buf [SizeofPtr]byte
|
var buf [SizeofPtr]byte
|
||||||
err = ptrace(peekReq, pid, addr-addr%SizeofPtr, uintptr(unsafe.Pointer(&buf[0])))
|
err = ptracePtr(peekReq, pid, addr-addr%SizeofPtr, unsafe.Pointer(&buf[0]))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
@ -1667,7 +1671,7 @@ func ptracePoke(pokeReq int, peekReq int, pid int, addr uintptr, data []byte) (c
|
||||||
// Trailing edge.
|
// Trailing edge.
|
||||||
if len(data) > 0 {
|
if len(data) > 0 {
|
||||||
var buf [SizeofPtr]byte
|
var buf [SizeofPtr]byte
|
||||||
err = ptrace(peekReq, pid, addr+uintptr(n), uintptr(unsafe.Pointer(&buf[0])))
|
err = ptracePtr(peekReq, pid, addr+uintptr(n), unsafe.Pointer(&buf[0]))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return n, err
|
return n, err
|
||||||
}
|
}
|
||||||
|
@ -1696,11 +1700,11 @@ func PtracePokeUser(pid int, addr uintptr, data []byte) (count int, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func PtraceGetRegs(pid int, regsout *PtraceRegs) (err error) {
|
func PtraceGetRegs(pid int, regsout *PtraceRegs) (err error) {
|
||||||
return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
|
return ptracePtr(PTRACE_GETREGS, pid, 0, unsafe.Pointer(regsout))
|
||||||
}
|
}
|
||||||
|
|
||||||
func PtraceSetRegs(pid int, regs *PtraceRegs) (err error) {
|
func PtraceSetRegs(pid int, regs *PtraceRegs) (err error) {
|
||||||
return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
|
return ptracePtr(PTRACE_SETREGS, pid, 0, unsafe.Pointer(regs))
|
||||||
}
|
}
|
||||||
|
|
||||||
func PtraceSetOptions(pid int, options int) (err error) {
|
func PtraceSetOptions(pid int, options int) (err error) {
|
||||||
|
@ -1709,7 +1713,7 @@ func PtraceSetOptions(pid int, options int) (err error) {
|
||||||
|
|
||||||
func PtraceGetEventMsg(pid int) (msg uint, err error) {
|
func PtraceGetEventMsg(pid int) (msg uint, err error) {
|
||||||
var data _C_long
|
var data _C_long
|
||||||
err = ptrace(PTRACE_GETEVENTMSG, pid, 0, uintptr(unsafe.Pointer(&data)))
|
err = ptracePtr(PTRACE_GETEVENTMSG, pid, 0, unsafe.Pointer(&data))
|
||||||
msg = uint(data)
|
msg = uint(data)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1869,7 +1873,6 @@ func Getpgrp() (pid int) {
|
||||||
//sys OpenTree(dfd int, fileName string, flags uint) (r int, err error)
|
//sys OpenTree(dfd int, fileName string, flags uint) (r int, err error)
|
||||||
//sys PerfEventOpen(attr *PerfEventAttr, pid int, cpu int, groupFd int, flags int) (fd int, err error)
|
//sys PerfEventOpen(attr *PerfEventAttr, pid int, cpu int, groupFd int, flags int) (fd int, err error)
|
||||||
//sys PivotRoot(newroot string, putold string) (err error) = SYS_PIVOT_ROOT
|
//sys PivotRoot(newroot string, putold string) (err error) = SYS_PIVOT_ROOT
|
||||||
//sysnb Prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) = SYS_PRLIMIT64
|
|
||||||
//sys Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error)
|
//sys Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error)
|
||||||
//sys Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) = SYS_PSELECT6
|
//sys Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) = SYS_PSELECT6
|
||||||
//sys read(fd int, p []byte) (n int, err error)
|
//sys read(fd int, p []byte) (n int, err error)
|
||||||
|
@ -1883,6 +1886,15 @@ func Getpgrp() (pid int) {
|
||||||
//sysnb Settimeofday(tv *Timeval) (err error)
|
//sysnb Settimeofday(tv *Timeval) (err error)
|
||||||
//sys Setns(fd int, nstype int) (err error)
|
//sys Setns(fd int, nstype int) (err error)
|
||||||
|
|
||||||
|
//go:linkname syscall_prlimit syscall.prlimit
|
||||||
|
func syscall_prlimit(pid, resource int, newlimit, old *syscall.Rlimit) error
|
||||||
|
|
||||||
|
func Prlimit(pid, resource int, newlimit, old *Rlimit) error {
|
||||||
|
// Just call the syscall version, because as of Go 1.21
|
||||||
|
// it will affect starting a new process.
|
||||||
|
return syscall_prlimit(pid, resource, (*syscall.Rlimit)(newlimit), (*syscall.Rlimit)(old))
|
||||||
|
}
|
||||||
|
|
||||||
// PrctlRetInt performs a prctl operation specified by option and further
|
// PrctlRetInt performs a prctl operation specified by option and further
|
||||||
// optional arguments arg2 through arg5 depending on option. It returns a
|
// optional arguments arg2 through arg5 depending on option. It returns a
|
||||||
// non-negative integer that is returned by the prctl syscall.
|
// non-negative integer that is returned by the prctl syscall.
|
||||||
|
@ -2154,6 +2166,14 @@ func isGroupMember(gid int) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func isCapDacOverrideSet() bool {
|
||||||
|
hdr := CapUserHeader{Version: LINUX_CAPABILITY_VERSION_3}
|
||||||
|
data := [2]CapUserData{}
|
||||||
|
err := Capget(&hdr, &data[0])
|
||||||
|
|
||||||
|
return err == nil && data[0].Effective&(1<<CAP_DAC_OVERRIDE) != 0
|
||||||
|
}
|
||||||
|
|
||||||
//sys faccessat(dirfd int, path string, mode uint32) (err error)
|
//sys faccessat(dirfd int, path string, mode uint32) (err error)
|
||||||
//sys Faccessat2(dirfd int, path string, mode uint32, flags int) (err error)
|
//sys Faccessat2(dirfd int, path string, mode uint32, flags int) (err error)
|
||||||
|
|
||||||
|
@ -2189,6 +2209,12 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
|
||||||
var uid int
|
var uid int
|
||||||
if flags&AT_EACCESS != 0 {
|
if flags&AT_EACCESS != 0 {
|
||||||
uid = Geteuid()
|
uid = Geteuid()
|
||||||
|
if uid != 0 && isCapDacOverrideSet() {
|
||||||
|
// If CAP_DAC_OVERRIDE is set, file access check is
|
||||||
|
// done by the kernel in the same way as for root
|
||||||
|
// (see generic_permission() in the Linux sources).
|
||||||
|
uid = 0
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
uid = Getuid()
|
uid = Getuid()
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,33 +97,6 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT
|
|
||||||
|
|
||||||
func Setrlimit(resource int, rlim *Rlimit) (err error) {
|
|
||||||
err = Prlimit(0, resource, rlim, nil)
|
|
||||||
if err != ENOSYS {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
rl := rlimit32{}
|
|
||||||
if rlim.Cur == rlimInf64 {
|
|
||||||
rl.Cur = rlimInf32
|
|
||||||
} else if rlim.Cur < uint64(rlimInf32) {
|
|
||||||
rl.Cur = uint32(rlim.Cur)
|
|
||||||
} else {
|
|
||||||
return EINVAL
|
|
||||||
}
|
|
||||||
if rlim.Max == rlimInf64 {
|
|
||||||
rl.Max = rlimInf32
|
|
||||||
} else if rlim.Max < uint64(rlimInf32) {
|
|
||||||
rl.Max = uint32(rlim.Max)
|
|
||||||
} else {
|
|
||||||
return EINVAL
|
|
||||||
}
|
|
||||||
|
|
||||||
return setrlimit(resource, &rl)
|
|
||||||
}
|
|
||||||
|
|
||||||
func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
|
func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
|
||||||
newoffset, errno := seek(fd, offset, whence)
|
newoffset, errno := seek(fd, offset, whence)
|
||||||
if errno != 0 {
|
if errno != 0 {
|
||||||
|
|
|
@ -46,7 +46,6 @@ 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 Setrlimit(resource int, rlim *Rlimit) (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)
|
||||||
|
|
||||||
|
|
|
@ -171,33 +171,6 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT
|
|
||||||
|
|
||||||
func Setrlimit(resource int, rlim *Rlimit) (err error) {
|
|
||||||
err = Prlimit(0, resource, rlim, nil)
|
|
||||||
if err != ENOSYS {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
rl := rlimit32{}
|
|
||||||
if rlim.Cur == rlimInf64 {
|
|
||||||
rl.Cur = rlimInf32
|
|
||||||
} else if rlim.Cur < uint64(rlimInf32) {
|
|
||||||
rl.Cur = uint32(rlim.Cur)
|
|
||||||
} else {
|
|
||||||
return EINVAL
|
|
||||||
}
|
|
||||||
if rlim.Max == rlimInf64 {
|
|
||||||
rl.Max = rlimInf32
|
|
||||||
} else if rlim.Max < uint64(rlimInf32) {
|
|
||||||
rl.Max = uint32(rlim.Max)
|
|
||||||
} else {
|
|
||||||
return EINVAL
|
|
||||||
}
|
|
||||||
|
|
||||||
return setrlimit(resource, &rl)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *PtraceRegs) PC() uint64 { return uint64(r.Uregs[15]) }
|
func (r *PtraceRegs) PC() uint64 { return uint64(r.Uregs[15]) }
|
||||||
|
|
||||||
func (r *PtraceRegs) SetPC(pc uint64) { r.Uregs[15] = uint32(pc) }
|
func (r *PtraceRegs) SetPC(pc uint64) { r.Uregs[15] = uint32(pc) }
|
||||||
|
|
|
@ -39,7 +39,6 @@ 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 setrlimit(resource int, rlim *Rlimit) (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)
|
||||||
|
|
||||||
|
@ -143,15 +142,6 @@ func Getrlimit(resource int, rlim *Rlimit) error {
|
||||||
return getrlimit(resource, rlim)
|
return getrlimit(resource, rlim)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setrlimit prefers the prlimit64 system call. See issue 38604.
|
|
||||||
func Setrlimit(resource int, rlim *Rlimit) error {
|
|
||||||
err := Prlimit(0, resource, rlim, nil)
|
|
||||||
if err != ENOSYS {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return setrlimit(resource, rlim)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *PtraceRegs) PC() uint64 { return r.Pc }
|
func (r *PtraceRegs) PC() uint64 { return r.Pc }
|
||||||
|
|
||||||
func (r *PtraceRegs) SetPC(pc uint64) { r.Pc = pc }
|
func (r *PtraceRegs) SetPC(pc uint64) { r.Pc = pc }
|
||||||
|
|
|
@ -126,11 +126,6 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func Setrlimit(resource int, rlim *Rlimit) (err error) {
|
|
||||||
err = Prlimit(0, resource, rlim, nil)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func futimesat(dirfd int, path string, tv *[2]Timeval) (err error) {
|
func futimesat(dirfd int, path string, tv *[2]Timeval) (err error) {
|
||||||
if tv == nil {
|
if tv == nil {
|
||||||
return utimensat(dirfd, path, nil, 0)
|
return utimensat(dirfd, path, nil, 0)
|
||||||
|
|
|
@ -37,7 +37,6 @@ 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 Setrlimit(resource int, rlim *Rlimit) (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)
|
||||||
|
|
|
@ -151,33 +151,6 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT
|
|
||||||
|
|
||||||
func Setrlimit(resource int, rlim *Rlimit) (err error) {
|
|
||||||
err = Prlimit(0, resource, rlim, nil)
|
|
||||||
if err != ENOSYS {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
rl := rlimit32{}
|
|
||||||
if rlim.Cur == rlimInf64 {
|
|
||||||
rl.Cur = rlimInf32
|
|
||||||
} else if rlim.Cur < uint64(rlimInf32) {
|
|
||||||
rl.Cur = uint32(rlim.Cur)
|
|
||||||
} else {
|
|
||||||
return EINVAL
|
|
||||||
}
|
|
||||||
if rlim.Max == rlimInf64 {
|
|
||||||
rl.Max = rlimInf32
|
|
||||||
} else if rlim.Max < uint64(rlimInf32) {
|
|
||||||
rl.Max = uint32(rlim.Max)
|
|
||||||
} else {
|
|
||||||
return EINVAL
|
|
||||||
}
|
|
||||||
|
|
||||||
return setrlimit(resource, &rl)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *PtraceRegs) PC() uint64 { return r.Epc }
|
func (r *PtraceRegs) PC() uint64 { return r.Epc }
|
||||||
|
|
||||||
func (r *PtraceRegs) SetPC(pc uint64) { r.Epc = pc }
|
func (r *PtraceRegs) SetPC(pc uint64) { r.Epc = pc }
|
||||||
|
|
|
@ -159,33 +159,6 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT
|
|
||||||
|
|
||||||
func Setrlimit(resource int, rlim *Rlimit) (err error) {
|
|
||||||
err = Prlimit(0, resource, rlim, nil)
|
|
||||||
if err != ENOSYS {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
rl := rlimit32{}
|
|
||||||
if rlim.Cur == rlimInf64 {
|
|
||||||
rl.Cur = rlimInf32
|
|
||||||
} else if rlim.Cur < uint64(rlimInf32) {
|
|
||||||
rl.Cur = uint32(rlim.Cur)
|
|
||||||
} else {
|
|
||||||
return EINVAL
|
|
||||||
}
|
|
||||||
if rlim.Max == rlimInf64 {
|
|
||||||
rl.Max = rlimInf32
|
|
||||||
} else if rlim.Max < uint64(rlimInf32) {
|
|
||||||
rl.Max = uint32(rlim.Max)
|
|
||||||
} else {
|
|
||||||
return EINVAL
|
|
||||||
}
|
|
||||||
|
|
||||||
return setrlimit(resource, &rl)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *PtraceRegs) PC() uint32 { return r.Nip }
|
func (r *PtraceRegs) PC() uint32 { return r.Nip }
|
||||||
|
|
||||||
func (r *PtraceRegs) SetPC(pc uint32) { r.Nip = pc }
|
func (r *PtraceRegs) SetPC(pc uint32) { r.Nip = pc }
|
||||||
|
|
|
@ -34,7 +34,6 @@ 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 Setrlimit(resource int, rlim *Rlimit) (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)
|
||||||
|
|
|
@ -38,7 +38,6 @@ 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 Setrlimit(resource int, rlim *Rlimit) (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,7 +34,6 @@ 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 Setrlimit(resource int, rlim *Rlimit) (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,7 +31,6 @@ 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 Setrlimit(resource int, rlim *Rlimit) (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)
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"runtime"
|
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
@ -178,13 +177,13 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
|
||||||
}
|
}
|
||||||
|
|
||||||
//sys ioctl(fd int, req uint, arg uintptr) (err error)
|
//sys ioctl(fd int, req uint, arg uintptr) (err error)
|
||||||
|
//sys ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) = SYS_IOCTL
|
||||||
|
|
||||||
//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
|
//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
|
||||||
|
|
||||||
func IoctlGetPtmget(fd int, req uint) (*Ptmget, error) {
|
func IoctlGetPtmget(fd int, req uint) (*Ptmget, error) {
|
||||||
var value Ptmget
|
var value Ptmget
|
||||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
|
err := ioctlPtr(fd, req, unsafe.Pointer(&value))
|
||||||
runtime.KeepAlive(value)
|
|
||||||
return &value, err
|
return &value, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,7 +340,6 @@ func Statvfs(path string, buf *Statvfs_t) (err error) {
|
||||||
//sys Setpriority(which int, who int, prio int) (err error)
|
//sys Setpriority(which int, who int, prio int) (err error)
|
||||||
//sysnb Setregid(rgid int, egid int) (err error)
|
//sysnb Setregid(rgid int, egid int) (err error)
|
||||||
//sysnb Setreuid(ruid int, euid int) (err error)
|
//sysnb Setreuid(ruid int, euid int) (err error)
|
||||||
//sysnb Setrlimit(which int, lim *Rlimit) (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)
|
||||||
|
@ -502,7 +500,6 @@ func Statvfs(path string, buf *Statvfs_t) (err error) {
|
||||||
// compat_43_osendmsg
|
// compat_43_osendmsg
|
||||||
// compat_43_osethostid
|
// compat_43_osethostid
|
||||||
// compat_43_osethostname
|
// compat_43_osethostname
|
||||||
// compat_43_osetrlimit
|
|
||||||
// compat_43_osigblock
|
// compat_43_osigblock
|
||||||
// compat_43_osigsetmask
|
// compat_43_osigsetmask
|
||||||
// compat_43_osigstack
|
// compat_43_osigstack
|
||||||
|
|
|
@ -152,6 +152,7 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//sys ioctl(fd int, req uint, arg uintptr) (err error)
|
//sys ioctl(fd int, req uint, arg uintptr) (err error)
|
||||||
|
//sys ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) = SYS_IOCTL
|
||||||
|
|
||||||
//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
|
//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
|
||||||
|
|
||||||
|
@ -293,7 +294,6 @@ func Uname(uname *Utsname) error {
|
||||||
//sysnb Setreuid(ruid int, euid int) (err error)
|
//sysnb Setreuid(ruid int, euid int) (err error)
|
||||||
//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
|
//sysnb Setresgid(rgid int, egid int, sgid int) (err error)
|
||||||
//sysnb Setresuid(ruid int, euid int, suid int) (err error)
|
//sysnb Setresuid(ruid int, euid int, suid int) (err error)
|
||||||
//sysnb Setrlimit(which int, lim *Rlimit) (err error)
|
|
||||||
//sysnb Setrtable(rtable int) (err error)
|
//sysnb Setrtable(rtable 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)
|
||||||
|
|
|
@ -408,8 +408,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||||
for n < len(pp.Path) && pp.Path[n] != 0 {
|
for n < len(pp.Path) && pp.Path[n] != 0 {
|
||||||
n++
|
n++
|
||||||
}
|
}
|
||||||
bytes := (*[len(pp.Path)]byte)(unsafe.Pointer(&pp.Path[0]))[0:n]
|
sa.Name = string(unsafe.Slice((*byte)(unsafe.Pointer(&pp.Path[0])), n))
|
||||||
sa.Name = string(bytes)
|
|
||||||
return sa, nil
|
return sa, nil
|
||||||
|
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
|
@ -546,22 +545,26 @@ func Minor(dev uint64) uint32 {
|
||||||
* Expose the ioctl function
|
* Expose the ioctl function
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//sys ioctlRet(fd int, req uint, arg uintptr) (ret int, err error) = libc.ioctl
|
//sys ioctlRet(fd int, req int, arg uintptr) (ret int, err error) = libc.ioctl
|
||||||
|
//sys ioctlPtrRet(fd int, req int, arg unsafe.Pointer) (ret int, err error) = libc.ioctl
|
||||||
|
|
||||||
func ioctl(fd int, req uint, arg uintptr) (err error) {
|
func ioctl(fd int, req int, arg uintptr) (err error) {
|
||||||
_, err = ioctlRet(fd, req, arg)
|
_, err = ioctlRet(fd, req, arg)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func IoctlSetTermio(fd int, req uint, value *Termio) error {
|
func ioctlPtr(fd int, req int, arg unsafe.Pointer) (err error) {
|
||||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
_, err = ioctlPtrRet(fd, req, arg)
|
||||||
runtime.KeepAlive(value)
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func IoctlGetTermio(fd int, req uint) (*Termio, error) {
|
func IoctlSetTermio(fd int, req int, value *Termio) error {
|
||||||
|
return ioctlPtr(fd, req, unsafe.Pointer(value))
|
||||||
|
}
|
||||||
|
|
||||||
|
func IoctlGetTermio(fd int, req int) (*Termio, error) {
|
||||||
var value Termio
|
var value Termio
|
||||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
|
err := ioctlPtr(fd, req, unsafe.Pointer(&value))
|
||||||
return &value, err
|
return &value, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -662,7 +665,6 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
|
||||||
//sys Setpriority(which int, who int, prio int) (err error)
|
//sys Setpriority(which int, who int, prio int) (err error)
|
||||||
//sysnb Setregid(rgid int, egid int) (err error)
|
//sysnb Setregid(rgid int, egid int) (err error)
|
||||||
//sysnb Setreuid(ruid int, euid int) (err error)
|
//sysnb Setreuid(ruid int, euid int) (err error)
|
||||||
//sysnb Setrlimit(which int, lim *Rlimit) (err error)
|
|
||||||
//sysnb Setsid() (pid int, err error)
|
//sysnb Setsid() (pid int, err error)
|
||||||
//sysnb Setuid(uid int) (err error)
|
//sysnb Setuid(uid int) (err error)
|
||||||
//sys Shutdown(s int, how int) (err error) = libsocket.shutdown
|
//sys Shutdown(s int, how int) (err error) = libsocket.shutdown
|
||||||
|
@ -1077,14 +1079,14 @@ func Getmsg(fd int, cl []byte, data []byte) (retCl []byte, retData []byte, flags
|
||||||
return retCl, retData, flags, nil
|
return retCl, retData, flags, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func IoctlSetIntRetInt(fd int, req uint, arg int) (int, error) {
|
func IoctlSetIntRetInt(fd int, req int, arg int) (int, error) {
|
||||||
return ioctlRet(fd, req, uintptr(arg))
|
return ioctlRet(fd, req, uintptr(arg))
|
||||||
}
|
}
|
||||||
|
|
||||||
func IoctlSetString(fd int, req uint, val string) error {
|
func IoctlSetString(fd int, req int, val string) error {
|
||||||
bs := make([]byte, len(val)+1)
|
bs := make([]byte, len(val)+1)
|
||||||
copy(bs[:len(bs)-1], val)
|
copy(bs[:len(bs)-1], val)
|
||||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&bs[0])))
|
err := ioctlPtr(fd, req, unsafe.Pointer(&bs[0]))
|
||||||
runtime.KeepAlive(&bs[0])
|
runtime.KeepAlive(&bs[0])
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -1117,8 +1119,8 @@ func (l *Lifreq) GetLifruUint() uint {
|
||||||
return *(*uint)(unsafe.Pointer(&l.Lifru[0]))
|
return *(*uint)(unsafe.Pointer(&l.Lifru[0]))
|
||||||
}
|
}
|
||||||
|
|
||||||
func IoctlLifreq(fd int, req uint, l *Lifreq) error {
|
func IoctlLifreq(fd int, req int, l *Lifreq) error {
|
||||||
return ioctl(fd, req, uintptr(unsafe.Pointer(l)))
|
return ioctlPtr(fd, req, unsafe.Pointer(l))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Strioctl Helpers
|
// Strioctl Helpers
|
||||||
|
@ -1128,6 +1130,6 @@ func (s *Strioctl) SetInt(i int) {
|
||||||
s.Dp = (*int8)(unsafe.Pointer(&i))
|
s.Dp = (*int8)(unsafe.Pointer(&i))
|
||||||
}
|
}
|
||||||
|
|
||||||
func IoctlSetStrioctlRetInt(fd int, req uint, s *Strioctl) (int, error) {
|
func IoctlSetStrioctlRetInt(fd int, req int, s *Strioctl) (int, error) {
|
||||||
return ioctlRet(fd, req, uintptr(unsafe.Pointer(s)))
|
return ioctlPtrRet(fd, req, unsafe.Pointer(s))
|
||||||
}
|
}
|
||||||
|
|
|
@ -587,3 +587,10 @@ func emptyIovecs(iov []Iovec) bool {
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Setrlimit sets a resource limit.
|
||||||
|
func Setrlimit(resource int, rlim *Rlimit) error {
|
||||||
|
// Just call the syscall version, because as of Go 1.21
|
||||||
|
// it will affect starting a new process.
|
||||||
|
return syscall.Setrlimit(resource, (*syscall.Rlimit)(rlim))
|
||||||
|
}
|
||||||
|
|
|
@ -139,8 +139,7 @@ func anyToSockaddr(_ int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||||
for n < int(pp.Len) && pp.Path[n] != 0 {
|
for n < int(pp.Len) && pp.Path[n] != 0 {
|
||||||
n++
|
n++
|
||||||
}
|
}
|
||||||
bytes := (*[len(pp.Path)]byte)(unsafe.Pointer(&pp.Path[0]))[0:n]
|
sa.Name = string(unsafe.Slice((*byte)(unsafe.Pointer(&pp.Path[0])), n))
|
||||||
sa.Name = string(bytes)
|
|
||||||
return sa, nil
|
return sa, nil
|
||||||
|
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
|
@ -213,7 +212,8 @@ func (cmsg *Cmsghdr) SetLen(length int) {
|
||||||
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) = SYS___SENDMSG_A
|
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) = SYS___SENDMSG_A
|
||||||
//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) = SYS_MMAP
|
//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) = SYS_MMAP
|
||||||
//sys munmap(addr uintptr, length uintptr) (err error) = SYS_MUNMAP
|
//sys munmap(addr uintptr, length uintptr) (err error) = SYS_MUNMAP
|
||||||
//sys ioctl(fd int, req uint, arg uintptr) (err error) = SYS_IOCTL
|
//sys ioctl(fd int, req int, arg uintptr) (err error) = SYS_IOCTL
|
||||||
|
//sys ioctlPtr(fd int, req int, arg unsafe.Pointer) (err error) = SYS_IOCTL
|
||||||
|
|
||||||
//sys Access(path string, mode uint32) (err error) = SYS___ACCESS_A
|
//sys Access(path string, mode uint32) (err error) = SYS___ACCESS_A
|
||||||
//sys Chdir(path string) (err error) = SYS___CHDIR_A
|
//sys Chdir(path string) (err error) = SYS___CHDIR_A
|
||||||
|
|
|
@ -1270,6 +1270,16 @@ const (
|
||||||
SEEK_END = 0x2
|
SEEK_END = 0x2
|
||||||
SEEK_HOLE = 0x3
|
SEEK_HOLE = 0x3
|
||||||
SEEK_SET = 0x0
|
SEEK_SET = 0x0
|
||||||
|
SF_APPEND = 0x40000
|
||||||
|
SF_ARCHIVED = 0x10000
|
||||||
|
SF_DATALESS = 0x40000000
|
||||||
|
SF_FIRMLINK = 0x800000
|
||||||
|
SF_IMMUTABLE = 0x20000
|
||||||
|
SF_NOUNLINK = 0x100000
|
||||||
|
SF_RESTRICTED = 0x80000
|
||||||
|
SF_SETTABLE = 0x3fff0000
|
||||||
|
SF_SUPPORTED = 0x9f0000
|
||||||
|
SF_SYNTHETIC = 0xc0000000
|
||||||
SHUT_RD = 0x0
|
SHUT_RD = 0x0
|
||||||
SHUT_RDWR = 0x2
|
SHUT_RDWR = 0x2
|
||||||
SHUT_WR = 0x1
|
SHUT_WR = 0x1
|
||||||
|
@ -1543,6 +1553,15 @@ const (
|
||||||
TIOCTIMESTAMP = 0x40107459
|
TIOCTIMESTAMP = 0x40107459
|
||||||
TIOCUCNTL = 0x80047466
|
TIOCUCNTL = 0x80047466
|
||||||
TOSTOP = 0x400000
|
TOSTOP = 0x400000
|
||||||
|
UF_APPEND = 0x4
|
||||||
|
UF_COMPRESSED = 0x20
|
||||||
|
UF_DATAVAULT = 0x80
|
||||||
|
UF_HIDDEN = 0x8000
|
||||||
|
UF_IMMUTABLE = 0x2
|
||||||
|
UF_NODUMP = 0x1
|
||||||
|
UF_OPAQUE = 0x8
|
||||||
|
UF_SETTABLE = 0xffff
|
||||||
|
UF_TRACKED = 0x40
|
||||||
VDISCARD = 0xf
|
VDISCARD = 0xf
|
||||||
VDSUSP = 0xb
|
VDSUSP = 0xb
|
||||||
VEOF = 0x0
|
VEOF = 0x0
|
||||||
|
|
|
@ -1270,6 +1270,16 @@ const (
|
||||||
SEEK_END = 0x2
|
SEEK_END = 0x2
|
||||||
SEEK_HOLE = 0x3
|
SEEK_HOLE = 0x3
|
||||||
SEEK_SET = 0x0
|
SEEK_SET = 0x0
|
||||||
|
SF_APPEND = 0x40000
|
||||||
|
SF_ARCHIVED = 0x10000
|
||||||
|
SF_DATALESS = 0x40000000
|
||||||
|
SF_FIRMLINK = 0x800000
|
||||||
|
SF_IMMUTABLE = 0x20000
|
||||||
|
SF_NOUNLINK = 0x100000
|
||||||
|
SF_RESTRICTED = 0x80000
|
||||||
|
SF_SETTABLE = 0x3fff0000
|
||||||
|
SF_SUPPORTED = 0x9f0000
|
||||||
|
SF_SYNTHETIC = 0xc0000000
|
||||||
SHUT_RD = 0x0
|
SHUT_RD = 0x0
|
||||||
SHUT_RDWR = 0x2
|
SHUT_RDWR = 0x2
|
||||||
SHUT_WR = 0x1
|
SHUT_WR = 0x1
|
||||||
|
@ -1543,6 +1553,15 @@ const (
|
||||||
TIOCTIMESTAMP = 0x40107459
|
TIOCTIMESTAMP = 0x40107459
|
||||||
TIOCUCNTL = 0x80047466
|
TIOCUCNTL = 0x80047466
|
||||||
TOSTOP = 0x400000
|
TOSTOP = 0x400000
|
||||||
|
UF_APPEND = 0x4
|
||||||
|
UF_COMPRESSED = 0x20
|
||||||
|
UF_DATAVAULT = 0x80
|
||||||
|
UF_HIDDEN = 0x8000
|
||||||
|
UF_IMMUTABLE = 0x2
|
||||||
|
UF_NODUMP = 0x1
|
||||||
|
UF_OPAQUE = 0x8
|
||||||
|
UF_SETTABLE = 0xffff
|
||||||
|
UF_TRACKED = 0x40
|
||||||
VDISCARD = 0xf
|
VDISCARD = 0xf
|
||||||
VDSUSP = 0xb
|
VDSUSP = 0xb
|
||||||
VEOF = 0x0
|
VEOF = 0x0
|
||||||
|
|
|
@ -70,6 +70,7 @@ const (
|
||||||
ALG_SET_DRBG_ENTROPY = 0x6
|
ALG_SET_DRBG_ENTROPY = 0x6
|
||||||
ALG_SET_IV = 0x2
|
ALG_SET_IV = 0x2
|
||||||
ALG_SET_KEY = 0x1
|
ALG_SET_KEY = 0x1
|
||||||
|
ALG_SET_KEY_BY_KEY_SERIAL = 0x7
|
||||||
ALG_SET_OP = 0x3
|
ALG_SET_OP = 0x3
|
||||||
ANON_INODE_FS_MAGIC = 0x9041934
|
ANON_INODE_FS_MAGIC = 0x9041934
|
||||||
ARPHRD_6LOWPAN = 0x339
|
ARPHRD_6LOWPAN = 0x339
|
||||||
|
@ -774,6 +775,8 @@ const (
|
||||||
DEVLINK_GENL_MCGRP_CONFIG_NAME = "config"
|
DEVLINK_GENL_MCGRP_CONFIG_NAME = "config"
|
||||||
DEVLINK_GENL_NAME = "devlink"
|
DEVLINK_GENL_NAME = "devlink"
|
||||||
DEVLINK_GENL_VERSION = 0x1
|
DEVLINK_GENL_VERSION = 0x1
|
||||||
|
DEVLINK_PORT_FN_CAP_MIGRATABLE = 0x2
|
||||||
|
DEVLINK_PORT_FN_CAP_ROCE = 0x1
|
||||||
DEVLINK_SB_THRESHOLD_TO_ALPHA_MAX = 0x14
|
DEVLINK_SB_THRESHOLD_TO_ALPHA_MAX = 0x14
|
||||||
DEVLINK_SUPPORTED_FLASH_OVERWRITE_SECTIONS = 0x3
|
DEVLINK_SUPPORTED_FLASH_OVERWRITE_SECTIONS = 0x3
|
||||||
DEVMEM_MAGIC = 0x454d444d
|
DEVMEM_MAGIC = 0x454d444d
|
||||||
|
@ -1262,6 +1265,8 @@ const (
|
||||||
FSCRYPT_MODE_AES_256_CTS = 0x4
|
FSCRYPT_MODE_AES_256_CTS = 0x4
|
||||||
FSCRYPT_MODE_AES_256_HCTR2 = 0xa
|
FSCRYPT_MODE_AES_256_HCTR2 = 0xa
|
||||||
FSCRYPT_MODE_AES_256_XTS = 0x1
|
FSCRYPT_MODE_AES_256_XTS = 0x1
|
||||||
|
FSCRYPT_MODE_SM4_CTS = 0x8
|
||||||
|
FSCRYPT_MODE_SM4_XTS = 0x7
|
||||||
FSCRYPT_POLICY_FLAGS_PAD_16 = 0x2
|
FSCRYPT_POLICY_FLAGS_PAD_16 = 0x2
|
||||||
FSCRYPT_POLICY_FLAGS_PAD_32 = 0x3
|
FSCRYPT_POLICY_FLAGS_PAD_32 = 0x3
|
||||||
FSCRYPT_POLICY_FLAGS_PAD_4 = 0x0
|
FSCRYPT_POLICY_FLAGS_PAD_4 = 0x0
|
||||||
|
@ -1280,8 +1285,6 @@ const (
|
||||||
FS_ENCRYPTION_MODE_AES_256_GCM = 0x2
|
FS_ENCRYPTION_MODE_AES_256_GCM = 0x2
|
||||||
FS_ENCRYPTION_MODE_AES_256_XTS = 0x1
|
FS_ENCRYPTION_MODE_AES_256_XTS = 0x1
|
||||||
FS_ENCRYPTION_MODE_INVALID = 0x0
|
FS_ENCRYPTION_MODE_INVALID = 0x0
|
||||||
FS_ENCRYPTION_MODE_SPECK128_256_CTS = 0x8
|
|
||||||
FS_ENCRYPTION_MODE_SPECK128_256_XTS = 0x7
|
|
||||||
FS_IOC_ADD_ENCRYPTION_KEY = 0xc0506617
|
FS_IOC_ADD_ENCRYPTION_KEY = 0xc0506617
|
||||||
FS_IOC_GET_ENCRYPTION_KEY_STATUS = 0xc080661a
|
FS_IOC_GET_ENCRYPTION_KEY_STATUS = 0xc080661a
|
||||||
FS_IOC_GET_ENCRYPTION_POLICY_EX = 0xc0096616
|
FS_IOC_GET_ENCRYPTION_POLICY_EX = 0xc0096616
|
||||||
|
@ -1770,6 +1773,7 @@ const (
|
||||||
LANDLOCK_ACCESS_FS_REFER = 0x2000
|
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_TRUNCATE = 0x4000
|
||||||
LANDLOCK_ACCESS_FS_WRITE_FILE = 0x2
|
LANDLOCK_ACCESS_FS_WRITE_FILE = 0x2
|
||||||
LANDLOCK_CREATE_RULESET_VERSION = 0x1
|
LANDLOCK_CREATE_RULESET_VERSION = 0x1
|
||||||
LINUX_REBOOT_CMD_CAD_OFF = 0x0
|
LINUX_REBOOT_CMD_CAD_OFF = 0x0
|
||||||
|
@ -1809,6 +1813,7 @@ const (
|
||||||
LWTUNNEL_IP_OPT_GENEVE_MAX = 0x3
|
LWTUNNEL_IP_OPT_GENEVE_MAX = 0x3
|
||||||
LWTUNNEL_IP_OPT_VXLAN_MAX = 0x1
|
LWTUNNEL_IP_OPT_VXLAN_MAX = 0x1
|
||||||
MADV_COLD = 0x14
|
MADV_COLD = 0x14
|
||||||
|
MADV_COLLAPSE = 0x19
|
||||||
MADV_DODUMP = 0x11
|
MADV_DODUMP = 0x11
|
||||||
MADV_DOFORK = 0xb
|
MADV_DOFORK = 0xb
|
||||||
MADV_DONTDUMP = 0x10
|
MADV_DONTDUMP = 0x10
|
||||||
|
@ -2163,6 +2168,7 @@ const (
|
||||||
PACKET_FANOUT_DATA = 0x16
|
PACKET_FANOUT_DATA = 0x16
|
||||||
PACKET_FANOUT_EBPF = 0x7
|
PACKET_FANOUT_EBPF = 0x7
|
||||||
PACKET_FANOUT_FLAG_DEFRAG = 0x8000
|
PACKET_FANOUT_FLAG_DEFRAG = 0x8000
|
||||||
|
PACKET_FANOUT_FLAG_IGNORE_OUTGOING = 0x4000
|
||||||
PACKET_FANOUT_FLAG_ROLLOVER = 0x1000
|
PACKET_FANOUT_FLAG_ROLLOVER = 0x1000
|
||||||
PACKET_FANOUT_FLAG_UNIQUEID = 0x2000
|
PACKET_FANOUT_FLAG_UNIQUEID = 0x2000
|
||||||
PACKET_FANOUT_HASH = 0x0
|
PACKET_FANOUT_HASH = 0x0
|
||||||
|
@ -2961,6 +2967,7 @@ const (
|
||||||
SOL_TCP = 0x6
|
SOL_TCP = 0x6
|
||||||
SOL_TIPC = 0x10f
|
SOL_TIPC = 0x10f
|
||||||
SOL_TLS = 0x11a
|
SOL_TLS = 0x11a
|
||||||
|
SOL_UDP = 0x11
|
||||||
SOL_X25 = 0x106
|
SOL_X25 = 0x106
|
||||||
SOL_XDP = 0x11b
|
SOL_XDP = 0x11b
|
||||||
SOMAXCONN = 0x1000
|
SOMAXCONN = 0x1000
|
||||||
|
@ -3245,6 +3252,19 @@ const (
|
||||||
TRACEFS_MAGIC = 0x74726163
|
TRACEFS_MAGIC = 0x74726163
|
||||||
TS_COMM_LEN = 0x20
|
TS_COMM_LEN = 0x20
|
||||||
UDF_SUPER_MAGIC = 0x15013346
|
UDF_SUPER_MAGIC = 0x15013346
|
||||||
|
UDP_CORK = 0x1
|
||||||
|
UDP_ENCAP = 0x64
|
||||||
|
UDP_ENCAP_ESPINUDP = 0x2
|
||||||
|
UDP_ENCAP_ESPINUDP_NON_IKE = 0x1
|
||||||
|
UDP_ENCAP_GTP0 = 0x4
|
||||||
|
UDP_ENCAP_GTP1U = 0x5
|
||||||
|
UDP_ENCAP_L2TPINUDP = 0x3
|
||||||
|
UDP_GRO = 0x68
|
||||||
|
UDP_NO_CHECK6_RX = 0x66
|
||||||
|
UDP_NO_CHECK6_TX = 0x65
|
||||||
|
UDP_SEGMENT = 0x67
|
||||||
|
UDP_V4_FLOW = 0x2
|
||||||
|
UDP_V6_FLOW = 0x6
|
||||||
UMOUNT_NOFOLLOW = 0x8
|
UMOUNT_NOFOLLOW = 0x8
|
||||||
USBDEVICE_SUPER_MAGIC = 0x9fa2
|
USBDEVICE_SUPER_MAGIC = 0x9fa2
|
||||||
UTIME_NOW = 0x3fffffff
|
UTIME_NOW = 0x3fffffff
|
||||||
|
|
|
@ -15,12 +15,12 @@ type PtraceRegsArm struct {
|
||||||
|
|
||||||
// PtraceGetRegsArm fetches the registers used by arm binaries.
|
// PtraceGetRegsArm fetches the registers used by arm binaries.
|
||||||
func PtraceGetRegsArm(pid int, regsout *PtraceRegsArm) error {
|
func PtraceGetRegsArm(pid int, regsout *PtraceRegsArm) error {
|
||||||
return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
|
return ptracePtr(PTRACE_GETREGS, pid, 0, unsafe.Pointer(regsout))
|
||||||
}
|
}
|
||||||
|
|
||||||
// PtraceSetRegsArm sets the registers used by arm binaries.
|
// PtraceSetRegsArm sets the registers used by arm binaries.
|
||||||
func PtraceSetRegsArm(pid int, regs *PtraceRegsArm) error {
|
func PtraceSetRegsArm(pid int, regs *PtraceRegsArm) error {
|
||||||
return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
|
return ptracePtr(PTRACE_SETREGS, pid, 0, unsafe.Pointer(regs))
|
||||||
}
|
}
|
||||||
|
|
||||||
// PtraceRegsArm64 is the registers used by arm64 binaries.
|
// PtraceRegsArm64 is the registers used by arm64 binaries.
|
||||||
|
@ -33,10 +33,10 @@ type PtraceRegsArm64 struct {
|
||||||
|
|
||||||
// PtraceGetRegsArm64 fetches the registers used by arm64 binaries.
|
// PtraceGetRegsArm64 fetches the registers used by arm64 binaries.
|
||||||
func PtraceGetRegsArm64(pid int, regsout *PtraceRegsArm64) error {
|
func PtraceGetRegsArm64(pid int, regsout *PtraceRegsArm64) error {
|
||||||
return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
|
return ptracePtr(PTRACE_GETREGS, pid, 0, unsafe.Pointer(regsout))
|
||||||
}
|
}
|
||||||
|
|
||||||
// PtraceSetRegsArm64 sets the registers used by arm64 binaries.
|
// PtraceSetRegsArm64 sets the registers used by arm64 binaries.
|
||||||
func PtraceSetRegsArm64(pid int, regs *PtraceRegsArm64) error {
|
func PtraceSetRegsArm64(pid int, regs *PtraceRegsArm64) error {
|
||||||
return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
|
return ptracePtr(PTRACE_SETREGS, pid, 0, unsafe.Pointer(regs))
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,11 +7,11 @@ import "unsafe"
|
||||||
// PtraceGetRegSetArm64 fetches the registers used by arm64 binaries.
|
// PtraceGetRegSetArm64 fetches the registers used by arm64 binaries.
|
||||||
func PtraceGetRegSetArm64(pid, addr int, regsout *PtraceRegsArm64) error {
|
func PtraceGetRegSetArm64(pid, addr int, regsout *PtraceRegsArm64) error {
|
||||||
iovec := Iovec{(*byte)(unsafe.Pointer(regsout)), uint64(unsafe.Sizeof(*regsout))}
|
iovec := Iovec{(*byte)(unsafe.Pointer(regsout)), uint64(unsafe.Sizeof(*regsout))}
|
||||||
return ptrace(PTRACE_GETREGSET, pid, uintptr(addr), uintptr(unsafe.Pointer(&iovec)))
|
return ptracePtr(PTRACE_GETREGSET, pid, uintptr(addr), unsafe.Pointer(&iovec))
|
||||||
}
|
}
|
||||||
|
|
||||||
// PtraceSetRegSetArm64 sets the registers used by arm64 binaries.
|
// PtraceSetRegSetArm64 sets the registers used by arm64 binaries.
|
||||||
func PtraceSetRegSetArm64(pid, addr int, regs *PtraceRegsArm64) error {
|
func PtraceSetRegSetArm64(pid, addr int, regs *PtraceRegsArm64) error {
|
||||||
iovec := Iovec{(*byte)(unsafe.Pointer(regs)), uint64(unsafe.Sizeof(*regs))}
|
iovec := Iovec{(*byte)(unsafe.Pointer(regs)), uint64(unsafe.Sizeof(*regs))}
|
||||||
return ptrace(PTRACE_SETREGSET, pid, uintptr(addr), uintptr(unsafe.Pointer(&iovec)))
|
return ptracePtr(PTRACE_SETREGSET, pid, uintptr(addr), unsafe.Pointer(&iovec))
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,12 +21,12 @@ type PtraceRegsMips struct {
|
||||||
|
|
||||||
// PtraceGetRegsMips fetches the registers used by mips binaries.
|
// PtraceGetRegsMips fetches the registers used by mips binaries.
|
||||||
func PtraceGetRegsMips(pid int, regsout *PtraceRegsMips) error {
|
func PtraceGetRegsMips(pid int, regsout *PtraceRegsMips) error {
|
||||||
return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
|
return ptracePtr(PTRACE_GETREGS, pid, 0, unsafe.Pointer(regsout))
|
||||||
}
|
}
|
||||||
|
|
||||||
// PtraceSetRegsMips sets the registers used by mips binaries.
|
// PtraceSetRegsMips sets the registers used by mips binaries.
|
||||||
func PtraceSetRegsMips(pid int, regs *PtraceRegsMips) error {
|
func PtraceSetRegsMips(pid int, regs *PtraceRegsMips) error {
|
||||||
return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
|
return ptracePtr(PTRACE_SETREGS, pid, 0, unsafe.Pointer(regs))
|
||||||
}
|
}
|
||||||
|
|
||||||
// PtraceRegsMips64 is the registers used by mips64 binaries.
|
// PtraceRegsMips64 is the registers used by mips64 binaries.
|
||||||
|
@ -42,10 +42,10 @@ type PtraceRegsMips64 struct {
|
||||||
|
|
||||||
// PtraceGetRegsMips64 fetches the registers used by mips64 binaries.
|
// PtraceGetRegsMips64 fetches the registers used by mips64 binaries.
|
||||||
func PtraceGetRegsMips64(pid int, regsout *PtraceRegsMips64) error {
|
func PtraceGetRegsMips64(pid int, regsout *PtraceRegsMips64) error {
|
||||||
return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
|
return ptracePtr(PTRACE_GETREGS, pid, 0, unsafe.Pointer(regsout))
|
||||||
}
|
}
|
||||||
|
|
||||||
// PtraceSetRegsMips64 sets the registers used by mips64 binaries.
|
// PtraceSetRegsMips64 sets the registers used by mips64 binaries.
|
||||||
func PtraceSetRegsMips64(pid int, regs *PtraceRegsMips64) error {
|
func PtraceSetRegsMips64(pid int, regs *PtraceRegsMips64) error {
|
||||||
return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
|
return ptracePtr(PTRACE_SETREGS, pid, 0, unsafe.Pointer(regs))
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,12 +21,12 @@ type PtraceRegsMipsle struct {
|
||||||
|
|
||||||
// PtraceGetRegsMipsle fetches the registers used by mipsle binaries.
|
// PtraceGetRegsMipsle fetches the registers used by mipsle binaries.
|
||||||
func PtraceGetRegsMipsle(pid int, regsout *PtraceRegsMipsle) error {
|
func PtraceGetRegsMipsle(pid int, regsout *PtraceRegsMipsle) error {
|
||||||
return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
|
return ptracePtr(PTRACE_GETREGS, pid, 0, unsafe.Pointer(regsout))
|
||||||
}
|
}
|
||||||
|
|
||||||
// PtraceSetRegsMipsle sets the registers used by mipsle binaries.
|
// PtraceSetRegsMipsle sets the registers used by mipsle binaries.
|
||||||
func PtraceSetRegsMipsle(pid int, regs *PtraceRegsMipsle) error {
|
func PtraceSetRegsMipsle(pid int, regs *PtraceRegsMipsle) error {
|
||||||
return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
|
return ptracePtr(PTRACE_SETREGS, pid, 0, unsafe.Pointer(regs))
|
||||||
}
|
}
|
||||||
|
|
||||||
// PtraceRegsMips64le is the registers used by mips64le binaries.
|
// PtraceRegsMips64le is the registers used by mips64le binaries.
|
||||||
|
@ -42,10 +42,10 @@ type PtraceRegsMips64le struct {
|
||||||
|
|
||||||
// PtraceGetRegsMips64le fetches the registers used by mips64le binaries.
|
// PtraceGetRegsMips64le fetches the registers used by mips64le binaries.
|
||||||
func PtraceGetRegsMips64le(pid int, regsout *PtraceRegsMips64le) error {
|
func PtraceGetRegsMips64le(pid int, regsout *PtraceRegsMips64le) error {
|
||||||
return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
|
return ptracePtr(PTRACE_GETREGS, pid, 0, unsafe.Pointer(regsout))
|
||||||
}
|
}
|
||||||
|
|
||||||
// PtraceSetRegsMips64le sets the registers used by mips64le binaries.
|
// PtraceSetRegsMips64le sets the registers used by mips64le binaries.
|
||||||
func PtraceSetRegsMips64le(pid int, regs *PtraceRegsMips64le) error {
|
func PtraceSetRegsMips64le(pid int, regs *PtraceRegsMips64le) error {
|
||||||
return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
|
return ptracePtr(PTRACE_SETREGS, pid, 0, unsafe.Pointer(regs))
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,12 +31,12 @@ type PtraceRegs386 struct {
|
||||||
|
|
||||||
// PtraceGetRegs386 fetches the registers used by 386 binaries.
|
// PtraceGetRegs386 fetches the registers used by 386 binaries.
|
||||||
func PtraceGetRegs386(pid int, regsout *PtraceRegs386) error {
|
func PtraceGetRegs386(pid int, regsout *PtraceRegs386) error {
|
||||||
return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
|
return ptracePtr(PTRACE_GETREGS, pid, 0, unsafe.Pointer(regsout))
|
||||||
}
|
}
|
||||||
|
|
||||||
// PtraceSetRegs386 sets the registers used by 386 binaries.
|
// PtraceSetRegs386 sets the registers used by 386 binaries.
|
||||||
func PtraceSetRegs386(pid int, regs *PtraceRegs386) error {
|
func PtraceSetRegs386(pid int, regs *PtraceRegs386) error {
|
||||||
return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
|
return ptracePtr(PTRACE_SETREGS, pid, 0, unsafe.Pointer(regs))
|
||||||
}
|
}
|
||||||
|
|
||||||
// PtraceRegsAmd64 is the registers used by amd64 binaries.
|
// PtraceRegsAmd64 is the registers used by amd64 binaries.
|
||||||
|
@ -72,10 +72,10 @@ type PtraceRegsAmd64 struct {
|
||||||
|
|
||||||
// PtraceGetRegsAmd64 fetches the registers used by amd64 binaries.
|
// PtraceGetRegsAmd64 fetches the registers used by amd64 binaries.
|
||||||
func PtraceGetRegsAmd64(pid int, regsout *PtraceRegsAmd64) error {
|
func PtraceGetRegsAmd64(pid int, regsout *PtraceRegsAmd64) error {
|
||||||
return ptrace(PTRACE_GETREGS, pid, 0, uintptr(unsafe.Pointer(regsout)))
|
return ptracePtr(PTRACE_GETREGS, pid, 0, unsafe.Pointer(regsout))
|
||||||
}
|
}
|
||||||
|
|
||||||
// PtraceSetRegsAmd64 sets the registers used by amd64 binaries.
|
// PtraceSetRegsAmd64 sets the registers used by amd64 binaries.
|
||||||
func PtraceSetRegsAmd64(pid int, regs *PtraceRegsAmd64) error {
|
func PtraceSetRegsAmd64(pid int, regs *PtraceRegsAmd64) error {
|
||||||
return ptrace(PTRACE_SETREGS, pid, 0, uintptr(unsafe.Pointer(regs)))
|
return ptracePtr(PTRACE_SETREGS, pid, 0, unsafe.Pointer(regs))
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,6 @@ int utime(uintptr_t, uintptr_t);
|
||||||
unsigned long long getsystemcfg(int);
|
unsigned long long getsystemcfg(int);
|
||||||
int umount(uintptr_t);
|
int umount(uintptr_t);
|
||||||
int getrlimit64(int, uintptr_t);
|
int getrlimit64(int, uintptr_t);
|
||||||
int setrlimit64(int, uintptr_t);
|
|
||||||
long long lseek64(int, long long, int);
|
long long lseek64(int, long long, int);
|
||||||
uintptr_t mmap(uintptr_t, uintptr_t, int, int, int, long long);
|
uintptr_t mmap(uintptr_t, uintptr_t, int, int, int, long long);
|
||||||
|
|
||||||
|
@ -213,7 +212,7 @@ func wait4(pid Pid_t, status *_C_int, options int, rusage *Rusage) (wpid Pid_t,
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func ioctl(fd int, req uint, arg uintptr) (err error) {
|
func ioctl(fd int, req int, arg uintptr) (err error) {
|
||||||
r0, er := C.ioctl(C.int(fd), C.int(req), C.uintptr_t(arg))
|
r0, er := C.ioctl(C.int(fd), C.int(req), C.uintptr_t(arg))
|
||||||
if r0 == -1 && er != nil {
|
if r0 == -1 && er != nil {
|
||||||
err = er
|
err = er
|
||||||
|
@ -223,6 +222,16 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func ioctlPtr(fd int, req int, arg unsafe.Pointer) (err error) {
|
||||||
|
r0, er := C.ioctl(C.int(fd), C.int(req), C.uintptr_t(uintptr(arg)))
|
||||||
|
if r0 == -1 && er != nil {
|
||||||
|
err = er
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func FcntlInt(fd uintptr, cmd int, arg int) (r int, err error) {
|
func FcntlInt(fd uintptr, cmd int, arg int) (r int, err error) {
|
||||||
r0, er := C.fcntl(C.uintptr_t(fd), C.int(cmd), C.uintptr_t(arg))
|
r0, er := C.fcntl(C.uintptr_t(fd), C.int(cmd), C.uintptr_t(arg))
|
||||||
r = int(r0)
|
r = int(r0)
|
||||||
|
@ -1454,16 +1463,6 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Setrlimit(resource int, rlim *Rlimit) (err error) {
|
|
||||||
r0, er := C.setrlimit64(C.int(resource), C.uintptr_t(uintptr(unsafe.Pointer(rlim))))
|
|
||||||
if r0 == -1 && er != nil {
|
|
||||||
err = er
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
|
||||||
|
|
||||||
func Seek(fd int, offset int64, whence int) (off int64, err error) {
|
func Seek(fd int, offset int64, whence int) (off int64, err error) {
|
||||||
r0, er := C.lseek64(C.int(fd), C.longlong(offset), C.int(whence))
|
r0, er := C.lseek64(C.int(fd), C.longlong(offset), C.int(whence))
|
||||||
off = int64(r0)
|
off = int64(r0)
|
||||||
|
|
|
@ -93,8 +93,18 @@ func wait4(pid Pid_t, status *_C_int, options int, rusage *Rusage) (wpid Pid_t,
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func ioctl(fd int, req uint, arg uintptr) (err error) {
|
func ioctl(fd int, req int, arg uintptr) (err error) {
|
||||||
_, e1 := callioctl(fd, int(req), arg)
|
_, e1 := callioctl(fd, req, arg)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func ioctlPtr(fd int, req int, arg unsafe.Pointer) (err error) {
|
||||||
|
_, e1 := callioctl_ptr(fd, req, arg)
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
}
|
}
|
||||||
|
@ -1412,16 +1422,6 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Setrlimit(resource int, rlim *Rlimit) (err error) {
|
|
||||||
_, e1 := callsetrlimit(resource, uintptr(unsafe.Pointer(rlim)))
|
|
||||||
if e1 != 0 {
|
|
||||||
err = errnoErr(e1)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
|
||||||
|
|
||||||
func Seek(fd int, offset int64, whence int) (off int64, err error) {
|
func Seek(fd int, offset int64, whence int) (off int64, err error) {
|
||||||
r0, e1 := calllseek(fd, offset, whence)
|
r0, e1 := calllseek(fd, offset, whence)
|
||||||
off = int64(r0)
|
off = int64(r0)
|
||||||
|
|
|
@ -124,7 +124,6 @@ import (
|
||||||
//go:cgo_import_dynamic libc_getsystemcfg getsystemcfg "libc.a/shr_64.o"
|
//go:cgo_import_dynamic libc_getsystemcfg getsystemcfg "libc.a/shr_64.o"
|
||||||
//go:cgo_import_dynamic libc_umount umount "libc.a/shr_64.o"
|
//go:cgo_import_dynamic libc_umount umount "libc.a/shr_64.o"
|
||||||
//go:cgo_import_dynamic libc_getrlimit getrlimit "libc.a/shr_64.o"
|
//go:cgo_import_dynamic libc_getrlimit getrlimit "libc.a/shr_64.o"
|
||||||
//go:cgo_import_dynamic libc_setrlimit setrlimit "libc.a/shr_64.o"
|
|
||||||
//go:cgo_import_dynamic libc_lseek lseek "libc.a/shr_64.o"
|
//go:cgo_import_dynamic libc_lseek lseek "libc.a/shr_64.o"
|
||||||
//go:cgo_import_dynamic libc_mmap64 mmap64 "libc.a/shr_64.o"
|
//go:cgo_import_dynamic libc_mmap64 mmap64 "libc.a/shr_64.o"
|
||||||
|
|
||||||
|
@ -242,7 +241,6 @@ import (
|
||||||
//go:linkname libc_getsystemcfg libc_getsystemcfg
|
//go:linkname libc_getsystemcfg libc_getsystemcfg
|
||||||
//go:linkname libc_umount libc_umount
|
//go:linkname libc_umount libc_umount
|
||||||
//go:linkname libc_getrlimit libc_getrlimit
|
//go:linkname libc_getrlimit libc_getrlimit
|
||||||
//go:linkname libc_setrlimit libc_setrlimit
|
|
||||||
//go:linkname libc_lseek libc_lseek
|
//go:linkname libc_lseek libc_lseek
|
||||||
//go:linkname libc_mmap64 libc_mmap64
|
//go:linkname libc_mmap64 libc_mmap64
|
||||||
|
|
||||||
|
@ -363,7 +361,6 @@ var (
|
||||||
libc_getsystemcfg,
|
libc_getsystemcfg,
|
||||||
libc_umount,
|
libc_umount,
|
||||||
libc_getrlimit,
|
libc_getrlimit,
|
||||||
libc_setrlimit,
|
|
||||||
libc_lseek,
|
libc_lseek,
|
||||||
libc_mmap64 syscallFunc
|
libc_mmap64 syscallFunc
|
||||||
)
|
)
|
||||||
|
@ -423,6 +420,13 @@ func callioctl(fd int, req int, arg uintptr) (r1 uintptr, e1 Errno) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func callioctl_ptr(fd int, req int, arg unsafe.Pointer) (r1 uintptr, e1 Errno) {
|
||||||
|
r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_ioctl)), 3, uintptr(fd), uintptr(req), uintptr(arg), 0, 0, 0)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func callfcntl(fd uintptr, cmd int, arg uintptr) (r1 uintptr, e1 Errno) {
|
func callfcntl(fd uintptr, cmd int, arg uintptr) (r1 uintptr, e1 Errno) {
|
||||||
r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_fcntl)), 3, fd, uintptr(cmd), arg, 0, 0, 0)
|
r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_fcntl)), 3, fd, uintptr(cmd), arg, 0, 0, 0)
|
||||||
return
|
return
|
||||||
|
@ -1172,13 +1176,6 @@ func callgetrlimit(resource int, rlim uintptr) (r1 uintptr, e1 Errno) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func callsetrlimit(resource int, rlim uintptr) (r1 uintptr, e1 Errno) {
|
|
||||||
r1, _, e1 = rawSyscall6(uintptr(unsafe.Pointer(&libc_setrlimit)), 2, uintptr(resource), rlim, 0, 0, 0, 0)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
|
||||||
|
|
||||||
func calllseek(fd int, offset int64, whence int) (r1 uintptr, e1 Errno) {
|
func calllseek(fd int, offset int64, whence int) (r1 uintptr, e1 Errno) {
|
||||||
r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_lseek)), 3, uintptr(fd), uintptr(offset), uintptr(whence), 0, 0, 0)
|
r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_lseek)), 3, uintptr(fd), uintptr(offset), uintptr(whence), 0, 0, 0)
|
||||||
return
|
return
|
||||||
|
|
|
@ -123,7 +123,6 @@ int utime(uintptr_t, uintptr_t);
|
||||||
unsigned long long getsystemcfg(int);
|
unsigned long long getsystemcfg(int);
|
||||||
int umount(uintptr_t);
|
int umount(uintptr_t);
|
||||||
int getrlimit(int, uintptr_t);
|
int getrlimit(int, uintptr_t);
|
||||||
int setrlimit(int, uintptr_t);
|
|
||||||
long long lseek(int, long long, int);
|
long long lseek(int, long long, int);
|
||||||
uintptr_t mmap64(uintptr_t, uintptr_t, int, int, int, long long);
|
uintptr_t mmap64(uintptr_t, uintptr_t, int, int, int, long long);
|
||||||
|
|
||||||
|
@ -131,6 +130,7 @@ uintptr_t mmap64(uintptr_t, uintptr_t, int, int, int, long long);
|
||||||
import "C"
|
import "C"
|
||||||
import (
|
import (
|
||||||
"syscall"
|
"syscall"
|
||||||
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
@ -191,6 +191,14 @@ func callioctl(fd int, req int, arg uintptr) (r1 uintptr, e1 Errno) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func callioctl_ptr(fd int, req int, arg unsafe.Pointer) (r1 uintptr, e1 Errno) {
|
||||||
|
r1 = uintptr(C.ioctl(C.int(fd), C.int(req), C.uintptr_t(uintptr(arg))))
|
||||||
|
e1 = syscall.GetErrno()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func callfcntl(fd uintptr, cmd int, arg uintptr) (r1 uintptr, e1 Errno) {
|
func callfcntl(fd uintptr, cmd int, arg uintptr) (r1 uintptr, e1 Errno) {
|
||||||
r1 = uintptr(C.fcntl(C.uintptr_t(fd), C.int(cmd), C.uintptr_t(arg)))
|
r1 = uintptr(C.fcntl(C.uintptr_t(fd), C.int(cmd), C.uintptr_t(arg)))
|
||||||
e1 = syscall.GetErrno()
|
e1 = syscall.GetErrno()
|
||||||
|
@ -1047,14 +1055,6 @@ func callgetrlimit(resource int, rlim uintptr) (r1 uintptr, e1 Errno) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func callsetrlimit(resource int, rlim uintptr) (r1 uintptr, e1 Errno) {
|
|
||||||
r1 = uintptr(C.setrlimit(C.int(resource), C.uintptr_t(rlim)))
|
|
||||||
e1 = syscall.GetErrno()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
|
||||||
|
|
||||||
func calllseek(fd int, offset int64, whence int) (r1 uintptr, e1 Errno) {
|
func calllseek(fd int, offset int64, whence int) (r1 uintptr, e1 Errno) {
|
||||||
r1 = uintptr(C.lseek(C.int(fd), C.longlong(offset), C.int(whence)))
|
r1 = uintptr(C.lseek(C.int(fd), C.longlong(offset), C.int(whence)))
|
||||||
e1 = syscall.GetErrno()
|
e1 = syscall.GetErrno()
|
||||||
|
|
|
@ -725,6 +725,14 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) {
|
||||||
|
_, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg))
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
var libc_ioctl_trampoline_addr uintptr
|
var libc_ioctl_trampoline_addr uintptr
|
||||||
|
|
||||||
//go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib"
|
//go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib"
|
||||||
|
@ -1984,6 +1992,31 @@ var libc_select_trampoline_addr uintptr
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func Setattrlist(path string, attrlist *Attrlist, attrBuf []byte, options int) (err error) {
|
||||||
|
var _p0 *byte
|
||||||
|
_p0, err = BytePtrFromString(path)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var _p1 unsafe.Pointer
|
||||||
|
if len(attrBuf) > 0 {
|
||||||
|
_p1 = unsafe.Pointer(&attrBuf[0])
|
||||||
|
} else {
|
||||||
|
_p1 = unsafe.Pointer(&_zero)
|
||||||
|
}
|
||||||
|
_, _, e1 := syscall_syscall6(libc_setattrlist_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(attrlist)), uintptr(_p1), uintptr(len(attrBuf)), uintptr(options), 0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var libc_setattrlist_trampoline_addr uintptr
|
||||||
|
|
||||||
|
//go:cgo_import_dynamic libc_setattrlist setattrlist "/usr/lib/libSystem.B.dylib"
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Setegid(egid int) (err error) {
|
func Setegid(egid int) (err error) {
|
||||||
_, _, e1 := syscall_syscall(libc_setegid_trampoline_addr, uintptr(egid), 0, 0)
|
_, _, e1 := syscall_syscall(libc_setegid_trampoline_addr, uintptr(egid), 0, 0)
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
|
@ -2115,20 +2148,6 @@ var libc_setreuid_trampoline_addr uintptr
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Setrlimit(which int, lim *Rlimit) (err error) {
|
|
||||||
_, _, e1 := syscall_rawSyscall(libc_setrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
|
|
||||||
if e1 != 0 {
|
|
||||||
err = errnoErr(e1)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
var libc_setrlimit_trampoline_addr uintptr
|
|
||||||
|
|
||||||
//go:cgo_import_dynamic libc_setrlimit setrlimit "/usr/lib/libSystem.B.dylib"
|
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
|
||||||
|
|
||||||
func Setsid() (pid int, err error) {
|
func Setsid() (pid int, err error) {
|
||||||
r0, _, e1 := syscall_rawSyscall(libc_setsid_trampoline_addr, 0, 0, 0)
|
r0, _, e1 := syscall_rawSyscall(libc_setsid_trampoline_addr, 0, 0, 0)
|
||||||
pid = int(r0)
|
pid = int(r0)
|
||||||
|
@ -2502,6 +2521,14 @@ func ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ptrace1Ptr(request int, pid int, addr uintptr, data unsafe.Pointer) (err error) {
|
||||||
|
_, _, e1 := syscall_syscall6(libc_ptrace_trampoline_addr, uintptr(request), uintptr(pid), addr, uintptr(data), 0, 0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
var libc_ptrace_trampoline_addr uintptr
|
var libc_ptrace_trampoline_addr uintptr
|
||||||
|
|
||||||
//go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib"
|
//go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib"
|
||||||
|
|
|
@ -705,6 +705,11 @@ TEXT libc_select_trampoline<>(SB),NOSPLIT,$0-0
|
||||||
GLOBL ·libc_select_trampoline_addr(SB), RODATA, $8
|
GLOBL ·libc_select_trampoline_addr(SB), RODATA, $8
|
||||||
DATA ·libc_select_trampoline_addr(SB)/8, $libc_select_trampoline<>(SB)
|
DATA ·libc_select_trampoline_addr(SB)/8, $libc_select_trampoline<>(SB)
|
||||||
|
|
||||||
|
TEXT libc_setattrlist_trampoline<>(SB),NOSPLIT,$0-0
|
||||||
|
JMP libc_setattrlist(SB)
|
||||||
|
GLOBL ·libc_setattrlist_trampoline_addr(SB), RODATA, $8
|
||||||
|
DATA ·libc_setattrlist_trampoline_addr(SB)/8, $libc_setattrlist_trampoline<>(SB)
|
||||||
|
|
||||||
TEXT libc_setegid_trampoline<>(SB),NOSPLIT,$0-0
|
TEXT libc_setegid_trampoline<>(SB),NOSPLIT,$0-0
|
||||||
JMP libc_setegid(SB)
|
JMP libc_setegid(SB)
|
||||||
|
|
||||||
|
@ -759,12 +764,6 @@ TEXT libc_setreuid_trampoline<>(SB),NOSPLIT,$0-0
|
||||||
GLOBL ·libc_setreuid_trampoline_addr(SB), RODATA, $8
|
GLOBL ·libc_setreuid_trampoline_addr(SB), RODATA, $8
|
||||||
DATA ·libc_setreuid_trampoline_addr(SB)/8, $libc_setreuid_trampoline<>(SB)
|
DATA ·libc_setreuid_trampoline_addr(SB)/8, $libc_setreuid_trampoline<>(SB)
|
||||||
|
|
||||||
TEXT libc_setrlimit_trampoline<>(SB),NOSPLIT,$0-0
|
|
||||||
JMP libc_setrlimit(SB)
|
|
||||||
|
|
||||||
GLOBL ·libc_setrlimit_trampoline_addr(SB), RODATA, $8
|
|
||||||
DATA ·libc_setrlimit_trampoline_addr(SB)/8, $libc_setrlimit_trampoline<>(SB)
|
|
||||||
|
|
||||||
TEXT libc_setsid_trampoline<>(SB),NOSPLIT,$0-0
|
TEXT libc_setsid_trampoline<>(SB),NOSPLIT,$0-0
|
||||||
JMP libc_setsid(SB)
|
JMP libc_setsid(SB)
|
||||||
|
|
||||||
|
|
|
@ -725,6 +725,14 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) {
|
||||||
|
_, _, e1 := syscall_syscall(libc_ioctl_trampoline_addr, uintptr(fd), uintptr(req), uintptr(arg))
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
var libc_ioctl_trampoline_addr uintptr
|
var libc_ioctl_trampoline_addr uintptr
|
||||||
|
|
||||||
//go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib"
|
//go:cgo_import_dynamic libc_ioctl ioctl "/usr/lib/libSystem.B.dylib"
|
||||||
|
@ -1984,6 +1992,31 @@ var libc_select_trampoline_addr uintptr
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func Setattrlist(path string, attrlist *Attrlist, attrBuf []byte, options int) (err error) {
|
||||||
|
var _p0 *byte
|
||||||
|
_p0, err = BytePtrFromString(path)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var _p1 unsafe.Pointer
|
||||||
|
if len(attrBuf) > 0 {
|
||||||
|
_p1 = unsafe.Pointer(&attrBuf[0])
|
||||||
|
} else {
|
||||||
|
_p1 = unsafe.Pointer(&_zero)
|
||||||
|
}
|
||||||
|
_, _, e1 := syscall_syscall6(libc_setattrlist_trampoline_addr, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(attrlist)), uintptr(_p1), uintptr(len(attrBuf)), uintptr(options), 0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var libc_setattrlist_trampoline_addr uintptr
|
||||||
|
|
||||||
|
//go:cgo_import_dynamic libc_setattrlist setattrlist "/usr/lib/libSystem.B.dylib"
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Setegid(egid int) (err error) {
|
func Setegid(egid int) (err error) {
|
||||||
_, _, e1 := syscall_syscall(libc_setegid_trampoline_addr, uintptr(egid), 0, 0)
|
_, _, e1 := syscall_syscall(libc_setegid_trampoline_addr, uintptr(egid), 0, 0)
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
|
@ -2115,20 +2148,6 @@ var libc_setreuid_trampoline_addr uintptr
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Setrlimit(which int, lim *Rlimit) (err error) {
|
|
||||||
_, _, e1 := syscall_rawSyscall(libc_setrlimit_trampoline_addr, uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
|
|
||||||
if e1 != 0 {
|
|
||||||
err = errnoErr(e1)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
var libc_setrlimit_trampoline_addr uintptr
|
|
||||||
|
|
||||||
//go:cgo_import_dynamic libc_setrlimit setrlimit "/usr/lib/libSystem.B.dylib"
|
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
|
||||||
|
|
||||||
func Setsid() (pid int, err error) {
|
func Setsid() (pid int, err error) {
|
||||||
r0, _, e1 := syscall_rawSyscall(libc_setsid_trampoline_addr, 0, 0, 0)
|
r0, _, e1 := syscall_rawSyscall(libc_setsid_trampoline_addr, 0, 0, 0)
|
||||||
pid = int(r0)
|
pid = int(r0)
|
||||||
|
@ -2502,6 +2521,14 @@ func ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ptrace1Ptr(request int, pid int, addr uintptr, data unsafe.Pointer) (err error) {
|
||||||
|
_, _, e1 := syscall_syscall6(libc_ptrace_trampoline_addr, uintptr(request), uintptr(pid), addr, uintptr(data), 0, 0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
var libc_ptrace_trampoline_addr uintptr
|
var libc_ptrace_trampoline_addr uintptr
|
||||||
|
|
||||||
//go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib"
|
//go:cgo_import_dynamic libc_ptrace ptrace "/usr/lib/libSystem.B.dylib"
|
||||||
|
|
|
@ -705,6 +705,11 @@ TEXT libc_select_trampoline<>(SB),NOSPLIT,$0-0
|
||||||
GLOBL ·libc_select_trampoline_addr(SB), RODATA, $8
|
GLOBL ·libc_select_trampoline_addr(SB), RODATA, $8
|
||||||
DATA ·libc_select_trampoline_addr(SB)/8, $libc_select_trampoline<>(SB)
|
DATA ·libc_select_trampoline_addr(SB)/8, $libc_select_trampoline<>(SB)
|
||||||
|
|
||||||
|
TEXT libc_setattrlist_trampoline<>(SB),NOSPLIT,$0-0
|
||||||
|
JMP libc_setattrlist(SB)
|
||||||
|
GLOBL ·libc_setattrlist_trampoline_addr(SB), RODATA, $8
|
||||||
|
DATA ·libc_setattrlist_trampoline_addr(SB)/8, $libc_setattrlist_trampoline<>(SB)
|
||||||
|
|
||||||
TEXT libc_setegid_trampoline<>(SB),NOSPLIT,$0-0
|
TEXT libc_setegid_trampoline<>(SB),NOSPLIT,$0-0
|
||||||
JMP libc_setegid(SB)
|
JMP libc_setegid(SB)
|
||||||
|
|
||||||
|
@ -759,12 +764,6 @@ TEXT libc_setreuid_trampoline<>(SB),NOSPLIT,$0-0
|
||||||
GLOBL ·libc_setreuid_trampoline_addr(SB), RODATA, $8
|
GLOBL ·libc_setreuid_trampoline_addr(SB), RODATA, $8
|
||||||
DATA ·libc_setreuid_trampoline_addr(SB)/8, $libc_setreuid_trampoline<>(SB)
|
DATA ·libc_setreuid_trampoline_addr(SB)/8, $libc_setreuid_trampoline<>(SB)
|
||||||
|
|
||||||
TEXT libc_setrlimit_trampoline<>(SB),NOSPLIT,$0-0
|
|
||||||
JMP libc_setrlimit(SB)
|
|
||||||
|
|
||||||
GLOBL ·libc_setrlimit_trampoline_addr(SB), RODATA, $8
|
|
||||||
DATA ·libc_setrlimit_trampoline_addr(SB)/8, $libc_setrlimit_trampoline<>(SB)
|
|
||||||
|
|
||||||
TEXT libc_setsid_trampoline<>(SB),NOSPLIT,$0-0
|
TEXT libc_setsid_trampoline<>(SB),NOSPLIT,$0-0
|
||||||
JMP libc_setsid(SB)
|
JMP libc_setsid(SB)
|
||||||
|
|
||||||
|
|
|
@ -436,6 +436,16 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) {
|
||||||
|
_, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
|
func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
|
||||||
var _p0 unsafe.Pointer
|
var _p0 unsafe.Pointer
|
||||||
if len(mib) > 0 {
|
if len(mib) > 0 {
|
||||||
|
@ -1400,16 +1410,6 @@ func Setresuid(ruid int, euid int, suid int) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Setrlimit(which int, lim *Rlimit) (err error) {
|
|
||||||
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
|
|
||||||
if e1 != 0 {
|
|
||||||
err = errnoErr(e1)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
|
||||||
|
|
||||||
func Setsid() (pid int, err error) {
|
func Setsid() (pid int, err error) {
|
||||||
r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0)
|
r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0)
|
||||||
pid = int(r0)
|
pid = int(r0)
|
||||||
|
|
|
@ -388,6 +388,16 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) {
|
||||||
|
_, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
|
func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
|
||||||
var _p0 unsafe.Pointer
|
var _p0 unsafe.Pointer
|
||||||
if len(mib) > 0 {
|
if len(mib) > 0 {
|
||||||
|
@ -414,6 +424,16 @@ func ptrace(request int, pid int, addr uintptr, data int) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func ptracePtr(request int, pid int, addr unsafe.Pointer, data int) (err error) {
|
||||||
|
_, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Access(path string, mode uint32) (err error) {
|
func Access(path string, mode uint32) (err error) {
|
||||||
var _p0 *byte
|
var _p0 *byte
|
||||||
_p0, err = BytePtrFromString(path)
|
_p0, err = BytePtrFromString(path)
|
||||||
|
@ -1625,16 +1645,6 @@ func Setresuid(ruid int, euid int, suid int) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Setrlimit(which int, lim *Rlimit) (err error) {
|
|
||||||
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
|
|
||||||
if e1 != 0 {
|
|
||||||
err = errnoErr(e1)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
|
||||||
|
|
||||||
func Setsid() (pid int, err error) {
|
func Setsid() (pid int, err error) {
|
||||||
r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0)
|
r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0)
|
||||||
pid = int(r0)
|
pid = int(r0)
|
||||||
|
|
|
@ -388,6 +388,16 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) {
|
||||||
|
_, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
|
func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
|
||||||
var _p0 unsafe.Pointer
|
var _p0 unsafe.Pointer
|
||||||
if len(mib) > 0 {
|
if len(mib) > 0 {
|
||||||
|
@ -414,6 +424,16 @@ func ptrace(request int, pid int, addr uintptr, data int) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func ptracePtr(request int, pid int, addr unsafe.Pointer, data int) (err error) {
|
||||||
|
_, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Access(path string, mode uint32) (err error) {
|
func Access(path string, mode uint32) (err error) {
|
||||||
var _p0 *byte
|
var _p0 *byte
|
||||||
_p0, err = BytePtrFromString(path)
|
_p0, err = BytePtrFromString(path)
|
||||||
|
@ -1625,16 +1645,6 @@ func Setresuid(ruid int, euid int, suid int) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Setrlimit(which int, lim *Rlimit) (err error) {
|
|
||||||
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
|
|
||||||
if e1 != 0 {
|
|
||||||
err = errnoErr(e1)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
|
||||||
|
|
||||||
func Setsid() (pid int, err error) {
|
func Setsid() (pid int, err error) {
|
||||||
r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0)
|
r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0)
|
||||||
pid = int(r0)
|
pid = int(r0)
|
||||||
|
|
|
@ -388,6 +388,16 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) {
|
||||||
|
_, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
|
func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
|
||||||
var _p0 unsafe.Pointer
|
var _p0 unsafe.Pointer
|
||||||
if len(mib) > 0 {
|
if len(mib) > 0 {
|
||||||
|
@ -414,6 +424,16 @@ func ptrace(request int, pid int, addr uintptr, data int) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func ptracePtr(request int, pid int, addr unsafe.Pointer, data int) (err error) {
|
||||||
|
_, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Access(path string, mode uint32) (err error) {
|
func Access(path string, mode uint32) (err error) {
|
||||||
var _p0 *byte
|
var _p0 *byte
|
||||||
_p0, err = BytePtrFromString(path)
|
_p0, err = BytePtrFromString(path)
|
||||||
|
@ -1625,16 +1645,6 @@ func Setresuid(ruid int, euid int, suid int) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Setrlimit(which int, lim *Rlimit) (err error) {
|
|
||||||
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
|
|
||||||
if e1 != 0 {
|
|
||||||
err = errnoErr(e1)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
|
||||||
|
|
||||||
func Setsid() (pid int, err error) {
|
func Setsid() (pid int, err error) {
|
||||||
r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0)
|
r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0)
|
||||||
pid = int(r0)
|
pid = int(r0)
|
||||||
|
|
|
@ -388,6 +388,16 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) {
|
||||||
|
_, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
|
func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
|
||||||
var _p0 unsafe.Pointer
|
var _p0 unsafe.Pointer
|
||||||
if len(mib) > 0 {
|
if len(mib) > 0 {
|
||||||
|
@ -414,6 +424,16 @@ func ptrace(request int, pid int, addr uintptr, data int) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func ptracePtr(request int, pid int, addr unsafe.Pointer, data int) (err error) {
|
||||||
|
_, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Access(path string, mode uint32) (err error) {
|
func Access(path string, mode uint32) (err error) {
|
||||||
var _p0 *byte
|
var _p0 *byte
|
||||||
_p0, err = BytePtrFromString(path)
|
_p0, err = BytePtrFromString(path)
|
||||||
|
@ -1625,16 +1645,6 @@ func Setresuid(ruid int, euid int, suid int) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Setrlimit(which int, lim *Rlimit) (err error) {
|
|
||||||
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
|
|
||||||
if e1 != 0 {
|
|
||||||
err = errnoErr(e1)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
|
||||||
|
|
||||||
func Setsid() (pid int, err error) {
|
func Setsid() (pid int, err error) {
|
||||||
r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0)
|
r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0)
|
||||||
pid = int(r0)
|
pid = int(r0)
|
||||||
|
|
|
@ -388,6 +388,16 @@ func ioctl(fd int, req uint, arg uintptr) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) {
|
||||||
|
_, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
|
func sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) {
|
||||||
var _p0 unsafe.Pointer
|
var _p0 unsafe.Pointer
|
||||||
if len(mib) > 0 {
|
if len(mib) > 0 {
|
||||||
|
@ -414,6 +424,16 @@ func ptrace(request int, pid int, addr uintptr, data int) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func ptracePtr(request int, pid int, addr unsafe.Pointer, data int) (err error) {
|
||||||
|
_, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Access(path string, mode uint32) (err error) {
|
func Access(path string, mode uint32) (err error) {
|
||||||
var _p0 *byte
|
var _p0 *byte
|
||||||
_p0, err = BytePtrFromString(path)
|
_p0, err = BytePtrFromString(path)
|
||||||
|
@ -1625,16 +1645,6 @@ func Setresuid(ruid int, euid int, suid int) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Setrlimit(which int, lim *Rlimit) (err error) {
|
|
||||||
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(which), uintptr(unsafe.Pointer(lim)), 0)
|
|
||||||
if e1 != 0 {
|
|
||||||
err = errnoErr(e1)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
|
||||||
|
|
||||||
func Setsid() (pid int, err error) {
|
func Setsid() (pid int, err error) {
|
||||||
r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0)
|
r0, _, e1 := RawSyscall(SYS_SETSID, 0, 0, 0)
|
||||||
pid = int(r0)
|
pid = int(r0)
|
||||||
|
|
|
@ -379,6 +379,16 @@ func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func ptracePtr(request int, pid int, addr uintptr, data unsafe.Pointer) (err error) {
|
||||||
|
_, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func reboot(magic1 uint, magic2 uint, cmd int, arg string) (err error) {
|
func reboot(magic1 uint, magic2 uint, cmd int, arg string) (err error) {
|
||||||
var _p0 *byte
|
var _p0 *byte
|
||||||
_p0, err = BytePtrFromString(arg)
|
_p0, err = BytePtrFromString(arg)
|
||||||
|
@ -1336,16 +1346,6 @@ func PivotRoot(newroot string, putold string) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) {
|
|
||||||
_, _, e1 := RawSyscall6(SYS_PRLIMIT64, uintptr(pid), uintptr(resource), uintptr(unsafe.Pointer(newlimit)), uintptr(unsafe.Pointer(old)), 0, 0)
|
|
||||||
if e1 != 0 {
|
|
||||||
err = errnoErr(e1)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
|
||||||
|
|
||||||
func Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error) {
|
func Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error) {
|
||||||
_, _, e1 := Syscall6(SYS_PRCTL, uintptr(option), uintptr(arg2), uintptr(arg3), uintptr(arg4), uintptr(arg5), 0)
|
_, _, e1 := Syscall6(SYS_PRCTL, uintptr(option), uintptr(arg2), uintptr(arg3), uintptr(arg4), uintptr(arg5), 0)
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
|
|
|
@ -411,16 +411,6 @@ func getrlimit(resource int, rlim *rlimit32) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func setrlimit(resource int, rlim *rlimit32) (err error) {
|
|
||||||
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
|
|
||||||
if e1 != 0 {
|
|
||||||
err = errnoErr(e1)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
|
||||||
|
|
||||||
func futimesat(dirfd int, path string, times *[2]Timeval) (err error) {
|
func futimesat(dirfd int, path string, times *[2]Timeval) (err error) {
|
||||||
var _p0 *byte
|
var _p0 *byte
|
||||||
_p0, err = BytePtrFromString(path)
|
_p0, err = BytePtrFromString(path)
|
||||||
|
|
|
@ -334,16 +334,6 @@ func setfsuid(uid int) (prev int, err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Setrlimit(resource int, rlim *Rlimit) (err error) {
|
|
||||||
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
|
|
||||||
if e1 != 0 {
|
|
||||||
err = errnoErr(e1)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
|
||||||
|
|
||||||
func Shutdown(fd int, how int) (err error) {
|
func Shutdown(fd int, how int) (err error) {
|
||||||
_, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0)
|
_, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0)
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
|
|
|
@ -578,16 +578,6 @@ func getrlimit(resource int, rlim *rlimit32) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func setrlimit(resource int, rlim *rlimit32) (err error) {
|
|
||||||
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
|
|
||||||
if e1 != 0 {
|
|
||||||
err = errnoErr(e1)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
|
||||||
|
|
||||||
func armSyncFileRange(fd int, flags int, off int64, n int64) (err error) {
|
func armSyncFileRange(fd int, flags int, off int64, n int64) (err error) {
|
||||||
_, _, e1 := Syscall6(SYS_ARM_SYNC_FILE_RANGE, uintptr(fd), uintptr(flags), uintptr(off), uintptr(off>>32), uintptr(n), uintptr(n>>32))
|
_, _, e1 := Syscall6(SYS_ARM_SYNC_FILE_RANGE, uintptr(fd), uintptr(flags), uintptr(off), uintptr(off>>32), uintptr(n), uintptr(n>>32))
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
|
|
|
@ -289,16 +289,6 @@ func setfsuid(uid int) (prev int, err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func setrlimit(resource int, rlim *Rlimit) (err error) {
|
|
||||||
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
|
|
||||||
if e1 != 0 {
|
|
||||||
err = errnoErr(e1)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
|
||||||
|
|
||||||
func Shutdown(fd int, how int) (err error) {
|
func Shutdown(fd int, how int) (err error) {
|
||||||
_, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0)
|
_, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0)
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
|
|
|
@ -644,16 +644,6 @@ func getrlimit(resource int, rlim *rlimit32) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func setrlimit(resource int, rlim *rlimit32) (err error) {
|
|
||||||
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
|
|
||||||
if e1 != 0 {
|
|
||||||
err = errnoErr(e1)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
|
||||||
|
|
||||||
func Alarm(seconds uint) (remaining uint, err error) {
|
func Alarm(seconds uint) (remaining uint, err error) {
|
||||||
r0, _, e1 := Syscall(SYS_ALARM, uintptr(seconds), 0, 0)
|
r0, _, e1 := Syscall(SYS_ALARM, uintptr(seconds), 0, 0)
|
||||||
remaining = uint(r0)
|
remaining = uint(r0)
|
||||||
|
|
|
@ -278,16 +278,6 @@ func setfsuid(uid int) (prev int, err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Setrlimit(resource int, rlim *Rlimit) (err error) {
|
|
||||||
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
|
|
||||||
if e1 != 0 {
|
|
||||||
err = errnoErr(e1)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
|
||||||
|
|
||||||
func Shutdown(fd int, how int) (err error) {
|
func Shutdown(fd int, how int) (err error) {
|
||||||
_, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0)
|
_, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0)
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
|
|
|
@ -278,16 +278,6 @@ func setfsuid(uid int) (prev int, err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func Setrlimit(resource int, rlim *Rlimit) (err error) {
|
|
||||||
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
|
|
||||||
if e1 != 0 {
|
|
||||||
err = errnoErr(e1)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
|
||||||
|
|
||||||
func Shutdown(fd int, how int) (err error) {
|
func Shutdown(fd int, how int) (err error) {
|
||||||
_, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0)
|
_, _, e1 := Syscall(SYS_SHUTDOWN, uintptr(fd), uintptr(how), 0)
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
|
|
|
@ -644,16 +644,6 @@ func getrlimit(resource int, rlim *rlimit32) (err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func setrlimit(resource int, rlim *rlimit32) (err error) {
|
|
||||||
_, _, e1 := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
|
|
||||||
if e1 != 0 {
|
|
||||||
err = errnoErr(e1)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
|
||||||
|
|
||||||
func Alarm(seconds uint) (remaining uint, err error) {
|
func Alarm(seconds uint) (remaining uint, err error) {
|
||||||
r0, _, e1 := Syscall(SYS_ALARM, uintptr(seconds), 0, 0)
|
r0, _, e1 := Syscall(SYS_ALARM, uintptr(seconds), 0, 0)
|
||||||
remaining = uint(r0)
|
remaining = uint(r0)
|
||||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче