mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
all: update golang.org/x/* dependencies
Updates src/ and src/cmd/* dependencies, using
go mod vendor
as well as
updatestd -branch=master -goroot=$GOROOT
This change was ran in anticipation of bringing in x/net/http2 CL 237957.
For #32112.
For #36905.
Change-Id: If8cefc348463b6d82d85020b57db411213720ef8
Reviewed-on: https://go-review.googlesource.com/c/go/+/296789
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
This commit is contained in:
parent
a8d9fb2fcd
commit
2d4042d4ab
397 changed files with 25528 additions and 9907 deletions
|
|
@ -1,12 +1,13 @@
|
||||||
module cmd
|
module cmd
|
||||||
|
|
||||||
go 1.16
|
go 1.17
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2
|
github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5
|
||||||
golang.org/x/arch v0.0.0-20201008161808-52c3e6f60cff
|
golang.org/x/arch v0.0.0-20210308155006-05f8f0431f72
|
||||||
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897
|
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83
|
||||||
golang.org/x/mod v0.4.3-0.20210310185834-19d50cac98aa
|
golang.org/x/mod v0.4.3-0.20210310185834-19d50cac98aa
|
||||||
golang.org/x/sys v0.0.0-20210218145245-beda7e5e158e // indirect
|
golang.org/x/sys v0.0.0-20210309074719-68d13333faf2 // indirect
|
||||||
golang.org/x/tools v0.1.1-0.20210220032852-2363391a5b2f
|
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d // indirect
|
||||||
|
golang.org/x/tools v0.1.1-0.20210312185553-8e4f4c86593a
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,18 @@
|
||||||
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
||||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
||||||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
||||||
github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2 h1:HyOHhUtuB/Ruw/L5s5pG2D0kckkN2/IzBs9OClGHnHI=
|
github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5 h1:zIaiqGYDQwa4HVx5wGRTXbx38Pqxjemn4BP98wpzpXo=
|
||||||
github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||||
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639 h1:mV02weKRL81bEnm8A0HT1/CAelMQDBuQIfLw8n+d6xI=
|
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639 h1:mV02weKRL81bEnm8A0HT1/CAelMQDBuQIfLw8n+d6xI=
|
||||||
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
golang.org/x/arch v0.0.0-20201008161808-52c3e6f60cff h1:XmKBi9R6duxOB3lfc72wyrwiOY7X2Jl1wuI+RFOyMDE=
|
golang.org/x/arch v0.0.0-20210308155006-05f8f0431f72 h1:CdaLHkic8S6xdhpWgHmtWij2rv2DTGwPuJZjjEDGk2w=
|
||||||
golang.org/x/arch v0.0.0-20201008161808-52c3e6f60cff/go.mod h1:flIaEI6LNU6xOCD5PaJvn9wGP0agmIOqjrtsKGRguv4=
|
golang.org/x/arch v0.0.0-20210308155006-05f8f0431f72/go.mod h1:flIaEI6LNU6xOCD5PaJvn9wGP0agmIOqjrtsKGRguv4=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||||
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E=
|
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83 h1:/ZScEX8SfEmUGRHs0gxpqteO5nfNW6axyZbBdw9A12g=
|
||||||
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
|
||||||
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||||
golang.org/x/mod v0.4.3-0.20210310185834-19d50cac98aa h1:++oSKjoJSsXNHyhUdK1BtBKMAaMHER+GWyKN3319OZA=
|
golang.org/x/mod v0.4.3-0.20210310185834-19d50cac98aa h1:++oSKjoJSsXNHyhUdK1BtBKMAaMHER+GWyKN3319OZA=
|
||||||
golang.org/x/mod v0.4.3-0.20210310185834-19d50cac98aa/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
golang.org/x/mod v0.4.3-0.20210310185834-19d50cac98aa/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||||
|
|
@ -23,17 +23,22 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/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/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210218145245-beda7e5e158e h1:f5mksnk+hgXHnImpZoWj64ja99j9zV7YUgrVG95uFE4=
|
golang.org/x/sys v0.0.0-20210309074719-68d13333faf2 h1:46ULzRKLh1CwgRq2dC5SlBzEqqNCi8rreOZnNrbqcIY=
|
||||||
golang.org/x/sys v0.0.0-20210218145245-beda7e5e158e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210309074719-68d13333faf2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||||
|
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d h1:SZxvLBoTP5yHO3Frd4z4vrF+DBX9vMVanchswa69toE=
|
||||||
|
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/tools v0.1.1-0.20210220032852-2363391a5b2f h1:R8L2zr6nSvQoIIw/EiaPP6HfmxeiArf+Nh/CWTC60wQ=
|
golang.org/x/tools v0.1.1-0.20210312185553-8e4f4c86593a h1:dM42cKDDlU6VAcfE6/ANedIkHqAPncj3GWNGqjv0f0Q=
|
||||||
golang.org/x/tools v0.1.1-0.20210220032852-2363391a5b2f/go.mod h1:9bzcO0MWcOuT0tm1iBGzDVPshzfwoVvREIui8C+MHqU=
|
golang.org/x/tools v0.1.1-0.20210312185553-8e4f4c86593a/go.mod h1:9bzcO0MWcOuT0tm1iBGzDVPshzfwoVvREIui8C+MHqU=
|
||||||
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-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
|
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
|
||||||
|
|
|
||||||
24
src/cmd/vendor/github.com/google/pprof/internal/binutils/addr2liner.go
generated
vendored
24
src/cmd/vendor/github.com/google/pprof/internal/binutils/addr2liner.go
generated
vendored
|
|
@ -70,7 +70,11 @@ func (a *addr2LinerJob) write(s string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *addr2LinerJob) readLine() (string, error) {
|
func (a *addr2LinerJob) readLine() (string, error) {
|
||||||
return a.out.ReadString('\n')
|
s, err := a.out.ReadString('\n')
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
return strings.TrimSpace(s), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// close releases any resources used by the addr2liner object.
|
// close releases any resources used by the addr2liner object.
|
||||||
|
|
@ -115,19 +119,11 @@ func newAddr2Liner(cmd, file string, base uint64) (*addr2Liner, error) {
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *addr2Liner) readString() (string, error) {
|
|
||||||
s, err := d.rw.readLine()
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
return strings.TrimSpace(s), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// readFrame parses the addr2line output for a single address. It
|
// readFrame parses the addr2line output for a single address. It
|
||||||
// returns a populated plugin.Frame and whether it has reached the end of the
|
// returns a populated plugin.Frame and whether it has reached the end of the
|
||||||
// data.
|
// data.
|
||||||
func (d *addr2Liner) readFrame() (plugin.Frame, bool) {
|
func (d *addr2Liner) readFrame() (plugin.Frame, bool) {
|
||||||
funcname, err := d.readString()
|
funcname, err := d.rw.readLine()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return plugin.Frame{}, true
|
return plugin.Frame{}, true
|
||||||
}
|
}
|
||||||
|
|
@ -135,12 +131,12 @@ func (d *addr2Liner) readFrame() (plugin.Frame, bool) {
|
||||||
// If addr2line returns a hex address we can assume it is the
|
// If addr2line returns a hex address we can assume it is the
|
||||||
// sentinel. Read and ignore next two lines of output from
|
// sentinel. Read and ignore next two lines of output from
|
||||||
// addr2line
|
// addr2line
|
||||||
d.readString()
|
d.rw.readLine()
|
||||||
d.readString()
|
d.rw.readLine()
|
||||||
return plugin.Frame{}, true
|
return plugin.Frame{}, true
|
||||||
}
|
}
|
||||||
|
|
||||||
fileline, err := d.readString()
|
fileline, err := d.rw.readLine()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return plugin.Frame{}, true
|
return plugin.Frame{}, true
|
||||||
}
|
}
|
||||||
|
|
@ -186,7 +182,7 @@ func (d *addr2Liner) rawAddrInfo(addr uint64) ([]plugin.Frame, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := d.readString()
|
resp, err := d.rw.readLine()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
34
src/cmd/vendor/github.com/google/pprof/internal/binutils/addr2liner_llvm.go
generated
vendored
34
src/cmd/vendor/github.com/google/pprof/internal/binutils/addr2liner_llvm.go
generated
vendored
|
|
@ -43,15 +43,21 @@ type llvmSymbolizerJob struct {
|
||||||
cmd *exec.Cmd
|
cmd *exec.Cmd
|
||||||
in io.WriteCloser
|
in io.WriteCloser
|
||||||
out *bufio.Reader
|
out *bufio.Reader
|
||||||
|
// llvm-symbolizer requires the symbol type, CODE or DATA, for symbolization.
|
||||||
|
symType string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *llvmSymbolizerJob) write(s string) error {
|
func (a *llvmSymbolizerJob) write(s string) error {
|
||||||
_, err := fmt.Fprint(a.in, s+"\n")
|
_, err := fmt.Fprintln(a.in, a.symType, s)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *llvmSymbolizerJob) readLine() (string, error) {
|
func (a *llvmSymbolizerJob) readLine() (string, error) {
|
||||||
return a.out.ReadString('\n')
|
s, err := a.out.ReadString('\n')
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
return strings.TrimSpace(s), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// close releases any resources used by the llvmSymbolizer object.
|
// close releases any resources used by the llvmSymbolizer object.
|
||||||
|
|
@ -64,13 +70,17 @@ func (a *llvmSymbolizerJob) close() {
|
||||||
// information about the given executable file. If file is a shared
|
// information about the given executable file. If file is a shared
|
||||||
// library, base should be the address at which it was mapped in the
|
// library, base should be the address at which it was mapped in the
|
||||||
// program under consideration.
|
// program under consideration.
|
||||||
func newLLVMSymbolizer(cmd, file string, base uint64) (*llvmSymbolizer, error) {
|
func newLLVMSymbolizer(cmd, file string, base uint64, isData bool) (*llvmSymbolizer, error) {
|
||||||
if cmd == "" {
|
if cmd == "" {
|
||||||
cmd = defaultLLVMSymbolizer
|
cmd = defaultLLVMSymbolizer
|
||||||
}
|
}
|
||||||
|
|
||||||
j := &llvmSymbolizerJob{
|
j := &llvmSymbolizerJob{
|
||||||
cmd: exec.Command(cmd, "-inlining", "-demangle=false"),
|
cmd: exec.Command(cmd, "-inlining", "-demangle=false"),
|
||||||
|
symType: "CODE",
|
||||||
|
}
|
||||||
|
if isData {
|
||||||
|
j.symType = "DATA"
|
||||||
}
|
}
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
|
|
@ -97,19 +107,11 @@ func newLLVMSymbolizer(cmd, file string, base uint64) (*llvmSymbolizer, error) {
|
||||||
return a, nil
|
return a, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *llvmSymbolizer) readString() (string, error) {
|
|
||||||
s, err := d.rw.readLine()
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
return strings.TrimSpace(s), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// readFrame parses the llvm-symbolizer output for a single address. It
|
// readFrame parses the llvm-symbolizer output for a single address. It
|
||||||
// returns a populated plugin.Frame and whether it has reached the end of the
|
// returns a populated plugin.Frame and whether it has reached the end of the
|
||||||
// data.
|
// data.
|
||||||
func (d *llvmSymbolizer) readFrame() (plugin.Frame, bool) {
|
func (d *llvmSymbolizer) readFrame() (plugin.Frame, bool) {
|
||||||
funcname, err := d.readString()
|
funcname, err := d.rw.readLine()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return plugin.Frame{}, true
|
return plugin.Frame{}, true
|
||||||
}
|
}
|
||||||
|
|
@ -121,13 +123,17 @@ func (d *llvmSymbolizer) readFrame() (plugin.Frame, bool) {
|
||||||
funcname = ""
|
funcname = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
fileline, err := d.readString()
|
fileline, err := d.rw.readLine()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return plugin.Frame{Func: funcname}, true
|
return plugin.Frame{Func: funcname}, true
|
||||||
}
|
}
|
||||||
|
|
||||||
linenumber := 0
|
linenumber := 0
|
||||||
if fileline == "??:0" {
|
// The llvm-symbolizer outputs the <file_name>:<line_number>:<column_number>.
|
||||||
|
// When it cannot identify the source code location, it outputs "??:0:0".
|
||||||
|
// Older versions output just the filename and line number, so we check for
|
||||||
|
// both conditions here.
|
||||||
|
if fileline == "??:0" || fileline == "??:0:0" {
|
||||||
fileline = ""
|
fileline = ""
|
||||||
} else {
|
} else {
|
||||||
switch split := strings.Split(fileline, ":"); len(split) {
|
switch split := strings.Split(fileline, ":"); len(split) {
|
||||||
|
|
|
||||||
56
src/cmd/vendor/github.com/google/pprof/internal/binutils/addr2liner_nm.go
generated
vendored
56
src/cmd/vendor/github.com/google/pprof/internal/binutils/addr2liner_nm.go
generated
vendored
|
|
@ -29,27 +29,42 @@ const (
|
||||||
defaultNM = "nm"
|
defaultNM = "nm"
|
||||||
)
|
)
|
||||||
|
|
||||||
// addr2LinerNM is a connection to an nm command for obtaining address
|
// addr2LinerNM is a connection to an nm command for obtaining symbol
|
||||||
// information from a binary.
|
// information from a binary.
|
||||||
type addr2LinerNM struct {
|
type addr2LinerNM struct {
|
||||||
m []symbolInfo // Sorted list of addresses from binary.
|
m []symbolInfo // Sorted list of symbol addresses from binary.
|
||||||
}
|
}
|
||||||
|
|
||||||
type symbolInfo struct {
|
type symbolInfo struct {
|
||||||
address uint64
|
address uint64
|
||||||
|
size uint64
|
||||||
name string
|
name string
|
||||||
|
symType string
|
||||||
|
}
|
||||||
|
|
||||||
|
// isData returns if the symbol has a known data object symbol type.
|
||||||
|
func (s *symbolInfo) isData() bool {
|
||||||
|
// The following symbol types are taken from https://linux.die.net/man/1/nm:
|
||||||
|
// Lowercase letter means local symbol, uppercase denotes a global symbol.
|
||||||
|
// - b or B: the symbol is in the uninitialized data section, e.g. .bss;
|
||||||
|
// - d or D: the symbol is in the initialized data section;
|
||||||
|
// - r or R: the symbol is in a read only data section;
|
||||||
|
// - v or V: the symbol is a weak object;
|
||||||
|
// - W: the symbol is a weak symbol that has not been specifically tagged as a
|
||||||
|
// weak object symbol. Experiments with some binaries, showed these to be
|
||||||
|
// mostly data objects.
|
||||||
|
return strings.ContainsAny(s.symType, "bBdDrRvVW")
|
||||||
}
|
}
|
||||||
|
|
||||||
// newAddr2LinerNM starts the given nm command reporting information about the
|
// newAddr2LinerNM starts the given nm command reporting information about the
|
||||||
// given executable file. If file is a shared library, base should be
|
// given executable file. If file is a shared library, base should be the
|
||||||
// the address at which it was mapped in the program under
|
// address at which it was mapped in the program under consideration.
|
||||||
// consideration.
|
|
||||||
func newAddr2LinerNM(cmd, file string, base uint64) (*addr2LinerNM, error) {
|
func newAddr2LinerNM(cmd, file string, base uint64) (*addr2LinerNM, error) {
|
||||||
if cmd == "" {
|
if cmd == "" {
|
||||||
cmd = defaultNM
|
cmd = defaultNM
|
||||||
}
|
}
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
c := exec.Command(cmd, "-n", file)
|
c := exec.Command(cmd, "--numeric-sort", "--print-size", "--format=posix", file)
|
||||||
c.Stdout = &b
|
c.Stdout = &b
|
||||||
if err := c.Run(); err != nil {
|
if err := c.Run(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
@ -74,17 +89,23 @@ func parseAddr2LinerNM(base uint64, nm io.Reader) (*addr2LinerNM, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
line = strings.TrimSpace(line)
|
line = strings.TrimSpace(line)
|
||||||
fields := strings.SplitN(line, " ", 3)
|
fields := strings.Split(line, " ")
|
||||||
if len(fields) != 3 {
|
if len(fields) != 4 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
address, err := strconv.ParseUint(fields[0], 16, 64)
|
address, err := strconv.ParseUint(fields[2], 16, 64)
|
||||||
|
if err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
size, err := strconv.ParseUint(fields[3], 16, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
a.m = append(a.m, symbolInfo{
|
a.m = append(a.m, symbolInfo{
|
||||||
address: address + base,
|
address: address + base,
|
||||||
name: fields[2],
|
size: size,
|
||||||
|
name: fields[0],
|
||||||
|
symType: fields[1],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -94,7 +115,7 @@ func parseAddr2LinerNM(base uint64, nm io.Reader) (*addr2LinerNM, error) {
|
||||||
// addrInfo returns the stack frame information for a specific program
|
// addrInfo returns the stack frame information for a specific program
|
||||||
// address. It returns nil if the address could not be identified.
|
// address. It returns nil if the address could not be identified.
|
||||||
func (a *addr2LinerNM) addrInfo(addr uint64) ([]plugin.Frame, error) {
|
func (a *addr2LinerNM) addrInfo(addr uint64) ([]plugin.Frame, error) {
|
||||||
if len(a.m) == 0 || addr < a.m[0].address || addr > a.m[len(a.m)-1].address {
|
if len(a.m) == 0 || addr < a.m[0].address || addr >= (a.m[len(a.m)-1].address+a.m[len(a.m)-1].size) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -113,12 +134,11 @@ func (a *addr2LinerNM) addrInfo(addr uint64) ([]plugin.Frame, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Address is between a.m[low] and a.m[high].
|
// Address is between a.m[low] and a.m[high]. Pick low, as it represents
|
||||||
// Pick low, as it represents [low, high).
|
// [low, high). For data symbols, we use a strict check that the address is in
|
||||||
f := []plugin.Frame{
|
// the [start, start + size) range of a.m[low].
|
||||||
{
|
if a.m[low].isData() && addr >= (a.m[low].address+a.m[low].size) {
|
||||||
Func: a.m[low].name,
|
return nil, nil
|
||||||
},
|
|
||||||
}
|
}
|
||||||
return f, nil
|
return []plugin.Frame{{Func: a.m[low].name}}, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
65
src/cmd/vendor/github.com/google/pprof/internal/binutils/binutils.go
generated
vendored
65
src/cmd/vendor/github.com/google/pprof/internal/binutils/binutils.go
generated
vendored
|
|
@ -18,6 +18,7 @@ package binutils
|
||||||
import (
|
import (
|
||||||
"debug/elf"
|
"debug/elf"
|
||||||
"debug/macho"
|
"debug/macho"
|
||||||
|
"debug/pe"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
@ -255,7 +256,7 @@ func (bu *Binutils) Disasm(file string, start, end uint64, intelSyntax bool) ([]
|
||||||
if !b.objdumpFound {
|
if !b.objdumpFound {
|
||||||
return nil, errors.New("cannot disasm: no objdump tool available")
|
return nil, errors.New("cannot disasm: no objdump tool available")
|
||||||
}
|
}
|
||||||
args := []string{"--disassemble-all", "--demangle", "--no-show-raw-insn",
|
args := []string{"--disassemble", "--demangle", "--no-show-raw-insn",
|
||||||
"--line-numbers", fmt.Sprintf("--start-address=%#x", start),
|
"--line-numbers", fmt.Sprintf("--start-address=%#x", start),
|
||||||
fmt.Sprintf("--stop-address=%#x", end)}
|
fmt.Sprintf("--stop-address=%#x", end)}
|
||||||
|
|
||||||
|
|
@ -337,6 +338,15 @@ func (bu *Binutils) Open(name string, start, limit, offset uint64) (plugin.ObjFi
|
||||||
return f, nil
|
return f, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
peMagic := string(header[:2])
|
||||||
|
if peMagic == "MZ" {
|
||||||
|
f, err := b.openPE(name, start, limit, offset)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("error reading PE file %s: %v", name, err)
|
||||||
|
}
|
||||||
|
return f, nil
|
||||||
|
}
|
||||||
|
|
||||||
return nil, fmt.Errorf("unrecognized binary format: %s", name)
|
return nil, fmt.Errorf("unrecognized binary format: %s", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -440,7 +450,23 @@ func (b *binrep) openELF(name string, start, limit, offset uint64) (plugin.ObjFi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
base, err := elfexec.GetBase(&ef.FileHeader, elfexec.FindTextProgHeader(ef), stextOffset, start, limit, offset)
|
var ph *elf.ProgHeader
|
||||||
|
// For user space executables, find the actual program segment that is
|
||||||
|
// associated with the given mapping. Skip this search if limit <= start.
|
||||||
|
// We cannot use just a check on the start address of the mapping to tell if
|
||||||
|
// it's a kernel / .ko module mapping, because with quipper address remapping
|
||||||
|
// enabled, the address would be in the lower half of the address space.
|
||||||
|
if stextOffset == nil && start < limit && limit < (uint64(1)<<63) {
|
||||||
|
ph, err = elfexec.FindProgHeaderForMapping(ef, offset, limit-start)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("failed to find program header for file %q, mapping pgoff %x, memsz=%x: %v", name, offset, limit-start, err)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// For the kernel, find the program segment that includes the .text section.
|
||||||
|
ph = elfexec.FindTextProgHeader(ef)
|
||||||
|
}
|
||||||
|
|
||||||
|
base, err := elfexec.GetBase(&ef.FileHeader, ph, stextOffset, start, limit, offset)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("could not identify base for %s: %v", name, err)
|
return nil, fmt.Errorf("could not identify base for %s: %v", name, err)
|
||||||
}
|
}
|
||||||
|
|
@ -451,10 +477,38 @@ func (b *binrep) openELF(name string, start, limit, offset uint64) (plugin.ObjFi
|
||||||
buildID = fmt.Sprintf("%x", id)
|
buildID = fmt.Sprintf("%x", id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
isData := ph != nil && ph.Flags&elf.PF_X == 0
|
||||||
if b.fast || (!b.addr2lineFound && !b.llvmSymbolizerFound) {
|
if b.fast || (!b.addr2lineFound && !b.llvmSymbolizerFound) {
|
||||||
return &fileNM{file: file{b, name, base, buildID}}, nil
|
return &fileNM{file: file{b, name, base, buildID, isData}}, nil
|
||||||
}
|
}
|
||||||
return &fileAddr2Line{file: file{b, name, base, buildID}}, nil
|
return &fileAddr2Line{file: file{b, name, base, buildID, isData}}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b *binrep) openPE(name string, start, limit, offset uint64) (plugin.ObjFile, error) {
|
||||||
|
pf, err := pe.Open(name)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("error parsing %s: %v", name, err)
|
||||||
|
}
|
||||||
|
defer pf.Close()
|
||||||
|
|
||||||
|
var imageBase uint64
|
||||||
|
switch h := pf.OptionalHeader.(type) {
|
||||||
|
case *pe.OptionalHeader32:
|
||||||
|
imageBase = uint64(h.ImageBase)
|
||||||
|
case *pe.OptionalHeader64:
|
||||||
|
imageBase = uint64(h.ImageBase)
|
||||||
|
default:
|
||||||
|
return nil, fmt.Errorf("unknown OptionalHeader %T", pf.OptionalHeader)
|
||||||
|
}
|
||||||
|
|
||||||
|
var base uint64
|
||||||
|
if start > 0 {
|
||||||
|
base = start - imageBase
|
||||||
|
}
|
||||||
|
if b.fast || (!b.addr2lineFound && !b.llvmSymbolizerFound) {
|
||||||
|
return &fileNM{file: file{b: b, name: name, base: base}}, nil
|
||||||
|
}
|
||||||
|
return &fileAddr2Line{file: file{b: b, name: name, base: base}}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// file implements the binutils.ObjFile interface.
|
// file implements the binutils.ObjFile interface.
|
||||||
|
|
@ -463,6 +517,7 @@ type file struct {
|
||||||
name string
|
name string
|
||||||
base uint64
|
base uint64
|
||||||
buildID string
|
buildID string
|
||||||
|
isData bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *file) Name() string {
|
func (f *file) Name() string {
|
||||||
|
|
@ -538,7 +593,7 @@ func (f *fileAddr2Line) SourceLine(addr uint64) ([]plugin.Frame, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *fileAddr2Line) init() {
|
func (f *fileAddr2Line) init() {
|
||||||
if llvmSymbolizer, err := newLLVMSymbolizer(f.b.llvmSymbolizer, f.name, f.base); err == nil {
|
if llvmSymbolizer, err := newLLVMSymbolizer(f.b.llvmSymbolizer, f.name, f.base, f.isData); err == nil {
|
||||||
f.llvmSymbolizer = llvmSymbolizer
|
f.llvmSymbolizer = llvmSymbolizer
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
3
src/cmd/vendor/github.com/google/pprof/internal/binutils/disasm.go
generated
vendored
3
src/cmd/vendor/github.com/google/pprof/internal/binutils/disasm.go
generated
vendored
|
|
@ -19,6 +19,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/google/pprof/internal/plugin"
|
"github.com/google/pprof/internal/plugin"
|
||||||
"github.com/ianlancetaylor/demangle"
|
"github.com/ianlancetaylor/demangle"
|
||||||
|
|
@ -121,6 +122,7 @@ func disassemble(asm []byte) ([]plugin.Inst, error) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
input = strings.TrimSpace(input)
|
||||||
|
|
||||||
if fields := objdumpAsmOutputRE.FindStringSubmatch(input); len(fields) == 3 {
|
if fields := objdumpAsmOutputRE.FindStringSubmatch(input); len(fields) == 3 {
|
||||||
if address, err := strconv.ParseUint(fields[1], 16, 64); err == nil {
|
if address, err := strconv.ParseUint(fields[1], 16, 64); err == nil {
|
||||||
|
|
@ -167,6 +169,7 @@ func nextSymbol(buf *bytes.Buffer) (uint64, string, error) {
|
||||||
return 0, "", err
|
return 0, "", err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
line = strings.TrimSpace(line)
|
||||||
|
|
||||||
if fields := nmOutputRE.FindStringSubmatch(line); len(fields) == 4 {
|
if fields := nmOutputRE.FindStringSubmatch(line); len(fields) == 4 {
|
||||||
if address, err := strconv.ParseUint(fields[1], 16, 64); err == nil {
|
if address, err := strconv.ParseUint(fields[1], 16, 64); err == nil {
|
||||||
|
|
|
||||||
6
src/cmd/vendor/github.com/google/pprof/internal/driver/driver.go
generated
vendored
6
src/cmd/vendor/github.com/google/pprof/internal/driver/driver.go
generated
vendored
|
|
@ -163,7 +163,7 @@ func applyCommandOverrides(cmd string, outputFormat int, cfg config) config {
|
||||||
trim := cfg.Trim
|
trim := cfg.Trim
|
||||||
|
|
||||||
switch cmd {
|
switch cmd {
|
||||||
case "disasm", "weblist":
|
case "disasm":
|
||||||
trim = false
|
trim = false
|
||||||
cfg.Granularity = "addresses"
|
cfg.Granularity = "addresses"
|
||||||
// Force the 'noinlines' mode so that source locations for a given address
|
// Force the 'noinlines' mode so that source locations for a given address
|
||||||
|
|
@ -172,6 +172,10 @@ func applyCommandOverrides(cmd string, outputFormat int, cfg config) config {
|
||||||
// This is because the merge is done by address and in case of an inlined
|
// This is because the merge is done by address and in case of an inlined
|
||||||
// stack each of the inlined entries is a separate callgraph node.
|
// stack each of the inlined entries is a separate callgraph node.
|
||||||
cfg.NoInlines = true
|
cfg.NoInlines = true
|
||||||
|
case "weblist":
|
||||||
|
trim = false
|
||||||
|
cfg.Granularity = "addresses"
|
||||||
|
cfg.NoInlines = false // Need inline info to support call expansion
|
||||||
case "peek":
|
case "peek":
|
||||||
trim = false
|
trim = false
|
||||||
case "list":
|
case "list":
|
||||||
|
|
|
||||||
1
src/cmd/vendor/github.com/google/pprof/internal/driver/webhtml.go
generated
vendored
1
src/cmd/vendor/github.com/google/pprof/internal/driver/webhtml.go
generated
vendored
|
|
@ -62,6 +62,7 @@ a {
|
||||||
.header .title h1 {
|
.header .title h1 {
|
||||||
font-size: 1.75em;
|
font-size: 1.75em;
|
||||||
margin-right: 1rem;
|
margin-right: 1rem;
|
||||||
|
margin-bottom: 4px;
|
||||||
}
|
}
|
||||||
.header .title a {
|
.header .title a {
|
||||||
color: #212121;
|
color: #212121;
|
||||||
|
|
|
||||||
81
src/cmd/vendor/github.com/google/pprof/internal/elfexec/elfexec.go
generated
vendored
81
src/cmd/vendor/github.com/google/pprof/internal/elfexec/elfexec.go
generated
vendored
|
|
@ -283,3 +283,84 @@ func FindTextProgHeader(f *elf.File) *elf.ProgHeader {
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FindProgHeaderForMapping returns the loadable program segment header that is
|
||||||
|
// fully contained in the runtime mapping with file offset pgoff and memory size
|
||||||
|
// memsz, or an error if the segment cannot be determined. The function returns
|
||||||
|
// a nil program header and no error if the ELF binary has no loadable segments.
|
||||||
|
func FindProgHeaderForMapping(f *elf.File, pgoff, memsz uint64) (*elf.ProgHeader, error) {
|
||||||
|
var headers []*elf.ProgHeader
|
||||||
|
loadables := 0
|
||||||
|
for _, p := range f.Progs {
|
||||||
|
if p.Type == elf.PT_LOAD && pgoff <= p.Off && p.Off+p.Memsz <= pgoff+memsz {
|
||||||
|
headers = append(headers, &p.ProgHeader)
|
||||||
|
}
|
||||||
|
if p.Type == elf.PT_LOAD {
|
||||||
|
loadables++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(headers) == 1 {
|
||||||
|
return headers[0], nil
|
||||||
|
}
|
||||||
|
// Some ELF files don't contain any program segments, e.g. .ko loadable kernel
|
||||||
|
// modules. Don't return an error in such cases.
|
||||||
|
if loadables == 0 {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
if len(headers) == 0 {
|
||||||
|
return nil, fmt.Errorf("no program header matches file offset %x and memory size %x", pgoff, memsz)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Segments are mapped page aligned. In some cases, segments may be smaller
|
||||||
|
// than a page, which causes the next segment to start at a file offset that
|
||||||
|
// is logically on the same page if we were to align file offsets by page.
|
||||||
|
// Example:
|
||||||
|
// LOAD 0x0000000000000000 0x0000000000400000 0x0000000000400000
|
||||||
|
// 0x00000000000006fc 0x00000000000006fc R E 0x200000
|
||||||
|
// LOAD 0x0000000000000e10 0x0000000000600e10 0x0000000000600e10
|
||||||
|
// 0x0000000000000230 0x0000000000000238 RW 0x200000
|
||||||
|
//
|
||||||
|
// In this case, perf records the following mappings for this executable:
|
||||||
|
// 0 0 [0xc0]: PERF_RECORD_MMAP2 87867/87867: [0x400000(0x1000) @ 0 00:3c 512041 0]: r-xp exename
|
||||||
|
// 0 0 [0xc0]: PERF_RECORD_MMAP2 87867/87867: [0x600000(0x2000) @ 0 00:3c 512041 0]: rw-p exename
|
||||||
|
//
|
||||||
|
// Both mappings have file offset 0. The first mapping is one page length and
|
||||||
|
// it can include only the first loadable segment. Due to page alignment, the
|
||||||
|
// second mapping starts also at file offset 0, and it spans two pages. It can
|
||||||
|
// include both the first and the second loadable segments. We must return the
|
||||||
|
// correct program header to compute the correct base offset.
|
||||||
|
//
|
||||||
|
// We cannot use the mapping protections to distinguish between segments,
|
||||||
|
// because protections are not passed through to this function.
|
||||||
|
// We cannot use the start address to differentiate between segments, because
|
||||||
|
// with ASLR, the mapping start address can be any value.
|
||||||
|
//
|
||||||
|
// We use a heuristic to compute the minimum mapping size required for a
|
||||||
|
// segment, assuming mappings are 4k page aligned, and return the segment that
|
||||||
|
// matches the given mapping size.
|
||||||
|
const pageSize = 4096
|
||||||
|
|
||||||
|
// The memory size based heuristic makes sense only if the mapping size is a
|
||||||
|
// multiple of 4k page size.
|
||||||
|
if memsz%pageSize != 0 {
|
||||||
|
return nil, fmt.Errorf("mapping size = %x and %d segments match the passed in mapping", memsz, len(headers))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return an error if no segment, or multiple segments match the size, so we can debug.
|
||||||
|
var ph *elf.ProgHeader
|
||||||
|
pageMask := ^uint64(pageSize - 1)
|
||||||
|
for _, h := range headers {
|
||||||
|
wantSize := (h.Vaddr+h.Memsz+pageSize-1)&pageMask - (h.Vaddr & pageMask)
|
||||||
|
if wantSize != memsz {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if ph != nil {
|
||||||
|
return nil, fmt.Errorf("found second program header (%#v) that matches memsz %x, first program header is %#v", *h, memsz, *ph)
|
||||||
|
}
|
||||||
|
ph = h
|
||||||
|
}
|
||||||
|
if ph == nil {
|
||||||
|
return nil, fmt.Errorf("found %d matching program headers, but none matches mapping size %x", len(headers), memsz)
|
||||||
|
}
|
||||||
|
return ph, nil
|
||||||
|
}
|
||||||
|
|
|
||||||
4
src/cmd/vendor/github.com/google/pprof/internal/graph/dotgraph.go
generated
vendored
4
src/cmd/vendor/github.com/google/pprof/internal/graph/dotgraph.go
generated
vendored
|
|
@ -322,8 +322,8 @@ func (b *builder) addEdge(edge *Edge, from, to int, hasNodelets bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// dotColor returns a color for the given score (between -1.0 and
|
// dotColor returns a color for the given score (between -1.0 and
|
||||||
// 1.0), with -1.0 colored red, 0.0 colored grey, and 1.0 colored
|
// 1.0), with -1.0 colored green, 0.0 colored grey, and 1.0 colored
|
||||||
// green. If isBackground is true, then a light (low-saturation)
|
// red. If isBackground is true, then a light (low-saturation)
|
||||||
// color is returned (suitable for use as a background color);
|
// color is returned (suitable for use as a background color);
|
||||||
// otherwise, a darker color is returned (suitable for use as a
|
// otherwise, a darker color is returned (suitable for use as a
|
||||||
// foreground color).
|
// foreground color).
|
||||||
|
|
|
||||||
254
src/cmd/vendor/github.com/google/pprof/internal/measurement/measurement.go
generated
vendored
254
src/cmd/vendor/github.com/google/pprof/internal/measurement/measurement.go
generated
vendored
|
|
@ -111,8 +111,9 @@ func compatibleValueTypes(v1, v2 *profile.ValueType) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
return v1.Unit == v2.Unit ||
|
return v1.Unit == v2.Unit ||
|
||||||
(isTimeUnit(v1.Unit) && isTimeUnit(v2.Unit)) ||
|
(timeUnits.sniffUnit(v1.Unit) != nil && timeUnits.sniffUnit(v2.Unit) != nil) ||
|
||||||
(isMemoryUnit(v1.Unit) && isMemoryUnit(v2.Unit))
|
(memoryUnits.sniffUnit(v1.Unit) != nil && memoryUnits.sniffUnit(v2.Unit) != nil) ||
|
||||||
|
(gcuUnits.sniffUnit(v1.Unit) != nil && gcuUnits.sniffUnit(v2.Unit) != nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scale a measurement from an unit to a different unit and returns
|
// Scale a measurement from an unit to a different unit and returns
|
||||||
|
|
@ -124,12 +125,15 @@ func Scale(value int64, fromUnit, toUnit string) (float64, string) {
|
||||||
v, u := Scale(-value, fromUnit, toUnit)
|
v, u := Scale(-value, fromUnit, toUnit)
|
||||||
return -v, u
|
return -v, u
|
||||||
}
|
}
|
||||||
if m, u, ok := memoryLabel(value, fromUnit, toUnit); ok {
|
if m, u, ok := memoryUnits.convertUnit(value, fromUnit, toUnit); ok {
|
||||||
return m, u
|
return m, u
|
||||||
}
|
}
|
||||||
if t, u, ok := timeLabel(value, fromUnit, toUnit); ok {
|
if t, u, ok := timeUnits.convertUnit(value, fromUnit, toUnit); ok {
|
||||||
return t, u
|
return t, u
|
||||||
}
|
}
|
||||||
|
if g, u, ok := gcuUnits.convertUnit(value, fromUnit, toUnit); ok {
|
||||||
|
return g, u
|
||||||
|
}
|
||||||
// Skip non-interesting units.
|
// Skip non-interesting units.
|
||||||
switch toUnit {
|
switch toUnit {
|
||||||
case "count", "sample", "unit", "minimum", "auto":
|
case "count", "sample", "unit", "minimum", "auto":
|
||||||
|
|
@ -172,157 +176,121 @@ func Percentage(value, total int64) string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// isMemoryUnit returns whether a name is recognized as a memory size
|
// unit includes a list of aliases representing a specific unit and a factor
|
||||||
// unit.
|
// which one can multiple a value in the specified unit by to get the value
|
||||||
func isMemoryUnit(unit string) bool {
|
// in terms of the base unit.
|
||||||
switch strings.TrimSuffix(strings.ToLower(unit), "s") {
|
type unit struct {
|
||||||
case "byte", "b", "kilobyte", "kb", "megabyte", "mb", "gigabyte", "gb":
|
canonicalName string
|
||||||
return true
|
aliases []string
|
||||||
}
|
factor float64
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func memoryLabel(value int64, fromUnit, toUnit string) (v float64, u string, ok bool) {
|
// unitType includes a list of units that are within the same category (i.e.
|
||||||
fromUnit = strings.TrimSuffix(strings.ToLower(fromUnit), "s")
|
// memory or time units) and a default unit to use for this type of unit.
|
||||||
toUnit = strings.TrimSuffix(strings.ToLower(toUnit), "s")
|
type unitType struct {
|
||||||
|
defaultUnit unit
|
||||||
switch fromUnit {
|
units []unit
|
||||||
case "byte", "b":
|
|
||||||
case "kb", "kbyte", "kilobyte":
|
|
||||||
value *= 1024
|
|
||||||
case "mb", "mbyte", "megabyte":
|
|
||||||
value *= 1024 * 1024
|
|
||||||
case "gb", "gbyte", "gigabyte":
|
|
||||||
value *= 1024 * 1024 * 1024
|
|
||||||
case "tb", "tbyte", "terabyte":
|
|
||||||
value *= 1024 * 1024 * 1024 * 1024
|
|
||||||
case "pb", "pbyte", "petabyte":
|
|
||||||
value *= 1024 * 1024 * 1024 * 1024 * 1024
|
|
||||||
default:
|
|
||||||
return 0, "", false
|
|
||||||
}
|
|
||||||
|
|
||||||
if toUnit == "minimum" || toUnit == "auto" {
|
|
||||||
switch {
|
|
||||||
case value < 1024:
|
|
||||||
toUnit = "b"
|
|
||||||
case value < 1024*1024:
|
|
||||||
toUnit = "kb"
|
|
||||||
case value < 1024*1024*1024:
|
|
||||||
toUnit = "mb"
|
|
||||||
case value < 1024*1024*1024*1024:
|
|
||||||
toUnit = "gb"
|
|
||||||
case value < 1024*1024*1024*1024*1024:
|
|
||||||
toUnit = "tb"
|
|
||||||
default:
|
|
||||||
toUnit = "pb"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var output float64
|
|
||||||
switch toUnit {
|
|
||||||
default:
|
|
||||||
output, toUnit = float64(value), "B"
|
|
||||||
case "kb", "kbyte", "kilobyte":
|
|
||||||
output, toUnit = float64(value)/1024, "kB"
|
|
||||||
case "mb", "mbyte", "megabyte":
|
|
||||||
output, toUnit = float64(value)/(1024*1024), "MB"
|
|
||||||
case "gb", "gbyte", "gigabyte":
|
|
||||||
output, toUnit = float64(value)/(1024*1024*1024), "GB"
|
|
||||||
case "tb", "tbyte", "terabyte":
|
|
||||||
output, toUnit = float64(value)/(1024*1024*1024*1024), "TB"
|
|
||||||
case "pb", "pbyte", "petabyte":
|
|
||||||
output, toUnit = float64(value)/(1024*1024*1024*1024*1024), "PB"
|
|
||||||
}
|
|
||||||
return output, toUnit, true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// isTimeUnit returns whether a name is recognized as a time unit.
|
// findByAlias returns the unit associated with the specified alias. It returns
|
||||||
func isTimeUnit(unit string) bool {
|
// nil if the unit with such alias is not found.
|
||||||
|
func (ut unitType) findByAlias(alias string) *unit {
|
||||||
|
for _, u := range ut.units {
|
||||||
|
for _, a := range u.aliases {
|
||||||
|
if alias == a {
|
||||||
|
return &u
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// sniffUnit simpifies the input alias and returns the unit associated with the
|
||||||
|
// specified alias. It returns nil if the unit with such alias is not found.
|
||||||
|
func (ut unitType) sniffUnit(unit string) *unit {
|
||||||
unit = strings.ToLower(unit)
|
unit = strings.ToLower(unit)
|
||||||
if len(unit) > 2 {
|
if len(unit) > 2 {
|
||||||
unit = strings.TrimSuffix(unit, "s")
|
unit = strings.TrimSuffix(unit, "s")
|
||||||
}
|
}
|
||||||
|
return ut.findByAlias(unit)
|
||||||
switch unit {
|
|
||||||
case "nanosecond", "ns", "microsecond", "millisecond", "ms", "s", "second", "sec", "hr", "day", "week", "year":
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func timeLabel(value int64, fromUnit, toUnit string) (v float64, u string, ok bool) {
|
// autoScale takes in the value with units of the base unit and returns
|
||||||
fromUnit = strings.ToLower(fromUnit)
|
// that value scaled to a reasonable unit if a reasonable unit is
|
||||||
if len(fromUnit) > 2 {
|
// found.
|
||||||
fromUnit = strings.TrimSuffix(fromUnit, "s")
|
func (ut unitType) autoScale(value float64) (float64, string, bool) {
|
||||||
|
var f float64
|
||||||
|
var unit string
|
||||||
|
for _, u := range ut.units {
|
||||||
|
if u.factor >= f && (value/u.factor) >= 1.0 {
|
||||||
|
f = u.factor
|
||||||
|
unit = u.canonicalName
|
||||||
}
|
}
|
||||||
|
|
||||||
toUnit = strings.ToLower(toUnit)
|
|
||||||
if len(toUnit) > 2 {
|
|
||||||
toUnit = strings.TrimSuffix(toUnit, "s")
|
|
||||||
}
|
}
|
||||||
|
if f == 0 {
|
||||||
var d time.Duration
|
|
||||||
switch fromUnit {
|
|
||||||
case "nanosecond", "ns":
|
|
||||||
d = time.Duration(value) * time.Nanosecond
|
|
||||||
case "microsecond":
|
|
||||||
d = time.Duration(value) * time.Microsecond
|
|
||||||
case "millisecond", "ms":
|
|
||||||
d = time.Duration(value) * time.Millisecond
|
|
||||||
case "second", "sec", "s":
|
|
||||||
d = time.Duration(value) * time.Second
|
|
||||||
case "cycle":
|
|
||||||
return float64(value), "", true
|
|
||||||
default:
|
|
||||||
return 0, "", false
|
return 0, "", false
|
||||||
}
|
}
|
||||||
|
return value / f, unit, true
|
||||||
if toUnit == "minimum" || toUnit == "auto" {
|
}
|
||||||
switch {
|
|
||||||
case d < 1*time.Microsecond:
|
// convertUnit converts a value from the fromUnit to the toUnit, autoscaling
|
||||||
toUnit = "ns"
|
// the value if the toUnit is "minimum" or "auto". If the fromUnit is not
|
||||||
case d < 1*time.Millisecond:
|
// included in the unitType, then a false boolean will be returned. If the
|
||||||
toUnit = "us"
|
// toUnit is not in the unitType, the value will be returned in terms of the
|
||||||
case d < 1*time.Second:
|
// default unitType.
|
||||||
toUnit = "ms"
|
func (ut unitType) convertUnit(value int64, fromUnitStr, toUnitStr string) (float64, string, bool) {
|
||||||
case d < 1*time.Minute:
|
fromUnit := ut.sniffUnit(fromUnitStr)
|
||||||
toUnit = "sec"
|
if fromUnit == nil {
|
||||||
case d < 1*time.Hour:
|
return 0, "", false
|
||||||
toUnit = "min"
|
}
|
||||||
case d < 24*time.Hour:
|
v := float64(value) * fromUnit.factor
|
||||||
toUnit = "hour"
|
if toUnitStr == "minimum" || toUnitStr == "auto" {
|
||||||
case d < 15*24*time.Hour:
|
if v, u, ok := ut.autoScale(v); ok {
|
||||||
toUnit = "day"
|
return v, u, true
|
||||||
case d < 120*24*time.Hour:
|
}
|
||||||
toUnit = "week"
|
return v / ut.defaultUnit.factor, ut.defaultUnit.canonicalName, true
|
||||||
default:
|
}
|
||||||
toUnit = "year"
|
toUnit := ut.sniffUnit(toUnitStr)
|
||||||
}
|
if toUnit == nil {
|
||||||
}
|
return v / ut.defaultUnit.factor, ut.defaultUnit.canonicalName, true
|
||||||
|
}
|
||||||
var output float64
|
return v / toUnit.factor, toUnit.canonicalName, true
|
||||||
dd := float64(d)
|
}
|
||||||
switch toUnit {
|
|
||||||
case "ns", "nanosecond":
|
var memoryUnits = unitType{
|
||||||
output, toUnit = dd/float64(time.Nanosecond), "ns"
|
units: []unit{
|
||||||
case "us", "microsecond":
|
{"B", []string{"b", "byte"}, 1},
|
||||||
output, toUnit = dd/float64(time.Microsecond), "us"
|
{"kB", []string{"kb", "kbyte", "kilobyte"}, float64(1 << 10)},
|
||||||
case "ms", "millisecond":
|
{"MB", []string{"mb", "mbyte", "megabyte"}, float64(1 << 20)},
|
||||||
output, toUnit = dd/float64(time.Millisecond), "ms"
|
{"GB", []string{"gb", "gbyte", "gigabyte"}, float64(1 << 30)},
|
||||||
case "min", "minute":
|
{"TB", []string{"tb", "tbyte", "terabyte"}, float64(1 << 40)},
|
||||||
output, toUnit = dd/float64(time.Minute), "mins"
|
{"PB", []string{"pb", "pbyte", "petabyte"}, float64(1 << 50)},
|
||||||
case "hour", "hr":
|
},
|
||||||
output, toUnit = dd/float64(time.Hour), "hrs"
|
defaultUnit: unit{"B", []string{"b", "byte"}, 1},
|
||||||
case "day":
|
}
|
||||||
output, toUnit = dd/float64(24*time.Hour), "days"
|
|
||||||
case "week", "wk":
|
var timeUnits = unitType{
|
||||||
output, toUnit = dd/float64(7*24*time.Hour), "wks"
|
units: []unit{
|
||||||
case "year", "yr":
|
{"ns", []string{"ns", "nanosecond"}, float64(time.Nanosecond)},
|
||||||
output, toUnit = dd/float64(365*24*time.Hour), "yrs"
|
{"us", []string{"μs", "us", "microsecond"}, float64(time.Microsecond)},
|
||||||
default:
|
{"ms", []string{"ms", "millisecond"}, float64(time.Millisecond)},
|
||||||
// "sec", "second", "s" handled by default case.
|
{"s", []string{"s", "sec", "second"}, float64(time.Second)},
|
||||||
output, toUnit = dd/float64(time.Second), "s"
|
{"hrs", []string{"hour", "hr"}, float64(time.Hour)},
|
||||||
}
|
},
|
||||||
return output, toUnit, true
|
defaultUnit: unit{"s", []string{}, float64(time.Second)},
|
||||||
|
}
|
||||||
|
|
||||||
|
var gcuUnits = unitType{
|
||||||
|
units: []unit{
|
||||||
|
{"n*GCU", []string{"nanogcu"}, 1e-9},
|
||||||
|
{"u*GCU", []string{"microgcu"}, 1e-6},
|
||||||
|
{"m*GCU", []string{"milligcu"}, 1e-3},
|
||||||
|
{"GCU", []string{"gcu"}, 1},
|
||||||
|
{"k*GCU", []string{"kilogcu"}, 1e3},
|
||||||
|
{"M*GCU", []string{"megagcu"}, 1e6},
|
||||||
|
{"G*GCU", []string{"gigagcu"}, 1e9},
|
||||||
|
{"T*GCU", []string{"teragcu"}, 1e12},
|
||||||
|
{"P*GCU", []string{"petagcu"}, 1e15},
|
||||||
|
},
|
||||||
|
defaultUnit: unit{"GCU", []string{}, 1.0},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
749
src/cmd/vendor/github.com/google/pprof/internal/report/source.go
generated
vendored
749
src/cmd/vendor/github.com/google/pprof/internal/report/source.go
generated
vendored
|
|
@ -24,12 +24,15 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"regexp"
|
||||||
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/google/pprof/internal/graph"
|
"github.com/google/pprof/internal/graph"
|
||||||
"github.com/google/pprof/internal/measurement"
|
"github.com/google/pprof/internal/measurement"
|
||||||
"github.com/google/pprof/internal/plugin"
|
"github.com/google/pprof/internal/plugin"
|
||||||
|
"github.com/google/pprof/profile"
|
||||||
)
|
)
|
||||||
|
|
||||||
// printSource prints an annotated source listing, include all
|
// printSource prints an annotated source listing, include all
|
||||||
|
|
@ -126,19 +129,68 @@ func printWebSource(w io.Writer, rpt *Report, obj plugin.ObjTool) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sourcePrinter holds state needed for generating source+asm HTML listing.
|
||||||
|
type sourcePrinter struct {
|
||||||
|
reader *sourceReader
|
||||||
|
objectTool plugin.ObjTool
|
||||||
|
objects map[string]plugin.ObjFile // Opened object files
|
||||||
|
sym *regexp.Regexp // May be nil
|
||||||
|
files map[string]*sourceFile // Set of files to print.
|
||||||
|
insts map[uint64]instructionInfo // Instructions of interest (keyed by address).
|
||||||
|
|
||||||
|
// Set of function names that we are interested in (because they had
|
||||||
|
// a sample and match sym).
|
||||||
|
interest map[string]bool
|
||||||
|
|
||||||
|
// Mapping from system function names to printable names.
|
||||||
|
prettyNames map[string]string
|
||||||
|
}
|
||||||
|
|
||||||
|
// instructionInfo holds collected information for an instruction.
|
||||||
|
type instructionInfo struct {
|
||||||
|
objAddr uint64 // Address in object file (with base subtracted out)
|
||||||
|
length int // Instruction length in bytes
|
||||||
|
disasm string // Disassembly of instruction
|
||||||
|
file string // For top-level function in which instruction occurs
|
||||||
|
line int // For top-level function in which instruction occurs
|
||||||
|
flat, cum int64 // Samples to report (divisor already applied)
|
||||||
|
}
|
||||||
|
|
||||||
|
// sourceFile contains collected information for files we will print.
|
||||||
|
type sourceFile struct {
|
||||||
|
fname string
|
||||||
|
cum int64
|
||||||
|
flat int64
|
||||||
|
lines map[int][]sourceInst // Instructions to show per line
|
||||||
|
funcName map[int]string // Function name per line
|
||||||
|
}
|
||||||
|
|
||||||
|
// sourceInst holds information for an instruction to be displayed.
|
||||||
|
type sourceInst struct {
|
||||||
|
addr uint64
|
||||||
|
stack []callID // Inlined call-stack
|
||||||
|
}
|
||||||
|
|
||||||
|
// sourceFunction contains information for a contiguous range of lines per function we
|
||||||
|
// will print.
|
||||||
|
type sourceFunction struct {
|
||||||
|
name string
|
||||||
|
begin, end int // Line numbers (end is not included in the range)
|
||||||
|
flat, cum int64
|
||||||
|
}
|
||||||
|
|
||||||
|
// addressRange is a range of addresses plus the object file that contains it.
|
||||||
|
type addressRange struct {
|
||||||
|
begin, end uint64
|
||||||
|
obj plugin.ObjFile
|
||||||
|
mapping *profile.Mapping
|
||||||
|
score int64 // Used to order ranges for processing
|
||||||
|
}
|
||||||
|
|
||||||
// PrintWebList prints annotated source listing of rpt to w.
|
// PrintWebList prints annotated source listing of rpt to w.
|
||||||
|
// rpt.prof should contain inlined call info.
|
||||||
func PrintWebList(w io.Writer, rpt *Report, obj plugin.ObjTool, maxFiles int) error {
|
func PrintWebList(w io.Writer, rpt *Report, obj plugin.ObjTool, maxFiles int) error {
|
||||||
o := rpt.options
|
sourcePath := rpt.options.SourcePath
|
||||||
g := rpt.newGraph(nil)
|
|
||||||
|
|
||||||
// If the regexp source can be parsed as an address, also match
|
|
||||||
// functions that land on that address.
|
|
||||||
var address *uint64
|
|
||||||
if hex, err := strconv.ParseUint(o.Symbol.String(), 0, 64); err == nil {
|
|
||||||
address = &hex
|
|
||||||
}
|
|
||||||
|
|
||||||
sourcePath := o.SourcePath
|
|
||||||
if sourcePath == "" {
|
if sourcePath == "" {
|
||||||
wd, err := os.Getwd()
|
wd, err := os.Getwd()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -146,171 +198,485 @@ func PrintWebList(w io.Writer, rpt *Report, obj plugin.ObjTool, maxFiles int) er
|
||||||
}
|
}
|
||||||
sourcePath = wd
|
sourcePath = wd
|
||||||
}
|
}
|
||||||
reader := newSourceReader(sourcePath, o.TrimPath)
|
sp := newSourcePrinter(rpt, obj, sourcePath)
|
||||||
|
sp.print(w, maxFiles, rpt)
|
||||||
|
sp.close()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
type fileFunction struct {
|
func newSourcePrinter(rpt *Report, obj plugin.ObjTool, sourcePath string) *sourcePrinter {
|
||||||
fileName, functionName string
|
sp := &sourcePrinter{
|
||||||
|
reader: newSourceReader(sourcePath, rpt.options.TrimPath),
|
||||||
|
objectTool: obj,
|
||||||
|
objects: map[string]plugin.ObjFile{},
|
||||||
|
sym: rpt.options.Symbol,
|
||||||
|
files: map[string]*sourceFile{},
|
||||||
|
insts: map[uint64]instructionInfo{},
|
||||||
|
prettyNames: map[string]string{},
|
||||||
|
interest: map[string]bool{},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract interesting symbols from binary files in the profile and
|
// If the regexp source can be parsed as an address, also match
|
||||||
// classify samples per symbol.
|
// functions that land on that address.
|
||||||
symbols := symbolsFromBinaries(rpt.prof, g, o.Symbol, address, obj)
|
var address *uint64
|
||||||
symNodes := nodesPerSymbol(g.Nodes, symbols)
|
if sp.sym != nil {
|
||||||
|
if hex, err := strconv.ParseUint(sp.sym.String(), 0, 64); err == nil {
|
||||||
|
address = &hex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Identify sources associated to a symbol by examining
|
addrs := map[uint64]bool{}
|
||||||
// symbol samples. Classify samples per source file.
|
flat := map[uint64]int64{}
|
||||||
fileNodes := make(map[fileFunction]graph.Nodes)
|
cum := map[uint64]int64{}
|
||||||
if len(symNodes) == 0 {
|
|
||||||
for _, n := range g.Nodes {
|
// Record an interest in the function corresponding to lines[index].
|
||||||
if n.Info.File == "" || !o.Symbol.MatchString(n.Info.Name) {
|
markInterest := func(addr uint64, lines []profile.Line, index int) {
|
||||||
|
fn := lines[index]
|
||||||
|
if fn.Function == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
sp.interest[fn.Function.Name] = true
|
||||||
|
sp.interest[fn.Function.SystemName] = true
|
||||||
|
addrs[addr] = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// See if sp.sym matches line.
|
||||||
|
matches := func(line profile.Line) bool {
|
||||||
|
if line.Function == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return sp.sym.MatchString(line.Function.Name) ||
|
||||||
|
sp.sym.MatchString(line.Function.SystemName) ||
|
||||||
|
sp.sym.MatchString(line.Function.Filename)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extract sample counts and compute set of interesting functions.
|
||||||
|
for _, sample := range rpt.prof.Sample {
|
||||||
|
value := rpt.options.SampleValue(sample.Value)
|
||||||
|
if rpt.options.SampleMeanDivisor != nil {
|
||||||
|
div := rpt.options.SampleMeanDivisor(sample.Value)
|
||||||
|
if div != 0 {
|
||||||
|
value /= div
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find call-sites matching sym.
|
||||||
|
for i := len(sample.Location) - 1; i >= 0; i-- {
|
||||||
|
loc := sample.Location[i]
|
||||||
|
for _, line := range loc.Line {
|
||||||
|
if line.Function == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
ff := fileFunction{n.Info.File, n.Info.Name}
|
sp.prettyNames[line.Function.SystemName] = line.Function.Name
|
||||||
fileNodes[ff] = append(fileNodes[ff], n)
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
for _, nodes := range symNodes {
|
cum[loc.Address] += value
|
||||||
for _, n := range nodes {
|
if i == 0 {
|
||||||
if n.Info.File != "" {
|
flat[loc.Address] += value
|
||||||
ff := fileFunction{n.Info.File, n.Info.Name}
|
}
|
||||||
fileNodes[ff] = append(fileNodes[ff], n)
|
|
||||||
|
if sp.sym == nil || (address != nil && loc.Address == *address) {
|
||||||
|
// Interested in top-level entry of stack.
|
||||||
|
if len(loc.Line) > 0 {
|
||||||
|
markInterest(loc.Address, loc.Line, len(loc.Line)-1)
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// Seach in inlined stack for a match.
|
||||||
|
matchFile := (loc.Mapping != nil && sp.sym.MatchString(loc.Mapping.File))
|
||||||
|
for j, line := range loc.Line {
|
||||||
|
if (j == 0 && matchFile) || matches(line) {
|
||||||
|
markInterest(loc.Address, loc.Line, j)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(fileNodes) == 0 {
|
sp.expandAddresses(rpt, addrs, flat)
|
||||||
return fmt.Errorf("no source information for %s", o.Symbol.String())
|
sp.initSamples(flat, cum)
|
||||||
}
|
return sp
|
||||||
|
}
|
||||||
|
|
||||||
sourceFiles := make(graph.Nodes, 0, len(fileNodes))
|
func (sp *sourcePrinter) close() {
|
||||||
for _, nodes := range fileNodes {
|
for _, objFile := range sp.objects {
|
||||||
sNode := *nodes[0]
|
if objFile != nil {
|
||||||
sNode.Flat, sNode.Cum = nodes.Sum()
|
objFile.Close()
|
||||||
sourceFiles = append(sourceFiles, &sNode)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Limit number of files printed?
|
|
||||||
if maxFiles < 0 {
|
|
||||||
sourceFiles.Sort(graph.FileOrder)
|
|
||||||
} else {
|
|
||||||
sourceFiles.Sort(graph.FlatNameOrder)
|
|
||||||
if maxFiles < len(sourceFiles) {
|
|
||||||
sourceFiles = sourceFiles[:maxFiles]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Print each file associated with this function.
|
func (sp *sourcePrinter) expandAddresses(rpt *Report, addrs map[uint64]bool, flat map[uint64]int64) {
|
||||||
for _, n := range sourceFiles {
|
// We found interesting addresses (ones with non-zero samples) above.
|
||||||
ff := fileFunction{n.Info.File, n.Info.Name}
|
// Get covering address ranges and disassemble the ranges.
|
||||||
fns := fileNodes[ff]
|
ranges := sp.splitIntoRanges(rpt.prof, addrs, flat)
|
||||||
|
|
||||||
asm := assemblyPerSourceLine(symbols, fns, ff.fileName, obj, o.IntelSyntax)
|
// Trim ranges if there are too many.
|
||||||
start, end := sourceCoordinates(asm)
|
const maxRanges = 25
|
||||||
|
sort.Slice(ranges, func(i, j int) bool {
|
||||||
|
return ranges[i].score > ranges[j].score
|
||||||
|
})
|
||||||
|
if len(ranges) > maxRanges {
|
||||||
|
ranges = ranges[:maxRanges]
|
||||||
|
}
|
||||||
|
|
||||||
fnodes, path, err := getSourceFromFile(ff.fileName, reader, fns, start, end)
|
for _, r := range ranges {
|
||||||
|
base := r.obj.Base()
|
||||||
|
insts, err := sp.objectTool.Disasm(r.mapping.File, r.begin-base, r.end-base,
|
||||||
|
rpt.options.IntelSyntax)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fnodes, path = getMissingFunctionSource(ff.fileName, asm, start, end)
|
// TODO(sanjay): Report that the covered addresses are missing.
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
printFunctionHeader(w, ff.functionName, path, n.Flat, n.Cum, rpt)
|
var lastFrames []plugin.Frame
|
||||||
for _, fn := range fnodes {
|
var lastAddr, maxAddr uint64
|
||||||
printFunctionSourceLine(w, fn, asm[fn.Info.Lineno], reader, rpt)
|
for i, inst := range insts {
|
||||||
|
addr := inst.Addr + base
|
||||||
|
|
||||||
|
// Guard against duplicate output from Disasm.
|
||||||
|
if addr <= maxAddr {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
maxAddr = addr
|
||||||
|
|
||||||
|
length := 1
|
||||||
|
if i+1 < len(insts) && insts[i+1].Addr > inst.Addr {
|
||||||
|
// Extend to next instruction.
|
||||||
|
length = int(insts[i+1].Addr - inst.Addr)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get inlined-call-stack for address.
|
||||||
|
frames, err := r.obj.SourceLine(addr)
|
||||||
|
if err != nil {
|
||||||
|
// Construct a frame from disassembler output.
|
||||||
|
frames = []plugin.Frame{{Func: inst.Function, File: inst.File, Line: inst.Line}}
|
||||||
|
}
|
||||||
|
|
||||||
|
x := instructionInfo{objAddr: inst.Addr, length: length, disasm: inst.Text}
|
||||||
|
if len(frames) > 0 {
|
||||||
|
// We could consider using the outer-most caller's source
|
||||||
|
// location so we give the some hint as to where the
|
||||||
|
// inlining happened that led to this instruction. So for
|
||||||
|
// example, suppose we have the following (inlined) call
|
||||||
|
// chains for this instruction:
|
||||||
|
// F1->G->H
|
||||||
|
// F2->G->H
|
||||||
|
// We could tag the instructions from the first call with
|
||||||
|
// F1 and instructions from the second call with F2. But
|
||||||
|
// that leads to a somewhat confusing display. So for now,
|
||||||
|
// we stick with just the inner-most location (i.e., H).
|
||||||
|
// In the future we will consider changing the display to
|
||||||
|
// make caller info more visible.
|
||||||
|
index := 0 // Inner-most frame
|
||||||
|
x.file = frames[index].File
|
||||||
|
x.line = frames[index].Line
|
||||||
|
}
|
||||||
|
sp.insts[addr] = x
|
||||||
|
|
||||||
|
// We sometimes get instructions with a zero reported line number.
|
||||||
|
// Make such instructions have the same line info as the preceding
|
||||||
|
// instruction, if an earlier instruction is found close enough.
|
||||||
|
const neighborhood = 32
|
||||||
|
if len(frames) > 0 && frames[0].Line != 0 {
|
||||||
|
lastFrames = frames
|
||||||
|
lastAddr = addr
|
||||||
|
} else if (addr-lastAddr <= neighborhood) && lastFrames != nil {
|
||||||
|
frames = lastFrames
|
||||||
|
}
|
||||||
|
|
||||||
|
// See if the stack contains a function we are interested in.
|
||||||
|
for i, f := range frames {
|
||||||
|
if !sp.interest[f.Func] {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// Record sub-stack under frame's file/line.
|
||||||
|
fname := canonicalizeFileName(f.File)
|
||||||
|
file := sp.files[fname]
|
||||||
|
if file == nil {
|
||||||
|
file = &sourceFile{
|
||||||
|
fname: fname,
|
||||||
|
lines: map[int][]sourceInst{},
|
||||||
|
funcName: map[int]string{},
|
||||||
|
}
|
||||||
|
sp.files[fname] = file
|
||||||
|
}
|
||||||
|
callees := frames[:i]
|
||||||
|
stack := make([]callID, 0, len(callees))
|
||||||
|
for j := len(callees) - 1; j >= 0; j-- { // Reverse so caller is first
|
||||||
|
stack = append(stack, callID{
|
||||||
|
file: callees[j].File,
|
||||||
|
line: callees[j].Line,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
file.lines[f.Line] = append(file.lines[f.Line], sourceInst{addr, stack})
|
||||||
|
|
||||||
|
// Remember the first function name encountered per source line
|
||||||
|
// and assume that that line belongs to that function.
|
||||||
|
if _, ok := file.funcName[f.Line]; !ok {
|
||||||
|
file.funcName[f.Line] = f.Func
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// splitIntoRanges converts the set of addresses we are interested in into a set of address
|
||||||
|
// ranges to disassemble.
|
||||||
|
func (sp *sourcePrinter) splitIntoRanges(prof *profile.Profile, set map[uint64]bool, flat map[uint64]int64) []addressRange {
|
||||||
|
// List of mappings so we can stop expanding address ranges at mapping boundaries.
|
||||||
|
mappings := append([]*profile.Mapping{}, prof.Mapping...)
|
||||||
|
sort.Slice(mappings, func(i, j int) bool { return mappings[i].Start < mappings[j].Start })
|
||||||
|
|
||||||
|
var result []addressRange
|
||||||
|
addrs := make([]uint64, 0, len(set))
|
||||||
|
for addr := range set {
|
||||||
|
addrs = append(addrs, addr)
|
||||||
|
}
|
||||||
|
sort.Slice(addrs, func(i, j int) bool { return addrs[i] < addrs[j] })
|
||||||
|
|
||||||
|
mappingIndex := 0
|
||||||
|
const expand = 500 // How much to expand range to pick up nearby addresses.
|
||||||
|
for i, n := 0, len(addrs); i < n; {
|
||||||
|
begin, end := addrs[i], addrs[i]
|
||||||
|
sum := flat[begin]
|
||||||
|
i++
|
||||||
|
|
||||||
|
// Advance to mapping containing addrs[i]
|
||||||
|
for mappingIndex < len(mappings) && mappings[mappingIndex].Limit <= begin {
|
||||||
|
mappingIndex++
|
||||||
|
}
|
||||||
|
if mappingIndex >= len(mappings) {
|
||||||
|
// TODO(sanjay): Report missed address and its samples.
|
||||||
|
break
|
||||||
|
}
|
||||||
|
m := mappings[mappingIndex]
|
||||||
|
obj := sp.objectFile(m)
|
||||||
|
if obj == nil {
|
||||||
|
// TODO(sanjay): Report missed address and its samples.
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find following addresses that are close enough to addrs[i].
|
||||||
|
for i < n && addrs[i] <= end+2*expand && addrs[i] < m.Limit {
|
||||||
|
// When we expand ranges by "expand" on either side, the ranges
|
||||||
|
// for addrs[i] and addrs[i-1] will merge.
|
||||||
|
end = addrs[i]
|
||||||
|
sum += flat[end]
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
if m.Start-begin >= expand {
|
||||||
|
begin -= expand
|
||||||
|
} else {
|
||||||
|
begin = m.Start
|
||||||
|
}
|
||||||
|
if m.Limit-end >= expand {
|
||||||
|
end += expand
|
||||||
|
} else {
|
||||||
|
end = m.Limit
|
||||||
|
}
|
||||||
|
|
||||||
|
result = append(result, addressRange{begin, end, obj, m, sum})
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sp *sourcePrinter) initSamples(flat, cum map[uint64]int64) {
|
||||||
|
for addr, inst := range sp.insts {
|
||||||
|
// Move all samples that were assigned to the middle of an instruction to the
|
||||||
|
// beginning of that instruction. This takes care of samples that were recorded
|
||||||
|
// against pc+1.
|
||||||
|
instEnd := addr + uint64(inst.length)
|
||||||
|
for p := addr; p < instEnd; p++ {
|
||||||
|
inst.flat += flat[p]
|
||||||
|
inst.cum += cum[p]
|
||||||
|
}
|
||||||
|
sp.insts[addr] = inst
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sp *sourcePrinter) print(w io.Writer, maxFiles int, rpt *Report) {
|
||||||
|
// Finalize per-file counts.
|
||||||
|
for _, file := range sp.files {
|
||||||
|
seen := map[uint64]bool{}
|
||||||
|
for _, line := range file.lines {
|
||||||
|
for _, x := range line {
|
||||||
|
if seen[x.addr] {
|
||||||
|
// Same address can be displayed multiple times in a file
|
||||||
|
// (e.g., if we show multiple inlined functions).
|
||||||
|
// Avoid double-counting samples in this case.
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
seen[x.addr] = true
|
||||||
|
inst := sp.insts[x.addr]
|
||||||
|
file.cum += inst.cum
|
||||||
|
file.flat += inst.flat
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get sorted list of files to print.
|
||||||
|
var files []*sourceFile
|
||||||
|
for _, f := range sp.files {
|
||||||
|
files = append(files, f)
|
||||||
|
}
|
||||||
|
order := func(i, j int) bool { return files[i].flat > files[j].flat }
|
||||||
|
if maxFiles < 0 {
|
||||||
|
// Order by name for compatibility with old code.
|
||||||
|
order = func(i, j int) bool { return files[i].fname < files[j].fname }
|
||||||
|
maxFiles = len(files)
|
||||||
|
}
|
||||||
|
sort.Slice(files, order)
|
||||||
|
for i, f := range files {
|
||||||
|
if i < maxFiles {
|
||||||
|
sp.printFile(w, f, rpt)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sp *sourcePrinter) printFile(w io.Writer, f *sourceFile, rpt *Report) {
|
||||||
|
for _, fn := range sp.functions(f) {
|
||||||
|
if fn.cum == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
printFunctionHeader(w, fn.name, f.fname, fn.flat, fn.cum, rpt)
|
||||||
|
var asm []assemblyInstruction
|
||||||
|
for l := fn.begin; l < fn.end; l++ {
|
||||||
|
lineContents, ok := sp.reader.line(f.fname, l)
|
||||||
|
if !ok {
|
||||||
|
if len(f.lines[l]) == 0 {
|
||||||
|
// Outside of range of valid lines and nothing to print.
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if l == 0 {
|
||||||
|
// Line number 0 shows up if line number is not known.
|
||||||
|
lineContents = "<instructions with unknown line numbers>"
|
||||||
|
} else {
|
||||||
|
// Past end of file, but have data to print.
|
||||||
|
lineContents = "???"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make list of assembly instructions.
|
||||||
|
asm = asm[:0]
|
||||||
|
var flatSum, cumSum int64
|
||||||
|
var lastAddr uint64
|
||||||
|
for _, inst := range f.lines[l] {
|
||||||
|
addr := inst.addr
|
||||||
|
x := sp.insts[addr]
|
||||||
|
flatSum += x.flat
|
||||||
|
cumSum += x.cum
|
||||||
|
startsBlock := (addr != lastAddr+uint64(sp.insts[lastAddr].length))
|
||||||
|
lastAddr = addr
|
||||||
|
|
||||||
|
// divisors already applied, so leave flatDiv,cumDiv as 0
|
||||||
|
asm = append(asm, assemblyInstruction{
|
||||||
|
address: x.objAddr,
|
||||||
|
instruction: x.disasm,
|
||||||
|
function: fn.name,
|
||||||
|
file: x.file,
|
||||||
|
line: x.line,
|
||||||
|
flat: x.flat,
|
||||||
|
cum: x.cum,
|
||||||
|
startsBlock: startsBlock,
|
||||||
|
inlineCalls: inst.stack,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
printFunctionSourceLine(w, l, flatSum, cumSum, lineContents, asm, sp.reader, rpt)
|
||||||
}
|
}
|
||||||
printFunctionClosing(w)
|
printFunctionClosing(w)
|
||||||
}
|
}
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// sourceCoordinates returns the lowest and highest line numbers from
|
// functions splits apart the lines to show in a file into a list of per-function ranges.
|
||||||
// a set of assembly statements.
|
func (sp *sourcePrinter) functions(f *sourceFile) []sourceFunction {
|
||||||
func sourceCoordinates(asm map[int][]assemblyInstruction) (start, end int) {
|
var funcs []sourceFunction
|
||||||
for l := range asm {
|
|
||||||
if start == 0 || l < start {
|
// Get interesting lines in sorted order.
|
||||||
start = l
|
lines := make([]int, 0, len(f.lines))
|
||||||
|
for l := range f.lines {
|
||||||
|
lines = append(lines, l)
|
||||||
}
|
}
|
||||||
if end == 0 || l > end {
|
sort.Ints(lines)
|
||||||
end = l
|
|
||||||
|
// Merge adjacent lines that are in same function and not too far apart.
|
||||||
|
const mergeLimit = 20
|
||||||
|
for _, l := range lines {
|
||||||
|
name := f.funcName[l]
|
||||||
|
if pretty, ok := sp.prettyNames[name]; ok {
|
||||||
|
// Use demangled name if available.
|
||||||
|
name = pretty
|
||||||
|
}
|
||||||
|
|
||||||
|
fn := sourceFunction{name: name, begin: l, end: l + 1}
|
||||||
|
for _, x := range f.lines[l] {
|
||||||
|
inst := sp.insts[x.addr]
|
||||||
|
fn.flat += inst.flat
|
||||||
|
fn.cum += inst.cum
|
||||||
|
}
|
||||||
|
|
||||||
|
// See if we should merge into preceding function.
|
||||||
|
if len(funcs) > 0 {
|
||||||
|
last := funcs[len(funcs)-1]
|
||||||
|
if l-last.end < mergeLimit && last.name == name {
|
||||||
|
last.end = l + 1
|
||||||
|
last.flat += fn.flat
|
||||||
|
last.cum += fn.cum
|
||||||
|
funcs[len(funcs)-1] = last
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return start, end
|
|
||||||
|
// Add new function.
|
||||||
|
funcs = append(funcs, fn)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Expand function boundaries to show neighborhood.
|
||||||
|
const expand = 5
|
||||||
|
for i, f := range funcs {
|
||||||
|
if i == 0 {
|
||||||
|
// Extend backwards, stopping at line number 1, but do not disturb 0
|
||||||
|
// since that is a special line number that can show up when addr2line
|
||||||
|
// cannot determine the real line number.
|
||||||
|
if f.begin > expand {
|
||||||
|
f.begin -= expand
|
||||||
|
} else if f.begin > 1 {
|
||||||
|
f.begin = 1
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Find gap from predecessor and divide between predecessor and f.
|
||||||
|
halfGap := (f.begin - funcs[i-1].end) / 2
|
||||||
|
if halfGap > expand {
|
||||||
|
halfGap = expand
|
||||||
|
}
|
||||||
|
funcs[i-1].end += halfGap
|
||||||
|
f.begin -= halfGap
|
||||||
|
}
|
||||||
|
funcs[i] = f
|
||||||
|
}
|
||||||
|
|
||||||
|
// Also extend the ending point of the last function.
|
||||||
|
if len(funcs) > 0 {
|
||||||
|
funcs[len(funcs)-1].end += expand
|
||||||
|
}
|
||||||
|
|
||||||
|
return funcs
|
||||||
}
|
}
|
||||||
|
|
||||||
// assemblyPerSourceLine disassembles the binary containing a symbol
|
// objectFile return the object for the named file, opening it if necessary.
|
||||||
// and classifies the assembly instructions according to its
|
// It returns nil on error.
|
||||||
// corresponding source line, annotating them with a set of samples.
|
func (sp *sourcePrinter) objectFile(m *profile.Mapping) plugin.ObjFile {
|
||||||
func assemblyPerSourceLine(objSyms []*objSymbol, rs graph.Nodes, src string, obj plugin.ObjTool, intelSyntax bool) map[int][]assemblyInstruction {
|
if object, ok := sp.objects[m.File]; ok {
|
||||||
assembly := make(map[int][]assemblyInstruction)
|
return object // May be nil if we detected an error earlier.
|
||||||
// Identify symbol to use for this collection of samples.
|
|
||||||
o := findMatchingSymbol(objSyms, rs)
|
|
||||||
if o == nil {
|
|
||||||
return assembly
|
|
||||||
}
|
}
|
||||||
|
object, err := sp.objectTool.Open(m.File, m.Start, m.Limit, m.Offset)
|
||||||
// Extract assembly for matched symbol
|
|
||||||
insts, err := obj.Disasm(o.sym.File, o.sym.Start, o.sym.End, intelSyntax)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return assembly
|
object = nil
|
||||||
}
|
}
|
||||||
|
sp.objects[m.File] = object // Cache even on error.
|
||||||
srcBase := filepath.Base(src)
|
return object
|
||||||
anodes := annotateAssembly(insts, rs, o.base)
|
|
||||||
var lineno = 0
|
|
||||||
var prevline = 0
|
|
||||||
for _, an := range anodes {
|
|
||||||
// Do not rely solely on the line number produced by Disasm
|
|
||||||
// since it is not what we want in the presence of inlining.
|
|
||||||
//
|
|
||||||
// E.g., suppose we are printing source code for F and this
|
|
||||||
// instruction is from H where F called G called H and both
|
|
||||||
// of those calls were inlined. We want to use the line
|
|
||||||
// number from F, not from H (which is what Disasm gives us).
|
|
||||||
//
|
|
||||||
// So find the outer-most linenumber in the source file.
|
|
||||||
found := false
|
|
||||||
if frames, err := o.file.SourceLine(an.address + o.base); err == nil {
|
|
||||||
for i := len(frames) - 1; i >= 0; i-- {
|
|
||||||
if filepath.Base(frames[i].File) == srcBase {
|
|
||||||
for j := i - 1; j >= 0; j-- {
|
|
||||||
an.inlineCalls = append(an.inlineCalls, callID{frames[j].File, frames[j].Line})
|
|
||||||
}
|
|
||||||
lineno = frames[i].Line
|
|
||||||
found = true
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !found && filepath.Base(an.file) == srcBase {
|
|
||||||
lineno = an.line
|
|
||||||
}
|
|
||||||
|
|
||||||
if lineno != 0 {
|
|
||||||
if lineno != prevline {
|
|
||||||
// This instruction starts a new block
|
|
||||||
// of contiguous instructions on this line.
|
|
||||||
an.startsBlock = true
|
|
||||||
}
|
|
||||||
prevline = lineno
|
|
||||||
assembly[lineno] = append(assembly[lineno], an)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return assembly
|
|
||||||
}
|
|
||||||
|
|
||||||
// findMatchingSymbol looks for the symbol that corresponds to a set
|
|
||||||
// of samples, by comparing their addresses.
|
|
||||||
func findMatchingSymbol(objSyms []*objSymbol, ns graph.Nodes) *objSymbol {
|
|
||||||
for _, n := range ns {
|
|
||||||
for _, o := range objSyms {
|
|
||||||
if filepath.Base(o.sym.File) == filepath.Base(n.Info.Objfile) &&
|
|
||||||
o.sym.Start <= n.Info.Address-o.base &&
|
|
||||||
n.Info.Address-o.base <= o.sym.End {
|
|
||||||
return o
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// printHeader prints the page header for a weblist report.
|
// printHeader prints the page header for a weblist report.
|
||||||
|
|
@ -348,22 +714,23 @@ func printFunctionHeader(w io.Writer, name, path string, flatSum, cumSum int64,
|
||||||
}
|
}
|
||||||
|
|
||||||
// printFunctionSourceLine prints a source line and the corresponding assembly.
|
// printFunctionSourceLine prints a source line and the corresponding assembly.
|
||||||
func printFunctionSourceLine(w io.Writer, fn *graph.Node, assembly []assemblyInstruction, reader *sourceReader, rpt *Report) {
|
func printFunctionSourceLine(w io.Writer, lineNo int, flat, cum int64, lineContents string,
|
||||||
|
assembly []assemblyInstruction, reader *sourceReader, rpt *Report) {
|
||||||
if len(assembly) == 0 {
|
if len(assembly) == 0 {
|
||||||
fmt.Fprintf(w,
|
fmt.Fprintf(w,
|
||||||
"<span class=line> %6d</span> <span class=nop> %10s %10s %8s %s </span>\n",
|
"<span class=line> %6d</span> <span class=nop> %10s %10s %8s %s </span>\n",
|
||||||
fn.Info.Lineno,
|
lineNo,
|
||||||
valueOrDot(fn.Flat, rpt), valueOrDot(fn.Cum, rpt),
|
valueOrDot(flat, rpt), valueOrDot(cum, rpt),
|
||||||
"", template.HTMLEscapeString(fn.Info.Name))
|
"", template.HTMLEscapeString(lineContents))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Fprintf(w,
|
fmt.Fprintf(w,
|
||||||
"<span class=line> %6d</span> <span class=deadsrc> %10s %10s %8s %s </span>",
|
"<span class=line> %6d</span> <span class=deadsrc> %10s %10s %8s %s </span>",
|
||||||
fn.Info.Lineno,
|
lineNo,
|
||||||
valueOrDot(fn.Flat, rpt), valueOrDot(fn.Cum, rpt),
|
valueOrDot(flat, rpt), valueOrDot(cum, rpt),
|
||||||
"", template.HTMLEscapeString(fn.Info.Name))
|
"", template.HTMLEscapeString(lineContents))
|
||||||
srcIndent := indentation(fn.Info.Name)
|
srcIndent := indentation(lineContents)
|
||||||
fmt.Fprint(w, "<span class=asm>")
|
fmt.Fprint(w, "<span class=asm>")
|
||||||
var curCalls []callID
|
var curCalls []callID
|
||||||
for i, an := range assembly {
|
for i, an := range assembly {
|
||||||
|
|
@ -374,15 +741,9 @@ func printFunctionSourceLine(w io.Writer, fn *graph.Node, assembly []assemblyIns
|
||||||
|
|
||||||
var fileline string
|
var fileline string
|
||||||
if an.file != "" {
|
if an.file != "" {
|
||||||
fileline = fmt.Sprintf("%s:%d", template.HTMLEscapeString(an.file), an.line)
|
fileline = fmt.Sprintf("%s:%d", template.HTMLEscapeString(filepath.Base(an.file)), an.line)
|
||||||
}
|
}
|
||||||
flat, cum := an.flat, an.cum
|
flat, cum := an.flat, an.cum
|
||||||
if an.flatDiv != 0 {
|
|
||||||
flat = flat / an.flatDiv
|
|
||||||
}
|
|
||||||
if an.cumDiv != 0 {
|
|
||||||
cum = cum / an.cumDiv
|
|
||||||
}
|
|
||||||
|
|
||||||
// Print inlined call context.
|
// Print inlined call context.
|
||||||
for j, c := range an.inlineCalls {
|
for j, c := range an.inlineCalls {
|
||||||
|
|
@ -398,15 +759,18 @@ func printFunctionSourceLine(w io.Writer, fn *graph.Node, assembly []assemblyIns
|
||||||
text := strings.Repeat(" ", srcIndent+4+4*j) + strings.TrimSpace(fline)
|
text := strings.Repeat(" ", srcIndent+4+4*j) + strings.TrimSpace(fline)
|
||||||
fmt.Fprintf(w, " %8s %10s %10s %8s <span class=inlinesrc>%s</span> <span class=unimportant>%s:%d</span>\n",
|
fmt.Fprintf(w, " %8s %10s %10s %8s <span class=inlinesrc>%s</span> <span class=unimportant>%s:%d</span>\n",
|
||||||
"", "", "", "",
|
"", "", "", "",
|
||||||
template.HTMLEscapeString(fmt.Sprintf("%-80s", text)),
|
template.HTMLEscapeString(rightPad(text, 80)),
|
||||||
template.HTMLEscapeString(filepath.Base(c.file)), c.line)
|
template.HTMLEscapeString(filepath.Base(c.file)), c.line)
|
||||||
}
|
}
|
||||||
curCalls = an.inlineCalls
|
curCalls = an.inlineCalls
|
||||||
text := strings.Repeat(" ", srcIndent+4+4*len(curCalls)) + an.instruction
|
text := strings.Repeat(" ", srcIndent+4+4*len(curCalls)) + an.instruction
|
||||||
fmt.Fprintf(w, " %8s %10s %10s %8x: %s <span class=unimportant>%s</span>\n",
|
fmt.Fprintf(w, " %8s %10s %10s %8x: %s <span class=unimportant>%s</span>\n",
|
||||||
"", valueOrDot(flat, rpt), valueOrDot(cum, rpt), an.address,
|
"", valueOrDot(flat, rpt), valueOrDot(cum, rpt), an.address,
|
||||||
template.HTMLEscapeString(fmt.Sprintf("%-80s", text)),
|
template.HTMLEscapeString(rightPad(text, 80)),
|
||||||
template.HTMLEscapeString(fileline))
|
// fileline should not be escaped since it was formed by appending
|
||||||
|
// line number (just digits) to an escaped file name. Escaping here
|
||||||
|
// would cause double-escaping of file name.
|
||||||
|
fileline)
|
||||||
}
|
}
|
||||||
fmt.Fprintln(w, "</span>")
|
fmt.Fprintln(w, "</span>")
|
||||||
}
|
}
|
||||||
|
|
@ -482,36 +846,6 @@ func getSourceFromFile(file string, reader *sourceReader, fns graph.Nodes, start
|
||||||
return src, file, nil
|
return src, file, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// getMissingFunctionSource creates a dummy function body to point to
|
|
||||||
// the source file and annotates it with the samples in asm.
|
|
||||||
func getMissingFunctionSource(filename string, asm map[int][]assemblyInstruction, start, end int) (graph.Nodes, string) {
|
|
||||||
var fnodes graph.Nodes
|
|
||||||
for i := start; i <= end; i++ {
|
|
||||||
insts := asm[i]
|
|
||||||
if len(insts) == 0 {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
var group assemblyInstruction
|
|
||||||
for _, insn := range insts {
|
|
||||||
group.flat += insn.flat
|
|
||||||
group.cum += insn.cum
|
|
||||||
group.flatDiv += insn.flatDiv
|
|
||||||
group.cumDiv += insn.cumDiv
|
|
||||||
}
|
|
||||||
flat := group.flatValue()
|
|
||||||
cum := group.cumValue()
|
|
||||||
fnodes = append(fnodes, &graph.Node{
|
|
||||||
Info: graph.NodeInfo{
|
|
||||||
Name: "???",
|
|
||||||
Lineno: i,
|
|
||||||
},
|
|
||||||
Flat: flat,
|
|
||||||
Cum: cum,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return fnodes, filename
|
|
||||||
}
|
|
||||||
|
|
||||||
// sourceReader provides access to source code with caching of file contents.
|
// sourceReader provides access to source code with caching of file contents.
|
||||||
type sourceReader struct {
|
type sourceReader struct {
|
||||||
// searchPath is a filepath.ListSeparator-separated list of directories where
|
// searchPath is a filepath.ListSeparator-separated list of directories where
|
||||||
|
|
@ -543,6 +877,7 @@ func (reader *sourceReader) fileError(path string) error {
|
||||||
return reader.errors[path]
|
return reader.errors[path]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// line returns the line numbered "lineno" in path, or _,false if lineno is out of range.
|
||||||
func (reader *sourceReader) line(path string, lineno int) (string, bool) {
|
func (reader *sourceReader) line(path string, lineno int) (string, bool) {
|
||||||
lines, ok := reader.files[path]
|
lines, ok := reader.files[path]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
@ -651,3 +986,37 @@ func indentation(line string) int {
|
||||||
}
|
}
|
||||||
return column
|
return column
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rightPad pads the input with spaces on the right-hand-side to make it have
|
||||||
|
// at least width n. It treats tabs as enough spaces that lead to the next
|
||||||
|
// 8-aligned tab-stop.
|
||||||
|
func rightPad(s string, n int) string {
|
||||||
|
var str strings.Builder
|
||||||
|
|
||||||
|
// Convert tabs to spaces as we go so padding works regardless of what prefix
|
||||||
|
// is placed before the result.
|
||||||
|
column := 0
|
||||||
|
for _, c := range s {
|
||||||
|
column++
|
||||||
|
if c == '\t' {
|
||||||
|
str.WriteRune(' ')
|
||||||
|
for column%8 != 0 {
|
||||||
|
column++
|
||||||
|
str.WriteRune(' ')
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
str.WriteRune(c)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for column < n {
|
||||||
|
column++
|
||||||
|
str.WriteRune(' ')
|
||||||
|
}
|
||||||
|
return str.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
func canonicalizeFileName(fname string) string {
|
||||||
|
fname = strings.TrimPrefix(fname, "/proc/self/cwd/")
|
||||||
|
fname = strings.TrimPrefix(fname, "./")
|
||||||
|
return filepath.Clean(fname)
|
||||||
|
}
|
||||||
|
|
|
||||||
3
src/cmd/vendor/github.com/google/pprof/internal/report/source_html.go
generated
vendored
3
src/cmd/vendor/github.com/google/pprof/internal/report/source_html.go
generated
vendored
|
|
@ -25,12 +25,11 @@ func AddSourceTemplates(t *template.Template) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const weblistPageCSS = `<style type="text/css">
|
const weblistPageCSS = `<style type="text/css">
|
||||||
body {
|
body #content{
|
||||||
font-family: sans-serif;
|
font-family: sans-serif;
|
||||||
}
|
}
|
||||||
h1 {
|
h1 {
|
||||||
font-size: 1.5em;
|
font-size: 1.5em;
|
||||||
margin-bottom: 4px;
|
|
||||||
}
|
}
|
||||||
.legend {
|
.legend {
|
||||||
font-size: 1.25em;
|
font-size: 1.25em;
|
||||||
|
|
|
||||||
5
src/cmd/vendor/github.com/google/pprof/profile/merge.go
generated
vendored
5
src/cmd/vendor/github.com/google/pprof/profile/merge.go
generated
vendored
|
|
@ -35,7 +35,10 @@ func (p *Profile) Compact() *Profile {
|
||||||
// functions and mappings. Profiles must have identical profile sample
|
// functions and mappings. Profiles must have identical profile sample
|
||||||
// and period types or the merge will fail. profile.Period of the
|
// and period types or the merge will fail. profile.Period of the
|
||||||
// resulting profile will be the maximum of all profiles, and
|
// resulting profile will be the maximum of all profiles, and
|
||||||
// profile.TimeNanos will be the earliest nonzero one.
|
// profile.TimeNanos will be the earliest nonzero one. Merges are
|
||||||
|
// associative with the caveat of the first profile having some
|
||||||
|
// specialization in how headers are combined. There may be other
|
||||||
|
// subtleties now or in the future regarding associativity.
|
||||||
func Merge(srcs []*Profile) (*Profile, error) {
|
func Merge(srcs []*Profile) (*Profile, error) {
|
||||||
if len(srcs) == 0 {
|
if len(srcs) == 0 {
|
||||||
return nil, fmt.Errorf("no profiles to merge")
|
return nil, fmt.Errorf("no profiles to merge")
|
||||||
|
|
|
||||||
18
src/cmd/vendor/github.com/google/pprof/profile/profile.go
generated
vendored
18
src/cmd/vendor/github.com/google/pprof/profile/profile.go
generated
vendored
|
|
@ -22,6 +22,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"math"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
"sort"
|
"sort"
|
||||||
|
|
@ -712,7 +713,8 @@ func (s *Sample) DiffBaseSample() bool {
|
||||||
return s.HasLabel("pprof::base", "true")
|
return s.HasLabel("pprof::base", "true")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scale multiplies all sample values in a profile by a constant.
|
// Scale multiplies all sample values in a profile by a constant and keeps
|
||||||
|
// only samples that have at least one non-zero value.
|
||||||
func (p *Profile) Scale(ratio float64) {
|
func (p *Profile) Scale(ratio float64) {
|
||||||
if ratio == 1 {
|
if ratio == 1 {
|
||||||
return
|
return
|
||||||
|
|
@ -724,7 +726,8 @@ func (p *Profile) Scale(ratio float64) {
|
||||||
p.ScaleN(ratios)
|
p.ScaleN(ratios)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ScaleN multiplies each sample values in a sample by a different amount.
|
// ScaleN multiplies each sample values in a sample by a different amount
|
||||||
|
// and keeps only samples that have at least one non-zero value.
|
||||||
func (p *Profile) ScaleN(ratios []float64) error {
|
func (p *Profile) ScaleN(ratios []float64) error {
|
||||||
if len(p.SampleType) != len(ratios) {
|
if len(p.SampleType) != len(ratios) {
|
||||||
return fmt.Errorf("mismatched scale ratios, got %d, want %d", len(ratios), len(p.SampleType))
|
return fmt.Errorf("mismatched scale ratios, got %d, want %d", len(ratios), len(p.SampleType))
|
||||||
|
|
@ -739,13 +742,22 @@ func (p *Profile) ScaleN(ratios []float64) error {
|
||||||
if allOnes {
|
if allOnes {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
fillIdx := 0
|
||||||
for _, s := range p.Sample {
|
for _, s := range p.Sample {
|
||||||
|
keepSample := false
|
||||||
for i, v := range s.Value {
|
for i, v := range s.Value {
|
||||||
if ratios[i] != 1 {
|
if ratios[i] != 1 {
|
||||||
s.Value[i] = int64(float64(v) * ratios[i])
|
val := int64(math.Round(float64(v) * ratios[i]))
|
||||||
|
s.Value[i] = val
|
||||||
|
keepSample = keepSample || val != 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if keepSample {
|
||||||
|
p.Sample[fillIdx] = s
|
||||||
|
fillIdx++
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
p.Sample = p.Sample[:fillIdx]
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
10
src/cmd/vendor/golang.org/x/arch/arm64/arm64asm/inst.go
generated
vendored
10
src/cmd/vendor/golang.org/x/arch/arm64/arm64asm/inst.go
generated
vendored
|
|
@ -538,10 +538,12 @@ type MemExtend struct {
|
||||||
Extend ExtShift
|
Extend ExtShift
|
||||||
// Amount indicates the index shift amount (but also see ShiftMustBeZero field below).
|
// Amount indicates the index shift amount (but also see ShiftMustBeZero field below).
|
||||||
Amount uint8
|
Amount uint8
|
||||||
// ShiftMustBeZero is set to true when the shift amount must be 0, even if the
|
// Refer to ARM reference manual, for byte load/store(register), the index
|
||||||
// Amount field is not 0. In GNU syntax, a #0 shift amount is printed if Amount
|
// shift amount must be 0, encoded in "S" as 0 if omitted, or as 1 if present.
|
||||||
// is not 0 but ShiftMustBeZero is true; #0 is not printed if Amount is 0 and
|
// a.ShiftMustBeZero is set true indicates the index shift amount must be 0.
|
||||||
// ShiftMustBeZero is true. Both cases represent shift by 0 bit.
|
// In GNU syntax, a #0 shift amount is printed if Amount is 1 but ShiftMustBeZero
|
||||||
|
// is true; #0 is not printed if Amount is 0 and ShiftMustBeZero is true.
|
||||||
|
// Both cases represent shift by 0 bit.
|
||||||
ShiftMustBeZero bool
|
ShiftMustBeZero bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
14
src/cmd/vendor/golang.org/x/arch/arm64/arm64asm/plan9x.go
generated
vendored
14
src/cmd/vendor/golang.org/x/arch/arm64/arm64asm/plan9x.go
generated
vendored
|
|
@ -595,14 +595,18 @@ func plan9Arg(inst *Inst, pc uint64, symname func(uint64) (string, uint64), arg
|
||||||
}
|
}
|
||||||
|
|
||||||
if a.Extend == lsl {
|
if a.Extend == lsl {
|
||||||
|
// Refer to ARM reference manual, for byte load/store(register), the index
|
||||||
|
// shift amount must be 0, encoded in "S" as 0 if omitted, or as 1 if present.
|
||||||
// a.Amount indicates the index shift amount, encoded in "S" field.
|
// a.Amount indicates the index shift amount, encoded in "S" field.
|
||||||
// a.ShiftMustBeZero is set true when the index shift amount must be 0,
|
// a.ShiftMustBeZero is set true indicates the index shift amount must be 0.
|
||||||
// even if the a.Amount field is not 0.
|
// When a.ShiftMustBeZero is true, GNU syntax prints "[Xn, Xm lsl #0]" if "S"
|
||||||
// When a.ShiftMustBeZero is ture, GNU syntax prints #0 shift amount if
|
// equals to 1, or prints "[Xn, Xm]" if "S" equals to 0.
|
||||||
// "S" equals to 1, or does not print #0 shift amount if "S" equals to 0.
|
|
||||||
// Go syntax should never print a zero index shift amount.
|
|
||||||
if a.Amount != 0 && !a.ShiftMustBeZero {
|
if a.Amount != 0 && !a.ShiftMustBeZero {
|
||||||
index = fmt.Sprintf("(%s<<%d)", indexreg, a.Amount)
|
index = fmt.Sprintf("(%s<<%d)", indexreg, a.Amount)
|
||||||
|
} else if a.ShiftMustBeZero && a.Amount == 1 {
|
||||||
|
// When a.ShiftMustBeZero is ture, Go syntax prints "(Rm<<0)" if "a.Amount"
|
||||||
|
// equals to 1.
|
||||||
|
index = fmt.Sprintf("(%s<<0)", indexreg)
|
||||||
} else {
|
} else {
|
||||||
index = fmt.Sprintf("(%s)", indexreg)
|
index = fmt.Sprintf("(%s)", indexreg)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
189
src/cmd/vendor/golang.org/x/arch/ppc64/ppc64asm/gnu.go
generated
vendored
189
src/cmd/vendor/golang.org/x/arch/ppc64/ppc64asm/gnu.go
generated
vendored
|
|
@ -11,8 +11,10 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
condBit = [4]string{"lt", "gt", "eq", "so"}
|
// bit 3 of index is a negated check.
|
||||||
condBitNeg = [4]string{"ge", "le", "ne", "so"}
|
condBit = [8]string{
|
||||||
|
"lt", "gt", "eq", "so",
|
||||||
|
"ge", "le", "ne", "ns"}
|
||||||
)
|
)
|
||||||
|
|
||||||
// GNUSyntax returns the GNU assembler syntax for the instruction, as defined by GNU binutils.
|
// GNUSyntax returns the GNU assembler syntax for the instruction, as defined by GNU binutils.
|
||||||
|
|
@ -31,57 +33,144 @@ func GNUSyntax(inst Inst, pc uint64) string {
|
||||||
// Special handling for some ops
|
// Special handling for some ops
|
||||||
startArg := 0
|
startArg := 0
|
||||||
sep := " "
|
sep := " "
|
||||||
switch inst.Op.String() {
|
opName := inst.Op.String()
|
||||||
case "bc":
|
switch opName {
|
||||||
bo := gnuArg(&inst, 0, inst.Args[0], PC)
|
case "bc", "bcl", "bca", "bcla", "bclr", "bclrl", "bcctr", "bcctrl", "bctar", "bctarl":
|
||||||
bi := inst.Args[1]
|
sfx := inst.Op.String()[2:]
|
||||||
switch bi := bi.(type) {
|
bo := int(inst.Args[0].(Imm))
|
||||||
case CondReg:
|
bi := inst.Args[1].(CondReg)
|
||||||
if bi >= CR0 {
|
atsfx := [4]string{"", "?", "-", "+"}
|
||||||
if bi == CR0 && bo == "16" {
|
decsfx := [2]string{"dnz", "dz"}
|
||||||
buf.WriteString("bdnz")
|
|
||||||
}
|
//BO field is... complicated (z == ignored bit, at == prediction hint)
|
||||||
buf.WriteString(fmt.Sprintf("bc cr%d", bi-CR0))
|
//Paraphrased from ISA 3.1 Book I Section 2.4:
|
||||||
}
|
//
|
||||||
cr := bi / 4
|
//0000z -> decrement ctr, b if ctr != 0 and CRbi == 0
|
||||||
switch bo {
|
//0001z -> decrement ctr, b if ctr == 0 and CRbi == 0
|
||||||
case "4":
|
//001at -> b if CRbi == 0
|
||||||
bit := condBitNeg[(bi-Cond0LT)%4]
|
//0100z -> decrement ctr, b if ctr != 0 and CRbi == 1
|
||||||
if cr == 0 {
|
//0101z -> decrement ctr, b if ctr == 0 and CRbi == 1
|
||||||
buf.WriteString(fmt.Sprintf("b%s", bit))
|
//011at -> b if CRbi == 1
|
||||||
} else {
|
//1a00t -> decrement ctr, b if ctr != 0
|
||||||
buf.WriteString(fmt.Sprintf("b%s cr%d,", bit, cr))
|
//1a01t -> decrement ctr, b if ctr == 0
|
||||||
sep = ""
|
//1z1zz -> b always
|
||||||
}
|
|
||||||
case "12":
|
// Decoding (in this order) we get
|
||||||
bit := condBit[(bi-Cond0LT)%4]
|
// BO & 0b00100 == 0b00000 -> dz if BO[1], else dnz (not simplified for bcctrl forms)
|
||||||
if cr == 0 {
|
// BO & 0b10000 == 0b10000 -> (bc and bca forms not simplified), at = B[4]B[0] if B[2] != 0, done
|
||||||
buf.WriteString(fmt.Sprintf("b%s", bit))
|
// BO & 0b10000 == 0b00000 -> t if BO[3], else f
|
||||||
} else {
|
// BO & 0b10100 == 0b00100 -> at = B[0:1]
|
||||||
buf.WriteString(fmt.Sprintf("b%s cr%d,", bit, cr))
|
|
||||||
sep = ""
|
// BI fields rename as follows:
|
||||||
}
|
// less than : lt BI%4==0 && test == t
|
||||||
case "8":
|
// less than or equal : le BI%4==1 && test == f
|
||||||
bit := condBit[(bi-Cond0LT)%4]
|
// equal : eq BI%4==2 && test == t
|
||||||
sep = ""
|
// greater than or equal: ge BI%4==0 && test == f
|
||||||
if cr == 0 {
|
// greater than : gt BI%4==1 && test == t
|
||||||
buf.WriteString(fmt.Sprintf("bdnzt %s,", bit))
|
// not less than : nl BI%4==0 && test == f
|
||||||
} else {
|
// not equal : ne BI%4==2 && test == f
|
||||||
buf.WriteString(fmt.Sprintf("bdnzt cr%d,%s,", cr, bit))
|
// not greater than : ng BI%4==1 && test == f
|
||||||
}
|
// summary overflow : so BI%4==3 && test == t
|
||||||
case "16":
|
// not summary overflow : ns BI%4==3 && test == f
|
||||||
if cr == 0 && bi == Cond0LT {
|
// unordered : un BI%4==3 && test == t
|
||||||
buf.WriteString("bdnz")
|
// not unordered : nu BI%4==3 && test == f
|
||||||
} else {
|
//
|
||||||
buf.WriteString(fmt.Sprintf("bdnz cr%d,", cr))
|
// Note, there are only 8 possible tests, but quite a few more
|
||||||
sep = ""
|
// ways to name fields. For simplicity, we choose those in condBit.
|
||||||
}
|
|
||||||
|
at := 0 // 0 == no hint, 1 == reserved, 2 == not likely, 3 == likely
|
||||||
|
form := 1 // 1 == n/a, 0 == cr bit not set, 4 == cr bit set
|
||||||
|
cr := (bi - Cond0LT) / 4
|
||||||
|
bh := -1 // Only for lr/tar/ctr variants.
|
||||||
|
switch opName {
|
||||||
|
case "bclr", "bclrl", "bcctr", "bcctrl", "bctar", "bctarl":
|
||||||
|
bh = int(inst.Args[2].(Imm))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if bo&0x14 == 0x14 {
|
||||||
|
if bo == 0x14 && bi == Cond0LT { // preferred form of unconditional branch
|
||||||
|
// Likewise, avoid printing fake b/ba/bl/bla
|
||||||
|
if opName != "bc" && opName != "bca" && opName != "bcl" && opName != "bcla" {
|
||||||
startArg = 2
|
startArg = 2
|
||||||
default:
|
|
||||||
fmt.Printf("Unexpected bi: %d for bc with bo: %s\n", bi, bo)
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
} else if bo&0x04 == 0 { // ctr is decremented
|
||||||
|
if opName != "bcctr" && opName != "bcctrl" {
|
||||||
|
startArg = 1
|
||||||
|
tf := ""
|
||||||
|
if bo&0x10 == 0x00 {
|
||||||
|
tf = "f"
|
||||||
|
if bo&0x08 == 0x08 {
|
||||||
|
tf = "t"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sfx = decsfx[(bo>>1)&1] + tf + sfx
|
||||||
|
}
|
||||||
|
if bo&0x10 == 0x10 {
|
||||||
|
if opName != "bcctr" && opName != "bcctrl" {
|
||||||
startArg = 2
|
startArg = 2
|
||||||
|
}
|
||||||
|
if bi != Cond0LT {
|
||||||
|
// A non-zero BI bit was encoded, but ignored by BO
|
||||||
|
startArg = 0
|
||||||
|
}
|
||||||
|
at = ((bo & 0x8) >> 2) | (bo & 0x1)
|
||||||
|
} else if bo&0x4 == 0x4 {
|
||||||
|
at = bo & 0x3
|
||||||
|
}
|
||||||
|
} else if bo&0x10 == 0x10 { // BI field is not used
|
||||||
|
if opName != "bca" && opName != "bc" {
|
||||||
|
at = ((bo & 0x8) >> 2) | (bo & 0x1)
|
||||||
|
startArg = 2
|
||||||
|
}
|
||||||
|
// If BI is encoded as a bit other than 0, no mnemonic.
|
||||||
|
if bo&0x14 == 0x14 {
|
||||||
|
startArg = 0
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
form = (bo & 0x8) >> 1
|
||||||
|
startArg = 2
|
||||||
|
if bo&0x14 == 0x04 {
|
||||||
|
at = bo & 0x3
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sfx += atsfx[at]
|
||||||
|
|
||||||
|
if form != 1 {
|
||||||
|
bit := int((bi-Cond0LT)%4) | (^form)&0x4
|
||||||
|
sfx = condBit[bit] + sfx
|
||||||
|
}
|
||||||
|
|
||||||
|
if at != 1 && startArg > 0 && bh <= 0 {
|
||||||
|
str := fmt.Sprintf("b%s", sfx)
|
||||||
|
if startArg > 1 && (cr != 0 || bh > 0) {
|
||||||
|
str += fmt.Sprintf(" cr%d", cr)
|
||||||
|
sep = ","
|
||||||
|
}
|
||||||
|
buf.WriteString(str)
|
||||||
|
if startArg < 2 && bh == 0 {
|
||||||
|
str := fmt.Sprintf(" %s",
|
||||||
|
gnuArg(&inst, 1, inst.Args[1], PC))
|
||||||
|
buf.WriteString(str)
|
||||||
|
startArg = 3
|
||||||
|
} else if bh == 0 {
|
||||||
|
startArg = 3
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if startArg == 0 || bh > 0 || at == 1 {
|
||||||
|
buf.WriteString(inst.Op.String())
|
||||||
|
buf.WriteString(atsfx[at])
|
||||||
|
startArg = 0
|
||||||
|
} else {
|
||||||
|
buf.WriteString("b" + sfx)
|
||||||
|
}
|
||||||
|
if bh == 0 {
|
||||||
|
str := fmt.Sprintf(" %d,%s", bo, gnuArg(&inst, 1, inst.Args[1], PC))
|
||||||
|
buf.WriteString(str)
|
||||||
|
startArg = 3
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
case "mtspr":
|
case "mtspr":
|
||||||
opcode := inst.Op.String()
|
opcode := inst.Op.String()
|
||||||
buf.WriteString(opcode[0:2])
|
buf.WriteString(opcode[0:2])
|
||||||
|
|
@ -198,7 +287,7 @@ func gnuArg(inst *Inst, argIndex int, arg Arg, pc uint64) string {
|
||||||
if arg <= Cond0SO {
|
if arg <= Cond0SO {
|
||||||
return bit
|
return bit
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("%s cr%d", bit, int(arg-Cond0LT)/4)
|
return fmt.Sprintf("4*cr%d+%s", int(arg-Cond0LT)/4, bit)
|
||||||
case Imm:
|
case Imm:
|
||||||
return fmt.Sprintf("%d", arg)
|
return fmt.Sprintf("%d", arg)
|
||||||
case SpReg:
|
case SpReg:
|
||||||
|
|
|
||||||
13
src/cmd/vendor/golang.org/x/arch/ppc64/ppc64asm/tables.go
generated
vendored
13
src/cmd/vendor/golang.org/x/arch/ppc64/ppc64asm/tables.go
generated
vendored
|
|
@ -2794,6 +2794,7 @@ var (
|
||||||
ap_FPReg_16_20 = &argField{Type: TypeFPReg, Shift: 0, BitFields: BitFields{{16, 5}}}
|
ap_FPReg_16_20 = &argField{Type: TypeFPReg, Shift: 0, BitFields: BitFields{{16, 5}}}
|
||||||
ap_FPReg_11_15 = &argField{Type: TypeFPReg, Shift: 0, BitFields: BitFields{{11, 5}}}
|
ap_FPReg_11_15 = &argField{Type: TypeFPReg, Shift: 0, BitFields: BitFields{{11, 5}}}
|
||||||
ap_FPReg_21_25 = &argField{Type: TypeFPReg, Shift: 0, BitFields: BitFields{{21, 5}}}
|
ap_FPReg_21_25 = &argField{Type: TypeFPReg, Shift: 0, BitFields: BitFields{{21, 5}}}
|
||||||
|
ap_ImmUnsigned_6_8 = &argField{Type: TypeImmUnsigned, Shift: 0, BitFields: BitFields{{6, 3}}}
|
||||||
ap_ImmUnsigned_16_19 = &argField{Type: TypeImmUnsigned, Shift: 0, BitFields: BitFields{{16, 4}}}
|
ap_ImmUnsigned_16_19 = &argField{Type: TypeImmUnsigned, Shift: 0, BitFields: BitFields{{16, 4}}}
|
||||||
ap_ImmUnsigned_15_15 = &argField{Type: TypeImmUnsigned, Shift: 0, BitFields: BitFields{{15, 1}}}
|
ap_ImmUnsigned_15_15 = &argField{Type: TypeImmUnsigned, Shift: 0, BitFields: BitFields{{15, 1}}}
|
||||||
ap_ImmUnsigned_7_14 = &argField{Type: TypeImmUnsigned, Shift: 0, BitFields: BitFields{{7, 8}}}
|
ap_ImmUnsigned_7_14 = &argField{Type: TypeImmUnsigned, Shift: 0, BitFields: BitFields{{7, 8}}}
|
||||||
|
|
@ -3653,21 +3654,21 @@ var instFormats = [...]instFormat{
|
||||||
{MCRFS, 0xfc0007fe, 0xfc000080, 0x63f801, // Move to Condition Register from FPSCR X-form (mcrfs BF,BFA)
|
{MCRFS, 0xfc0007fe, 0xfc000080, 0x63f801, // Move to Condition Register from FPSCR X-form (mcrfs BF,BFA)
|
||||||
[5]*argField{ap_CondRegField_6_8, ap_CondRegField_11_13}},
|
[5]*argField{ap_CondRegField_6_8, ap_CondRegField_11_13}},
|
||||||
{MTFSFI, 0xfc0007ff, 0xfc00010c, 0x7e0800, // Move To FPSCR Field Immediate X-form (mtfsfi BF,U,W)
|
{MTFSFI, 0xfc0007ff, 0xfc00010c, 0x7e0800, // Move To FPSCR Field Immediate X-form (mtfsfi BF,U,W)
|
||||||
[5]*argField{ap_CondRegField_6_8, ap_ImmUnsigned_16_19, ap_ImmUnsigned_15_15}},
|
[5]*argField{ap_ImmUnsigned_6_8, ap_ImmUnsigned_16_19, ap_ImmUnsigned_15_15}},
|
||||||
{MTFSFICC, 0xfc0007ff, 0xfc00010d, 0x7e0800, // Move To FPSCR Field Immediate X-form (mtfsfi. BF,U,W)
|
{MTFSFICC, 0xfc0007ff, 0xfc00010d, 0x7e0800, // Move To FPSCR Field Immediate X-form (mtfsfi. BF,U,W)
|
||||||
[5]*argField{ap_CondRegField_6_8, ap_ImmUnsigned_16_19, ap_ImmUnsigned_15_15}},
|
[5]*argField{ap_ImmUnsigned_6_8, ap_ImmUnsigned_16_19, ap_ImmUnsigned_15_15}},
|
||||||
{MTFSF, 0xfc0007ff, 0xfc00058e, 0x0, // Move To FPSCR Fields XFL-form (mtfsf FLM,FRB,L,W)
|
{MTFSF, 0xfc0007ff, 0xfc00058e, 0x0, // Move To FPSCR Fields XFL-form (mtfsf FLM,FRB,L,W)
|
||||||
[5]*argField{ap_ImmUnsigned_7_14, ap_FPReg_16_20, ap_ImmUnsigned_6_6, ap_ImmUnsigned_15_15}},
|
[5]*argField{ap_ImmUnsigned_7_14, ap_FPReg_16_20, ap_ImmUnsigned_6_6, ap_ImmUnsigned_15_15}},
|
||||||
{MTFSFCC, 0xfc0007ff, 0xfc00058f, 0x0, // Move To FPSCR Fields XFL-form (mtfsf. FLM,FRB,L,W)
|
{MTFSFCC, 0xfc0007ff, 0xfc00058f, 0x0, // Move To FPSCR Fields XFL-form (mtfsf. FLM,FRB,L,W)
|
||||||
[5]*argField{ap_ImmUnsigned_7_14, ap_FPReg_16_20, ap_ImmUnsigned_6_6, ap_ImmUnsigned_15_15}},
|
[5]*argField{ap_ImmUnsigned_7_14, ap_FPReg_16_20, ap_ImmUnsigned_6_6, ap_ImmUnsigned_15_15}},
|
||||||
{MTFSB0, 0xfc0007ff, 0xfc00008c, 0x1ff800, // Move To FPSCR Bit 0 X-form (mtfsb0 BT)
|
{MTFSB0, 0xfc0007ff, 0xfc00008c, 0x1ff800, // Move To FPSCR Bit 0 X-form (mtfsb0 BT)
|
||||||
[5]*argField{ap_CondRegBit_6_10}},
|
[5]*argField{ap_ImmUnsigned_6_10}},
|
||||||
{MTFSB0CC, 0xfc0007ff, 0xfc00008d, 0x1ff800, // Move To FPSCR Bit 0 X-form (mtfsb0. BT)
|
{MTFSB0CC, 0xfc0007ff, 0xfc00008d, 0x1ff800, // Move To FPSCR Bit 0 X-form (mtfsb0. BT)
|
||||||
[5]*argField{ap_CondRegBit_6_10}},
|
[5]*argField{ap_ImmUnsigned_6_10}},
|
||||||
{MTFSB1, 0xfc0007ff, 0xfc00004c, 0x1ff800, // Move To FPSCR Bit 1 X-form (mtfsb1 BT)
|
{MTFSB1, 0xfc0007ff, 0xfc00004c, 0x1ff800, // Move To FPSCR Bit 1 X-form (mtfsb1 BT)
|
||||||
[5]*argField{ap_CondRegBit_6_10}},
|
[5]*argField{ap_ImmUnsigned_6_10}},
|
||||||
{MTFSB1CC, 0xfc0007ff, 0xfc00004d, 0x1ff800, // Move To FPSCR Bit 1 X-form (mtfsb1. BT)
|
{MTFSB1CC, 0xfc0007ff, 0xfc00004d, 0x1ff800, // Move To FPSCR Bit 1 X-form (mtfsb1. BT)
|
||||||
[5]*argField{ap_CondRegBit_6_10}},
|
[5]*argField{ap_ImmUnsigned_6_10}},
|
||||||
{LVEBX, 0xfc0007fe, 0x7c00000e, 0x1, // Load Vector Element Byte Indexed X-form (lvebx VRT,RA,RB)
|
{LVEBX, 0xfc0007fe, 0x7c00000e, 0x1, // Load Vector Element Byte Indexed X-form (lvebx VRT,RA,RB)
|
||||||
[5]*argField{ap_VecReg_6_10, ap_Reg_11_15, ap_Reg_16_20}},
|
[5]*argField{ap_VecReg_6_10, ap_Reg_11_15, ap_Reg_16_20}},
|
||||||
{LVEHX, 0xfc0007fe, 0x7c00004e, 0x1, // Load Vector Element Halfword Indexed X-form (lvehx VRT,RA,RB)
|
{LVEHX, 0xfc0007fe, 0x7c00004e, 0x1, // Load Vector Element Halfword Indexed X-form (lvehx VRT,RA,RB)
|
||||||
|
|
|
||||||
16365
src/cmd/vendor/golang.org/x/arch/x86/x86asm/tables.go
generated
vendored
16365
src/cmd/vendor/golang.org/x/arch/x86/x86asm/tables.go
generated
vendored
File diff suppressed because it is too large
Load diff
1
src/cmd/vendor/golang.org/x/crypto/ed25519/ed25519.go
generated
vendored
1
src/cmd/vendor/golang.org/x/crypto/ed25519/ed25519.go
generated
vendored
|
|
@ -5,6 +5,7 @@
|
||||||
// In Go 1.13, the ed25519 package was promoted to the standard library as
|
// In Go 1.13, the ed25519 package was promoted to the standard library as
|
||||||
// crypto/ed25519, and this package became a wrapper for the standard library one.
|
// crypto/ed25519, and this package became a wrapper for the standard library one.
|
||||||
//
|
//
|
||||||
|
//go:build !go1.13
|
||||||
// +build !go1.13
|
// +build !go1.13
|
||||||
|
|
||||||
// Package ed25519 implements the Ed25519 signature algorithm. See
|
// Package ed25519 implements the Ed25519 signature algorithm. See
|
||||||
|
|
|
||||||
1
src/cmd/vendor/golang.org/x/crypto/ed25519/ed25519_go113.go
generated
vendored
1
src/cmd/vendor/golang.org/x/crypto/ed25519/ed25519_go113.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// 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 go1.13
|
||||||
// +build go1.13
|
// +build go1.13
|
||||||
|
|
||||||
// Package ed25519 implements the Ed25519 signature algorithm. See
|
// Package ed25519 implements the Ed25519 signature algorithm. See
|
||||||
|
|
|
||||||
989
src/cmd/vendor/golang.org/x/crypto/ssh/terminal/terminal.go
generated
vendored
989
src/cmd/vendor/golang.org/x/crypto/ssh/terminal/terminal.go
generated
vendored
File diff suppressed because it is too large
Load diff
8
src/cmd/vendor/golang.org/x/sys/plan9/asm.s
generated
vendored
Normal file
8
src/cmd/vendor/golang.org/x/sys/plan9/asm.s
generated
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
// Copyright 2014 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "textflag.h"
|
||||||
|
|
||||||
|
TEXT ·use(SB),NOSPLIT,$0
|
||||||
|
RET
|
||||||
30
src/cmd/vendor/golang.org/x/sys/plan9/asm_plan9_386.s
generated
vendored
Normal file
30
src/cmd/vendor/golang.org/x/sys/plan9/asm_plan9_386.s
generated
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
// Copyright 2009 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "textflag.h"
|
||||||
|
|
||||||
|
//
|
||||||
|
// System call support for 386, Plan 9
|
||||||
|
//
|
||||||
|
|
||||||
|
// Just jump to package syscall's implementation for all these functions.
|
||||||
|
// The runtime may know about them.
|
||||||
|
|
||||||
|
TEXT ·Syscall(SB),NOSPLIT,$0-32
|
||||||
|
JMP syscall·Syscall(SB)
|
||||||
|
|
||||||
|
TEXT ·Syscall6(SB),NOSPLIT,$0-44
|
||||||
|
JMP syscall·Syscall6(SB)
|
||||||
|
|
||||||
|
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
|
||||||
|
JMP syscall·RawSyscall(SB)
|
||||||
|
|
||||||
|
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
|
||||||
|
JMP syscall·RawSyscall6(SB)
|
||||||
|
|
||||||
|
TEXT ·seek(SB),NOSPLIT,$0-36
|
||||||
|
JMP syscall·seek(SB)
|
||||||
|
|
||||||
|
TEXT ·exit(SB),NOSPLIT,$4-4
|
||||||
|
JMP syscall·exit(SB)
|
||||||
30
src/cmd/vendor/golang.org/x/sys/plan9/asm_plan9_amd64.s
generated
vendored
Normal file
30
src/cmd/vendor/golang.org/x/sys/plan9/asm_plan9_amd64.s
generated
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
// Copyright 2009 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "textflag.h"
|
||||||
|
|
||||||
|
//
|
||||||
|
// System call support for amd64, Plan 9
|
||||||
|
//
|
||||||
|
|
||||||
|
// Just jump to package syscall's implementation for all these functions.
|
||||||
|
// The runtime may know about them.
|
||||||
|
|
||||||
|
TEXT ·Syscall(SB),NOSPLIT,$0-64
|
||||||
|
JMP syscall·Syscall(SB)
|
||||||
|
|
||||||
|
TEXT ·Syscall6(SB),NOSPLIT,$0-88
|
||||||
|
JMP syscall·Syscall6(SB)
|
||||||
|
|
||||||
|
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
|
||||||
|
JMP syscall·RawSyscall(SB)
|
||||||
|
|
||||||
|
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
|
||||||
|
JMP syscall·RawSyscall6(SB)
|
||||||
|
|
||||||
|
TEXT ·seek(SB),NOSPLIT,$0-56
|
||||||
|
JMP syscall·seek(SB)
|
||||||
|
|
||||||
|
TEXT ·exit(SB),NOSPLIT,$8-8
|
||||||
|
JMP syscall·exit(SB)
|
||||||
25
src/cmd/vendor/golang.org/x/sys/plan9/asm_plan9_arm.s
generated
vendored
Normal file
25
src/cmd/vendor/golang.org/x/sys/plan9/asm_plan9_arm.s
generated
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
// Copyright 2009 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "textflag.h"
|
||||||
|
|
||||||
|
// System call support for plan9 on arm
|
||||||
|
|
||||||
|
// Just jump to package syscall's implementation for all these functions.
|
||||||
|
// The runtime may know about them.
|
||||||
|
|
||||||
|
TEXT ·Syscall(SB),NOSPLIT,$0-32
|
||||||
|
JMP syscall·Syscall(SB)
|
||||||
|
|
||||||
|
TEXT ·Syscall6(SB),NOSPLIT,$0-44
|
||||||
|
JMP syscall·Syscall6(SB)
|
||||||
|
|
||||||
|
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
|
||||||
|
JMP syscall·RawSyscall(SB)
|
||||||
|
|
||||||
|
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
|
||||||
|
JMP syscall·RawSyscall6(SB)
|
||||||
|
|
||||||
|
TEXT ·seek(SB),NOSPLIT,$0-36
|
||||||
|
JMP syscall·exit(SB)
|
||||||
70
src/cmd/vendor/golang.org/x/sys/plan9/const_plan9.go
generated
vendored
Normal file
70
src/cmd/vendor/golang.org/x/sys/plan9/const_plan9.go
generated
vendored
Normal file
|
|
@ -0,0 +1,70 @@
|
||||||
|
package plan9
|
||||||
|
|
||||||
|
// Plan 9 Constants
|
||||||
|
|
||||||
|
// Open modes
|
||||||
|
const (
|
||||||
|
O_RDONLY = 0
|
||||||
|
O_WRONLY = 1
|
||||||
|
O_RDWR = 2
|
||||||
|
O_TRUNC = 16
|
||||||
|
O_CLOEXEC = 32
|
||||||
|
O_EXCL = 0x1000
|
||||||
|
)
|
||||||
|
|
||||||
|
// Rfork flags
|
||||||
|
const (
|
||||||
|
RFNAMEG = 1 << 0
|
||||||
|
RFENVG = 1 << 1
|
||||||
|
RFFDG = 1 << 2
|
||||||
|
RFNOTEG = 1 << 3
|
||||||
|
RFPROC = 1 << 4
|
||||||
|
RFMEM = 1 << 5
|
||||||
|
RFNOWAIT = 1 << 6
|
||||||
|
RFCNAMEG = 1 << 10
|
||||||
|
RFCENVG = 1 << 11
|
||||||
|
RFCFDG = 1 << 12
|
||||||
|
RFREND = 1 << 13
|
||||||
|
RFNOMNT = 1 << 14
|
||||||
|
)
|
||||||
|
|
||||||
|
// Qid.Type bits
|
||||||
|
const (
|
||||||
|
QTDIR = 0x80
|
||||||
|
QTAPPEND = 0x40
|
||||||
|
QTEXCL = 0x20
|
||||||
|
QTMOUNT = 0x10
|
||||||
|
QTAUTH = 0x08
|
||||||
|
QTTMP = 0x04
|
||||||
|
QTFILE = 0x00
|
||||||
|
)
|
||||||
|
|
||||||
|
// Dir.Mode bits
|
||||||
|
const (
|
||||||
|
DMDIR = 0x80000000
|
||||||
|
DMAPPEND = 0x40000000
|
||||||
|
DMEXCL = 0x20000000
|
||||||
|
DMMOUNT = 0x10000000
|
||||||
|
DMAUTH = 0x08000000
|
||||||
|
DMTMP = 0x04000000
|
||||||
|
DMREAD = 0x4
|
||||||
|
DMWRITE = 0x2
|
||||||
|
DMEXEC = 0x1
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
STATMAX = 65535
|
||||||
|
ERRMAX = 128
|
||||||
|
STATFIXLEN = 49
|
||||||
|
)
|
||||||
|
|
||||||
|
// Mount and bind flags
|
||||||
|
const (
|
||||||
|
MREPL = 0x0000
|
||||||
|
MBEFORE = 0x0001
|
||||||
|
MAFTER = 0x0002
|
||||||
|
MORDER = 0x0003
|
||||||
|
MCREATE = 0x0004
|
||||||
|
MCACHE = 0x0010
|
||||||
|
MMASK = 0x0017
|
||||||
|
)
|
||||||
212
src/cmd/vendor/golang.org/x/sys/plan9/dir_plan9.go
generated
vendored
Normal file
212
src/cmd/vendor/golang.org/x/sys/plan9/dir_plan9.go
generated
vendored
Normal file
|
|
@ -0,0 +1,212 @@
|
||||||
|
// Copyright 2012 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// Plan 9 directory marshalling. See intro(5).
|
||||||
|
|
||||||
|
package plan9
|
||||||
|
|
||||||
|
import "errors"
|
||||||
|
|
||||||
|
var (
|
||||||
|
ErrShortStat = errors.New("stat buffer too short")
|
||||||
|
ErrBadStat = errors.New("malformed stat buffer")
|
||||||
|
ErrBadName = errors.New("bad character in file name")
|
||||||
|
)
|
||||||
|
|
||||||
|
// A Qid represents a 9P server's unique identification for a file.
|
||||||
|
type Qid struct {
|
||||||
|
Path uint64 // the file server's unique identification for the file
|
||||||
|
Vers uint32 // version number for given Path
|
||||||
|
Type uint8 // the type of the file (plan9.QTDIR for example)
|
||||||
|
}
|
||||||
|
|
||||||
|
// A Dir contains the metadata for a file.
|
||||||
|
type Dir struct {
|
||||||
|
// system-modified data
|
||||||
|
Type uint16 // server type
|
||||||
|
Dev uint32 // server subtype
|
||||||
|
|
||||||
|
// file data
|
||||||
|
Qid Qid // unique id from server
|
||||||
|
Mode uint32 // permissions
|
||||||
|
Atime uint32 // last read time
|
||||||
|
Mtime uint32 // last write time
|
||||||
|
Length int64 // file length
|
||||||
|
Name string // last element of path
|
||||||
|
Uid string // owner name
|
||||||
|
Gid string // group name
|
||||||
|
Muid string // last modifier name
|
||||||
|
}
|
||||||
|
|
||||||
|
var nullDir = Dir{
|
||||||
|
Type: ^uint16(0),
|
||||||
|
Dev: ^uint32(0),
|
||||||
|
Qid: Qid{
|
||||||
|
Path: ^uint64(0),
|
||||||
|
Vers: ^uint32(0),
|
||||||
|
Type: ^uint8(0),
|
||||||
|
},
|
||||||
|
Mode: ^uint32(0),
|
||||||
|
Atime: ^uint32(0),
|
||||||
|
Mtime: ^uint32(0),
|
||||||
|
Length: ^int64(0),
|
||||||
|
}
|
||||||
|
|
||||||
|
// Null assigns special "don't touch" values to members of d to
|
||||||
|
// avoid modifying them during plan9.Wstat.
|
||||||
|
func (d *Dir) Null() { *d = nullDir }
|
||||||
|
|
||||||
|
// Marshal encodes a 9P stat message corresponding to d into b
|
||||||
|
//
|
||||||
|
// If there isn't enough space in b for a stat message, ErrShortStat is returned.
|
||||||
|
func (d *Dir) Marshal(b []byte) (n int, err error) {
|
||||||
|
n = STATFIXLEN + len(d.Name) + len(d.Uid) + len(d.Gid) + len(d.Muid)
|
||||||
|
if n > len(b) {
|
||||||
|
return n, ErrShortStat
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, c := range d.Name {
|
||||||
|
if c == '/' {
|
||||||
|
return n, ErrBadName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
b = pbit16(b, uint16(n)-2)
|
||||||
|
b = pbit16(b, d.Type)
|
||||||
|
b = pbit32(b, d.Dev)
|
||||||
|
b = pbit8(b, d.Qid.Type)
|
||||||
|
b = pbit32(b, d.Qid.Vers)
|
||||||
|
b = pbit64(b, d.Qid.Path)
|
||||||
|
b = pbit32(b, d.Mode)
|
||||||
|
b = pbit32(b, d.Atime)
|
||||||
|
b = pbit32(b, d.Mtime)
|
||||||
|
b = pbit64(b, uint64(d.Length))
|
||||||
|
b = pstring(b, d.Name)
|
||||||
|
b = pstring(b, d.Uid)
|
||||||
|
b = pstring(b, d.Gid)
|
||||||
|
b = pstring(b, d.Muid)
|
||||||
|
|
||||||
|
return n, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalDir decodes a single 9P stat message from b and returns the resulting Dir.
|
||||||
|
//
|
||||||
|
// If b is too small to hold a valid stat message, ErrShortStat is returned.
|
||||||
|
//
|
||||||
|
// If the stat message itself is invalid, ErrBadStat is returned.
|
||||||
|
func UnmarshalDir(b []byte) (*Dir, error) {
|
||||||
|
if len(b) < STATFIXLEN {
|
||||||
|
return nil, ErrShortStat
|
||||||
|
}
|
||||||
|
size, buf := gbit16(b)
|
||||||
|
if len(b) != int(size)+2 {
|
||||||
|
return nil, ErrBadStat
|
||||||
|
}
|
||||||
|
b = buf
|
||||||
|
|
||||||
|
var d Dir
|
||||||
|
d.Type, b = gbit16(b)
|
||||||
|
d.Dev, b = gbit32(b)
|
||||||
|
d.Qid.Type, b = gbit8(b)
|
||||||
|
d.Qid.Vers, b = gbit32(b)
|
||||||
|
d.Qid.Path, b = gbit64(b)
|
||||||
|
d.Mode, b = gbit32(b)
|
||||||
|
d.Atime, b = gbit32(b)
|
||||||
|
d.Mtime, b = gbit32(b)
|
||||||
|
|
||||||
|
n, b := gbit64(b)
|
||||||
|
d.Length = int64(n)
|
||||||
|
|
||||||
|
var ok bool
|
||||||
|
if d.Name, b, ok = gstring(b); !ok {
|
||||||
|
return nil, ErrBadStat
|
||||||
|
}
|
||||||
|
if d.Uid, b, ok = gstring(b); !ok {
|
||||||
|
return nil, ErrBadStat
|
||||||
|
}
|
||||||
|
if d.Gid, b, ok = gstring(b); !ok {
|
||||||
|
return nil, ErrBadStat
|
||||||
|
}
|
||||||
|
if d.Muid, b, ok = gstring(b); !ok {
|
||||||
|
return nil, ErrBadStat
|
||||||
|
}
|
||||||
|
|
||||||
|
return &d, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// pbit8 copies the 8-bit number v to b and returns the remaining slice of b.
|
||||||
|
func pbit8(b []byte, v uint8) []byte {
|
||||||
|
b[0] = byte(v)
|
||||||
|
return b[1:]
|
||||||
|
}
|
||||||
|
|
||||||
|
// pbit16 copies the 16-bit number v to b in little-endian order and returns the remaining slice of b.
|
||||||
|
func pbit16(b []byte, v uint16) []byte {
|
||||||
|
b[0] = byte(v)
|
||||||
|
b[1] = byte(v >> 8)
|
||||||
|
return b[2:]
|
||||||
|
}
|
||||||
|
|
||||||
|
// pbit32 copies the 32-bit number v to b in little-endian order and returns the remaining slice of b.
|
||||||
|
func pbit32(b []byte, v uint32) []byte {
|
||||||
|
b[0] = byte(v)
|
||||||
|
b[1] = byte(v >> 8)
|
||||||
|
b[2] = byte(v >> 16)
|
||||||
|
b[3] = byte(v >> 24)
|
||||||
|
return b[4:]
|
||||||
|
}
|
||||||
|
|
||||||
|
// pbit64 copies the 64-bit number v to b in little-endian order and returns the remaining slice of b.
|
||||||
|
func pbit64(b []byte, v uint64) []byte {
|
||||||
|
b[0] = byte(v)
|
||||||
|
b[1] = byte(v >> 8)
|
||||||
|
b[2] = byte(v >> 16)
|
||||||
|
b[3] = byte(v >> 24)
|
||||||
|
b[4] = byte(v >> 32)
|
||||||
|
b[5] = byte(v >> 40)
|
||||||
|
b[6] = byte(v >> 48)
|
||||||
|
b[7] = byte(v >> 56)
|
||||||
|
return b[8:]
|
||||||
|
}
|
||||||
|
|
||||||
|
// pstring copies the string s to b, prepending it with a 16-bit length in little-endian order, and
|
||||||
|
// returning the remaining slice of b..
|
||||||
|
func pstring(b []byte, s string) []byte {
|
||||||
|
b = pbit16(b, uint16(len(s)))
|
||||||
|
n := copy(b, s)
|
||||||
|
return b[n:]
|
||||||
|
}
|
||||||
|
|
||||||
|
// gbit8 reads an 8-bit number from b and returns it with the remaining slice of b.
|
||||||
|
func gbit8(b []byte) (uint8, []byte) {
|
||||||
|
return uint8(b[0]), b[1:]
|
||||||
|
}
|
||||||
|
|
||||||
|
// gbit16 reads a 16-bit number in little-endian order from b and returns it with the remaining slice of b.
|
||||||
|
func gbit16(b []byte) (uint16, []byte) {
|
||||||
|
return uint16(b[0]) | uint16(b[1])<<8, b[2:]
|
||||||
|
}
|
||||||
|
|
||||||
|
// gbit32 reads a 32-bit number in little-endian order from b and returns it with the remaining slice of b.
|
||||||
|
func gbit32(b []byte) (uint32, []byte) {
|
||||||
|
return uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24, b[4:]
|
||||||
|
}
|
||||||
|
|
||||||
|
// gbit64 reads a 64-bit number in little-endian order from b and returns it with the remaining slice of b.
|
||||||
|
func gbit64(b []byte) (uint64, []byte) {
|
||||||
|
lo := uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24
|
||||||
|
hi := uint32(b[4]) | uint32(b[5])<<8 | uint32(b[6])<<16 | uint32(b[7])<<24
|
||||||
|
return uint64(lo) | uint64(hi)<<32, b[8:]
|
||||||
|
}
|
||||||
|
|
||||||
|
// gstring reads a string from b, prefixed with a 16-bit length in little-endian order.
|
||||||
|
// It returns the string with the remaining slice of b and a boolean. If the length is
|
||||||
|
// greater than the number of bytes in b, the boolean will be false.
|
||||||
|
func gstring(b []byte) (string, []byte, bool) {
|
||||||
|
n, b := gbit16(b)
|
||||||
|
if int(n) > len(b) {
|
||||||
|
return "", b, false
|
||||||
|
}
|
||||||
|
return string(b[:n]), b[n:], true
|
||||||
|
}
|
||||||
31
src/cmd/vendor/golang.org/x/sys/plan9/env_plan9.go
generated
vendored
Normal file
31
src/cmd/vendor/golang.org/x/sys/plan9/env_plan9.go
generated
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
// Copyright 2011 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.
|
||||||
|
|
||||||
|
// Plan 9 environment variables.
|
||||||
|
|
||||||
|
package plan9
|
||||||
|
|
||||||
|
import (
|
||||||
|
"syscall"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Getenv(key string) (value string, found bool) {
|
||||||
|
return syscall.Getenv(key)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Setenv(key, value string) error {
|
||||||
|
return syscall.Setenv(key, value)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Clearenv() {
|
||||||
|
syscall.Clearenv()
|
||||||
|
}
|
||||||
|
|
||||||
|
func Environ() []string {
|
||||||
|
return syscall.Environ()
|
||||||
|
}
|
||||||
|
|
||||||
|
func Unsetenv(key string) error {
|
||||||
|
return syscall.Unsetenv(key)
|
||||||
|
}
|
||||||
50
src/cmd/vendor/golang.org/x/sys/plan9/errors_plan9.go
generated
vendored
Normal file
50
src/cmd/vendor/golang.org/x/sys/plan9/errors_plan9.go
generated
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
// Copyright 2011 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 plan9
|
||||||
|
|
||||||
|
import "syscall"
|
||||||
|
|
||||||
|
// Constants
|
||||||
|
const (
|
||||||
|
// Invented values to support what package os expects.
|
||||||
|
O_CREAT = 0x02000
|
||||||
|
O_APPEND = 0x00400
|
||||||
|
O_NOCTTY = 0x00000
|
||||||
|
O_NONBLOCK = 0x00000
|
||||||
|
O_SYNC = 0x00000
|
||||||
|
O_ASYNC = 0x00000
|
||||||
|
|
||||||
|
S_IFMT = 0x1f000
|
||||||
|
S_IFIFO = 0x1000
|
||||||
|
S_IFCHR = 0x2000
|
||||||
|
S_IFDIR = 0x4000
|
||||||
|
S_IFBLK = 0x6000
|
||||||
|
S_IFREG = 0x8000
|
||||||
|
S_IFLNK = 0xa000
|
||||||
|
S_IFSOCK = 0xc000
|
||||||
|
)
|
||||||
|
|
||||||
|
// Errors
|
||||||
|
var (
|
||||||
|
EINVAL = syscall.NewError("bad arg in system call")
|
||||||
|
ENOTDIR = syscall.NewError("not a directory")
|
||||||
|
EISDIR = syscall.NewError("file is a directory")
|
||||||
|
ENOENT = syscall.NewError("file does not exist")
|
||||||
|
EEXIST = syscall.NewError("file already exists")
|
||||||
|
EMFILE = syscall.NewError("no free file descriptors")
|
||||||
|
EIO = syscall.NewError("i/o error")
|
||||||
|
ENAMETOOLONG = syscall.NewError("file name too long")
|
||||||
|
EINTR = syscall.NewError("interrupted")
|
||||||
|
EPERM = syscall.NewError("permission denied")
|
||||||
|
EBUSY = syscall.NewError("no free devices")
|
||||||
|
ETIMEDOUT = syscall.NewError("connection timed out")
|
||||||
|
EPLAN9 = syscall.NewError("not supported by plan 9")
|
||||||
|
|
||||||
|
// The following errors do not correspond to any
|
||||||
|
// Plan 9 system messages. Invented to support
|
||||||
|
// what package os and others expect.
|
||||||
|
EACCES = syscall.NewError("access permission denied")
|
||||||
|
EAFNOSUPPORT = syscall.NewError("address family not supported by protocol")
|
||||||
|
)
|
||||||
150
src/cmd/vendor/golang.org/x/sys/plan9/mkall.sh
generated
vendored
Normal file
150
src/cmd/vendor/golang.org/x/sys/plan9/mkall.sh
generated
vendored
Normal file
|
|
@ -0,0 +1,150 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# Copyright 2009 The Go Authors. All rights reserved.
|
||||||
|
# Use of this source code is governed by a BSD-style
|
||||||
|
# license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
# The plan9 package provides access to the raw system call
|
||||||
|
# interface of the underlying operating system. Porting Go to
|
||||||
|
# a new architecture/operating system combination requires
|
||||||
|
# some manual effort, though there are tools that automate
|
||||||
|
# much of the process. The auto-generated files have names
|
||||||
|
# beginning with z.
|
||||||
|
#
|
||||||
|
# This script runs or (given -n) prints suggested commands to generate z files
|
||||||
|
# for the current system. Running those commands is not automatic.
|
||||||
|
# This script is documentation more than anything else.
|
||||||
|
#
|
||||||
|
# * asm_${GOOS}_${GOARCH}.s
|
||||||
|
#
|
||||||
|
# This hand-written assembly file implements system call dispatch.
|
||||||
|
# There are three entry points:
|
||||||
|
#
|
||||||
|
# func Syscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr);
|
||||||
|
# func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr);
|
||||||
|
# func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr);
|
||||||
|
#
|
||||||
|
# The first and second are the standard ones; they differ only in
|
||||||
|
# how many arguments can be passed to the kernel.
|
||||||
|
# The third is for low-level use by the ForkExec wrapper;
|
||||||
|
# unlike the first two, it does not call into the scheduler to
|
||||||
|
# let it know that a system call is running.
|
||||||
|
#
|
||||||
|
# * syscall_${GOOS}.go
|
||||||
|
#
|
||||||
|
# This hand-written Go file implements system calls that need
|
||||||
|
# special handling and lists "//sys" comments giving prototypes
|
||||||
|
# for ones that can be auto-generated. Mksyscall reads those
|
||||||
|
# comments to generate the stubs.
|
||||||
|
#
|
||||||
|
# * syscall_${GOOS}_${GOARCH}.go
|
||||||
|
#
|
||||||
|
# Same as syscall_${GOOS}.go except that it contains code specific
|
||||||
|
# to ${GOOS} on one particular architecture.
|
||||||
|
#
|
||||||
|
# * types_${GOOS}.c
|
||||||
|
#
|
||||||
|
# This hand-written C file includes standard C headers and then
|
||||||
|
# creates typedef or enum names beginning with a dollar sign
|
||||||
|
# (use of $ in variable names is a gcc extension). The hardest
|
||||||
|
# part about preparing this file is figuring out which headers to
|
||||||
|
# include and which symbols need to be #defined to get the
|
||||||
|
# actual data structures that pass through to the kernel system calls.
|
||||||
|
# Some C libraries present alternate versions for binary compatibility
|
||||||
|
# and translate them on the way in and out of system calls, but
|
||||||
|
# there is almost always a #define that can get the real ones.
|
||||||
|
# See types_darwin.c and types_linux.c for examples.
|
||||||
|
#
|
||||||
|
# * zerror_${GOOS}_${GOARCH}.go
|
||||||
|
#
|
||||||
|
# This machine-generated file defines the system's error numbers,
|
||||||
|
# error strings, and signal numbers. The generator is "mkerrors.sh".
|
||||||
|
# Usually no arguments are needed, but mkerrors.sh will pass its
|
||||||
|
# arguments on to godefs.
|
||||||
|
#
|
||||||
|
# * zsyscall_${GOOS}_${GOARCH}.go
|
||||||
|
#
|
||||||
|
# Generated by mksyscall.pl; see syscall_${GOOS}.go above.
|
||||||
|
#
|
||||||
|
# * zsysnum_${GOOS}_${GOARCH}.go
|
||||||
|
#
|
||||||
|
# Generated by mksysnum_${GOOS}.
|
||||||
|
#
|
||||||
|
# * ztypes_${GOOS}_${GOARCH}.go
|
||||||
|
#
|
||||||
|
# Generated by godefs; see types_${GOOS}.c above.
|
||||||
|
|
||||||
|
GOOSARCH="${GOOS}_${GOARCH}"
|
||||||
|
|
||||||
|
# defaults
|
||||||
|
mksyscall="go run mksyscall.go"
|
||||||
|
mkerrors="./mkerrors.sh"
|
||||||
|
zerrors="zerrors_$GOOSARCH.go"
|
||||||
|
mksysctl=""
|
||||||
|
zsysctl="zsysctl_$GOOSARCH.go"
|
||||||
|
mksysnum=
|
||||||
|
mktypes=
|
||||||
|
run="sh"
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
-syscalls)
|
||||||
|
for i in zsyscall*go
|
||||||
|
do
|
||||||
|
sed 1q $i | sed 's;^// ;;' | sh > _$i && gofmt < _$i > $i
|
||||||
|
rm _$i
|
||||||
|
done
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
-n)
|
||||||
|
run="cat"
|
||||||
|
shift
|
||||||
|
esac
|
||||||
|
|
||||||
|
case "$#" in
|
||||||
|
0)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo 'usage: mkall.sh [-n]' 1>&2
|
||||||
|
exit 2
|
||||||
|
esac
|
||||||
|
|
||||||
|
case "$GOOSARCH" in
|
||||||
|
_* | *_ | _)
|
||||||
|
echo 'undefined $GOOS_$GOARCH:' "$GOOSARCH" 1>&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
plan9_386)
|
||||||
|
mkerrors=
|
||||||
|
mksyscall="go run mksyscall.go -l32 -plan9 -tags plan9,386"
|
||||||
|
mksysnum="./mksysnum_plan9.sh /n/sources/plan9/sys/src/libc/9syscall/sys.h"
|
||||||
|
mktypes="XXX"
|
||||||
|
;;
|
||||||
|
plan9_amd64)
|
||||||
|
mkerrors=
|
||||||
|
mksyscall="go run mksyscall.go -l32 -plan9 -tags plan9,amd64"
|
||||||
|
mksysnum="./mksysnum_plan9.sh /n/sources/plan9/sys/src/libc/9syscall/sys.h"
|
||||||
|
mktypes="XXX"
|
||||||
|
;;
|
||||||
|
plan9_arm)
|
||||||
|
mkerrors=
|
||||||
|
mksyscall="go run mksyscall.go -l32 -plan9 -tags plan9,arm"
|
||||||
|
mksysnum="./mksysnum_plan9.sh /n/sources/plan9/sys/src/libc/9syscall/sys.h"
|
||||||
|
mktypes="XXX"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo 'unrecognized $GOOS_$GOARCH: ' "$GOOSARCH" 1>&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
(
|
||||||
|
if [ -n "$mkerrors" ]; then echo "$mkerrors |gofmt >$zerrors"; fi
|
||||||
|
case "$GOOS" in
|
||||||
|
plan9)
|
||||||
|
syscall_goos="syscall_$GOOS.go"
|
||||||
|
if [ -n "$mksyscall" ]; then echo "$mksyscall $syscall_goos |gofmt >zsyscall_$GOOSARCH.go"; fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
if [ -n "$mksysctl" ]; then echo "$mksysctl |gofmt >$zsysctl"; fi
|
||||||
|
if [ -n "$mksysnum" ]; then echo "$mksysnum |gofmt >zsysnum_$GOOSARCH.go"; fi
|
||||||
|
if [ -n "$mktypes" ]; then echo "$mktypes types_$GOOS.go |gofmt >ztypes_$GOOSARCH.go"; fi
|
||||||
|
) | $run
|
||||||
246
src/cmd/vendor/golang.org/x/sys/plan9/mkerrors.sh
generated
vendored
Normal file
246
src/cmd/vendor/golang.org/x/sys/plan9/mkerrors.sh
generated
vendored
Normal file
|
|
@ -0,0 +1,246 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# Copyright 2009 The Go Authors. All rights reserved.
|
||||||
|
# Use of this source code is governed by a BSD-style
|
||||||
|
# license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
# Generate Go code listing errors and other #defined constant
|
||||||
|
# values (ENAMETOOLONG etc.), by asking the preprocessor
|
||||||
|
# about the definitions.
|
||||||
|
|
||||||
|
unset LANG
|
||||||
|
export LC_ALL=C
|
||||||
|
export LC_CTYPE=C
|
||||||
|
|
||||||
|
CC=${CC:-gcc}
|
||||||
|
|
||||||
|
uname=$(uname)
|
||||||
|
|
||||||
|
includes='
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/file.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <netinet/ip.h>
|
||||||
|
#include <netinet/ip6.h>
|
||||||
|
#include <netinet/tcp.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <sys/signal.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <sys/resource.h>
|
||||||
|
'
|
||||||
|
|
||||||
|
ccflags="$@"
|
||||||
|
|
||||||
|
# Write go tool cgo -godefs input.
|
||||||
|
(
|
||||||
|
echo package plan9
|
||||||
|
echo
|
||||||
|
echo '/*'
|
||||||
|
indirect="includes_$(uname)"
|
||||||
|
echo "${!indirect} $includes"
|
||||||
|
echo '*/'
|
||||||
|
echo 'import "C"'
|
||||||
|
echo
|
||||||
|
echo 'const ('
|
||||||
|
|
||||||
|
# The gcc command line prints all the #defines
|
||||||
|
# it encounters while processing the input
|
||||||
|
echo "${!indirect} $includes" | $CC -x c - -E -dM $ccflags |
|
||||||
|
awk '
|
||||||
|
$1 != "#define" || $2 ~ /\(/ || $3 == "" {next}
|
||||||
|
|
||||||
|
$2 ~ /^E([ABCD]X|[BIS]P|[SD]I|S|FL)$/ {next} # 386 registers
|
||||||
|
$2 ~ /^(SIGEV_|SIGSTKSZ|SIGRT(MIN|MAX))/ {next}
|
||||||
|
$2 ~ /^(SCM_SRCRT)$/ {next}
|
||||||
|
$2 ~ /^(MAP_FAILED)$/ {next}
|
||||||
|
|
||||||
|
$2 !~ /^ETH_/ &&
|
||||||
|
$2 !~ /^EPROC_/ &&
|
||||||
|
$2 !~ /^EQUIV_/ &&
|
||||||
|
$2 !~ /^EXPR_/ &&
|
||||||
|
$2 ~ /^E[A-Z0-9_]+$/ ||
|
||||||
|
$2 ~ /^B[0-9_]+$/ ||
|
||||||
|
$2 ~ /^V[A-Z0-9]+$/ ||
|
||||||
|
$2 ~ /^CS[A-Z0-9]/ ||
|
||||||
|
$2 ~ /^I(SIG|CANON|CRNL|EXTEN|MAXBEL|STRIP|UTF8)$/ ||
|
||||||
|
$2 ~ /^IGN/ ||
|
||||||
|
$2 ~ /^IX(ON|ANY|OFF)$/ ||
|
||||||
|
$2 ~ /^IN(LCR|PCK)$/ ||
|
||||||
|
$2 ~ /(^FLU?SH)|(FLU?SH$)/ ||
|
||||||
|
$2 ~ /^C(LOCAL|READ)$/ ||
|
||||||
|
$2 == "BRKINT" ||
|
||||||
|
$2 == "HUPCL" ||
|
||||||
|
$2 == "PENDIN" ||
|
||||||
|
$2 == "TOSTOP" ||
|
||||||
|
$2 ~ /^PAR/ ||
|
||||||
|
$2 ~ /^SIG[^_]/ ||
|
||||||
|
$2 ~ /^O[CNPFP][A-Z]+[^_][A-Z]+$/ ||
|
||||||
|
$2 ~ /^IN_/ ||
|
||||||
|
$2 ~ /^LOCK_(SH|EX|NB|UN)$/ ||
|
||||||
|
$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|ICMP6|TCP|EVFILT|NOTE|EV|SHUT|PROT|MAP|PACKET|MSG|SCM|MCL|DT|MADV|PR)_/ ||
|
||||||
|
$2 == "ICMPV6_FILTER" ||
|
||||||
|
$2 == "SOMAXCONN" ||
|
||||||
|
$2 == "NAME_MAX" ||
|
||||||
|
$2 == "IFNAMSIZ" ||
|
||||||
|
$2 ~ /^CTL_(MAXNAME|NET|QUERY)$/ ||
|
||||||
|
$2 ~ /^SYSCTL_VERS/ ||
|
||||||
|
$2 ~ /^(MS|MNT)_/ ||
|
||||||
|
$2 ~ /^TUN(SET|GET|ATTACH|DETACH)/ ||
|
||||||
|
$2 ~ /^(O|F|FD|NAME|S|PTRACE|PT)_/ ||
|
||||||
|
$2 ~ /^LINUX_REBOOT_CMD_/ ||
|
||||||
|
$2 ~ /^LINUX_REBOOT_MAGIC[12]$/ ||
|
||||||
|
$2 !~ "NLA_TYPE_MASK" &&
|
||||||
|
$2 ~ /^(NETLINK|NLM|NLMSG|NLA|IFA|IFAN|RT|RTCF|RTN|RTPROT|RTNH|ARPHRD|ETH_P)_/ ||
|
||||||
|
$2 ~ /^SIOC/ ||
|
||||||
|
$2 ~ /^TIOC/ ||
|
||||||
|
$2 !~ "RTF_BITS" &&
|
||||||
|
$2 ~ /^(IFF|IFT|NET_RT|RTM|RTF|RTV|RTA|RTAX)_/ ||
|
||||||
|
$2 ~ /^BIOC/ ||
|
||||||
|
$2 ~ /^RUSAGE_(SELF|CHILDREN|THREAD)/ ||
|
||||||
|
$2 ~ /^RLIMIT_(AS|CORE|CPU|DATA|FSIZE|NOFILE|STACK)|RLIM_INFINITY/ ||
|
||||||
|
$2 ~ /^PRIO_(PROCESS|PGRP|USER)/ ||
|
||||||
|
$2 ~ /^CLONE_[A-Z_]+/ ||
|
||||||
|
$2 !~ /^(BPF_TIMEVAL)$/ &&
|
||||||
|
$2 ~ /^(BPF|DLT)_/ ||
|
||||||
|
$2 !~ "WMESGLEN" &&
|
||||||
|
$2 ~ /^W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", $2, $2)}
|
||||||
|
$2 ~ /^__WCOREFLAG$/ {next}
|
||||||
|
$2 ~ /^__W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", substr($2,3), $2)}
|
||||||
|
|
||||||
|
{next}
|
||||||
|
' | sort
|
||||||
|
|
||||||
|
echo ')'
|
||||||
|
) >_const.go
|
||||||
|
|
||||||
|
# Pull out the error names for later.
|
||||||
|
errors=$(
|
||||||
|
echo '#include <errno.h>' | $CC -x c - -E -dM $ccflags |
|
||||||
|
awk '$1=="#define" && $2 ~ /^E[A-Z0-9_]+$/ { print $2 }' |
|
||||||
|
sort
|
||||||
|
)
|
||||||
|
|
||||||
|
# Pull out the signal names for later.
|
||||||
|
signals=$(
|
||||||
|
echo '#include <signal.h>' | $CC -x c - -E -dM $ccflags |
|
||||||
|
awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print $2 }' |
|
||||||
|
egrep -v '(SIGSTKSIZE|SIGSTKSZ|SIGRT)' |
|
||||||
|
sort
|
||||||
|
)
|
||||||
|
|
||||||
|
# Again, writing regexps to a file.
|
||||||
|
echo '#include <errno.h>' | $CC -x c - -E -dM $ccflags |
|
||||||
|
awk '$1=="#define" && $2 ~ /^E[A-Z0-9_]+$/ { print "^\t" $2 "[ \t]*=" }' |
|
||||||
|
sort >_error.grep
|
||||||
|
echo '#include <signal.h>' | $CC -x c - -E -dM $ccflags |
|
||||||
|
awk '$1=="#define" && $2 ~ /^SIG[A-Z0-9]+$/ { print "^\t" $2 "[ \t]*=" }' |
|
||||||
|
egrep -v '(SIGSTKSIZE|SIGSTKSZ|SIGRT)' |
|
||||||
|
sort >_signal.grep
|
||||||
|
|
||||||
|
echo '// mkerrors.sh' "$@"
|
||||||
|
echo '// Code generated by the command above; DO NOT EDIT.'
|
||||||
|
echo
|
||||||
|
go tool cgo -godefs -- "$@" _const.go >_error.out
|
||||||
|
cat _error.out | grep -vf _error.grep | grep -vf _signal.grep
|
||||||
|
echo
|
||||||
|
echo '// Errors'
|
||||||
|
echo 'const ('
|
||||||
|
cat _error.out | grep -f _error.grep | sed 's/=\(.*\)/= Errno(\1)/'
|
||||||
|
echo ')'
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo '// Signals'
|
||||||
|
echo 'const ('
|
||||||
|
cat _error.out | grep -f _signal.grep | sed 's/=\(.*\)/= Signal(\1)/'
|
||||||
|
echo ')'
|
||||||
|
|
||||||
|
# Run C program to print error and syscall strings.
|
||||||
|
(
|
||||||
|
echo -E "
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
|
#define nelem(x) (sizeof(x)/sizeof((x)[0]))
|
||||||
|
|
||||||
|
enum { A = 'A', Z = 'Z', a = 'a', z = 'z' }; // avoid need for single quotes below
|
||||||
|
|
||||||
|
int errors[] = {
|
||||||
|
"
|
||||||
|
for i in $errors
|
||||||
|
do
|
||||||
|
echo -E ' '$i,
|
||||||
|
done
|
||||||
|
|
||||||
|
echo -E "
|
||||||
|
};
|
||||||
|
|
||||||
|
int signals[] = {
|
||||||
|
"
|
||||||
|
for i in $signals
|
||||||
|
do
|
||||||
|
echo -E ' '$i,
|
||||||
|
done
|
||||||
|
|
||||||
|
# Use -E because on some systems bash builtin interprets \n itself.
|
||||||
|
echo -E '
|
||||||
|
};
|
||||||
|
|
||||||
|
static int
|
||||||
|
intcmp(const void *a, const void *b)
|
||||||
|
{
|
||||||
|
return *(int*)a - *(int*)b;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main(void)
|
||||||
|
{
|
||||||
|
int i, j, e;
|
||||||
|
char buf[1024], *p;
|
||||||
|
|
||||||
|
printf("\n\n// Error table\n");
|
||||||
|
printf("var errors = [...]string {\n");
|
||||||
|
qsort(errors, nelem(errors), sizeof errors[0], intcmp);
|
||||||
|
for(i=0; i<nelem(errors); i++) {
|
||||||
|
e = errors[i];
|
||||||
|
if(i > 0 && errors[i-1] == e)
|
||||||
|
continue;
|
||||||
|
strcpy(buf, strerror(e));
|
||||||
|
// lowercase first letter: Bad -> bad, but STREAM -> STREAM.
|
||||||
|
if(A <= buf[0] && buf[0] <= Z && a <= buf[1] && buf[1] <= z)
|
||||||
|
buf[0] += a - A;
|
||||||
|
printf("\t%d: \"%s\",\n", e, buf);
|
||||||
|
}
|
||||||
|
printf("}\n\n");
|
||||||
|
|
||||||
|
printf("\n\n// Signal table\n");
|
||||||
|
printf("var signals = [...]string {\n");
|
||||||
|
qsort(signals, nelem(signals), sizeof signals[0], intcmp);
|
||||||
|
for(i=0; i<nelem(signals); i++) {
|
||||||
|
e = signals[i];
|
||||||
|
if(i > 0 && signals[i-1] == e)
|
||||||
|
continue;
|
||||||
|
strcpy(buf, strsignal(e));
|
||||||
|
// lowercase first letter: Bad -> bad, but STREAM -> STREAM.
|
||||||
|
if(A <= buf[0] && buf[0] <= Z && a <= buf[1] && buf[1] <= z)
|
||||||
|
buf[0] += a - A;
|
||||||
|
// cut trailing : number.
|
||||||
|
p = strrchr(buf, ":"[0]);
|
||||||
|
if(p)
|
||||||
|
*p = '\0';
|
||||||
|
printf("\t%d: \"%s\",\n", e, buf);
|
||||||
|
}
|
||||||
|
printf("}\n\n");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
'
|
||||||
|
) >_errors.c
|
||||||
|
|
||||||
|
$CC $ccflags -o _errors _errors.c && $GORUN ./_errors && rm -f _errors.c _errors _const.go _error.grep _signal.grep _error.out
|
||||||
23
src/cmd/vendor/golang.org/x/sys/plan9/mksysnum_plan9.sh
generated
vendored
Normal file
23
src/cmd/vendor/golang.org/x/sys/plan9/mksysnum_plan9.sh
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# Copyright 2009 The Go Authors. All rights reserved.
|
||||||
|
# Use of this source code is governed by a BSD-style
|
||||||
|
# license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
COMMAND="mksysnum_plan9.sh $@"
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
// $COMMAND
|
||||||
|
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
|
||||||
|
|
||||||
|
package plan9
|
||||||
|
|
||||||
|
const(
|
||||||
|
EOF
|
||||||
|
|
||||||
|
SP='[ ]' # space or tab
|
||||||
|
sed "s/^#define${SP}\\([A-Z0-9_][A-Z0-9_]*\\)${SP}${SP}*\\([0-9][0-9]*\\)/SYS_\\1=\\2/g" \
|
||||||
|
< $1 | grep -v SYS__
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
)
|
||||||
|
EOF
|
||||||
21
src/cmd/vendor/golang.org/x/sys/plan9/pwd_go15_plan9.go
generated
vendored
Normal file
21
src/cmd/vendor/golang.org/x/sys/plan9/pwd_go15_plan9.go
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
// Copyright 2015 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build go1.5
|
||||||
|
|
||||||
|
package plan9
|
||||||
|
|
||||||
|
import "syscall"
|
||||||
|
|
||||||
|
func fixwd() {
|
||||||
|
syscall.Fixwd()
|
||||||
|
}
|
||||||
|
|
||||||
|
func Getwd() (wd string, err error) {
|
||||||
|
return syscall.Getwd()
|
||||||
|
}
|
||||||
|
|
||||||
|
func Chdir(path string) error {
|
||||||
|
return syscall.Chdir(path)
|
||||||
|
}
|
||||||
23
src/cmd/vendor/golang.org/x/sys/plan9/pwd_plan9.go
generated
vendored
Normal file
23
src/cmd/vendor/golang.org/x/sys/plan9/pwd_plan9.go
generated
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
// Copyright 2015 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build !go1.5
|
||||||
|
|
||||||
|
package plan9
|
||||||
|
|
||||||
|
func fixwd() {
|
||||||
|
}
|
||||||
|
|
||||||
|
func Getwd() (wd string, err error) {
|
||||||
|
fd, err := open(".", O_RDONLY)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
defer Close(fd)
|
||||||
|
return Fd2path(fd)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Chdir(path string) error {
|
||||||
|
return chdir(path)
|
||||||
|
}
|
||||||
30
src/cmd/vendor/golang.org/x/sys/plan9/race.go
generated
vendored
Normal file
30
src/cmd/vendor/golang.org/x/sys/plan9/race.go
generated
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
// Copyright 2012 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build plan9,race
|
||||||
|
|
||||||
|
package plan9
|
||||||
|
|
||||||
|
import (
|
||||||
|
"runtime"
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
const raceenabled = true
|
||||||
|
|
||||||
|
func raceAcquire(addr unsafe.Pointer) {
|
||||||
|
runtime.RaceAcquire(addr)
|
||||||
|
}
|
||||||
|
|
||||||
|
func raceReleaseMerge(addr unsafe.Pointer) {
|
||||||
|
runtime.RaceReleaseMerge(addr)
|
||||||
|
}
|
||||||
|
|
||||||
|
func raceReadRange(addr unsafe.Pointer, len int) {
|
||||||
|
runtime.RaceReadRange(addr, len)
|
||||||
|
}
|
||||||
|
|
||||||
|
func raceWriteRange(addr unsafe.Pointer, len int) {
|
||||||
|
runtime.RaceWriteRange(addr, len)
|
||||||
|
}
|
||||||
25
src/cmd/vendor/golang.org/x/sys/plan9/race0.go
generated
vendored
Normal file
25
src/cmd/vendor/golang.org/x/sys/plan9/race0.go
generated
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
// Copyright 2012 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build plan9,!race
|
||||||
|
|
||||||
|
package plan9
|
||||||
|
|
||||||
|
import (
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
const raceenabled = false
|
||||||
|
|
||||||
|
func raceAcquire(addr unsafe.Pointer) {
|
||||||
|
}
|
||||||
|
|
||||||
|
func raceReleaseMerge(addr unsafe.Pointer) {
|
||||||
|
}
|
||||||
|
|
||||||
|
func raceReadRange(addr unsafe.Pointer, len int) {
|
||||||
|
}
|
||||||
|
|
||||||
|
func raceWriteRange(addr unsafe.Pointer, len int) {
|
||||||
|
}
|
||||||
22
src/cmd/vendor/golang.org/x/sys/plan9/str.go
generated
vendored
Normal file
22
src/cmd/vendor/golang.org/x/sys/plan9/str.go
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
// Copyright 2009 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build plan9
|
||||||
|
|
||||||
|
package plan9
|
||||||
|
|
||||||
|
func itoa(val int) string { // do it here rather than with fmt to avoid dependency
|
||||||
|
if val < 0 {
|
||||||
|
return "-" + itoa(-val)
|
||||||
|
}
|
||||||
|
var buf [32]byte // big enough for int64
|
||||||
|
i := len(buf) - 1
|
||||||
|
for val >= 10 {
|
||||||
|
buf[i] = byte(val%10 + '0')
|
||||||
|
i--
|
||||||
|
val /= 10
|
||||||
|
}
|
||||||
|
buf[i] = byte(val + '0')
|
||||||
|
return string(buf[i:])
|
||||||
|
}
|
||||||
116
src/cmd/vendor/golang.org/x/sys/plan9/syscall.go
generated
vendored
Normal file
116
src/cmd/vendor/golang.org/x/sys/plan9/syscall.go
generated
vendored
Normal file
|
|
@ -0,0 +1,116 @@
|
||||||
|
// Copyright 2009 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
// +build plan9
|
||||||
|
|
||||||
|
// Package plan9 contains an interface to the low-level operating system
|
||||||
|
// primitives. OS details vary depending on the underlying system, and
|
||||||
|
// by default, godoc will display the OS-specific documentation for the current
|
||||||
|
// system. If you want godoc to display documentation for another
|
||||||
|
// system, set $GOOS and $GOARCH to the desired system. For example, if
|
||||||
|
// you want to view documentation for freebsd/arm on linux/amd64, set $GOOS
|
||||||
|
// to freebsd and $GOARCH to arm.
|
||||||
|
//
|
||||||
|
// The primary use of this package is inside other packages that provide a more
|
||||||
|
// portable interface to the system, such as "os", "time" and "net". Use
|
||||||
|
// those packages rather than this one if you can.
|
||||||
|
//
|
||||||
|
// For details of the functions and data types in this package consult
|
||||||
|
// the manuals for the appropriate operating system.
|
||||||
|
//
|
||||||
|
// These calls return err == nil to indicate success; otherwise
|
||||||
|
// err represents an operating system error describing the failure and
|
||||||
|
// holds a value of type syscall.ErrorString.
|
||||||
|
package plan9 // import "golang.org/x/sys/plan9"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"strings"
|
||||||
|
"unsafe"
|
||||||
|
|
||||||
|
"golang.org/x/sys/internal/unsafeheader"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ByteSliceFromString returns a NUL-terminated slice of bytes
|
||||||
|
// containing the text of s. If s contains a NUL byte at any
|
||||||
|
// location, it returns (nil, EINVAL).
|
||||||
|
func ByteSliceFromString(s string) ([]byte, error) {
|
||||||
|
if strings.IndexByte(s, 0) != -1 {
|
||||||
|
return nil, EINVAL
|
||||||
|
}
|
||||||
|
a := make([]byte, len(s)+1)
|
||||||
|
copy(a, s)
|
||||||
|
return a, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// BytePtrFromString returns a pointer to a NUL-terminated array of
|
||||||
|
// bytes containing the text of s. If s contains a NUL byte at any
|
||||||
|
// location, it returns (nil, EINVAL).
|
||||||
|
func BytePtrFromString(s string) (*byte, error) {
|
||||||
|
a, err := ByteSliceFromString(s)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &a[0], nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ByteSliceToString returns a string form of the text represented by the slice s, with a terminating NUL and any
|
||||||
|
// bytes after the NUL removed.
|
||||||
|
func ByteSliceToString(s []byte) string {
|
||||||
|
if i := bytes.IndexByte(s, 0); i != -1 {
|
||||||
|
s = s[:i]
|
||||||
|
}
|
||||||
|
return string(s)
|
||||||
|
}
|
||||||
|
|
||||||
|
// BytePtrToString takes a pointer to a sequence of text and returns the corresponding string.
|
||||||
|
// If the pointer is nil, it returns the empty string. It assumes that the text sequence is terminated
|
||||||
|
// at a zero byte; if the zero byte is not present, the program may crash.
|
||||||
|
func BytePtrToString(p *byte) string {
|
||||||
|
if p == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
if *p == 0 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find NUL terminator.
|
||||||
|
n := 0
|
||||||
|
for ptr := unsafe.Pointer(p); *(*byte)(ptr) != 0; n++ {
|
||||||
|
ptr = unsafe.Pointer(uintptr(ptr) + 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
var s []byte
|
||||||
|
h := (*unsafeheader.Slice)(unsafe.Pointer(&s))
|
||||||
|
h.Data = unsafe.Pointer(p)
|
||||||
|
h.Len = n
|
||||||
|
h.Cap = n
|
||||||
|
|
||||||
|
return string(s)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Single-word zero for use when we need a valid pointer to 0 bytes.
|
||||||
|
// See mksyscall.pl.
|
||||||
|
var _zero uintptr
|
||||||
|
|
||||||
|
func (ts *Timespec) Unix() (sec int64, nsec int64) {
|
||||||
|
return int64(ts.Sec), int64(ts.Nsec)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (tv *Timeval) Unix() (sec int64, nsec int64) {
|
||||||
|
return int64(tv.Sec), int64(tv.Usec) * 1000
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ts *Timespec) Nano() int64 {
|
||||||
|
return int64(ts.Sec)*1e9 + int64(ts.Nsec)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (tv *Timeval) Nano() int64 {
|
||||||
|
return int64(tv.Sec)*1e9 + int64(tv.Usec)*1000
|
||||||
|
}
|
||||||
|
|
||||||
|
// use is a no-op, but the compiler cannot see that it is.
|
||||||
|
// Calling use(p) ensures that p is kept live until that point.
|
||||||
|
//go:noescape
|
||||||
|
func use(p unsafe.Pointer)
|
||||||
349
src/cmd/vendor/golang.org/x/sys/plan9/syscall_plan9.go
generated
vendored
Normal file
349
src/cmd/vendor/golang.org/x/sys/plan9/syscall_plan9.go
generated
vendored
Normal file
|
|
@ -0,0 +1,349 @@
|
||||||
|
// Copyright 2011 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.
|
||||||
|
|
||||||
|
// Plan 9 system calls.
|
||||||
|
// This file is compiled as ordinary Go code,
|
||||||
|
// but it is also input to mksyscall,
|
||||||
|
// which parses the //sys lines and generates system call stubs.
|
||||||
|
// Note that sometimes we use a lowercase //sys name and
|
||||||
|
// wrap it in our own nicer implementation.
|
||||||
|
|
||||||
|
package plan9
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"syscall"
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
// A Note is a string describing a process note.
|
||||||
|
// It implements the os.Signal interface.
|
||||||
|
type Note string
|
||||||
|
|
||||||
|
func (n Note) Signal() {}
|
||||||
|
|
||||||
|
func (n Note) String() string {
|
||||||
|
return string(n)
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
Stdin = 0
|
||||||
|
Stdout = 1
|
||||||
|
Stderr = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
// For testing: clients can set this flag to force
|
||||||
|
// creation of IPv6 sockets to return EAFNOSUPPORT.
|
||||||
|
var SocketDisableIPv6 bool
|
||||||
|
|
||||||
|
func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err syscall.ErrorString)
|
||||||
|
func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.ErrorString)
|
||||||
|
func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr)
|
||||||
|
func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr)
|
||||||
|
|
||||||
|
func atoi(b []byte) (n uint) {
|
||||||
|
n = 0
|
||||||
|
for i := 0; i < len(b); i++ {
|
||||||
|
n = n*10 + uint(b[i]-'0')
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func cstring(s []byte) string {
|
||||||
|
i := bytes.IndexByte(s, 0)
|
||||||
|
if i == -1 {
|
||||||
|
i = len(s)
|
||||||
|
}
|
||||||
|
return string(s[:i])
|
||||||
|
}
|
||||||
|
|
||||||
|
func errstr() string {
|
||||||
|
var buf [ERRMAX]byte
|
||||||
|
|
||||||
|
RawSyscall(SYS_ERRSTR, uintptr(unsafe.Pointer(&buf[0])), uintptr(len(buf)), 0)
|
||||||
|
|
||||||
|
buf[len(buf)-1] = 0
|
||||||
|
return cstring(buf[:])
|
||||||
|
}
|
||||||
|
|
||||||
|
// Implemented in assembly to import from runtime.
|
||||||
|
func exit(code int)
|
||||||
|
|
||||||
|
func Exit(code int) { exit(code) }
|
||||||
|
|
||||||
|
func readnum(path string) (uint, error) {
|
||||||
|
var b [12]byte
|
||||||
|
|
||||||
|
fd, e := Open(path, O_RDONLY)
|
||||||
|
if e != nil {
|
||||||
|
return 0, e
|
||||||
|
}
|
||||||
|
defer Close(fd)
|
||||||
|
|
||||||
|
n, e := Pread(fd, b[:], 0)
|
||||||
|
|
||||||
|
if e != nil {
|
||||||
|
return 0, e
|
||||||
|
}
|
||||||
|
|
||||||
|
m := 0
|
||||||
|
for ; m < n && b[m] == ' '; m++ {
|
||||||
|
}
|
||||||
|
|
||||||
|
return atoi(b[m : n-1]), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func Getpid() (pid int) {
|
||||||
|
n, _ := readnum("#c/pid")
|
||||||
|
return int(n)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Getppid() (ppid int) {
|
||||||
|
n, _ := readnum("#c/ppid")
|
||||||
|
return int(n)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Read(fd int, p []byte) (n int, err error) {
|
||||||
|
return Pread(fd, p, -1)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Write(fd int, p []byte) (n int, err error) {
|
||||||
|
return Pwrite(fd, p, -1)
|
||||||
|
}
|
||||||
|
|
||||||
|
var ioSync int64
|
||||||
|
|
||||||
|
//sys fd2path(fd int, buf []byte) (err error)
|
||||||
|
func Fd2path(fd int) (path string, err error) {
|
||||||
|
var buf [512]byte
|
||||||
|
|
||||||
|
e := fd2path(fd, buf[:])
|
||||||
|
if e != nil {
|
||||||
|
return "", e
|
||||||
|
}
|
||||||
|
return cstring(buf[:]), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
//sys pipe(p *[2]int32) (err error)
|
||||||
|
func Pipe(p []int) (err error) {
|
||||||
|
if len(p) != 2 {
|
||||||
|
return syscall.ErrorString("bad arg in system call")
|
||||||
|
}
|
||||||
|
var pp [2]int32
|
||||||
|
err = pipe(&pp)
|
||||||
|
p[0] = int(pp[0])
|
||||||
|
p[1] = int(pp[1])
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Underlying system call writes to newoffset via pointer.
|
||||||
|
// Implemented in assembly to avoid allocation.
|
||||||
|
func seek(placeholder uintptr, fd int, offset int64, whence int) (newoffset int64, err string)
|
||||||
|
|
||||||
|
func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
|
||||||
|
newoffset, e := seek(0, fd, offset, whence)
|
||||||
|
|
||||||
|
if newoffset == -1 {
|
||||||
|
err = syscall.ErrorString(e)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func Mkdir(path string, mode uint32) (err error) {
|
||||||
|
fd, err := Create(path, O_RDONLY, DMDIR|mode)
|
||||||
|
|
||||||
|
if fd != -1 {
|
||||||
|
Close(fd)
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
type Waitmsg struct {
|
||||||
|
Pid int
|
||||||
|
Time [3]uint32
|
||||||
|
Msg string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w Waitmsg) Exited() bool { return true }
|
||||||
|
func (w Waitmsg) Signaled() bool { return false }
|
||||||
|
|
||||||
|
func (w Waitmsg) ExitStatus() int {
|
||||||
|
if len(w.Msg) == 0 {
|
||||||
|
// a normal exit returns no message
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
//sys await(s []byte) (n int, err error)
|
||||||
|
func Await(w *Waitmsg) (err error) {
|
||||||
|
var buf [512]byte
|
||||||
|
var f [5][]byte
|
||||||
|
|
||||||
|
n, err := await(buf[:])
|
||||||
|
|
||||||
|
if err != nil || w == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
nf := 0
|
||||||
|
p := 0
|
||||||
|
for i := 0; i < n && nf < len(f)-1; i++ {
|
||||||
|
if buf[i] == ' ' {
|
||||||
|
f[nf] = buf[p:i]
|
||||||
|
p = i + 1
|
||||||
|
nf++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
f[nf] = buf[p:]
|
||||||
|
nf++
|
||||||
|
|
||||||
|
if nf != len(f) {
|
||||||
|
return syscall.ErrorString("invalid wait message")
|
||||||
|
}
|
||||||
|
w.Pid = int(atoi(f[0]))
|
||||||
|
w.Time[0] = uint32(atoi(f[1]))
|
||||||
|
w.Time[1] = uint32(atoi(f[2]))
|
||||||
|
w.Time[2] = uint32(atoi(f[3]))
|
||||||
|
w.Msg = cstring(f[4])
|
||||||
|
if w.Msg == "''" {
|
||||||
|
// await() returns '' for no error
|
||||||
|
w.Msg = ""
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func Unmount(name, old string) (err error) {
|
||||||
|
fixwd()
|
||||||
|
oldp, err := BytePtrFromString(old)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
oldptr := uintptr(unsafe.Pointer(oldp))
|
||||||
|
|
||||||
|
var r0 uintptr
|
||||||
|
var e syscall.ErrorString
|
||||||
|
|
||||||
|
// bind(2) man page: If name is zero, everything bound or mounted upon old is unbound or unmounted.
|
||||||
|
if name == "" {
|
||||||
|
r0, _, e = Syscall(SYS_UNMOUNT, _zero, oldptr, 0)
|
||||||
|
} else {
|
||||||
|
namep, err := BytePtrFromString(name)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
r0, _, e = Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(namep)), oldptr, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func Fchdir(fd int) (err error) {
|
||||||
|
path, err := Fd2path(fd)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
return Chdir(path)
|
||||||
|
}
|
||||||
|
|
||||||
|
type Timespec struct {
|
||||||
|
Sec int32
|
||||||
|
Nsec int32
|
||||||
|
}
|
||||||
|
|
||||||
|
type Timeval struct {
|
||||||
|
Sec int32
|
||||||
|
Usec int32
|
||||||
|
}
|
||||||
|
|
||||||
|
func NsecToTimeval(nsec int64) (tv Timeval) {
|
||||||
|
nsec += 999 // round up to microsecond
|
||||||
|
tv.Usec = int32(nsec % 1e9 / 1e3)
|
||||||
|
tv.Sec = int32(nsec / 1e9)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func nsec() int64 {
|
||||||
|
var scratch int64
|
||||||
|
|
||||||
|
r0, _, _ := Syscall(SYS_NSEC, uintptr(unsafe.Pointer(&scratch)), 0, 0)
|
||||||
|
// TODO(aram): remove hack after I fix _nsec in the pc64 kernel.
|
||||||
|
if r0 == 0 {
|
||||||
|
return scratch
|
||||||
|
}
|
||||||
|
return int64(r0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func Gettimeofday(tv *Timeval) error {
|
||||||
|
nsec := nsec()
|
||||||
|
*tv = NsecToTimeval(nsec)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func Getpagesize() int { return 0x1000 }
|
||||||
|
|
||||||
|
func Getegid() (egid int) { return -1 }
|
||||||
|
func Geteuid() (euid int) { return -1 }
|
||||||
|
func Getgid() (gid int) { return -1 }
|
||||||
|
func Getuid() (uid int) { return -1 }
|
||||||
|
|
||||||
|
func Getgroups() (gids []int, err error) {
|
||||||
|
return make([]int, 0), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
//sys open(path string, mode int) (fd int, err error)
|
||||||
|
func Open(path string, mode int) (fd int, err error) {
|
||||||
|
fixwd()
|
||||||
|
return open(path, mode)
|
||||||
|
}
|
||||||
|
|
||||||
|
//sys create(path string, mode int, perm uint32) (fd int, err error)
|
||||||
|
func Create(path string, mode int, perm uint32) (fd int, err error) {
|
||||||
|
fixwd()
|
||||||
|
return create(path, mode, perm)
|
||||||
|
}
|
||||||
|
|
||||||
|
//sys remove(path string) (err error)
|
||||||
|
func Remove(path string) error {
|
||||||
|
fixwd()
|
||||||
|
return remove(path)
|
||||||
|
}
|
||||||
|
|
||||||
|
//sys stat(path string, edir []byte) (n int, err error)
|
||||||
|
func Stat(path string, edir []byte) (n int, err error) {
|
||||||
|
fixwd()
|
||||||
|
return stat(path, edir)
|
||||||
|
}
|
||||||
|
|
||||||
|
//sys bind(name string, old string, flag int) (err error)
|
||||||
|
func Bind(name string, old string, flag int) (err error) {
|
||||||
|
fixwd()
|
||||||
|
return bind(name, old, flag)
|
||||||
|
}
|
||||||
|
|
||||||
|
//sys mount(fd int, afd int, old string, flag int, aname string) (err error)
|
||||||
|
func Mount(fd int, afd int, old string, flag int, aname string) (err error) {
|
||||||
|
fixwd()
|
||||||
|
return mount(fd, afd, old, flag, aname)
|
||||||
|
}
|
||||||
|
|
||||||
|
//sys wstat(path string, edir []byte) (err error)
|
||||||
|
func Wstat(path string, edir []byte) (err error) {
|
||||||
|
fixwd()
|
||||||
|
return wstat(path, edir)
|
||||||
|
}
|
||||||
|
|
||||||
|
//sys chdir(path string) (err error)
|
||||||
|
//sys Dup(oldfd int, newfd int) (fd int, err error)
|
||||||
|
//sys Pread(fd int, p []byte, offset int64) (n int, err error)
|
||||||
|
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error)
|
||||||
|
//sys Close(fd int) (err error)
|
||||||
|
//sys Fstat(fd int, edir []byte) (n int, err error)
|
||||||
|
//sys Fwstat(fd int, edir []byte) (err error)
|
||||||
284
src/cmd/vendor/golang.org/x/sys/plan9/zsyscall_plan9_386.go
generated
vendored
Normal file
284
src/cmd/vendor/golang.org/x/sys/plan9/zsyscall_plan9_386.go
generated
vendored
Normal file
|
|
@ -0,0 +1,284 @@
|
||||||
|
// go run mksyscall.go -l32 -plan9 -tags plan9,386 syscall_plan9.go
|
||||||
|
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||||
|
|
||||||
|
// +build plan9,386
|
||||||
|
|
||||||
|
package plan9
|
||||||
|
|
||||||
|
import "unsafe"
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func fd2path(fd int, buf []byte) (err error) {
|
||||||
|
var _p0 unsafe.Pointer
|
||||||
|
if len(buf) > 0 {
|
||||||
|
_p0 = unsafe.Pointer(&buf[0])
|
||||||
|
} else {
|
||||||
|
_p0 = unsafe.Pointer(&_zero)
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall(SYS_FD2PATH, uintptr(fd), uintptr(_p0), uintptr(len(buf)))
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func pipe(p *[2]int32) (err error) {
|
||||||
|
r0, _, e1 := Syscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func await(s []byte) (n int, err error) {
|
||||||
|
var _p0 unsafe.Pointer
|
||||||
|
if len(s) > 0 {
|
||||||
|
_p0 = unsafe.Pointer(&s[0])
|
||||||
|
} else {
|
||||||
|
_p0 = unsafe.Pointer(&_zero)
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall(SYS_AWAIT, uintptr(_p0), uintptr(len(s)), 0)
|
||||||
|
n = int(r0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func open(path string, mode int) (fd int, err error) {
|
||||||
|
var _p0 *byte
|
||||||
|
_p0, err = BytePtrFromString(path)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
|
||||||
|
fd = int(r0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func create(path string, mode int, perm uint32) (fd int, err error) {
|
||||||
|
var _p0 *byte
|
||||||
|
_p0, err = BytePtrFromString(path)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall(SYS_CREATE, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm))
|
||||||
|
fd = int(r0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func remove(path string) (err error) {
|
||||||
|
var _p0 *byte
|
||||||
|
_p0, err = BytePtrFromString(path)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall(SYS_REMOVE, uintptr(unsafe.Pointer(_p0)), 0, 0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func stat(path string, edir []byte) (n int, err error) {
|
||||||
|
var _p0 *byte
|
||||||
|
_p0, err = BytePtrFromString(path)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var _p1 unsafe.Pointer
|
||||||
|
if len(edir) > 0 {
|
||||||
|
_p1 = unsafe.Pointer(&edir[0])
|
||||||
|
} else {
|
||||||
|
_p1 = unsafe.Pointer(&_zero)
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(edir)))
|
||||||
|
n = int(r0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func bind(name string, old string, flag int) (err error) {
|
||||||
|
var _p0 *byte
|
||||||
|
_p0, err = BytePtrFromString(name)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var _p1 *byte
|
||||||
|
_p1, err = BytePtrFromString(old)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall(SYS_BIND, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flag))
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func mount(fd int, afd int, old string, flag int, aname string) (err error) {
|
||||||
|
var _p0 *byte
|
||||||
|
_p0, err = BytePtrFromString(old)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var _p1 *byte
|
||||||
|
_p1, err = BytePtrFromString(aname)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall6(SYS_MOUNT, uintptr(fd), uintptr(afd), uintptr(unsafe.Pointer(_p0)), uintptr(flag), uintptr(unsafe.Pointer(_p1)), 0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func wstat(path string, edir []byte) (err error) {
|
||||||
|
var _p0 *byte
|
||||||
|
_p0, err = BytePtrFromString(path)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var _p1 unsafe.Pointer
|
||||||
|
if len(edir) > 0 {
|
||||||
|
_p1 = unsafe.Pointer(&edir[0])
|
||||||
|
} else {
|
||||||
|
_p1 = unsafe.Pointer(&_zero)
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall(SYS_WSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(edir)))
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func chdir(path string) (err error) {
|
||||||
|
var _p0 *byte
|
||||||
|
_p0, err = BytePtrFromString(path)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func Dup(oldfd int, newfd int) (fd int, err error) {
|
||||||
|
r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), uintptr(newfd), 0)
|
||||||
|
fd = int(r0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func Pread(fd int, p []byte, offset int64) (n int, err error) {
|
||||||
|
var _p0 unsafe.Pointer
|
||||||
|
if len(p) > 0 {
|
||||||
|
_p0 = unsafe.Pointer(&p[0])
|
||||||
|
} else {
|
||||||
|
_p0 = unsafe.Pointer(&_zero)
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0)
|
||||||
|
n = int(r0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func Pwrite(fd int, p []byte, offset int64) (n int, err error) {
|
||||||
|
var _p0 unsafe.Pointer
|
||||||
|
if len(p) > 0 {
|
||||||
|
_p0 = unsafe.Pointer(&p[0])
|
||||||
|
} else {
|
||||||
|
_p0 = unsafe.Pointer(&_zero)
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0)
|
||||||
|
n = int(r0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func Close(fd int) (err error) {
|
||||||
|
r0, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func Fstat(fd int, edir []byte) (n int, err error) {
|
||||||
|
var _p0 unsafe.Pointer
|
||||||
|
if len(edir) > 0 {
|
||||||
|
_p0 = unsafe.Pointer(&edir[0])
|
||||||
|
} else {
|
||||||
|
_p0 = unsafe.Pointer(&_zero)
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(_p0), uintptr(len(edir)))
|
||||||
|
n = int(r0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func Fwstat(fd int, edir []byte) (err error) {
|
||||||
|
var _p0 unsafe.Pointer
|
||||||
|
if len(edir) > 0 {
|
||||||
|
_p0 = unsafe.Pointer(&edir[0])
|
||||||
|
} else {
|
||||||
|
_p0 = unsafe.Pointer(&_zero)
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall(SYS_FWSTAT, uintptr(fd), uintptr(_p0), uintptr(len(edir)))
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
284
src/cmd/vendor/golang.org/x/sys/plan9/zsyscall_plan9_amd64.go
generated
vendored
Normal file
284
src/cmd/vendor/golang.org/x/sys/plan9/zsyscall_plan9_amd64.go
generated
vendored
Normal file
|
|
@ -0,0 +1,284 @@
|
||||||
|
// go run mksyscall.go -l32 -plan9 -tags plan9,amd64 syscall_plan9.go
|
||||||
|
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||||
|
|
||||||
|
// +build plan9,amd64
|
||||||
|
|
||||||
|
package plan9
|
||||||
|
|
||||||
|
import "unsafe"
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func fd2path(fd int, buf []byte) (err error) {
|
||||||
|
var _p0 unsafe.Pointer
|
||||||
|
if len(buf) > 0 {
|
||||||
|
_p0 = unsafe.Pointer(&buf[0])
|
||||||
|
} else {
|
||||||
|
_p0 = unsafe.Pointer(&_zero)
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall(SYS_FD2PATH, uintptr(fd), uintptr(_p0), uintptr(len(buf)))
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func pipe(p *[2]int32) (err error) {
|
||||||
|
r0, _, e1 := Syscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func await(s []byte) (n int, err error) {
|
||||||
|
var _p0 unsafe.Pointer
|
||||||
|
if len(s) > 0 {
|
||||||
|
_p0 = unsafe.Pointer(&s[0])
|
||||||
|
} else {
|
||||||
|
_p0 = unsafe.Pointer(&_zero)
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall(SYS_AWAIT, uintptr(_p0), uintptr(len(s)), 0)
|
||||||
|
n = int(r0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func open(path string, mode int) (fd int, err error) {
|
||||||
|
var _p0 *byte
|
||||||
|
_p0, err = BytePtrFromString(path)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
|
||||||
|
fd = int(r0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func create(path string, mode int, perm uint32) (fd int, err error) {
|
||||||
|
var _p0 *byte
|
||||||
|
_p0, err = BytePtrFromString(path)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall(SYS_CREATE, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm))
|
||||||
|
fd = int(r0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func remove(path string) (err error) {
|
||||||
|
var _p0 *byte
|
||||||
|
_p0, err = BytePtrFromString(path)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall(SYS_REMOVE, uintptr(unsafe.Pointer(_p0)), 0, 0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func stat(path string, edir []byte) (n int, err error) {
|
||||||
|
var _p0 *byte
|
||||||
|
_p0, err = BytePtrFromString(path)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var _p1 unsafe.Pointer
|
||||||
|
if len(edir) > 0 {
|
||||||
|
_p1 = unsafe.Pointer(&edir[0])
|
||||||
|
} else {
|
||||||
|
_p1 = unsafe.Pointer(&_zero)
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(edir)))
|
||||||
|
n = int(r0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func bind(name string, old string, flag int) (err error) {
|
||||||
|
var _p0 *byte
|
||||||
|
_p0, err = BytePtrFromString(name)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var _p1 *byte
|
||||||
|
_p1, err = BytePtrFromString(old)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall(SYS_BIND, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flag))
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func mount(fd int, afd int, old string, flag int, aname string) (err error) {
|
||||||
|
var _p0 *byte
|
||||||
|
_p0, err = BytePtrFromString(old)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var _p1 *byte
|
||||||
|
_p1, err = BytePtrFromString(aname)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall6(SYS_MOUNT, uintptr(fd), uintptr(afd), uintptr(unsafe.Pointer(_p0)), uintptr(flag), uintptr(unsafe.Pointer(_p1)), 0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func wstat(path string, edir []byte) (err error) {
|
||||||
|
var _p0 *byte
|
||||||
|
_p0, err = BytePtrFromString(path)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var _p1 unsafe.Pointer
|
||||||
|
if len(edir) > 0 {
|
||||||
|
_p1 = unsafe.Pointer(&edir[0])
|
||||||
|
} else {
|
||||||
|
_p1 = unsafe.Pointer(&_zero)
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall(SYS_WSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(edir)))
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func chdir(path string) (err error) {
|
||||||
|
var _p0 *byte
|
||||||
|
_p0, err = BytePtrFromString(path)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func Dup(oldfd int, newfd int) (fd int, err error) {
|
||||||
|
r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), uintptr(newfd), 0)
|
||||||
|
fd = int(r0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func Pread(fd int, p []byte, offset int64) (n int, err error) {
|
||||||
|
var _p0 unsafe.Pointer
|
||||||
|
if len(p) > 0 {
|
||||||
|
_p0 = unsafe.Pointer(&p[0])
|
||||||
|
} else {
|
||||||
|
_p0 = unsafe.Pointer(&_zero)
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0)
|
||||||
|
n = int(r0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func Pwrite(fd int, p []byte, offset int64) (n int, err error) {
|
||||||
|
var _p0 unsafe.Pointer
|
||||||
|
if len(p) > 0 {
|
||||||
|
_p0 = unsafe.Pointer(&p[0])
|
||||||
|
} else {
|
||||||
|
_p0 = unsafe.Pointer(&_zero)
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0)
|
||||||
|
n = int(r0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func Close(fd int) (err error) {
|
||||||
|
r0, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func Fstat(fd int, edir []byte) (n int, err error) {
|
||||||
|
var _p0 unsafe.Pointer
|
||||||
|
if len(edir) > 0 {
|
||||||
|
_p0 = unsafe.Pointer(&edir[0])
|
||||||
|
} else {
|
||||||
|
_p0 = unsafe.Pointer(&_zero)
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(_p0), uintptr(len(edir)))
|
||||||
|
n = int(r0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func Fwstat(fd int, edir []byte) (err error) {
|
||||||
|
var _p0 unsafe.Pointer
|
||||||
|
if len(edir) > 0 {
|
||||||
|
_p0 = unsafe.Pointer(&edir[0])
|
||||||
|
} else {
|
||||||
|
_p0 = unsafe.Pointer(&_zero)
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall(SYS_FWSTAT, uintptr(fd), uintptr(_p0), uintptr(len(edir)))
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
284
src/cmd/vendor/golang.org/x/sys/plan9/zsyscall_plan9_arm.go
generated
vendored
Normal file
284
src/cmd/vendor/golang.org/x/sys/plan9/zsyscall_plan9_arm.go
generated
vendored
Normal file
|
|
@ -0,0 +1,284 @@
|
||||||
|
// go run mksyscall.go -l32 -plan9 -tags plan9,arm syscall_plan9.go
|
||||||
|
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||||
|
|
||||||
|
// +build plan9,arm
|
||||||
|
|
||||||
|
package plan9
|
||||||
|
|
||||||
|
import "unsafe"
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func fd2path(fd int, buf []byte) (err error) {
|
||||||
|
var _p0 unsafe.Pointer
|
||||||
|
if len(buf) > 0 {
|
||||||
|
_p0 = unsafe.Pointer(&buf[0])
|
||||||
|
} else {
|
||||||
|
_p0 = unsafe.Pointer(&_zero)
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall(SYS_FD2PATH, uintptr(fd), uintptr(_p0), uintptr(len(buf)))
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func pipe(p *[2]int32) (err error) {
|
||||||
|
r0, _, e1 := Syscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func await(s []byte) (n int, err error) {
|
||||||
|
var _p0 unsafe.Pointer
|
||||||
|
if len(s) > 0 {
|
||||||
|
_p0 = unsafe.Pointer(&s[0])
|
||||||
|
} else {
|
||||||
|
_p0 = unsafe.Pointer(&_zero)
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall(SYS_AWAIT, uintptr(_p0), uintptr(len(s)), 0)
|
||||||
|
n = int(r0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func open(path string, mode int) (fd int, err error) {
|
||||||
|
var _p0 *byte
|
||||||
|
_p0, err = BytePtrFromString(path)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(_p0)), uintptr(mode), 0)
|
||||||
|
fd = int(r0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func create(path string, mode int, perm uint32) (fd int, err error) {
|
||||||
|
var _p0 *byte
|
||||||
|
_p0, err = BytePtrFromString(path)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall(SYS_CREATE, uintptr(unsafe.Pointer(_p0)), uintptr(mode), uintptr(perm))
|
||||||
|
fd = int(r0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func remove(path string) (err error) {
|
||||||
|
var _p0 *byte
|
||||||
|
_p0, err = BytePtrFromString(path)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall(SYS_REMOVE, uintptr(unsafe.Pointer(_p0)), 0, 0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func stat(path string, edir []byte) (n int, err error) {
|
||||||
|
var _p0 *byte
|
||||||
|
_p0, err = BytePtrFromString(path)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var _p1 unsafe.Pointer
|
||||||
|
if len(edir) > 0 {
|
||||||
|
_p1 = unsafe.Pointer(&edir[0])
|
||||||
|
} else {
|
||||||
|
_p1 = unsafe.Pointer(&_zero)
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(edir)))
|
||||||
|
n = int(r0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func bind(name string, old string, flag int) (err error) {
|
||||||
|
var _p0 *byte
|
||||||
|
_p0, err = BytePtrFromString(name)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var _p1 *byte
|
||||||
|
_p1, err = BytePtrFromString(old)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall(SYS_BIND, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(flag))
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func mount(fd int, afd int, old string, flag int, aname string) (err error) {
|
||||||
|
var _p0 *byte
|
||||||
|
_p0, err = BytePtrFromString(old)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var _p1 *byte
|
||||||
|
_p1, err = BytePtrFromString(aname)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall6(SYS_MOUNT, uintptr(fd), uintptr(afd), uintptr(unsafe.Pointer(_p0)), uintptr(flag), uintptr(unsafe.Pointer(_p1)), 0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func wstat(path string, edir []byte) (err error) {
|
||||||
|
var _p0 *byte
|
||||||
|
_p0, err = BytePtrFromString(path)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var _p1 unsafe.Pointer
|
||||||
|
if len(edir) > 0 {
|
||||||
|
_p1 = unsafe.Pointer(&edir[0])
|
||||||
|
} else {
|
||||||
|
_p1 = unsafe.Pointer(&_zero)
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall(SYS_WSTAT, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(edir)))
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func chdir(path string) (err error) {
|
||||||
|
var _p0 *byte
|
||||||
|
_p0, err = BytePtrFromString(path)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(_p0)), 0, 0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func Dup(oldfd int, newfd int) (fd int, err error) {
|
||||||
|
r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), uintptr(newfd), 0)
|
||||||
|
fd = int(r0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func Pread(fd int, p []byte, offset int64) (n int, err error) {
|
||||||
|
var _p0 unsafe.Pointer
|
||||||
|
if len(p) > 0 {
|
||||||
|
_p0 = unsafe.Pointer(&p[0])
|
||||||
|
} else {
|
||||||
|
_p0 = unsafe.Pointer(&_zero)
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0)
|
||||||
|
n = int(r0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func Pwrite(fd int, p []byte, offset int64) (n int, err error) {
|
||||||
|
var _p0 unsafe.Pointer
|
||||||
|
if len(p) > 0 {
|
||||||
|
_p0 = unsafe.Pointer(&p[0])
|
||||||
|
} else {
|
||||||
|
_p0 = unsafe.Pointer(&_zero)
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0)
|
||||||
|
n = int(r0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func Close(fd int) (err error) {
|
||||||
|
r0, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func Fstat(fd int, edir []byte) (n int, err error) {
|
||||||
|
var _p0 unsafe.Pointer
|
||||||
|
if len(edir) > 0 {
|
||||||
|
_p0 = unsafe.Pointer(&edir[0])
|
||||||
|
} else {
|
||||||
|
_p0 = unsafe.Pointer(&_zero)
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(_p0), uintptr(len(edir)))
|
||||||
|
n = int(r0)
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func Fwstat(fd int, edir []byte) (err error) {
|
||||||
|
var _p0 unsafe.Pointer
|
||||||
|
if len(edir) > 0 {
|
||||||
|
_p0 = unsafe.Pointer(&edir[0])
|
||||||
|
} else {
|
||||||
|
_p0 = unsafe.Pointer(&_zero)
|
||||||
|
}
|
||||||
|
r0, _, e1 := Syscall(SYS_FWSTAT, uintptr(fd), uintptr(_p0), uintptr(len(edir)))
|
||||||
|
if int32(r0) == -1 {
|
||||||
|
err = e1
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
49
src/cmd/vendor/golang.org/x/sys/plan9/zsysnum_plan9.go
generated
vendored
Normal file
49
src/cmd/vendor/golang.org/x/sys/plan9/zsysnum_plan9.go
generated
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
// mksysnum_plan9.sh /opt/plan9/sys/src/libc/9syscall/sys.h
|
||||||
|
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
|
||||||
|
|
||||||
|
package plan9
|
||||||
|
|
||||||
|
const (
|
||||||
|
SYS_SYSR1 = 0
|
||||||
|
SYS_BIND = 2
|
||||||
|
SYS_CHDIR = 3
|
||||||
|
SYS_CLOSE = 4
|
||||||
|
SYS_DUP = 5
|
||||||
|
SYS_ALARM = 6
|
||||||
|
SYS_EXEC = 7
|
||||||
|
SYS_EXITS = 8
|
||||||
|
SYS_FAUTH = 10
|
||||||
|
SYS_SEGBRK = 12
|
||||||
|
SYS_OPEN = 14
|
||||||
|
SYS_OSEEK = 16
|
||||||
|
SYS_SLEEP = 17
|
||||||
|
SYS_RFORK = 19
|
||||||
|
SYS_PIPE = 21
|
||||||
|
SYS_CREATE = 22
|
||||||
|
SYS_FD2PATH = 23
|
||||||
|
SYS_BRK_ = 24
|
||||||
|
SYS_REMOVE = 25
|
||||||
|
SYS_NOTIFY = 28
|
||||||
|
SYS_NOTED = 29
|
||||||
|
SYS_SEGATTACH = 30
|
||||||
|
SYS_SEGDETACH = 31
|
||||||
|
SYS_SEGFREE = 32
|
||||||
|
SYS_SEGFLUSH = 33
|
||||||
|
SYS_RENDEZVOUS = 34
|
||||||
|
SYS_UNMOUNT = 35
|
||||||
|
SYS_SEMACQUIRE = 37
|
||||||
|
SYS_SEMRELEASE = 38
|
||||||
|
SYS_SEEK = 39
|
||||||
|
SYS_FVERSION = 40
|
||||||
|
SYS_ERRSTR = 41
|
||||||
|
SYS_STAT = 42
|
||||||
|
SYS_FSTAT = 43
|
||||||
|
SYS_WSTAT = 44
|
||||||
|
SYS_FWSTAT = 45
|
||||||
|
SYS_MOUNT = 46
|
||||||
|
SYS_AWAIT = 47
|
||||||
|
SYS_PREAD = 50
|
||||||
|
SYS_PWRITE = 51
|
||||||
|
SYS_TSEMACQUIRE = 52
|
||||||
|
SYS_NSEC = 53
|
||||||
|
)
|
||||||
3
src/cmd/vendor/golang.org/x/sys/unix/aliases.go
generated
vendored
3
src/cmd/vendor/golang.org/x/sys/unix/aliases.go
generated
vendored
|
|
@ -2,7 +2,8 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
//go:build (aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos) && go1.9
|
||||||
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
|
||||||
// +build go1.9
|
// +build go1.9
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
|
||||||
426
src/cmd/vendor/golang.org/x/sys/unix/asm_zos_s390x.s
generated
vendored
Normal file
426
src/cmd/vendor/golang.org/x/sys/unix/asm_zos_s390x.s
generated
vendored
Normal file
|
|
@ -0,0 +1,426 @@
|
||||||
|
// Copyright 2020 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build zos && s390x && gc
|
||||||
|
// +build zos
|
||||||
|
// +build s390x
|
||||||
|
// +build gc
|
||||||
|
|
||||||
|
#include "textflag.h"
|
||||||
|
|
||||||
|
#define PSALAA 1208(R0)
|
||||||
|
#define GTAB64(x) 80(x)
|
||||||
|
#define LCA64(x) 88(x)
|
||||||
|
#define CAA(x) 8(x)
|
||||||
|
#define EDCHPXV(x) 1016(x) // in the CAA
|
||||||
|
#define SAVSTACK_ASYNC(x) 336(x) // in the LCA
|
||||||
|
|
||||||
|
// SS_*, where x=SAVSTACK_ASYNC
|
||||||
|
#define SS_LE(x) 0(x)
|
||||||
|
#define SS_GO(x) 8(x)
|
||||||
|
#define SS_ERRNO(x) 16(x)
|
||||||
|
#define SS_ERRNOJR(x) 20(x)
|
||||||
|
|
||||||
|
#define LE_CALL BYTE $0x0D; BYTE $0x76; // BL R7, R6
|
||||||
|
|
||||||
|
TEXT ·clearErrno(SB),NOSPLIT,$0-0
|
||||||
|
BL addrerrno<>(SB)
|
||||||
|
MOVD $0, 0(R3)
|
||||||
|
RET
|
||||||
|
|
||||||
|
// Returns the address of errno in R3.
|
||||||
|
TEXT addrerrno<>(SB),NOSPLIT|NOFRAME,$0-0
|
||||||
|
// Get library control area (LCA).
|
||||||
|
MOVW PSALAA, R8
|
||||||
|
MOVD LCA64(R8), R8
|
||||||
|
|
||||||
|
// Get __errno FuncDesc.
|
||||||
|
MOVD CAA(R8), R9
|
||||||
|
MOVD EDCHPXV(R9), R9
|
||||||
|
ADD $(0x156*16), R9
|
||||||
|
LMG 0(R9), R5, R6
|
||||||
|
|
||||||
|
// Switch to saved LE stack.
|
||||||
|
MOVD SAVSTACK_ASYNC(R8), R9
|
||||||
|
MOVD 0(R9), R4
|
||||||
|
MOVD $0, 0(R9)
|
||||||
|
|
||||||
|
// Call __errno function.
|
||||||
|
LE_CALL
|
||||||
|
NOPH
|
||||||
|
|
||||||
|
// Switch back to Go stack.
|
||||||
|
XOR R0, R0 // Restore R0 to $0.
|
||||||
|
MOVD R4, 0(R9) // Save stack pointer.
|
||||||
|
RET
|
||||||
|
|
||||||
|
TEXT ·syscall_syscall(SB),NOSPLIT,$0-56
|
||||||
|
BL runtime·entersyscall(SB)
|
||||||
|
MOVD a1+8(FP), R1
|
||||||
|
MOVD a2+16(FP), R2
|
||||||
|
MOVD a3+24(FP), R3
|
||||||
|
|
||||||
|
// Get library control area (LCA).
|
||||||
|
MOVW PSALAA, R8
|
||||||
|
MOVD LCA64(R8), R8
|
||||||
|
|
||||||
|
// Get function.
|
||||||
|
MOVD CAA(R8), R9
|
||||||
|
MOVD EDCHPXV(R9), R9
|
||||||
|
MOVD trap+0(FP), R5
|
||||||
|
SLD $4, R5
|
||||||
|
ADD R5, R9
|
||||||
|
LMG 0(R9), R5, R6
|
||||||
|
|
||||||
|
// Restore LE stack.
|
||||||
|
MOVD SAVSTACK_ASYNC(R8), R9
|
||||||
|
MOVD 0(R9), R4
|
||||||
|
MOVD $0, 0(R9)
|
||||||
|
|
||||||
|
// Call function.
|
||||||
|
LE_CALL
|
||||||
|
NOPH
|
||||||
|
XOR R0, R0 // Restore R0 to $0.
|
||||||
|
MOVD R4, 0(R9) // Save stack pointer.
|
||||||
|
|
||||||
|
MOVD R3, r1+32(FP)
|
||||||
|
MOVD R0, r2+40(FP)
|
||||||
|
MOVD R0, err+48(FP)
|
||||||
|
MOVW R3, R4
|
||||||
|
CMP R4, $-1
|
||||||
|
BNE done
|
||||||
|
BL addrerrno<>(SB)
|
||||||
|
MOVWZ 0(R3), R3
|
||||||
|
MOVD R3, err+48(FP)
|
||||||
|
done:
|
||||||
|
BL runtime·exitsyscall(SB)
|
||||||
|
RET
|
||||||
|
|
||||||
|
TEXT ·syscall_rawsyscall(SB),NOSPLIT,$0-56
|
||||||
|
MOVD a1+8(FP), R1
|
||||||
|
MOVD a2+16(FP), R2
|
||||||
|
MOVD a3+24(FP), R3
|
||||||
|
|
||||||
|
// Get library control area (LCA).
|
||||||
|
MOVW PSALAA, R8
|
||||||
|
MOVD LCA64(R8), R8
|
||||||
|
|
||||||
|
// Get function.
|
||||||
|
MOVD CAA(R8), R9
|
||||||
|
MOVD EDCHPXV(R9), R9
|
||||||
|
MOVD trap+0(FP), R5
|
||||||
|
SLD $4, R5
|
||||||
|
ADD R5, R9
|
||||||
|
LMG 0(R9), R5, R6
|
||||||
|
|
||||||
|
// Restore LE stack.
|
||||||
|
MOVD SAVSTACK_ASYNC(R8), R9
|
||||||
|
MOVD 0(R9), R4
|
||||||
|
MOVD $0, 0(R9)
|
||||||
|
|
||||||
|
// Call function.
|
||||||
|
LE_CALL
|
||||||
|
NOPH
|
||||||
|
XOR R0, R0 // Restore R0 to $0.
|
||||||
|
MOVD R4, 0(R9) // Save stack pointer.
|
||||||
|
|
||||||
|
MOVD R3, r1+32(FP)
|
||||||
|
MOVD R0, r2+40(FP)
|
||||||
|
MOVD R0, err+48(FP)
|
||||||
|
MOVW R3, R4
|
||||||
|
CMP R4, $-1
|
||||||
|
BNE done
|
||||||
|
BL addrerrno<>(SB)
|
||||||
|
MOVWZ 0(R3), R3
|
||||||
|
MOVD R3, err+48(FP)
|
||||||
|
done:
|
||||||
|
RET
|
||||||
|
|
||||||
|
TEXT ·syscall_syscall6(SB),NOSPLIT,$0-80
|
||||||
|
BL runtime·entersyscall(SB)
|
||||||
|
MOVD a1+8(FP), R1
|
||||||
|
MOVD a2+16(FP), R2
|
||||||
|
MOVD a3+24(FP), R3
|
||||||
|
|
||||||
|
// Get library control area (LCA).
|
||||||
|
MOVW PSALAA, R8
|
||||||
|
MOVD LCA64(R8), R8
|
||||||
|
|
||||||
|
// Get function.
|
||||||
|
MOVD CAA(R8), R9
|
||||||
|
MOVD EDCHPXV(R9), R9
|
||||||
|
MOVD trap+0(FP), R5
|
||||||
|
SLD $4, R5
|
||||||
|
ADD R5, R9
|
||||||
|
LMG 0(R9), R5, R6
|
||||||
|
|
||||||
|
// Restore LE stack.
|
||||||
|
MOVD SAVSTACK_ASYNC(R8), R9
|
||||||
|
MOVD 0(R9), R4
|
||||||
|
MOVD $0, 0(R9)
|
||||||
|
|
||||||
|
// Fill in parameter list.
|
||||||
|
MOVD a4+32(FP), R12
|
||||||
|
MOVD R12, (2176+24)(R4)
|
||||||
|
MOVD a5+40(FP), R12
|
||||||
|
MOVD R12, (2176+32)(R4)
|
||||||
|
MOVD a6+48(FP), R12
|
||||||
|
MOVD R12, (2176+40)(R4)
|
||||||
|
|
||||||
|
// Call function.
|
||||||
|
LE_CALL
|
||||||
|
NOPH
|
||||||
|
XOR R0, R0 // Restore R0 to $0.
|
||||||
|
MOVD R4, 0(R9) // Save stack pointer.
|
||||||
|
|
||||||
|
MOVD R3, r1+56(FP)
|
||||||
|
MOVD R0, r2+64(FP)
|
||||||
|
MOVD R0, err+72(FP)
|
||||||
|
MOVW R3, R4
|
||||||
|
CMP R4, $-1
|
||||||
|
BNE done
|
||||||
|
BL addrerrno<>(SB)
|
||||||
|
MOVWZ 0(R3), R3
|
||||||
|
MOVD R3, err+72(FP)
|
||||||
|
done:
|
||||||
|
BL runtime·exitsyscall(SB)
|
||||||
|
RET
|
||||||
|
|
||||||
|
TEXT ·syscall_rawsyscall6(SB),NOSPLIT,$0-80
|
||||||
|
MOVD a1+8(FP), R1
|
||||||
|
MOVD a2+16(FP), R2
|
||||||
|
MOVD a3+24(FP), R3
|
||||||
|
|
||||||
|
// Get library control area (LCA).
|
||||||
|
MOVW PSALAA, R8
|
||||||
|
MOVD LCA64(R8), R8
|
||||||
|
|
||||||
|
// Get function.
|
||||||
|
MOVD CAA(R8), R9
|
||||||
|
MOVD EDCHPXV(R9), R9
|
||||||
|
MOVD trap+0(FP), R5
|
||||||
|
SLD $4, R5
|
||||||
|
ADD R5, R9
|
||||||
|
LMG 0(R9), R5, R6
|
||||||
|
|
||||||
|
// Restore LE stack.
|
||||||
|
MOVD SAVSTACK_ASYNC(R8), R9
|
||||||
|
MOVD 0(R9), R4
|
||||||
|
MOVD $0, 0(R9)
|
||||||
|
|
||||||
|
// Fill in parameter list.
|
||||||
|
MOVD a4+32(FP), R12
|
||||||
|
MOVD R12, (2176+24)(R4)
|
||||||
|
MOVD a5+40(FP), R12
|
||||||
|
MOVD R12, (2176+32)(R4)
|
||||||
|
MOVD a6+48(FP), R12
|
||||||
|
MOVD R12, (2176+40)(R4)
|
||||||
|
|
||||||
|
// Call function.
|
||||||
|
LE_CALL
|
||||||
|
NOPH
|
||||||
|
XOR R0, R0 // Restore R0 to $0.
|
||||||
|
MOVD R4, 0(R9) // Save stack pointer.
|
||||||
|
|
||||||
|
MOVD R3, r1+56(FP)
|
||||||
|
MOVD R0, r2+64(FP)
|
||||||
|
MOVD R0, err+72(FP)
|
||||||
|
MOVW R3, R4
|
||||||
|
CMP R4, $-1
|
||||||
|
BNE done
|
||||||
|
BL ·rrno<>(SB)
|
||||||
|
MOVWZ 0(R3), R3
|
||||||
|
MOVD R3, err+72(FP)
|
||||||
|
done:
|
||||||
|
RET
|
||||||
|
|
||||||
|
TEXT ·syscall_syscall9(SB),NOSPLIT,$0
|
||||||
|
BL runtime·entersyscall(SB)
|
||||||
|
MOVD a1+8(FP), R1
|
||||||
|
MOVD a2+16(FP), R2
|
||||||
|
MOVD a3+24(FP), R3
|
||||||
|
|
||||||
|
// Get library control area (LCA).
|
||||||
|
MOVW PSALAA, R8
|
||||||
|
MOVD LCA64(R8), R8
|
||||||
|
|
||||||
|
// Get function.
|
||||||
|
MOVD CAA(R8), R9
|
||||||
|
MOVD EDCHPXV(R9), R9
|
||||||
|
MOVD trap+0(FP), R5
|
||||||
|
SLD $4, R5
|
||||||
|
ADD R5, R9
|
||||||
|
LMG 0(R9), R5, R6
|
||||||
|
|
||||||
|
// Restore LE stack.
|
||||||
|
MOVD SAVSTACK_ASYNC(R8), R9
|
||||||
|
MOVD 0(R9), R4
|
||||||
|
MOVD $0, 0(R9)
|
||||||
|
|
||||||
|
// Fill in parameter list.
|
||||||
|
MOVD a4+32(FP), R12
|
||||||
|
MOVD R12, (2176+24)(R4)
|
||||||
|
MOVD a5+40(FP), R12
|
||||||
|
MOVD R12, (2176+32)(R4)
|
||||||
|
MOVD a6+48(FP), R12
|
||||||
|
MOVD R12, (2176+40)(R4)
|
||||||
|
MOVD a7+56(FP), R12
|
||||||
|
MOVD R12, (2176+48)(R4)
|
||||||
|
MOVD a8+64(FP), R12
|
||||||
|
MOVD R12, (2176+56)(R4)
|
||||||
|
MOVD a9+72(FP), R12
|
||||||
|
MOVD R12, (2176+64)(R4)
|
||||||
|
|
||||||
|
// Call function.
|
||||||
|
LE_CALL
|
||||||
|
NOPH
|
||||||
|
XOR R0, R0 // Restore R0 to $0.
|
||||||
|
MOVD R4, 0(R9) // Save stack pointer.
|
||||||
|
|
||||||
|
MOVD R3, r1+80(FP)
|
||||||
|
MOVD R0, r2+88(FP)
|
||||||
|
MOVD R0, err+96(FP)
|
||||||
|
MOVW R3, R4
|
||||||
|
CMP R4, $-1
|
||||||
|
BNE done
|
||||||
|
BL addrerrno<>(SB)
|
||||||
|
MOVWZ 0(R3), R3
|
||||||
|
MOVD R3, err+96(FP)
|
||||||
|
done:
|
||||||
|
BL runtime·exitsyscall(SB)
|
||||||
|
RET
|
||||||
|
|
||||||
|
TEXT ·syscall_rawsyscall9(SB),NOSPLIT,$0
|
||||||
|
MOVD a1+8(FP), R1
|
||||||
|
MOVD a2+16(FP), R2
|
||||||
|
MOVD a3+24(FP), R3
|
||||||
|
|
||||||
|
// Get library control area (LCA).
|
||||||
|
MOVW PSALAA, R8
|
||||||
|
MOVD LCA64(R8), R8
|
||||||
|
|
||||||
|
// Get function.
|
||||||
|
MOVD CAA(R8), R9
|
||||||
|
MOVD EDCHPXV(R9), R9
|
||||||
|
MOVD trap+0(FP), R5
|
||||||
|
SLD $4, R5
|
||||||
|
ADD R5, R9
|
||||||
|
LMG 0(R9), R5, R6
|
||||||
|
|
||||||
|
// Restore LE stack.
|
||||||
|
MOVD SAVSTACK_ASYNC(R8), R9
|
||||||
|
MOVD 0(R9), R4
|
||||||
|
MOVD $0, 0(R9)
|
||||||
|
|
||||||
|
// Fill in parameter list.
|
||||||
|
MOVD a4+32(FP), R12
|
||||||
|
MOVD R12, (2176+24)(R4)
|
||||||
|
MOVD a5+40(FP), R12
|
||||||
|
MOVD R12, (2176+32)(R4)
|
||||||
|
MOVD a6+48(FP), R12
|
||||||
|
MOVD R12, (2176+40)(R4)
|
||||||
|
MOVD a7+56(FP), R12
|
||||||
|
MOVD R12, (2176+48)(R4)
|
||||||
|
MOVD a8+64(FP), R12
|
||||||
|
MOVD R12, (2176+56)(R4)
|
||||||
|
MOVD a9+72(FP), R12
|
||||||
|
MOVD R12, (2176+64)(R4)
|
||||||
|
|
||||||
|
// Call function.
|
||||||
|
LE_CALL
|
||||||
|
NOPH
|
||||||
|
XOR R0, R0 // Restore R0 to $0.
|
||||||
|
MOVD R4, 0(R9) // Save stack pointer.
|
||||||
|
|
||||||
|
MOVD R3, r1+80(FP)
|
||||||
|
MOVD R0, r2+88(FP)
|
||||||
|
MOVD R0, err+96(FP)
|
||||||
|
MOVW R3, R4
|
||||||
|
CMP R4, $-1
|
||||||
|
BNE done
|
||||||
|
BL addrerrno<>(SB)
|
||||||
|
MOVWZ 0(R3), R3
|
||||||
|
MOVD R3, err+96(FP)
|
||||||
|
done:
|
||||||
|
RET
|
||||||
|
|
||||||
|
// func svcCall(fnptr unsafe.Pointer, argv *unsafe.Pointer, dsa *uint64)
|
||||||
|
TEXT ·svcCall(SB),NOSPLIT,$0
|
||||||
|
BL runtime·save_g(SB) // Save g and stack pointer
|
||||||
|
MOVW PSALAA, R8
|
||||||
|
MOVD LCA64(R8), R8
|
||||||
|
MOVD SAVSTACK_ASYNC(R8), R9
|
||||||
|
MOVD R15, 0(R9)
|
||||||
|
|
||||||
|
MOVD argv+8(FP), R1 // Move function arguments into registers
|
||||||
|
MOVD dsa+16(FP), g
|
||||||
|
MOVD fnptr+0(FP), R15
|
||||||
|
|
||||||
|
BYTE $0x0D // Branch to function
|
||||||
|
BYTE $0xEF
|
||||||
|
|
||||||
|
BL runtime·load_g(SB) // Restore g and stack pointer
|
||||||
|
MOVW PSALAA, R8
|
||||||
|
MOVD LCA64(R8), R8
|
||||||
|
MOVD SAVSTACK_ASYNC(R8), R9
|
||||||
|
MOVD 0(R9), R15
|
||||||
|
|
||||||
|
RET
|
||||||
|
|
||||||
|
// func svcLoad(name *byte) unsafe.Pointer
|
||||||
|
TEXT ·svcLoad(SB),NOSPLIT,$0
|
||||||
|
MOVD R15, R2 // Save go stack pointer
|
||||||
|
MOVD name+0(FP), R0 // Move SVC args into registers
|
||||||
|
MOVD $0x80000000, R1
|
||||||
|
MOVD $0, R15
|
||||||
|
BYTE $0x0A // SVC 08 LOAD
|
||||||
|
BYTE $0x08
|
||||||
|
MOVW R15, R3 // Save return code from SVC
|
||||||
|
MOVD R2, R15 // Restore go stack pointer
|
||||||
|
CMP R3, $0 // Check SVC return code
|
||||||
|
BNE error
|
||||||
|
|
||||||
|
MOVD $-2, R3 // Reset last bit of entry point to zero
|
||||||
|
AND R0, R3
|
||||||
|
MOVD R3, addr+8(FP) // Return entry point returned by SVC
|
||||||
|
CMP R0, R3 // Check if last bit of entry point was set
|
||||||
|
BNE done
|
||||||
|
|
||||||
|
MOVD R15, R2 // Save go stack pointer
|
||||||
|
MOVD $0, R15 // Move SVC args into registers (entry point still in r0 from SVC 08)
|
||||||
|
BYTE $0x0A // SVC 09 DELETE
|
||||||
|
BYTE $0x09
|
||||||
|
MOVD R2, R15 // Restore go stack pointer
|
||||||
|
|
||||||
|
error:
|
||||||
|
MOVD $0, addr+8(FP) // Return 0 on failure
|
||||||
|
done:
|
||||||
|
XOR R0, R0 // Reset r0 to 0
|
||||||
|
RET
|
||||||
|
|
||||||
|
// func svcUnload(name *byte, fnptr unsafe.Pointer) int64
|
||||||
|
TEXT ·svcUnload(SB),NOSPLIT,$0
|
||||||
|
MOVD R15, R2 // Save go stack pointer
|
||||||
|
MOVD name+0(FP), R0 // Move SVC args into registers
|
||||||
|
MOVD addr+8(FP), R15
|
||||||
|
BYTE $0x0A // SVC 09
|
||||||
|
BYTE $0x09
|
||||||
|
XOR R0, R0 // Reset r0 to 0
|
||||||
|
MOVD R15, R1 // Save SVC return code
|
||||||
|
MOVD R2, R15 // Restore go stack pointer
|
||||||
|
MOVD R1, rc+0(FP) // Return SVC return code
|
||||||
|
RET
|
||||||
|
|
||||||
|
// func gettid() uint64
|
||||||
|
TEXT ·gettid(SB), NOSPLIT, $0
|
||||||
|
// Get library control area (LCA).
|
||||||
|
MOVW PSALAA, R8
|
||||||
|
MOVD LCA64(R8), R8
|
||||||
|
|
||||||
|
// Get CEECAATHDID
|
||||||
|
MOVD CAA(R8), R9
|
||||||
|
MOVD 0x3D0(R9), R9
|
||||||
|
MOVD R9, ret+0(FP)
|
||||||
|
|
||||||
|
RET
|
||||||
1
src/cmd/vendor/golang.org/x/sys/unix/cap_freebsd.go
generated
vendored
1
src/cmd/vendor/golang.org/x/sys/unix/cap_freebsd.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// 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 freebsd
|
||||||
// +build freebsd
|
// +build freebsd
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
|
||||||
3
src/cmd/vendor/golang.org/x/sys/unix/constants.go
generated
vendored
3
src/cmd/vendor/golang.org/x/sys/unix/constants.go
generated
vendored
|
|
@ -2,7 +2,8 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
|
||||||
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
|
|
||||||
4
src/cmd/vendor/golang.org/x/sys/unix/dev_aix_ppc.go
generated
vendored
4
src/cmd/vendor/golang.org/x/sys/unix/dev_aix_ppc.go
generated
vendored
|
|
@ -2,8 +2,8 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build aix
|
//go:build aix && ppc
|
||||||
// +build ppc
|
// +build aix,ppc
|
||||||
|
|
||||||
// Functions to access/create device major and minor numbers matching the
|
// Functions to access/create device major and minor numbers matching the
|
||||||
// encoding used by AIX.
|
// encoding used by AIX.
|
||||||
|
|
|
||||||
4
src/cmd/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go
generated
vendored
4
src/cmd/vendor/golang.org/x/sys/unix/dev_aix_ppc64.go
generated
vendored
|
|
@ -2,8 +2,8 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build aix
|
//go:build aix && ppc64
|
||||||
// +build ppc64
|
// +build aix,ppc64
|
||||||
|
|
||||||
// Functions to access/create device major and minor numbers matching the
|
// Functions to access/create device major and minor numbers matching the
|
||||||
// encoding used AIX.
|
// encoding used AIX.
|
||||||
|
|
|
||||||
29
src/cmd/vendor/golang.org/x/sys/unix/dev_zos.go
generated
vendored
Normal file
29
src/cmd/vendor/golang.org/x/sys/unix/dev_zos.go
generated
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
// Copyright 2020 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build zos && s390x
|
||||||
|
// +build zos,s390x
|
||||||
|
|
||||||
|
// Functions to access/create device major and minor numbers matching the
|
||||||
|
// encoding used by z/OS.
|
||||||
|
//
|
||||||
|
// The information below is extracted and adapted from <sys/stat.h> macros.
|
||||||
|
|
||||||
|
package unix
|
||||||
|
|
||||||
|
// Major returns the major component of a z/OS device number.
|
||||||
|
func Major(dev uint64) uint32 {
|
||||||
|
return uint32((dev >> 16) & 0x0000FFFF)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Minor returns the minor component of a z/OS device number.
|
||||||
|
func Minor(dev uint64) uint32 {
|
||||||
|
return uint32(dev & 0x0000FFFF)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mkdev returns a z/OS device number generated from the given major and minor
|
||||||
|
// components.
|
||||||
|
func Mkdev(major, minor uint32) uint64 {
|
||||||
|
return (uint64(major) << 16) | uint64(minor)
|
||||||
|
}
|
||||||
1
src/cmd/vendor/golang.org/x/sys/unix/dirent.go
generated
vendored
1
src/cmd/vendor/golang.org/x/sys/unix/dirent.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// 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 || linux || netbsd || openbsd || solaris
|
||||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
|
||||||
1
src/cmd/vendor/golang.org/x/sys/unix/endian_big.go
generated
vendored
1
src/cmd/vendor/golang.org/x/sys/unix/endian_big.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// 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 armbe || arm64be || m68k || mips || mips64 || mips64p32 || ppc || ppc64 || s390 || s390x || shbe || sparc || sparc64
|
||||||
// +build armbe arm64be m68k mips mips64 mips64p32 ppc ppc64 s390 s390x shbe sparc sparc64
|
// +build armbe arm64be m68k mips mips64 mips64p32 ppc ppc64 s390 s390x shbe sparc sparc64
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
|
||||||
1
src/cmd/vendor/golang.org/x/sys/unix/endian_little.go
generated
vendored
1
src/cmd/vendor/golang.org/x/sys/unix/endian_little.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
//
|
//
|
||||||
|
//go:build 386 || amd64 || amd64p32 || alpha || arm || arm64 || mipsle || mips64le || mips64p32le || nios2 || ppc64le || riscv || riscv64 || sh
|
||||||
// +build 386 amd64 amd64p32 alpha arm arm64 mipsle mips64le mips64p32le nios2 ppc64le riscv riscv64 sh
|
// +build 386 amd64 amd64p32 alpha arm arm64 mipsle mips64le mips64p32le nios2 ppc64le riscv riscv64 sh
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
|
||||||
3
src/cmd/vendor/golang.org/x/sys/unix/env_unix.go
generated
vendored
3
src/cmd/vendor/golang.org/x/sys/unix/env_unix.go
generated
vendored
|
|
@ -2,7 +2,8 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
|
||||||
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
|
||||||
|
|
||||||
// Unix environment variables.
|
// Unix environment variables.
|
||||||
|
|
||||||
|
|
|
||||||
221
src/cmd/vendor/golang.org/x/sys/unix/epoll_zos.go
generated
vendored
Normal file
221
src/cmd/vendor/golang.org/x/sys/unix/epoll_zos.go
generated
vendored
Normal file
|
|
@ -0,0 +1,221 @@
|
||||||
|
// Copyright 2020 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build zos && s390x
|
||||||
|
// +build zos,s390x
|
||||||
|
|
||||||
|
package unix
|
||||||
|
|
||||||
|
import (
|
||||||
|
"sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
// This file simulates epoll on z/OS using poll.
|
||||||
|
|
||||||
|
// Analogous to epoll_event on Linux.
|
||||||
|
// TODO(neeilan): Pad is because the Linux kernel expects a 96-bit struct. We never pass this to the kernel; remove?
|
||||||
|
type EpollEvent struct {
|
||||||
|
Events uint32
|
||||||
|
Fd int32
|
||||||
|
Pad int32
|
||||||
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
EPOLLERR = 0x8
|
||||||
|
EPOLLHUP = 0x10
|
||||||
|
EPOLLIN = 0x1
|
||||||
|
EPOLLMSG = 0x400
|
||||||
|
EPOLLOUT = 0x4
|
||||||
|
EPOLLPRI = 0x2
|
||||||
|
EPOLLRDBAND = 0x80
|
||||||
|
EPOLLRDNORM = 0x40
|
||||||
|
EPOLLWRBAND = 0x200
|
||||||
|
EPOLLWRNORM = 0x100
|
||||||
|
EPOLL_CTL_ADD = 0x1
|
||||||
|
EPOLL_CTL_DEL = 0x2
|
||||||
|
EPOLL_CTL_MOD = 0x3
|
||||||
|
// The following constants are part of the epoll API, but represent
|
||||||
|
// currently unsupported functionality on z/OS.
|
||||||
|
// EPOLL_CLOEXEC = 0x80000
|
||||||
|
// EPOLLET = 0x80000000
|
||||||
|
// EPOLLONESHOT = 0x40000000
|
||||||
|
// EPOLLRDHUP = 0x2000 // Typically used with edge-triggered notis
|
||||||
|
// EPOLLEXCLUSIVE = 0x10000000 // Exclusive wake-up mode
|
||||||
|
// EPOLLWAKEUP = 0x20000000 // Relies on Linux's BLOCK_SUSPEND capability
|
||||||
|
)
|
||||||
|
|
||||||
|
// TODO(neeilan): We can eliminate these epToPoll / pToEpoll calls by using identical mask values for POLL/EPOLL
|
||||||
|
// constants where possible The lower 16 bits of epoll events (uint32) can fit any system poll event (int16).
|
||||||
|
|
||||||
|
// epToPollEvt converts epoll event field to poll equivalent.
|
||||||
|
// In epoll, Events is a 32-bit field, while poll uses 16 bits.
|
||||||
|
func epToPollEvt(events uint32) int16 {
|
||||||
|
var ep2p = map[uint32]int16{
|
||||||
|
EPOLLIN: POLLIN,
|
||||||
|
EPOLLOUT: POLLOUT,
|
||||||
|
EPOLLHUP: POLLHUP,
|
||||||
|
EPOLLPRI: POLLPRI,
|
||||||
|
EPOLLERR: POLLERR,
|
||||||
|
}
|
||||||
|
|
||||||
|
var pollEvts int16 = 0
|
||||||
|
for epEvt, pEvt := range ep2p {
|
||||||
|
if (events & epEvt) != 0 {
|
||||||
|
pollEvts |= pEvt
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return pollEvts
|
||||||
|
}
|
||||||
|
|
||||||
|
// pToEpollEvt converts 16 bit poll event bitfields to 32-bit epoll event fields.
|
||||||
|
func pToEpollEvt(revents int16) uint32 {
|
||||||
|
var p2ep = map[int16]uint32{
|
||||||
|
POLLIN: EPOLLIN,
|
||||||
|
POLLOUT: EPOLLOUT,
|
||||||
|
POLLHUP: EPOLLHUP,
|
||||||
|
POLLPRI: EPOLLPRI,
|
||||||
|
POLLERR: EPOLLERR,
|
||||||
|
}
|
||||||
|
|
||||||
|
var epollEvts uint32 = 0
|
||||||
|
for pEvt, epEvt := range p2ep {
|
||||||
|
if (revents & pEvt) != 0 {
|
||||||
|
epollEvts |= epEvt
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return epollEvts
|
||||||
|
}
|
||||||
|
|
||||||
|
// Per-process epoll implementation.
|
||||||
|
type epollImpl struct {
|
||||||
|
mu sync.Mutex
|
||||||
|
epfd2ep map[int]*eventPoll
|
||||||
|
nextEpfd int
|
||||||
|
}
|
||||||
|
|
||||||
|
// eventPoll holds a set of file descriptors being watched by the process. A process can have multiple epoll instances.
|
||||||
|
// On Linux, this is an in-kernel data structure accessed through a fd.
|
||||||
|
type eventPoll struct {
|
||||||
|
mu sync.Mutex
|
||||||
|
fds map[int]*EpollEvent
|
||||||
|
}
|
||||||
|
|
||||||
|
// epoll impl for this process.
|
||||||
|
var impl epollImpl = epollImpl{
|
||||||
|
epfd2ep: make(map[int]*eventPoll),
|
||||||
|
nextEpfd: 0,
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *epollImpl) epollcreate(size int) (epfd int, err error) {
|
||||||
|
e.mu.Lock()
|
||||||
|
defer e.mu.Unlock()
|
||||||
|
epfd = e.nextEpfd
|
||||||
|
e.nextEpfd++
|
||||||
|
|
||||||
|
e.epfd2ep[epfd] = &eventPoll{
|
||||||
|
fds: make(map[int]*EpollEvent),
|
||||||
|
}
|
||||||
|
return epfd, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *epollImpl) epollcreate1(flag int) (fd int, err error) {
|
||||||
|
return e.epollcreate(4)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *epollImpl) epollctl(epfd int, op int, fd int, event *EpollEvent) (err error) {
|
||||||
|
e.mu.Lock()
|
||||||
|
defer e.mu.Unlock()
|
||||||
|
|
||||||
|
ep, ok := e.epfd2ep[epfd]
|
||||||
|
if !ok {
|
||||||
|
|
||||||
|
return EBADF
|
||||||
|
}
|
||||||
|
|
||||||
|
switch op {
|
||||||
|
case EPOLL_CTL_ADD:
|
||||||
|
// TODO(neeilan): When we make epfds and fds disjoint, detect epoll
|
||||||
|
// loops here (instances watching each other) and return ELOOP.
|
||||||
|
if _, ok := ep.fds[fd]; ok {
|
||||||
|
return EEXIST
|
||||||
|
}
|
||||||
|
ep.fds[fd] = event
|
||||||
|
case EPOLL_CTL_MOD:
|
||||||
|
if _, ok := ep.fds[fd]; !ok {
|
||||||
|
return ENOENT
|
||||||
|
}
|
||||||
|
ep.fds[fd] = event
|
||||||
|
case EPOLL_CTL_DEL:
|
||||||
|
if _, ok := ep.fds[fd]; !ok {
|
||||||
|
return ENOENT
|
||||||
|
}
|
||||||
|
delete(ep.fds, fd)
|
||||||
|
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Must be called while holding ep.mu
|
||||||
|
func (ep *eventPoll) getFds() []int {
|
||||||
|
fds := make([]int, len(ep.fds))
|
||||||
|
for fd := range ep.fds {
|
||||||
|
fds = append(fds, fd)
|
||||||
|
}
|
||||||
|
return fds
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e *epollImpl) epollwait(epfd int, events []EpollEvent, msec int) (n int, err error) {
|
||||||
|
e.mu.Lock() // in [rare] case of concurrent epollcreate + epollwait
|
||||||
|
ep, ok := e.epfd2ep[epfd]
|
||||||
|
|
||||||
|
if !ok {
|
||||||
|
e.mu.Unlock()
|
||||||
|
return 0, EBADF
|
||||||
|
}
|
||||||
|
|
||||||
|
pollfds := make([]PollFd, 4)
|
||||||
|
for fd, epollevt := range ep.fds {
|
||||||
|
pollfds = append(pollfds, PollFd{Fd: int32(fd), Events: epToPollEvt(epollevt.Events)})
|
||||||
|
}
|
||||||
|
e.mu.Unlock()
|
||||||
|
|
||||||
|
n, err = Poll(pollfds, msec)
|
||||||
|
if err != nil {
|
||||||
|
return n, err
|
||||||
|
}
|
||||||
|
|
||||||
|
i := 0
|
||||||
|
for _, pFd := range pollfds {
|
||||||
|
if pFd.Revents != 0 {
|
||||||
|
events[i] = EpollEvent{Fd: pFd.Fd, Events: pToEpollEvt(pFd.Revents)}
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
|
||||||
|
if i == n {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return n, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func EpollCreate(size int) (fd int, err error) {
|
||||||
|
return impl.epollcreate(size)
|
||||||
|
}
|
||||||
|
|
||||||
|
func EpollCreate1(flag int) (fd int, err error) {
|
||||||
|
return impl.epollcreate1(flag)
|
||||||
|
}
|
||||||
|
|
||||||
|
func EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error) {
|
||||||
|
return impl.epollctl(epfd, op, fd, event)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Because EpollWait mutates events, the caller is expected to coordinate
|
||||||
|
// concurrent access if calling with the same epfd from multiple goroutines.
|
||||||
|
func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) {
|
||||||
|
return impl.epollwait(epfd, events, msec)
|
||||||
|
}
|
||||||
1
src/cmd/vendor/golang.org/x/sys/unix/fcntl.go
generated
vendored
1
src/cmd/vendor/golang.org/x/sys/unix/fcntl.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// 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 dragonfly || freebsd || linux || netbsd || openbsd
|
||||||
// +build dragonfly freebsd linux netbsd openbsd
|
// +build dragonfly freebsd linux netbsd openbsd
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
|
||||||
1
src/cmd/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go
generated
vendored
1
src/cmd/vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build (linux && 386) || (linux && arm) || (linux && mips) || (linux && mipsle)
|
||||||
// +build linux,386 linux,arm linux,mips linux,mipsle
|
// +build linux,386 linux,arm linux,mips linux,mipsle
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
|
||||||
1
src/cmd/vendor/golang.org/x/sys/unix/fdset.go
generated
vendored
1
src/cmd/vendor/golang.org/x/sys/unix/fdset.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// 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 || linux || netbsd || openbsd || solaris
|
||||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
|
||||||
164
src/cmd/vendor/golang.org/x/sys/unix/fstatfs_zos.go
generated
vendored
Normal file
164
src/cmd/vendor/golang.org/x/sys/unix/fstatfs_zos.go
generated
vendored
Normal file
|
|
@ -0,0 +1,164 @@
|
||||||
|
// Copyright 2020 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build zos && s390x
|
||||||
|
// +build zos,s390x
|
||||||
|
|
||||||
|
package unix
|
||||||
|
|
||||||
|
import (
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
// This file simulates fstatfs on z/OS using fstatvfs and w_getmntent.
|
||||||
|
|
||||||
|
func Fstatfs(fd int, stat *Statfs_t) (err error) {
|
||||||
|
var stat_v Statvfs_t
|
||||||
|
err = Fstatvfs(fd, &stat_v)
|
||||||
|
if err == nil {
|
||||||
|
// populate stat
|
||||||
|
stat.Type = 0
|
||||||
|
stat.Bsize = stat_v.Bsize
|
||||||
|
stat.Blocks = stat_v.Blocks
|
||||||
|
stat.Bfree = stat_v.Bfree
|
||||||
|
stat.Bavail = stat_v.Bavail
|
||||||
|
stat.Files = stat_v.Files
|
||||||
|
stat.Ffree = stat_v.Ffree
|
||||||
|
stat.Fsid = stat_v.Fsid
|
||||||
|
stat.Namelen = stat_v.Namemax
|
||||||
|
stat.Frsize = stat_v.Frsize
|
||||||
|
stat.Flags = stat_v.Flag
|
||||||
|
for passn := 0; passn < 5; passn++ {
|
||||||
|
switch passn {
|
||||||
|
case 0:
|
||||||
|
err = tryGetmntent64(stat)
|
||||||
|
break
|
||||||
|
case 1:
|
||||||
|
err = tryGetmntent128(stat)
|
||||||
|
break
|
||||||
|
case 2:
|
||||||
|
err = tryGetmntent256(stat)
|
||||||
|
break
|
||||||
|
case 3:
|
||||||
|
err = tryGetmntent512(stat)
|
||||||
|
break
|
||||||
|
case 4:
|
||||||
|
err = tryGetmntent1024(stat)
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
//proceed to return if: err is nil (found), err is nonnil but not ERANGE (another error occurred)
|
||||||
|
if err == nil || err != nil && err != ERANGE {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func tryGetmntent64(stat *Statfs_t) (err error) {
|
||||||
|
var mnt_ent_buffer struct {
|
||||||
|
header W_Mnth
|
||||||
|
filesys_info [64]W_Mntent
|
||||||
|
}
|
||||||
|
var buffer_size int = int(unsafe.Sizeof(mnt_ent_buffer))
|
||||||
|
fs_count, err := W_Getmntent((*byte)(unsafe.Pointer(&mnt_ent_buffer)), buffer_size)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = ERANGE //return ERANGE if no match is found in this batch
|
||||||
|
for i := 0; i < fs_count; i++ {
|
||||||
|
if stat.Fsid == uint64(mnt_ent_buffer.filesys_info[i].Dev) {
|
||||||
|
stat.Type = uint32(mnt_ent_buffer.filesys_info[i].Fstname[0])
|
||||||
|
err = nil
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func tryGetmntent128(stat *Statfs_t) (err error) {
|
||||||
|
var mnt_ent_buffer struct {
|
||||||
|
header W_Mnth
|
||||||
|
filesys_info [128]W_Mntent
|
||||||
|
}
|
||||||
|
var buffer_size int = int(unsafe.Sizeof(mnt_ent_buffer))
|
||||||
|
fs_count, err := W_Getmntent((*byte)(unsafe.Pointer(&mnt_ent_buffer)), buffer_size)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = ERANGE //return ERANGE if no match is found in this batch
|
||||||
|
for i := 0; i < fs_count; i++ {
|
||||||
|
if stat.Fsid == uint64(mnt_ent_buffer.filesys_info[i].Dev) {
|
||||||
|
stat.Type = uint32(mnt_ent_buffer.filesys_info[i].Fstname[0])
|
||||||
|
err = nil
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func tryGetmntent256(stat *Statfs_t) (err error) {
|
||||||
|
var mnt_ent_buffer struct {
|
||||||
|
header W_Mnth
|
||||||
|
filesys_info [256]W_Mntent
|
||||||
|
}
|
||||||
|
var buffer_size int = int(unsafe.Sizeof(mnt_ent_buffer))
|
||||||
|
fs_count, err := W_Getmntent((*byte)(unsafe.Pointer(&mnt_ent_buffer)), buffer_size)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = ERANGE //return ERANGE if no match is found in this batch
|
||||||
|
for i := 0; i < fs_count; i++ {
|
||||||
|
if stat.Fsid == uint64(mnt_ent_buffer.filesys_info[i].Dev) {
|
||||||
|
stat.Type = uint32(mnt_ent_buffer.filesys_info[i].Fstname[0])
|
||||||
|
err = nil
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func tryGetmntent512(stat *Statfs_t) (err error) {
|
||||||
|
var mnt_ent_buffer struct {
|
||||||
|
header W_Mnth
|
||||||
|
filesys_info [512]W_Mntent
|
||||||
|
}
|
||||||
|
var buffer_size int = int(unsafe.Sizeof(mnt_ent_buffer))
|
||||||
|
fs_count, err := W_Getmntent((*byte)(unsafe.Pointer(&mnt_ent_buffer)), buffer_size)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = ERANGE //return ERANGE if no match is found in this batch
|
||||||
|
for i := 0; i < fs_count; i++ {
|
||||||
|
if stat.Fsid == uint64(mnt_ent_buffer.filesys_info[i].Dev) {
|
||||||
|
stat.Type = uint32(mnt_ent_buffer.filesys_info[i].Fstname[0])
|
||||||
|
err = nil
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func tryGetmntent1024(stat *Statfs_t) (err error) {
|
||||||
|
var mnt_ent_buffer struct {
|
||||||
|
header W_Mnth
|
||||||
|
filesys_info [1024]W_Mntent
|
||||||
|
}
|
||||||
|
var buffer_size int = int(unsafe.Sizeof(mnt_ent_buffer))
|
||||||
|
fs_count, err := W_Getmntent((*byte)(unsafe.Pointer(&mnt_ent_buffer)), buffer_size)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = ERANGE //return ERANGE if no match is found in this batch
|
||||||
|
for i := 0; i < fs_count; i++ {
|
||||||
|
if stat.Fsid == uint64(mnt_ent_buffer.filesys_info[i].Dev) {
|
||||||
|
stat.Type = uint32(mnt_ent_buffer.filesys_info[i].Fstname[0])
|
||||||
|
err = nil
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
4
src/cmd/vendor/golang.org/x/sys/unix/gccgo.go
generated
vendored
4
src/cmd/vendor/golang.org/x/sys/unix/gccgo.go
generated
vendored
|
|
@ -2,8 +2,8 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build gccgo
|
//go:build gccgo && !aix
|
||||||
// +build !aix
|
// +build gccgo,!aix
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
|
|
||||||
1
src/cmd/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go
generated
vendored
1
src/cmd/vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// 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 gccgo && linux && amd64
|
||||||
// +build gccgo,linux,amd64
|
// +build gccgo,linux,amd64
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
|
||||||
1
src/cmd/vendor/golang.org/x/sys/unix/ioctl.go
generated
vendored
1
src/cmd/vendor/golang.org/x/sys/unix/ioctl.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// 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 || linux || netbsd || openbsd || solaris
|
||||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
|
||||||
74
src/cmd/vendor/golang.org/x/sys/unix/ioctl_zos.go
generated
vendored
Normal file
74
src/cmd/vendor/golang.org/x/sys/unix/ioctl_zos.go
generated
vendored
Normal file
|
|
@ -0,0 +1,74 @@
|
||||||
|
// Copyright 2020 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build zos && s390x
|
||||||
|
// +build zos,s390x
|
||||||
|
|
||||||
|
package unix
|
||||||
|
|
||||||
|
import (
|
||||||
|
"runtime"
|
||||||
|
"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 uint, value int) error {
|
||||||
|
return ioctl(fd, req, uintptr(value))
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 uint, value *Winsize) error {
|
||||||
|
// TODO: if we get the chance, remove the req parameter and
|
||||||
|
// hardcode TIOCSWINSZ.
|
||||||
|
err := ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
||||||
|
runtime.KeepAlive(value)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlSetTermios performs an ioctl on fd with a *Termios.
|
||||||
|
//
|
||||||
|
// The req value is expected to be TCSETS, TCSETSW, or TCSETSF
|
||||||
|
func IoctlSetTermios(fd int, req uint, value *Termios) error {
|
||||||
|
if (req != TCSETS) && (req != TCSETSW) && (req != TCSETSF) {
|
||||||
|
return ENOSYS
|
||||||
|
}
|
||||||
|
err := Tcsetattr(fd, int(req), value)
|
||||||
|
runtime.KeepAlive(value)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 uint) (int, error) {
|
||||||
|
var value int
|
||||||
|
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
|
||||||
|
return value, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func IoctlGetWinsize(fd int, req uint) (*Winsize, error) {
|
||||||
|
var value Winsize
|
||||||
|
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
|
||||||
|
return &value, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlGetTermios performs an ioctl on fd with a *Termios.
|
||||||
|
//
|
||||||
|
// The req value is expected to be TCGETS
|
||||||
|
func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||||
|
var value Termios
|
||||||
|
if req != TCGETS {
|
||||||
|
return &value, ENOSYS
|
||||||
|
}
|
||||||
|
err := Tcgetattr(fd, &value)
|
||||||
|
return &value, err
|
||||||
|
}
|
||||||
22
src/cmd/vendor/golang.org/x/sys/unix/mkerrors.sh
generated
vendored
22
src/cmd/vendor/golang.org/x/sys/unix/mkerrors.sh
generated
vendored
|
|
@ -115,6 +115,7 @@ includes_FreeBSD='
|
||||||
#include <sys/sched.h>
|
#include <sys/sched.h>
|
||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
#include <sys/un.h>
|
||||||
#include <sys/sockio.h>
|
#include <sys/sockio.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
|
|
@ -214,6 +215,7 @@ struct ltchars {
|
||||||
#include <linux/fsverity.h>
|
#include <linux/fsverity.h>
|
||||||
#include <linux/genetlink.h>
|
#include <linux/genetlink.h>
|
||||||
#include <linux/hdreg.h>
|
#include <linux/hdreg.h>
|
||||||
|
#include <linux/hidraw.h>
|
||||||
#include <linux/icmpv6.h>
|
#include <linux/icmpv6.h>
|
||||||
#include <linux/if.h>
|
#include <linux/if.h>
|
||||||
#include <linux/if_addr.h>
|
#include <linux/if_addr.h>
|
||||||
|
|
@ -224,6 +226,7 @@ struct ltchars {
|
||||||
#include <linux/if_tun.h>
|
#include <linux/if_tun.h>
|
||||||
#include <linux/if_packet.h>
|
#include <linux/if_packet.h>
|
||||||
#include <linux/if_xdp.h>
|
#include <linux/if_xdp.h>
|
||||||
|
#include <linux/input.h>
|
||||||
#include <linux/kexec.h>
|
#include <linux/kexec.h>
|
||||||
#include <linux/keyctl.h>
|
#include <linux/keyctl.h>
|
||||||
#include <linux/loop.h>
|
#include <linux/loop.h>
|
||||||
|
|
@ -300,6 +303,17 @@ struct ltchars {
|
||||||
// Including linux/l2tp.h here causes conflicts between linux/in.h
|
// Including linux/l2tp.h here causes conflicts between linux/in.h
|
||||||
// and netinet/in.h included via net/route.h above.
|
// and netinet/in.h included via net/route.h above.
|
||||||
#define IPPROTO_L2TP 115
|
#define IPPROTO_L2TP 115
|
||||||
|
|
||||||
|
// Copied from linux/hid.h.
|
||||||
|
// Keep in sync with the size of the referenced fields.
|
||||||
|
#define _HIDIOCGRAWNAME_LEN 128 // sizeof_field(struct hid_device, name)
|
||||||
|
#define _HIDIOCGRAWPHYS_LEN 64 // sizeof_field(struct hid_device, phys)
|
||||||
|
#define _HIDIOCGRAWUNIQ_LEN 64 // sizeof_field(struct hid_device, uniq)
|
||||||
|
|
||||||
|
#define _HIDIOCGRAWNAME HIDIOCGRAWNAME(_HIDIOCGRAWNAME_LEN)
|
||||||
|
#define _HIDIOCGRAWPHYS HIDIOCGRAWPHYS(_HIDIOCGRAWPHYS_LEN)
|
||||||
|
#define _HIDIOCGRAWUNIQ HIDIOCGRAWUNIQ(_HIDIOCGRAWUNIQ_LEN)
|
||||||
|
|
||||||
'
|
'
|
||||||
|
|
||||||
includes_NetBSD='
|
includes_NetBSD='
|
||||||
|
|
@ -447,6 +461,8 @@ ccflags="$@"
|
||||||
$2 !~ /^EPROC_/ &&
|
$2 !~ /^EPROC_/ &&
|
||||||
$2 !~ /^EQUIV_/ &&
|
$2 !~ /^EQUIV_/ &&
|
||||||
$2 !~ /^EXPR_/ &&
|
$2 !~ /^EXPR_/ &&
|
||||||
|
$2 !~ /^EVIOC/ &&
|
||||||
|
$2 !~ /^EV_/ &&
|
||||||
$2 ~ /^E[A-Z0-9_]+$/ ||
|
$2 ~ /^E[A-Z0-9_]+$/ ||
|
||||||
$2 ~ /^B[0-9_]+$/ ||
|
$2 ~ /^B[0-9_]+$/ ||
|
||||||
$2 ~ /^(OLD|NEW)DEV$/ ||
|
$2 ~ /^(OLD|NEW)DEV$/ ||
|
||||||
|
|
@ -481,7 +497,7 @@ 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|ICMP6|TCP|MCAST|EVFILT|NOTE|EV|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL)_/ ||
|
$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|ICMP6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL)_/ ||
|
||||||
$2 ~ /^TP_STATUS_/ ||
|
$2 ~ /^TP_STATUS_/ ||
|
||||||
$2 ~ /^FALLOC_/ ||
|
$2 ~ /^FALLOC_/ ||
|
||||||
$2 == "ICMPV6_FILTER" ||
|
$2 == "ICMPV6_FILTER" ||
|
||||||
|
|
@ -571,6 +587,9 @@ ccflags="$@"
|
||||||
$2 ~ /^W[A-Z0-9]+$/ ||
|
$2 ~ /^W[A-Z0-9]+$/ ||
|
||||||
$2 ~/^PPPIOC/ ||
|
$2 ~/^PPPIOC/ ||
|
||||||
$2 ~ /^FAN_|FANOTIFY_/ ||
|
$2 ~ /^FAN_|FANOTIFY_/ ||
|
||||||
|
$2 == "HID_MAX_DESCRIPTOR_SIZE" ||
|
||||||
|
$2 ~ /^_?HIDIOC/ ||
|
||||||
|
$2 ~ /^BUS_(USB|HIL|BLUETOOTH|VIRTUAL)$/ ||
|
||||||
$2 ~ /^BLK[A-Z]*(GET$|SET$|BUF$|PART$|SIZE)/ {printf("\t%s = C.%s\n", $2, $2)}
|
$2 ~ /^BLK[A-Z]*(GET$|SET$|BUF$|PART$|SIZE)/ {printf("\t%s = C.%s\n", $2, $2)}
|
||||||
$2 ~ /^__WCOREFLAG$/ {next}
|
$2 ~ /^__WCOREFLAG$/ {next}
|
||||||
$2 ~ /^__W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", substr($2,3), $2)}
|
$2 ~ /^__W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", substr($2,3), $2)}
|
||||||
|
|
@ -608,6 +627,7 @@ echo '#include <signal.h>' | $CC -x c - -E -dM $ccflags |
|
||||||
echo '// mkerrors.sh' "$@"
|
echo '// mkerrors.sh' "$@"
|
||||||
echo '// Code generated by the command above; see README.md. DO NOT EDIT.'
|
echo '// Code generated by the command above; see README.md. DO NOT EDIT.'
|
||||||
echo
|
echo
|
||||||
|
echo "//go:build ${GOARCH} && ${GOOS}"
|
||||||
echo "// +build ${GOARCH},${GOOS}"
|
echo "// +build ${GOARCH},${GOOS}"
|
||||||
echo
|
echo
|
||||||
go tool cgo -godefs -- "$@" _const.go >_error.out
|
go tool cgo -godefs -- "$@" _const.go >_error.out
|
||||||
|
|
|
||||||
1
src/cmd/vendor/golang.org/x/sys/unix/pagesize_unix.go
generated
vendored
1
src/cmd/vendor/golang.org/x/sys/unix/pagesize_unix.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// 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 || linux || netbsd || openbsd || solaris
|
||||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||||
|
|
||||||
// For Unix, get the pagesize from the runtime.
|
// For Unix, get the pagesize from the runtime.
|
||||||
|
|
|
||||||
1
src/cmd/vendor/golang.org/x/sys/unix/ptrace_darwin.go
generated
vendored
1
src/cmd/vendor/golang.org/x/sys/unix/ptrace_darwin.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// 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 darwin && !ios
|
||||||
// +build darwin,!ios
|
// +build darwin,!ios
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
|
||||||
1
src/cmd/vendor/golang.org/x/sys/unix/ptrace_ios.go
generated
vendored
1
src/cmd/vendor/golang.org/x/sys/unix/ptrace_ios.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// 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 ios
|
||||||
// +build ios
|
// +build ios
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
|
||||||
1
src/cmd/vendor/golang.org/x/sys/unix/race.go
generated
vendored
1
src/cmd/vendor/golang.org/x/sys/unix/race.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// 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 (darwin && race) || (linux && race) || (freebsd && race)
|
||||||
// +build darwin,race linux,race freebsd,race
|
// +build darwin,race linux,race freebsd,race
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
|
||||||
3
src/cmd/vendor/golang.org/x/sys/unix/race0.go
generated
vendored
3
src/cmd/vendor/golang.org/x/sys/unix/race0.go
generated
vendored
|
|
@ -2,7 +2,8 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build aix darwin,!race linux,!race freebsd,!race netbsd openbsd solaris dragonfly
|
//go:build aix || (darwin && !race) || (linux && !race) || (freebsd && !race) || netbsd || openbsd || solaris || dragonfly || zos
|
||||||
|
// +build aix darwin,!race linux,!race freebsd,!race netbsd openbsd solaris dragonfly zos
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
|
|
||||||
1
src/cmd/vendor/golang.org/x/sys/unix/readdirent_getdents.go
generated
vendored
1
src/cmd/vendor/golang.org/x/sys/unix/readdirent_getdents.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// 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 || dragonfly || freebsd || linux || netbsd || openbsd
|
||||||
// +build aix dragonfly freebsd linux netbsd openbsd
|
// +build aix dragonfly freebsd linux netbsd openbsd
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
|
||||||
1
src/cmd/vendor/golang.org/x/sys/unix/readdirent_getdirentries.go
generated
vendored
1
src/cmd/vendor/golang.org/x/sys/unix/readdirent_getdirentries.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// 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 darwin
|
||||||
// +build darwin
|
// +build darwin
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
|
||||||
3
src/cmd/vendor/golang.org/x/sys/unix/sockcmsg_unix.go
generated
vendored
3
src/cmd/vendor/golang.org/x/sys/unix/sockcmsg_unix.go
generated
vendored
|
|
@ -2,7 +2,8 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
|
||||||
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
|
||||||
|
|
||||||
// Socket control messages
|
// Socket control messages
|
||||||
|
|
||||||
|
|
|
||||||
7
src/cmd/vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go
generated
vendored
7
src/cmd/vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go
generated
vendored
|
|
@ -2,7 +2,8 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build aix darwin freebsd linux netbsd openbsd solaris
|
//go:build aix || darwin || freebsd || linux || netbsd || openbsd || solaris || zos
|
||||||
|
// +build aix darwin freebsd linux netbsd openbsd solaris zos
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
|
@ -36,6 +37,10 @@ func cmsgAlignOf(salen int) int {
|
||||||
if runtime.GOOS == "netbsd" && runtime.GOARCH == "arm64" {
|
if runtime.GOOS == "netbsd" && runtime.GOARCH == "arm64" {
|
||||||
salign = 16
|
salign = 16
|
||||||
}
|
}
|
||||||
|
case "zos":
|
||||||
|
// z/OS socket macros use [32-bit] sizeof(int) alignment,
|
||||||
|
// not pointer width.
|
||||||
|
salign = SizeofInt
|
||||||
}
|
}
|
||||||
|
|
||||||
return (salen + salign - 1) & ^(salign - 1)
|
return (salen + salign - 1) & ^(salign - 1)
|
||||||
|
|
|
||||||
1
src/cmd/vendor/golang.org/x/sys/unix/str.go
generated
vendored
1
src/cmd/vendor/golang.org/x/sys/unix/str.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// 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 || linux || netbsd || openbsd || solaris
|
||||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
|
||||||
3
src/cmd/vendor/golang.org/x/sys/unix/syscall.go
generated
vendored
3
src/cmd/vendor/golang.org/x/sys/unix/syscall.go
generated
vendored
|
|
@ -2,7 +2,8 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris || zos
|
||||||
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris zos
|
||||||
|
|
||||||
// Package unix contains an interface to the low-level operating system
|
// Package unix contains an interface to the low-level operating system
|
||||||
// primitives. OS details vary depending on the underlying system, and
|
// primitives. OS details vary depending on the underlying system, and
|
||||||
|
|
|
||||||
1
src/cmd/vendor/golang.org/x/sys/unix/syscall_aix.go
generated
vendored
1
src/cmd/vendor/golang.org/x/sys/unix/syscall_aix.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// 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
|
||||||
// +build aix
|
// +build aix
|
||||||
|
|
||||||
// Aix system calls.
|
// Aix system calls.
|
||||||
|
|
|
||||||
4
src/cmd/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go
generated
vendored
4
src/cmd/vendor/golang.org/x/sys/unix/syscall_aix_ppc.go
generated
vendored
|
|
@ -2,8 +2,8 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build aix
|
//go:build aix && ppc
|
||||||
// +build ppc
|
// +build aix,ppc
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
|
|
||||||
4
src/cmd/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go
generated
vendored
4
src/cmd/vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go
generated
vendored
|
|
@ -2,8 +2,8 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build aix
|
//go:build aix && ppc64
|
||||||
// +build ppc64
|
// +build aix,ppc64
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
|
|
||||||
1
src/cmd/vendor/golang.org/x/sys/unix/syscall_bsd.go
generated
vendored
1
src/cmd/vendor/golang.org/x/sys/unix/syscall_bsd.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// 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 darwin || dragonfly || freebsd || netbsd || openbsd
|
||||||
// +build darwin dragonfly freebsd netbsd openbsd
|
// +build darwin dragonfly freebsd netbsd openbsd
|
||||||
|
|
||||||
// BSD system call wrappers shared by *BSD based systems
|
// BSD system call wrappers shared by *BSD based systems
|
||||||
|
|
|
||||||
1
src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin.1_12.go
generated
vendored
1
src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin.1_12.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// 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 darwin && go1.12 && !go1.13
|
||||||
// +build darwin,go1.12,!go1.13
|
// +build darwin,go1.12,!go1.13
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
|
||||||
1
src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin.1_13.go
generated
vendored
1
src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin.1_13.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// 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 darwin && go1.13
|
||||||
// +build darwin,go1.13
|
// +build darwin,go1.13
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
|
||||||
2
src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin.go
generated
vendored
2
src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin.go
generated
vendored
|
|
@ -382,7 +382,7 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
|
||||||
// The usual level and opt are SOL_LOCAL and LOCAL_PEERCRED, respectively.
|
// The usual level and opt are SOL_LOCAL and LOCAL_PEERCRED, respectively.
|
||||||
func GetsockoptXucred(fd, level, opt int) (*Xucred, error) {
|
func GetsockoptXucred(fd, level, opt int) (*Xucred, error) {
|
||||||
x := new(Xucred)
|
x := new(Xucred)
|
||||||
vallen := _Socklen(unsafe.Sizeof(Xucred{}))
|
vallen := _Socklen(SizeofXucred)
|
||||||
err := getsockopt(fd, level, opt, unsafe.Pointer(x), &vallen)
|
err := getsockopt(fd, level, opt, unsafe.Pointer(x), &vallen)
|
||||||
return x, err
|
return x, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
1
src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin_386.go
generated
vendored
1
src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin_386.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build 386 && darwin
|
||||||
// +build 386,darwin
|
// +build 386,darwin
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
|
||||||
1
src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go
generated
vendored
1
src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// 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 amd64 && darwin
|
||||||
// +build amd64,darwin
|
// +build amd64,darwin
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
|
||||||
1
src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go
generated
vendored
1
src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// 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 arm64 && darwin
|
||||||
// +build arm64,darwin
|
// +build arm64,darwin
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
|
||||||
1
src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go
generated
vendored
1
src/cmd/vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// 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 darwin && go1.12
|
||||||
// +build darwin,go1.12
|
// +build darwin,go1.12
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
|
||||||
7
src/cmd/vendor/golang.org/x/sys/unix/syscall_dragonfly.go
generated
vendored
7
src/cmd/vendor/golang.org/x/sys/unix/syscall_dragonfly.go
generated
vendored
|
|
@ -105,13 +105,16 @@ func Pipe(p []int) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//sysnb pipe2(flags int) (r int, w int, err error)
|
//sysnb pipe2(p *[2]_C_int, flags int) (r int, w int, err error)
|
||||||
|
|
||||||
func Pipe2(p []int, flags int) (err error) {
|
func Pipe2(p []int, flags int) (err error) {
|
||||||
if len(p) != 2 {
|
if len(p) != 2 {
|
||||||
return EINVAL
|
return EINVAL
|
||||||
}
|
}
|
||||||
p[0], p[1], err = pipe2(flags)
|
var pp [2]_C_int
|
||||||
|
// pipe2 on dragonfly takes an fds array as an argument, but still
|
||||||
|
// returns the file descriptors.
|
||||||
|
p[0], p[1], err = pipe2(&pp, flags)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
1
src/cmd/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go
generated
vendored
1
src/cmd/vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// 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 amd64 && dragonfly
|
||||||
// +build amd64,dragonfly
|
// +build amd64,dragonfly
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
|
||||||
9
src/cmd/vendor/golang.org/x/sys/unix/syscall_freebsd.go
generated
vendored
9
src/cmd/vendor/golang.org/x/sys/unix/syscall_freebsd.go
generated
vendored
|
|
@ -126,6 +126,15 @@ func SetsockoptIPMreqn(fd, level, opt int, mreq *IPMreqn) (err error) {
|
||||||
return setsockopt(fd, level, opt, unsafe.Pointer(mreq), unsafe.Sizeof(*mreq))
|
return setsockopt(fd, level, opt, unsafe.Pointer(mreq), unsafe.Sizeof(*mreq))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetsockoptXucred is a getsockopt wrapper that returns an Xucred struct.
|
||||||
|
// The usual level and opt are SOL_LOCAL and LOCAL_PEERCRED, respectively.
|
||||||
|
func GetsockoptXucred(fd, level, opt int) (*Xucred, error) {
|
||||||
|
x := new(Xucred)
|
||||||
|
vallen := _Socklen(SizeofXucred)
|
||||||
|
err := getsockopt(fd, level, opt, unsafe.Pointer(x), &vallen)
|
||||||
|
return x, err
|
||||||
|
}
|
||||||
|
|
||||||
func Accept4(fd, flags int) (nfd int, sa Sockaddr, err error) {
|
func Accept4(fd, flags int) (nfd int, sa Sockaddr, err error) {
|
||||||
var rsa RawSockaddrAny
|
var rsa RawSockaddrAny
|
||||||
var len _Socklen = SizeofSockaddrAny
|
var len _Socklen = SizeofSockaddrAny
|
||||||
|
|
|
||||||
1
src/cmd/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go
generated
vendored
1
src/cmd/vendor/golang.org/x/sys/unix/syscall_freebsd_386.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build 386 && freebsd
|
||||||
// +build 386,freebsd
|
// +build 386,freebsd
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
|
||||||
1
src/cmd/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go
generated
vendored
1
src/cmd/vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// 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 amd64 && freebsd
|
||||||
// +build amd64,freebsd
|
// +build amd64,freebsd
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
|
||||||
1
src/cmd/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go
generated
vendored
1
src/cmd/vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// 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 arm && freebsd
|
||||||
// +build arm,freebsd
|
// +build arm,freebsd
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
|
||||||
1
src/cmd/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go
generated
vendored
1
src/cmd/vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// 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 arm64 && freebsd
|
||||||
// +build arm64,freebsd
|
// +build arm64,freebsd
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
|
||||||
1
src/cmd/vendor/golang.org/x/sys/unix/syscall_illumos.go
generated
vendored
1
src/cmd/vendor/golang.org/x/sys/unix/syscall_illumos.go
generated
vendored
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
// illumos system calls not present on Solaris.
|
// illumos system calls not present on Solaris.
|
||||||
|
|
||||||
|
//go:build amd64 && illumos
|
||||||
// +build amd64,illumos
|
// +build amd64,illumos
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
|
||||||
89
src/cmd/vendor/golang.org/x/sys/unix/syscall_linux.go
generated
vendored
89
src/cmd/vendor/golang.org/x/sys/unix/syscall_linux.go
generated
vendored
|
|
@ -137,12 +137,61 @@ func IoctlFileClone(destFd, srcFd int) error {
|
||||||
return ioctl(destFd, FICLONE, uintptr(srcFd))
|
return ioctl(destFd, FICLONE, uintptr(srcFd))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type FileDedupeRange struct {
|
||||||
|
Src_offset uint64
|
||||||
|
Src_length uint64
|
||||||
|
Reserved1 uint16
|
||||||
|
Reserved2 uint32
|
||||||
|
Info []FileDedupeRangeInfo
|
||||||
|
}
|
||||||
|
|
||||||
|
type FileDedupeRangeInfo struct {
|
||||||
|
Dest_fd int64
|
||||||
|
Dest_offset uint64
|
||||||
|
Bytes_deduped uint64
|
||||||
|
Status int32
|
||||||
|
Reserved uint32
|
||||||
|
}
|
||||||
|
|
||||||
// IoctlFileDedupeRange performs an FIDEDUPERANGE ioctl operation to share the
|
// IoctlFileDedupeRange performs an FIDEDUPERANGE ioctl operation to share the
|
||||||
// range of data conveyed in value with the file associated with the file
|
// range of data conveyed in value from the file associated with the file
|
||||||
// descriptor destFd. See the ioctl_fideduperange(2) man page for details.
|
// descriptor srcFd to the value.Info destinations. See the
|
||||||
func IoctlFileDedupeRange(destFd int, value *FileDedupeRange) error {
|
// ioctl_fideduperange(2) man page for details.
|
||||||
err := ioctl(destFd, FIDEDUPERANGE, uintptr(unsafe.Pointer(value)))
|
func IoctlFileDedupeRange(srcFd int, value *FileDedupeRange) error {
|
||||||
runtime.KeepAlive(value)
|
buf := make([]byte, SizeofRawFileDedupeRange+
|
||||||
|
len(value.Info)*SizeofRawFileDedupeRangeInfo)
|
||||||
|
rawrange := (*RawFileDedupeRange)(unsafe.Pointer(&buf[0]))
|
||||||
|
rawrange.Src_offset = value.Src_offset
|
||||||
|
rawrange.Src_length = value.Src_length
|
||||||
|
rawrange.Dest_count = uint16(len(value.Info))
|
||||||
|
rawrange.Reserved1 = value.Reserved1
|
||||||
|
rawrange.Reserved2 = value.Reserved2
|
||||||
|
|
||||||
|
for i := range value.Info {
|
||||||
|
rawinfo := (*RawFileDedupeRangeInfo)(unsafe.Pointer(
|
||||||
|
uintptr(unsafe.Pointer(&buf[0])) + uintptr(SizeofRawFileDedupeRange) +
|
||||||
|
uintptr(i*SizeofRawFileDedupeRangeInfo)))
|
||||||
|
rawinfo.Dest_fd = value.Info[i].Dest_fd
|
||||||
|
rawinfo.Dest_offset = value.Info[i].Dest_offset
|
||||||
|
rawinfo.Bytes_deduped = value.Info[i].Bytes_deduped
|
||||||
|
rawinfo.Status = value.Info[i].Status
|
||||||
|
rawinfo.Reserved = value.Info[i].Reserved
|
||||||
|
}
|
||||||
|
|
||||||
|
err := ioctl(srcFd, FIDEDUPERANGE, uintptr(unsafe.Pointer(&buf[0])))
|
||||||
|
|
||||||
|
// Output
|
||||||
|
for i := range value.Info {
|
||||||
|
rawinfo := (*RawFileDedupeRangeInfo)(unsafe.Pointer(
|
||||||
|
uintptr(unsafe.Pointer(&buf[0])) + uintptr(SizeofRawFileDedupeRange) +
|
||||||
|
uintptr(i*SizeofRawFileDedupeRangeInfo)))
|
||||||
|
value.Info[i].Dest_fd = rawinfo.Dest_fd
|
||||||
|
value.Info[i].Dest_offset = rawinfo.Dest_offset
|
||||||
|
value.Info[i].Bytes_deduped = rawinfo.Bytes_deduped
|
||||||
|
value.Info[i].Status = rawinfo.Status
|
||||||
|
value.Info[i].Reserved = rawinfo.Reserved
|
||||||
|
}
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -153,6 +202,36 @@ func IoctlWatchdogKeepalive(fd int) error {
|
||||||
return ioctl(fd, WDIOC_KEEPALIVE, 0)
|
return ioctl(fd, WDIOC_KEEPALIVE, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func IoctlHIDGetDesc(fd int, value *HIDRawReportDescriptor) error {
|
||||||
|
err := ioctl(fd, HIDIOCGRDESC, uintptr(unsafe.Pointer(value)))
|
||||||
|
runtime.KeepAlive(value)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
func IoctlHIDGetRawInfo(fd int) (*HIDRawDevInfo, error) {
|
||||||
|
var value HIDRawDevInfo
|
||||||
|
err := ioctl(fd, HIDIOCGRAWINFO, uintptr(unsafe.Pointer(&value)))
|
||||||
|
return &value, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func IoctlHIDGetRawName(fd int) (string, error) {
|
||||||
|
var value [_HIDIOCGRAWNAME_LEN]byte
|
||||||
|
err := ioctl(fd, _HIDIOCGRAWNAME, uintptr(unsafe.Pointer(&value[0])))
|
||||||
|
return ByteSliceToString(value[:]), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func IoctlHIDGetRawPhys(fd int) (string, error) {
|
||||||
|
var value [_HIDIOCGRAWPHYS_LEN]byte
|
||||||
|
err := ioctl(fd, _HIDIOCGRAWPHYS, uintptr(unsafe.Pointer(&value[0])))
|
||||||
|
return ByteSliceToString(value[:]), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func IoctlHIDGetRawUniq(fd int) (string, error) {
|
||||||
|
var value [_HIDIOCGRAWUNIQ_LEN]byte
|
||||||
|
err := ioctl(fd, _HIDIOCGRAWUNIQ, uintptr(unsafe.Pointer(&value[0])))
|
||||||
|
return ByteSliceToString(value[:]), err
|
||||||
|
}
|
||||||
|
|
||||||
//sys Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error)
|
//sys Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error)
|
||||||
|
|
||||||
func Link(oldpath string, newpath string) (err error) {
|
func Link(oldpath string, newpath string) (err error) {
|
||||||
|
|
|
||||||
1
src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_386.go
generated
vendored
1
src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_386.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build 386 && linux
|
||||||
// +build 386,linux
|
// +build 386,linux
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
|
||||||
1
src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go
generated
vendored
1
src/cmd/vendor/golang.org/x/sys/unix/syscall_linux_amd64.go
generated
vendored
|
|
@ -2,6 +2,7 @@
|
||||||
// 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 amd64 && linux
|
||||||
// +build amd64,linux
|
// +build amd64,linux
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue