mirror of
https://github.com/vbatts/go-mtree.git
synced 2024-11-25 17:45:39 +00:00
go: update deps, and vendored sources
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
1adae81a54
commit
47b137db03
327 changed files with 32563 additions and 20551 deletions
7
go.mod
7
go.mod
|
@ -4,8 +4,7 @@ go 1.13
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/davecgh/go-spew v1.1.1
|
github.com/davecgh/go-spew v1.1.1
|
||||||
github.com/fatih/color v1.12.0 // indirect
|
github.com/sirupsen/logrus v1.8.1
|
||||||
github.com/sirupsen/logrus v1.7.0
|
golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29
|
||||||
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad
|
golang.org/x/sys v0.0.0-20220403205710-6acee93ad0eb
|
||||||
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c
|
|
||||||
)
|
)
|
||||||
|
|
32
go.sum
32
go.sum
|
@ -1,26 +1,20 @@
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/fatih/color v1.12.0 h1:mRhaKNwANqRgUBGKmnI5ZxEk7QXmjQeCcuYFMX2bfcc=
|
|
||||||
github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
|
|
||||||
github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8=
|
|
||||||
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
|
||||||
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
|
|
||||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM=
|
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
|
||||||
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||||
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
|
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29 h1:tkVvjkPTB7pnW3jnid7kNyAMPVWllTNOf/qKDze4p9o=
|
||||||
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad h1:DN0cp81fZ3njFcrLCytUHRSUkqBjfTo4Tx9RJTWs0EY=
|
golang.org/x/crypto v0.0.0-20220331220935-ae2d96664a29/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||||
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
|
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c h1:VwygUrnw9jn88c4u8GD3rZQbqrP/tgas88tPUbBxQrk=
|
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20220403205710-6acee93ad0eb h1:PVGECzEo9Y3uOidtkHGdd347NjLtITfJFO9BxFpmRoo=
|
||||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
golang.org/x/sys v0.0.0-20220403205710-6acee93ad0eb/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
|
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
|
14
vendor/github.com/sirupsen/logrus/.travis.yml
generated
vendored
14
vendor/github.com/sirupsen/logrus/.travis.yml
generated
vendored
|
@ -4,14 +4,12 @@ git:
|
||||||
depth: 1
|
depth: 1
|
||||||
env:
|
env:
|
||||||
- GO111MODULE=on
|
- GO111MODULE=on
|
||||||
go: [1.13.x, 1.14.x]
|
go: 1.15.x
|
||||||
os: [linux, osx]
|
os: linux
|
||||||
install:
|
install:
|
||||||
- ./travis/install.sh
|
- ./travis/install.sh
|
||||||
script:
|
script:
|
||||||
- ./travis/cross_build.sh
|
- cd ci
|
||||||
- ./travis/lint.sh
|
- go run mage.go -v -w ../ crossBuild
|
||||||
- export GOMAXPROCS=4
|
- go run mage.go -v -w ../ lint
|
||||||
- export GORACE=halt_on_error=1
|
- go run mage.go -v -w ../ test
|
||||||
- go test -race -v ./...
|
|
||||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then go test -race -v -tags appengine ./... ; fi
|
|
||||||
|
|
36
vendor/github.com/sirupsen/logrus/CHANGELOG.md
generated
vendored
36
vendor/github.com/sirupsen/logrus/CHANGELOG.md
generated
vendored
|
@ -1,3 +1,39 @@
|
||||||
|
# 1.8.1
|
||||||
|
Code quality:
|
||||||
|
* move magefile in its own subdir/submodule to remove magefile dependency on logrus consumer
|
||||||
|
* improve timestamp format documentation
|
||||||
|
|
||||||
|
Fixes:
|
||||||
|
* fix race condition on logger hooks
|
||||||
|
|
||||||
|
|
||||||
|
# 1.8.0
|
||||||
|
|
||||||
|
Correct versioning number replacing v1.7.1.
|
||||||
|
|
||||||
|
# 1.7.1
|
||||||
|
|
||||||
|
Beware this release has introduced a new public API and its semver is therefore incorrect.
|
||||||
|
|
||||||
|
Code quality:
|
||||||
|
* use go 1.15 in travis
|
||||||
|
* use magefile as task runner
|
||||||
|
|
||||||
|
Fixes:
|
||||||
|
* small fixes about new go 1.13 error formatting system
|
||||||
|
* Fix for long time race condiction with mutating data hooks
|
||||||
|
|
||||||
|
Features:
|
||||||
|
* build support for zos
|
||||||
|
|
||||||
|
# 1.7.0
|
||||||
|
Fixes:
|
||||||
|
* the dependency toward a windows terminal library has been removed
|
||||||
|
|
||||||
|
Features:
|
||||||
|
* a new buffer pool management API has been added
|
||||||
|
* a set of `<LogLevel>Fn()` functions have been added
|
||||||
|
|
||||||
# 1.6.0
|
# 1.6.0
|
||||||
Fixes:
|
Fixes:
|
||||||
* end of line cleanup
|
* end of line cleanup
|
||||||
|
|
2
vendor/github.com/sirupsen/logrus/README.md
generated
vendored
2
vendor/github.com/sirupsen/logrus/README.md
generated
vendored
|
@ -402,7 +402,7 @@ func (f *MyJSONFormatter) Format(entry *Entry) ([]byte, error) {
|
||||||
// source of the official loggers.
|
// source of the official loggers.
|
||||||
serialized, err := json.Marshal(entry.Data)
|
serialized, err := json.Marshal(entry.Data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("Failed to marshal fields to JSON, %v", err)
|
return nil, fmt.Errorf("Failed to marshal fields to JSON, %w", err)
|
||||||
}
|
}
|
||||||
return append(serialized, '\n'), nil
|
return append(serialized, '\n'), nil
|
||||||
}
|
}
|
||||||
|
|
75
vendor/github.com/sirupsen/logrus/entry.go
generated
vendored
75
vendor/github.com/sirupsen/logrus/entry.go
generated
vendored
|
@ -78,6 +78,14 @@ func NewEntry(logger *Logger) *Entry {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (entry *Entry) Dup() *Entry {
|
||||||
|
data := make(Fields, len(entry.Data))
|
||||||
|
for k, v := range entry.Data {
|
||||||
|
data[k] = v
|
||||||
|
}
|
||||||
|
return &Entry{Logger: entry.Logger, Data: data, Time: entry.Time, Context: entry.Context, err: entry.err}
|
||||||
|
}
|
||||||
|
|
||||||
// Returns the bytes representation of this entry from the formatter.
|
// Returns the bytes representation of this entry from the formatter.
|
||||||
func (entry *Entry) Bytes() ([]byte, error) {
|
func (entry *Entry) Bytes() ([]byte, error) {
|
||||||
return entry.Logger.Formatter.Format(entry)
|
return entry.Logger.Formatter.Format(entry)
|
||||||
|
@ -123,11 +131,9 @@ func (entry *Entry) WithFields(fields Fields) *Entry {
|
||||||
for k, v := range fields {
|
for k, v := range fields {
|
||||||
isErrField := false
|
isErrField := false
|
||||||
if t := reflect.TypeOf(v); t != nil {
|
if t := reflect.TypeOf(v); t != nil {
|
||||||
switch t.Kind() {
|
switch {
|
||||||
case reflect.Func:
|
case t.Kind() == reflect.Func, t.Kind() == reflect.Ptr && t.Elem().Kind() == reflect.Func:
|
||||||
isErrField = true
|
isErrField = true
|
||||||
case reflect.Ptr:
|
|
||||||
isErrField = t.Elem().Kind() == reflect.Func
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if isErrField {
|
if isErrField {
|
||||||
|
@ -212,68 +218,72 @@ func (entry Entry) HasCaller() (has bool) {
|
||||||
entry.Caller != nil
|
entry.Caller != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function is not declared with a pointer value because otherwise
|
func (entry *Entry) log(level Level, msg string) {
|
||||||
// race conditions will occur when using multiple goroutines
|
|
||||||
func (entry Entry) log(level Level, msg string) {
|
|
||||||
var buffer *bytes.Buffer
|
var buffer *bytes.Buffer
|
||||||
|
|
||||||
// Default to now, but allow users to override if they want.
|
newEntry := entry.Dup()
|
||||||
//
|
|
||||||
// We don't have to worry about polluting future calls to Entry#log()
|
if newEntry.Time.IsZero() {
|
||||||
// with this assignment because this function is declared with a
|
newEntry.Time = time.Now()
|
||||||
// non-pointer receiver.
|
|
||||||
if entry.Time.IsZero() {
|
|
||||||
entry.Time = time.Now()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
entry.Level = level
|
newEntry.Level = level
|
||||||
entry.Message = msg
|
newEntry.Message = msg
|
||||||
entry.Logger.mu.Lock()
|
|
||||||
if entry.Logger.ReportCaller {
|
|
||||||
entry.Caller = getCaller()
|
|
||||||
}
|
|
||||||
entry.Logger.mu.Unlock()
|
|
||||||
|
|
||||||
entry.fireHooks()
|
newEntry.Logger.mu.Lock()
|
||||||
|
reportCaller := newEntry.Logger.ReportCaller
|
||||||
|
newEntry.Logger.mu.Unlock()
|
||||||
|
|
||||||
|
if reportCaller {
|
||||||
|
newEntry.Caller = getCaller()
|
||||||
|
}
|
||||||
|
|
||||||
|
newEntry.fireHooks()
|
||||||
|
|
||||||
buffer = getBuffer()
|
buffer = getBuffer()
|
||||||
defer func() {
|
defer func() {
|
||||||
entry.Buffer = nil
|
newEntry.Buffer = nil
|
||||||
putBuffer(buffer)
|
putBuffer(buffer)
|
||||||
}()
|
}()
|
||||||
buffer.Reset()
|
buffer.Reset()
|
||||||
entry.Buffer = buffer
|
newEntry.Buffer = buffer
|
||||||
|
|
||||||
entry.write()
|
newEntry.write()
|
||||||
|
|
||||||
entry.Buffer = nil
|
newEntry.Buffer = nil
|
||||||
|
|
||||||
// To avoid Entry#log() returning a value that only would make sense for
|
// To avoid Entry#log() returning a value that only would make sense for
|
||||||
// panic() to use in Entry#Panic(), we avoid the allocation by checking
|
// panic() to use in Entry#Panic(), we avoid the allocation by checking
|
||||||
// directly here.
|
// directly here.
|
||||||
if level <= PanicLevel {
|
if level <= PanicLevel {
|
||||||
panic(&entry)
|
panic(newEntry)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (entry *Entry) fireHooks() {
|
func (entry *Entry) fireHooks() {
|
||||||
|
var tmpHooks LevelHooks
|
||||||
entry.Logger.mu.Lock()
|
entry.Logger.mu.Lock()
|
||||||
defer entry.Logger.mu.Unlock()
|
tmpHooks = make(LevelHooks, len(entry.Logger.Hooks))
|
||||||
err := entry.Logger.Hooks.Fire(entry.Level, entry)
|
for k, v := range entry.Logger.Hooks {
|
||||||
|
tmpHooks[k] = v
|
||||||
|
}
|
||||||
|
entry.Logger.mu.Unlock()
|
||||||
|
|
||||||
|
err := tmpHooks.Fire(entry.Level, entry)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "Failed to fire hook: %v\n", err)
|
fmt.Fprintf(os.Stderr, "Failed to fire hook: %v\n", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (entry *Entry) write() {
|
func (entry *Entry) write() {
|
||||||
entry.Logger.mu.Lock()
|
|
||||||
defer entry.Logger.mu.Unlock()
|
|
||||||
serialized, err := entry.Logger.Formatter.Format(entry)
|
serialized, err := entry.Logger.Formatter.Format(entry)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "Failed to obtain reader, %v\n", err)
|
fmt.Fprintf(os.Stderr, "Failed to obtain reader, %v\n", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if _, err = entry.Logger.Out.Write(serialized); err != nil {
|
entry.Logger.mu.Lock()
|
||||||
|
defer entry.Logger.mu.Unlock()
|
||||||
|
if _, err := entry.Logger.Out.Write(serialized); err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "Failed to write to log, %v\n", err)
|
fmt.Fprintf(os.Stderr, "Failed to write to log, %v\n", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -319,7 +329,6 @@ func (entry *Entry) Fatal(args ...interface{}) {
|
||||||
|
|
||||||
func (entry *Entry) Panic(args ...interface{}) {
|
func (entry *Entry) Panic(args ...interface{}) {
|
||||||
entry.Log(PanicLevel, args...)
|
entry.Log(PanicLevel, args...)
|
||||||
panic(fmt.Sprint(args...))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Entry Printf family functions
|
// Entry Printf family functions
|
||||||
|
|
2
vendor/github.com/sirupsen/logrus/go.sum
generated
vendored
2
vendor/github.com/sirupsen/logrus/go.sum
generated
vendored
|
@ -4,7 +4,5 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
|
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc=
|
|
||||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4=
|
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4=
|
||||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
|
5
vendor/github.com/sirupsen/logrus/json_formatter.go
generated
vendored
5
vendor/github.com/sirupsen/logrus/json_formatter.go
generated
vendored
|
@ -23,6 +23,9 @@ func (f FieldMap) resolve(key fieldKey) string {
|
||||||
// JSONFormatter formats logs into parsable json
|
// JSONFormatter formats logs into parsable json
|
||||||
type JSONFormatter struct {
|
type JSONFormatter struct {
|
||||||
// TimestampFormat sets the format used for marshaling timestamps.
|
// TimestampFormat sets the format used for marshaling timestamps.
|
||||||
|
// The format to use is the same than for time.Format or time.Parse from the standard
|
||||||
|
// library.
|
||||||
|
// The standard Library already provides a set of predefined format.
|
||||||
TimestampFormat string
|
TimestampFormat string
|
||||||
|
|
||||||
// DisableTimestamp allows disabling automatic timestamps in output
|
// DisableTimestamp allows disabling automatic timestamps in output
|
||||||
|
@ -118,7 +121,7 @@ func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) {
|
||||||
encoder.SetIndent("", " ")
|
encoder.SetIndent("", " ")
|
||||||
}
|
}
|
||||||
if err := encoder.Encode(data); err != nil {
|
if err := encoder.Encode(data); err != nil {
|
||||||
return nil, fmt.Errorf("failed to marshal fields to JSON, %v", err)
|
return nil, fmt.Errorf("failed to marshal fields to JSON, %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return b.Bytes(), nil
|
return b.Bytes(), nil
|
||||||
|
|
2
vendor/github.com/sirupsen/logrus/logger.go
generated
vendored
2
vendor/github.com/sirupsen/logrus/logger.go
generated
vendored
|
@ -12,7 +12,7 @@ import (
|
||||||
// LogFunction For big messages, it can be more efficient to pass a function
|
// LogFunction For big messages, it can be more efficient to pass a function
|
||||||
// and only call it if the log level is actually enables rather than
|
// and only call it if the log level is actually enables rather than
|
||||||
// generating the log message and then checking if the level is enabled
|
// generating the log message and then checking if the level is enabled
|
||||||
type LogFunction func()[]interface{}
|
type LogFunction func() []interface{}
|
||||||
|
|
||||||
type Logger struct {
|
type Logger struct {
|
||||||
// The logs are `io.Copy`'d to this in a mutex. It's common to set this to a
|
// The logs are `io.Copy`'d to this in a mutex. It's common to set this to a
|
||||||
|
|
2
vendor/github.com/sirupsen/logrus/terminal_check_unix.go
generated
vendored
2
vendor/github.com/sirupsen/logrus/terminal_check_unix.go
generated
vendored
|
@ -1,4 +1,4 @@
|
||||||
// +build linux aix
|
// +build linux aix zos
|
||||||
// +build !js
|
// +build !js
|
||||||
|
|
||||||
package logrus
|
package logrus
|
||||||
|
|
7
vendor/github.com/sirupsen/logrus/text_formatter.go
generated
vendored
7
vendor/github.com/sirupsen/logrus/text_formatter.go
generated
vendored
|
@ -53,7 +53,10 @@ type TextFormatter struct {
|
||||||
// the time passed since beginning of execution.
|
// the time passed since beginning of execution.
|
||||||
FullTimestamp bool
|
FullTimestamp bool
|
||||||
|
|
||||||
// TimestampFormat to use for display when a full timestamp is printed
|
// TimestampFormat to use for display when a full timestamp is printed.
|
||||||
|
// The format to use is the same than for time.Format or time.Parse from the standard
|
||||||
|
// library.
|
||||||
|
// The standard Library already provides a set of predefined format.
|
||||||
TimestampFormat string
|
TimestampFormat string
|
||||||
|
|
||||||
// The fields are sorted by default for a consistent output. For applications
|
// The fields are sorted by default for a consistent output. For applications
|
||||||
|
@ -235,6 +238,8 @@ func (f *TextFormatter) printColored(b *bytes.Buffer, entry *Entry, keys []strin
|
||||||
levelColor = yellow
|
levelColor = yellow
|
||||||
case ErrorLevel, FatalLevel, PanicLevel:
|
case ErrorLevel, FatalLevel, PanicLevel:
|
||||||
levelColor = red
|
levelColor = red
|
||||||
|
case InfoLevel:
|
||||||
|
levelColor = blue
|
||||||
default:
|
default:
|
||||||
levelColor = blue
|
levelColor = blue
|
||||||
}
|
}
|
||||||
|
|
8
vendor/golang.org/x/sys/unix/README.md
generated
vendored
8
vendor/golang.org/x/sys/unix/README.md
generated
vendored
|
@ -76,7 +76,7 @@ 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
|
ForkExec wrapper. Unlike the first two, it does not call into the scheduler to
|
||||||
let it know that a system call is running.
|
let it know that a system call is running.
|
||||||
|
|
||||||
When porting Go to an new architecture/OS, this file must be implemented for
|
When porting Go to a new architecture/OS, this file must be implemented for
|
||||||
each GOOS/GOARCH pair.
|
each GOOS/GOARCH pair.
|
||||||
|
|
||||||
### mksysnum
|
### mksysnum
|
||||||
|
@ -107,7 +107,7 @@ prototype can be exported (capitalized) or not.
|
||||||
Adding a new syscall often just requires adding a new `//sys` function prototype
|
Adding a new syscall often just requires adding a new `//sys` function prototype
|
||||||
with the desired arguments and a capitalized name so it is exported. However, if
|
with the desired arguments and a capitalized name so it is exported. However, if
|
||||||
you want the interface to the syscall to be different, often one will make an
|
you want the interface to the syscall to be different, often one will make an
|
||||||
unexported `//sys` prototype, an then write a custom wrapper in
|
unexported `//sys` prototype, and then write a custom wrapper in
|
||||||
`syscall_${GOOS}.go`.
|
`syscall_${GOOS}.go`.
|
||||||
|
|
||||||
### types files
|
### types files
|
||||||
|
@ -137,7 +137,7 @@ some `#if/#elif` macros in your include statements.
|
||||||
|
|
||||||
This script is used to generate the system's various constants. This doesn't
|
This script is used to generate the system's various constants. This doesn't
|
||||||
just include the error numbers and error strings, but also the signal numbers
|
just include the error numbers and error strings, but also the signal numbers
|
||||||
an a wide variety of miscellaneous constants. The constants come from the list
|
and a wide variety of miscellaneous constants. The constants come from the list
|
||||||
of include files in the `includes_${uname}` variable. A regex then picks out
|
of include files in the `includes_${uname}` variable. A regex then picks out
|
||||||
the desired `#define` statements, and generates the corresponding Go constants.
|
the desired `#define` statements, and generates the corresponding Go constants.
|
||||||
The error numbers and strings are generated from `#include <errno.h>`, and the
|
The error numbers and strings are generated from `#include <errno.h>`, and the
|
||||||
|
@ -149,7 +149,7 @@ To add a constant, add the header that includes it to the appropriate variable.
|
||||||
Then, edit the regex (if necessary) to match the desired constant. Avoid making
|
Then, edit the regex (if necessary) to match the desired constant. Avoid making
|
||||||
the regex too broad to avoid matching unintended constants.
|
the regex too broad to avoid matching unintended constants.
|
||||||
|
|
||||||
### mkmerge.go
|
### internal/mkmerge
|
||||||
|
|
||||||
This program is used to extract duplicate const, func, and type declarations
|
This program is used to extract duplicate const, func, and type declarations
|
||||||
from the generated architecture-specific files listed below, and merge these
|
from the generated architecture-specific files listed below, and merge these
|
||||||
|
|
3
vendor/golang.org/x/sys/unix/aliases.go
generated
vendored
3
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
|
||||||
|
|
1
vendor/golang.org/x/sys/unix/asm_aix_ppc64.s
generated
vendored
1
vendor/golang.org/x/sys/unix/asm_aix_ppc64.s
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 gc
|
||||||
// +build gc
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
// Copyright 2009 The Go Authors. All rights reserved.
|
// Copyright 2021 The Go Authors. All rights reserved.
|
||||||
// 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 || netbsd || openbsd) && gc
|
||||||
|
// +build freebsd netbsd openbsd
|
||||||
// +build gc
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
//
|
// System call support for 386 BSD
|
||||||
// System call support for 386, Darwin
|
|
||||||
//
|
|
||||||
|
|
||||||
// Just jump to package syscall's implementation for all these functions.
|
// Just jump to package syscall's implementation for all these functions.
|
||||||
// The runtime may know about them.
|
// The runtime may know about them.
|
|
@ -1,14 +1,14 @@
|
||||||
// Copyright 2009 The Go Authors. All rights reserved.
|
// Copyright 2021 The Go Authors. All rights reserved.
|
||||||
// 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) && gc
|
||||||
|
// +build darwin dragonfly freebsd netbsd openbsd
|
||||||
// +build gc
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
//
|
// System call support for AMD64 BSD
|
||||||
// System call support for AMD64, Darwin
|
|
||||||
//
|
|
||||||
|
|
||||||
// Just jump to package syscall's implementation for all these functions.
|
// Just jump to package syscall's implementation for all these functions.
|
||||||
// The runtime may know about them.
|
// The runtime may know about them.
|
|
@ -1,14 +1,14 @@
|
||||||
// Copyright 2013 The Go Authors. All rights reserved.
|
// Copyright 2021 The Go Authors. All rights reserved.
|
||||||
// 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 || netbsd || openbsd) && gc
|
||||||
|
// +build freebsd netbsd openbsd
|
||||||
// +build gc
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
//
|
// System call support for ARM BSD
|
||||||
// System call support for ARM, NetBSD
|
|
||||||
//
|
|
||||||
|
|
||||||
// Just jump to package syscall's implementation for all these functions.
|
// Just jump to package syscall's implementation for all these functions.
|
||||||
// The runtime may know about them.
|
// The runtime may know about them.
|
|
@ -1,14 +1,14 @@
|
||||||
// Copyright 2009 The Go Authors. All rights reserved.
|
// Copyright 2021 The Go Authors. All rights reserved.
|
||||||
// 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 || freebsd || netbsd || openbsd) && gc
|
||||||
|
// +build darwin freebsd netbsd openbsd
|
||||||
// +build gc
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
//
|
// System call support for ARM64 BSD
|
||||||
// System call support for AMD64, NetBSD
|
|
||||||
//
|
|
||||||
|
|
||||||
// Just jump to package syscall's implementation for all these functions.
|
// Just jump to package syscall's implementation for all these functions.
|
||||||
// The runtime may know about them.
|
// The runtime may know about them.
|
30
vendor/golang.org/x/sys/unix/asm_darwin_arm.s
generated
vendored
30
vendor/golang.org/x/sys/unix/asm_darwin_arm.s
generated
vendored
|
@ -1,30 +0,0 @@
|
||||||
// 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 gc
|
|
||||||
// +build arm,darwin
|
|
||||||
|
|
||||||
#include "textflag.h"
|
|
||||||
|
|
||||||
//
|
|
||||||
// System call support for ARM, Darwin
|
|
||||||
//
|
|
||||||
|
|
||||||
// Just jump to package syscall's implementation for all these functions.
|
|
||||||
// The runtime may know about them.
|
|
||||||
|
|
||||||
TEXT ·Syscall(SB),NOSPLIT,$0-28
|
|
||||||
B syscall·Syscall(SB)
|
|
||||||
|
|
||||||
TEXT ·Syscall6(SB),NOSPLIT,$0-40
|
|
||||||
B syscall·Syscall6(SB)
|
|
||||||
|
|
||||||
TEXT ·Syscall9(SB),NOSPLIT,$0-52
|
|
||||||
B syscall·Syscall9(SB)
|
|
||||||
|
|
||||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
|
|
||||||
B syscall·RawSyscall(SB)
|
|
||||||
|
|
||||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
|
|
||||||
B syscall·RawSyscall6(SB)
|
|
30
vendor/golang.org/x/sys/unix/asm_darwin_arm64.s
generated
vendored
30
vendor/golang.org/x/sys/unix/asm_darwin_arm64.s
generated
vendored
|
@ -1,30 +0,0 @@
|
||||||
// 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 gc
|
|
||||||
// +build arm64,darwin
|
|
||||||
|
|
||||||
#include "textflag.h"
|
|
||||||
|
|
||||||
//
|
|
||||||
// System call support for AMD64, Darwin
|
|
||||||
//
|
|
||||||
|
|
||||||
// Just jump to package syscall's implementation for all these functions.
|
|
||||||
// The runtime may know about them.
|
|
||||||
|
|
||||||
TEXT ·Syscall(SB),NOSPLIT,$0-56
|
|
||||||
B syscall·Syscall(SB)
|
|
||||||
|
|
||||||
TEXT ·Syscall6(SB),NOSPLIT,$0-80
|
|
||||||
B syscall·Syscall6(SB)
|
|
||||||
|
|
||||||
TEXT ·Syscall9(SB),NOSPLIT,$0-104
|
|
||||||
B syscall·Syscall9(SB)
|
|
||||||
|
|
||||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
|
|
||||||
B syscall·RawSyscall(SB)
|
|
||||||
|
|
||||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
|
|
||||||
B syscall·RawSyscall6(SB)
|
|
29
vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s
generated
vendored
29
vendor/golang.org/x/sys/unix/asm_dragonfly_amd64.s
generated
vendored
|
@ -1,29 +0,0 @@
|
||||||
// Copyright 2009 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build gc
|
|
||||||
|
|
||||||
#include "textflag.h"
|
|
||||||
|
|
||||||
//
|
|
||||||
// System call support for AMD64, DragonFly
|
|
||||||
//
|
|
||||||
|
|
||||||
// Just jump to package syscall's implementation for all these functions.
|
|
||||||
// The runtime may know about them.
|
|
||||||
|
|
||||||
TEXT ·Syscall(SB),NOSPLIT,$0-56
|
|
||||||
JMP syscall·Syscall(SB)
|
|
||||||
|
|
||||||
TEXT ·Syscall6(SB),NOSPLIT,$0-80
|
|
||||||
JMP syscall·Syscall6(SB)
|
|
||||||
|
|
||||||
TEXT ·Syscall9(SB),NOSPLIT,$0-104
|
|
||||||
JMP syscall·Syscall9(SB)
|
|
||||||
|
|
||||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
|
|
||||||
JMP syscall·RawSyscall(SB)
|
|
||||||
|
|
||||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
|
|
||||||
JMP syscall·RawSyscall6(SB)
|
|
29
vendor/golang.org/x/sys/unix/asm_freebsd_386.s
generated
vendored
29
vendor/golang.org/x/sys/unix/asm_freebsd_386.s
generated
vendored
|
@ -1,29 +0,0 @@
|
||||||
// Copyright 2009 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build gc
|
|
||||||
|
|
||||||
#include "textflag.h"
|
|
||||||
|
|
||||||
//
|
|
||||||
// System call support for 386, FreeBSD
|
|
||||||
//
|
|
||||||
|
|
||||||
// Just jump to package syscall's implementation for all these functions.
|
|
||||||
// The runtime may know about them.
|
|
||||||
|
|
||||||
TEXT ·Syscall(SB),NOSPLIT,$0-28
|
|
||||||
JMP syscall·Syscall(SB)
|
|
||||||
|
|
||||||
TEXT ·Syscall6(SB),NOSPLIT,$0-40
|
|
||||||
JMP syscall·Syscall6(SB)
|
|
||||||
|
|
||||||
TEXT ·Syscall9(SB),NOSPLIT,$0-52
|
|
||||||
JMP syscall·Syscall9(SB)
|
|
||||||
|
|
||||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
|
|
||||||
JMP syscall·RawSyscall(SB)
|
|
||||||
|
|
||||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
|
|
||||||
JMP syscall·RawSyscall6(SB)
|
|
29
vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s
generated
vendored
29
vendor/golang.org/x/sys/unix/asm_freebsd_amd64.s
generated
vendored
|
@ -1,29 +0,0 @@
|
||||||
// Copyright 2009 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build gc
|
|
||||||
|
|
||||||
#include "textflag.h"
|
|
||||||
|
|
||||||
//
|
|
||||||
// System call support for AMD64, FreeBSD
|
|
||||||
//
|
|
||||||
|
|
||||||
// Just jump to package syscall's implementation for all these functions.
|
|
||||||
// The runtime may know about them.
|
|
||||||
|
|
||||||
TEXT ·Syscall(SB),NOSPLIT,$0-56
|
|
||||||
JMP syscall·Syscall(SB)
|
|
||||||
|
|
||||||
TEXT ·Syscall6(SB),NOSPLIT,$0-80
|
|
||||||
JMP syscall·Syscall6(SB)
|
|
||||||
|
|
||||||
TEXT ·Syscall9(SB),NOSPLIT,$0-104
|
|
||||||
JMP syscall·Syscall9(SB)
|
|
||||||
|
|
||||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
|
|
||||||
JMP syscall·RawSyscall(SB)
|
|
||||||
|
|
||||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
|
|
||||||
JMP syscall·RawSyscall6(SB)
|
|
29
vendor/golang.org/x/sys/unix/asm_freebsd_arm.s
generated
vendored
29
vendor/golang.org/x/sys/unix/asm_freebsd_arm.s
generated
vendored
|
@ -1,29 +0,0 @@
|
||||||
// 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 gc
|
|
||||||
|
|
||||||
#include "textflag.h"
|
|
||||||
|
|
||||||
//
|
|
||||||
// System call support for ARM, FreeBSD
|
|
||||||
//
|
|
||||||
|
|
||||||
// Just jump to package syscall's implementation for all these functions.
|
|
||||||
// The runtime may know about them.
|
|
||||||
|
|
||||||
TEXT ·Syscall(SB),NOSPLIT,$0-28
|
|
||||||
B syscall·Syscall(SB)
|
|
||||||
|
|
||||||
TEXT ·Syscall6(SB),NOSPLIT,$0-40
|
|
||||||
B syscall·Syscall6(SB)
|
|
||||||
|
|
||||||
TEXT ·Syscall9(SB),NOSPLIT,$0-52
|
|
||||||
B syscall·Syscall9(SB)
|
|
||||||
|
|
||||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
|
|
||||||
B syscall·RawSyscall(SB)
|
|
||||||
|
|
||||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
|
|
||||||
B syscall·RawSyscall6(SB)
|
|
29
vendor/golang.org/x/sys/unix/asm_freebsd_arm64.s
generated
vendored
29
vendor/golang.org/x/sys/unix/asm_freebsd_arm64.s
generated
vendored
|
@ -1,29 +0,0 @@
|
||||||
// Copyright 2018 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build gc
|
|
||||||
|
|
||||||
#include "textflag.h"
|
|
||||||
|
|
||||||
//
|
|
||||||
// System call support for ARM64, FreeBSD
|
|
||||||
//
|
|
||||||
|
|
||||||
// Just jump to package syscall's implementation for all these functions.
|
|
||||||
// The runtime may know about them.
|
|
||||||
|
|
||||||
TEXT ·Syscall(SB),NOSPLIT,$0-56
|
|
||||||
JMP syscall·Syscall(SB)
|
|
||||||
|
|
||||||
TEXT ·Syscall6(SB),NOSPLIT,$0-80
|
|
||||||
JMP syscall·Syscall6(SB)
|
|
||||||
|
|
||||||
TEXT ·Syscall9(SB),NOSPLIT,$0-104
|
|
||||||
JMP syscall·Syscall9(SB)
|
|
||||||
|
|
||||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
|
|
||||||
JMP syscall·RawSyscall(SB)
|
|
||||||
|
|
||||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
|
|
||||||
JMP syscall·RawSyscall6(SB)
|
|
1
vendor/golang.org/x/sys/unix/asm_linux_386.s
generated
vendored
1
vendor/golang.org/x/sys/unix/asm_linux_386.s
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 gc
|
||||||
// +build gc
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
1
vendor/golang.org/x/sys/unix/asm_linux_amd64.s
generated
vendored
1
vendor/golang.org/x/sys/unix/asm_linux_amd64.s
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 gc
|
||||||
// +build gc
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
1
vendor/golang.org/x/sys/unix/asm_linux_arm.s
generated
vendored
1
vendor/golang.org/x/sys/unix/asm_linux_arm.s
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 gc
|
||||||
// +build gc
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
1
vendor/golang.org/x/sys/unix/asm_linux_arm64.s
generated
vendored
1
vendor/golang.org/x/sys/unix/asm_linux_arm64.s
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 && arm64 && gc
|
||||||
// +build linux
|
// +build linux
|
||||||
// +build arm64
|
// +build arm64
|
||||||
// +build gc
|
// +build gc
|
||||||
|
|
1
vendor/golang.org/x/sys/unix/asm_linux_mips64x.s
generated
vendored
1
vendor/golang.org/x/sys/unix/asm_linux_mips64x.s
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 && (mips64 || mips64le) && gc
|
||||||
// +build linux
|
// +build linux
|
||||||
// +build mips64 mips64le
|
// +build mips64 mips64le
|
||||||
// +build gc
|
// +build gc
|
||||||
|
|
1
vendor/golang.org/x/sys/unix/asm_linux_mipsx.s
generated
vendored
1
vendor/golang.org/x/sys/unix/asm_linux_mipsx.s
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 && (mips || mipsle) && gc
|
||||||
// +build linux
|
// +build linux
|
||||||
// +build mips mipsle
|
// +build mips mipsle
|
||||||
// +build gc
|
// +build gc
|
||||||
|
|
1
vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s
generated
vendored
1
vendor/golang.org/x/sys/unix/asm_linux_ppc64x.s
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 && (ppc64 || ppc64le) && gc
|
||||||
// +build linux
|
// +build linux
|
||||||
// +build ppc64 ppc64le
|
// +build ppc64 ppc64le
|
||||||
// +build gc
|
// +build gc
|
||||||
|
|
4
vendor/golang.org/x/sys/unix/asm_linux_riscv64.s
generated
vendored
4
vendor/golang.org/x/sys/unix/asm_linux_riscv64.s
generated
vendored
|
@ -2,7 +2,9 @@
|
||||||
// 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 riscv64,gc
|
//go:build riscv64 && gc
|
||||||
|
// +build riscv64
|
||||||
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
|
3
vendor/golang.org/x/sys/unix/asm_linux_s390x.s
generated
vendored
3
vendor/golang.org/x/sys/unix/asm_linux_s390x.s
generated
vendored
|
@ -2,8 +2,9 @@
|
||||||
// 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 s390x
|
//go:build linux && s390x && gc
|
||||||
// +build linux
|
// +build linux
|
||||||
|
// +build s390x
|
||||||
// +build gc
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
29
vendor/golang.org/x/sys/unix/asm_netbsd_386.s
generated
vendored
29
vendor/golang.org/x/sys/unix/asm_netbsd_386.s
generated
vendored
|
@ -1,29 +0,0 @@
|
||||||
// Copyright 2009 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build gc
|
|
||||||
|
|
||||||
#include "textflag.h"
|
|
||||||
|
|
||||||
//
|
|
||||||
// System call support for 386, NetBSD
|
|
||||||
//
|
|
||||||
|
|
||||||
// Just jump to package syscall's implementation for all these functions.
|
|
||||||
// The runtime may know about them.
|
|
||||||
|
|
||||||
TEXT ·Syscall(SB),NOSPLIT,$0-28
|
|
||||||
JMP syscall·Syscall(SB)
|
|
||||||
|
|
||||||
TEXT ·Syscall6(SB),NOSPLIT,$0-40
|
|
||||||
JMP syscall·Syscall6(SB)
|
|
||||||
|
|
||||||
TEXT ·Syscall9(SB),NOSPLIT,$0-52
|
|
||||||
JMP syscall·Syscall9(SB)
|
|
||||||
|
|
||||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
|
|
||||||
JMP syscall·RawSyscall(SB)
|
|
||||||
|
|
||||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
|
|
||||||
JMP syscall·RawSyscall6(SB)
|
|
29
vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s
generated
vendored
29
vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s
generated
vendored
|
@ -1,29 +0,0 @@
|
||||||
// Copyright 2019 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build gc
|
|
||||||
|
|
||||||
#include "textflag.h"
|
|
||||||
|
|
||||||
//
|
|
||||||
// System call support for ARM64, NetBSD
|
|
||||||
//
|
|
||||||
|
|
||||||
// Just jump to package syscall's implementation for all these functions.
|
|
||||||
// The runtime may know about them.
|
|
||||||
|
|
||||||
TEXT ·Syscall(SB),NOSPLIT,$0-56
|
|
||||||
B syscall·Syscall(SB)
|
|
||||||
|
|
||||||
TEXT ·Syscall6(SB),NOSPLIT,$0-80
|
|
||||||
B syscall·Syscall6(SB)
|
|
||||||
|
|
||||||
TEXT ·Syscall9(SB),NOSPLIT,$0-104
|
|
||||||
B syscall·Syscall9(SB)
|
|
||||||
|
|
||||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
|
|
||||||
B syscall·RawSyscall(SB)
|
|
||||||
|
|
||||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
|
|
||||||
B syscall·RawSyscall6(SB)
|
|
29
vendor/golang.org/x/sys/unix/asm_openbsd_386.s
generated
vendored
29
vendor/golang.org/x/sys/unix/asm_openbsd_386.s
generated
vendored
|
@ -1,29 +0,0 @@
|
||||||
// Copyright 2009 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build gc
|
|
||||||
|
|
||||||
#include "textflag.h"
|
|
||||||
|
|
||||||
//
|
|
||||||
// System call support for 386, OpenBSD
|
|
||||||
//
|
|
||||||
|
|
||||||
// Just jump to package syscall's implementation for all these functions.
|
|
||||||
// The runtime may know about them.
|
|
||||||
|
|
||||||
TEXT ·Syscall(SB),NOSPLIT,$0-28
|
|
||||||
JMP syscall·Syscall(SB)
|
|
||||||
|
|
||||||
TEXT ·Syscall6(SB),NOSPLIT,$0-40
|
|
||||||
JMP syscall·Syscall6(SB)
|
|
||||||
|
|
||||||
TEXT ·Syscall9(SB),NOSPLIT,$0-52
|
|
||||||
JMP syscall·Syscall9(SB)
|
|
||||||
|
|
||||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
|
|
||||||
JMP syscall·RawSyscall(SB)
|
|
||||||
|
|
||||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
|
|
||||||
JMP syscall·RawSyscall6(SB)
|
|
29
vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s
generated
vendored
29
vendor/golang.org/x/sys/unix/asm_openbsd_amd64.s
generated
vendored
|
@ -1,29 +0,0 @@
|
||||||
// Copyright 2009 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build gc
|
|
||||||
|
|
||||||
#include "textflag.h"
|
|
||||||
|
|
||||||
//
|
|
||||||
// System call support for AMD64, OpenBSD
|
|
||||||
//
|
|
||||||
|
|
||||||
// Just jump to package syscall's implementation for all these functions.
|
|
||||||
// The runtime may know about them.
|
|
||||||
|
|
||||||
TEXT ·Syscall(SB),NOSPLIT,$0-56
|
|
||||||
JMP syscall·Syscall(SB)
|
|
||||||
|
|
||||||
TEXT ·Syscall6(SB),NOSPLIT,$0-80
|
|
||||||
JMP syscall·Syscall6(SB)
|
|
||||||
|
|
||||||
TEXT ·Syscall9(SB),NOSPLIT,$0-104
|
|
||||||
JMP syscall·Syscall9(SB)
|
|
||||||
|
|
||||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
|
|
||||||
JMP syscall·RawSyscall(SB)
|
|
||||||
|
|
||||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
|
|
||||||
JMP syscall·RawSyscall6(SB)
|
|
29
vendor/golang.org/x/sys/unix/asm_openbsd_arm.s
generated
vendored
29
vendor/golang.org/x/sys/unix/asm_openbsd_arm.s
generated
vendored
|
@ -1,29 +0,0 @@
|
||||||
// Copyright 2017 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build gc
|
|
||||||
|
|
||||||
#include "textflag.h"
|
|
||||||
|
|
||||||
//
|
|
||||||
// System call support for ARM, OpenBSD
|
|
||||||
//
|
|
||||||
|
|
||||||
// Just jump to package syscall's implementation for all these functions.
|
|
||||||
// The runtime may know about them.
|
|
||||||
|
|
||||||
TEXT ·Syscall(SB),NOSPLIT,$0-28
|
|
||||||
B syscall·Syscall(SB)
|
|
||||||
|
|
||||||
TEXT ·Syscall6(SB),NOSPLIT,$0-40
|
|
||||||
B syscall·Syscall6(SB)
|
|
||||||
|
|
||||||
TEXT ·Syscall9(SB),NOSPLIT,$0-52
|
|
||||||
B syscall·Syscall9(SB)
|
|
||||||
|
|
||||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
|
|
||||||
B syscall·RawSyscall(SB)
|
|
||||||
|
|
||||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
|
|
||||||
B syscall·RawSyscall6(SB)
|
|
29
vendor/golang.org/x/sys/unix/asm_openbsd_arm64.s
generated
vendored
29
vendor/golang.org/x/sys/unix/asm_openbsd_arm64.s
generated
vendored
|
@ -1,29 +0,0 @@
|
||||||
// Copyright 2019 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build gc
|
|
||||||
|
|
||||||
#include "textflag.h"
|
|
||||||
|
|
||||||
//
|
|
||||||
// System call support for arm64, OpenBSD
|
|
||||||
//
|
|
||||||
|
|
||||||
// Just jump to package syscall's implementation for all these functions.
|
|
||||||
// The runtime may know about them.
|
|
||||||
|
|
||||||
TEXT ·Syscall(SB),NOSPLIT,$0-56
|
|
||||||
JMP syscall·Syscall(SB)
|
|
||||||
|
|
||||||
TEXT ·Syscall6(SB),NOSPLIT,$0-80
|
|
||||||
JMP syscall·Syscall6(SB)
|
|
||||||
|
|
||||||
TEXT ·Syscall9(SB),NOSPLIT,$0-104
|
|
||||||
JMP syscall·Syscall9(SB)
|
|
||||||
|
|
||||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
|
|
||||||
JMP syscall·RawSyscall(SB)
|
|
||||||
|
|
||||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
|
|
||||||
JMP syscall·RawSyscall6(SB)
|
|
1
vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s
generated
vendored
1
vendor/golang.org/x/sys/unix/asm_openbsd_mips64.s
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 gc
|
||||||
// +build gc
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
1
vendor/golang.org/x/sys/unix/asm_solaris_amd64.s
generated
vendored
1
vendor/golang.org/x/sys/unix/asm_solaris_amd64.s
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 gc
|
||||||
// +build gc
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
426
vendor/golang.org/x/sys/unix/asm_zos_s390x.s
generated
vendored
Normal file
426
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
vendor/golang.org/x/sys/unix/cap_freebsd.go
generated
vendored
1
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
vendor/golang.org/x/sys/unix/constants.go
generated
vendored
3
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
vendor/golang.org/x/sys/unix/dev_aix_ppc.go
generated
vendored
4
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
vendor/golang.org/x/sys/unix/dev_aix_ppc64.go
generated
vendored
4
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
vendor/golang.org/x/sys/unix/dev_zos.go
generated
vendored
Normal file
29
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
vendor/golang.org/x/sys/unix/dirent.go
generated
vendored
1
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
vendor/golang.org/x/sys/unix/endian_big.go
generated
vendored
1
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
vendor/golang.org/x/sys/unix/endian_little.go
generated
vendored
1
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
vendor/golang.org/x/sys/unix/env_unix.go
generated
vendored
3
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
vendor/golang.org/x/sys/unix/epoll_zos.go
generated
vendored
Normal file
221
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
vendor/golang.org/x/sys/unix/fcntl.go
generated
vendored
1
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
|
||||||
|
|
3
vendor/golang.org/x/sys/unix/fcntl_linux_32bit.go
generated
vendored
3
vendor/golang.org/x/sys/unix/fcntl_linux_32bit.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 linux,386 linux,arm linux,mips linux,mipsle
|
//go:build (linux && 386) || (linux && arm) || (linux && mips) || (linux && mipsle) || (linux && ppc)
|
||||||
|
// +build linux,386 linux,arm linux,mips linux,mipsle linux,ppc
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
|
3
vendor/golang.org/x/sys/unix/fdset.go
generated
vendored
3
vendor/golang.org/x/sys/unix/fdset.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
|
||||||
|
|
||||||
|
|
164
vendor/golang.org/x/sys/unix/fstatfs_zos.go
generated
vendored
Normal file
164
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
vendor/golang.org/x/sys/unix/gccgo.go
generated
vendored
4
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
vendor/golang.org/x/sys/unix/gccgo_linux_amd64.go
generated
vendored
1
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
|
||||||
|
|
149
vendor/golang.org/x/sys/unix/ifreq_linux.go
generated
vendored
Normal file
149
vendor/golang.org/x/sys/unix/ifreq_linux.go
generated
vendored
Normal file
|
@ -0,0 +1,149 @@
|
||||||
|
// Copyright 2021 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 linux
|
||||||
|
// +build linux
|
||||||
|
|
||||||
|
package unix
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Helpers for dealing with ifreq since it contains a union and thus requires a
|
||||||
|
// lot of unsafe.Pointer casts to use properly.
|
||||||
|
|
||||||
|
// An Ifreq is a type-safe wrapper around the raw ifreq struct. An Ifreq
|
||||||
|
// contains an interface name and a union of arbitrary data which can be
|
||||||
|
// accessed using the Ifreq's methods. To create an Ifreq, use the NewIfreq
|
||||||
|
// function.
|
||||||
|
//
|
||||||
|
// Use the Name method to access the stored interface name. The union data
|
||||||
|
// fields can be get and set using the following methods:
|
||||||
|
// - Uint16/SetUint16: flags
|
||||||
|
// - Uint32/SetUint32: ifindex, metric, mtu
|
||||||
|
type Ifreq struct{ raw ifreq }
|
||||||
|
|
||||||
|
// NewIfreq creates an Ifreq with the input network interface name after
|
||||||
|
// validating the name does not exceed IFNAMSIZ-1 (trailing NULL required)
|
||||||
|
// bytes.
|
||||||
|
func NewIfreq(name string) (*Ifreq, error) {
|
||||||
|
// Leave room for terminating NULL byte.
|
||||||
|
if len(name) >= IFNAMSIZ {
|
||||||
|
return nil, EINVAL
|
||||||
|
}
|
||||||
|
|
||||||
|
var ifr ifreq
|
||||||
|
copy(ifr.Ifrn[:], name)
|
||||||
|
|
||||||
|
return &Ifreq{raw: ifr}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO(mdlayher): get/set methods for hardware address sockaddr, char array, etc.
|
||||||
|
|
||||||
|
// Name returns the interface name associated with the Ifreq.
|
||||||
|
func (ifr *Ifreq) Name() string {
|
||||||
|
// BytePtrToString requires a NULL terminator or the program may crash. If
|
||||||
|
// one is not present, just return the empty string.
|
||||||
|
if !bytes.Contains(ifr.raw.Ifrn[:], []byte{0x00}) {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
return BytePtrToString(&ifr.raw.Ifrn[0])
|
||||||
|
}
|
||||||
|
|
||||||
|
// According to netdevice(7), only AF_INET addresses are returned for numerous
|
||||||
|
// sockaddr ioctls. For convenience, we expose these as Inet4Addr since the Port
|
||||||
|
// field and other data is always empty.
|
||||||
|
|
||||||
|
// Inet4Addr returns the Ifreq union data from an embedded sockaddr as a C
|
||||||
|
// in_addr/Go []byte (4-byte IPv4 address) value. If the sockaddr family is not
|
||||||
|
// AF_INET, an error is returned.
|
||||||
|
func (ifr *Ifreq) Inet4Addr() ([]byte, error) {
|
||||||
|
raw := *(*RawSockaddrInet4)(unsafe.Pointer(&ifr.raw.Ifru[:SizeofSockaddrInet4][0]))
|
||||||
|
if raw.Family != AF_INET {
|
||||||
|
// Cannot safely interpret raw.Addr bytes as an IPv4 address.
|
||||||
|
return nil, EINVAL
|
||||||
|
}
|
||||||
|
|
||||||
|
return raw.Addr[:], nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetInet4Addr sets a C in_addr/Go []byte (4-byte IPv4 address) value in an
|
||||||
|
// embedded sockaddr within the Ifreq's union data. v must be 4 bytes in length
|
||||||
|
// or an error will be returned.
|
||||||
|
func (ifr *Ifreq) SetInet4Addr(v []byte) error {
|
||||||
|
if len(v) != 4 {
|
||||||
|
return EINVAL
|
||||||
|
}
|
||||||
|
|
||||||
|
var addr [4]byte
|
||||||
|
copy(addr[:], v)
|
||||||
|
|
||||||
|
ifr.clear()
|
||||||
|
*(*RawSockaddrInet4)(
|
||||||
|
unsafe.Pointer(&ifr.raw.Ifru[:SizeofSockaddrInet4][0]),
|
||||||
|
) = RawSockaddrInet4{
|
||||||
|
// Always set IP family as ioctls would require it anyway.
|
||||||
|
Family: AF_INET,
|
||||||
|
Addr: addr,
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Uint16 returns the Ifreq union data as a C short/Go uint16 value.
|
||||||
|
func (ifr *Ifreq) Uint16() uint16 {
|
||||||
|
return *(*uint16)(unsafe.Pointer(&ifr.raw.Ifru[:2][0]))
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetUint16 sets a C short/Go uint16 value as the Ifreq's union data.
|
||||||
|
func (ifr *Ifreq) SetUint16(v uint16) {
|
||||||
|
ifr.clear()
|
||||||
|
*(*uint16)(unsafe.Pointer(&ifr.raw.Ifru[:2][0])) = v
|
||||||
|
}
|
||||||
|
|
||||||
|
// Uint32 returns the Ifreq union data as a C int/Go uint32 value.
|
||||||
|
func (ifr *Ifreq) Uint32() uint32 {
|
||||||
|
return *(*uint32)(unsafe.Pointer(&ifr.raw.Ifru[:4][0]))
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetUint32 sets a C int/Go uint32 value as the Ifreq's union data.
|
||||||
|
func (ifr *Ifreq) SetUint32(v uint32) {
|
||||||
|
ifr.clear()
|
||||||
|
*(*uint32)(unsafe.Pointer(&ifr.raw.Ifru[:4][0])) = v
|
||||||
|
}
|
||||||
|
|
||||||
|
// clear zeroes the ifreq's union field to prevent trailing garbage data from
|
||||||
|
// being sent to the kernel if an ifreq is reused.
|
||||||
|
func (ifr *Ifreq) clear() {
|
||||||
|
for i := range ifr.raw.Ifru {
|
||||||
|
ifr.raw.Ifru[i] = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO(mdlayher): export as IfreqData? For now we can provide helpers such as
|
||||||
|
// IoctlGetEthtoolDrvinfo which use these APIs under the hood.
|
||||||
|
|
||||||
|
// An ifreqData is an Ifreq which carries pointer data. To produce an ifreqData,
|
||||||
|
// use the Ifreq.withData method.
|
||||||
|
type ifreqData struct {
|
||||||
|
name [IFNAMSIZ]byte
|
||||||
|
// A type separate from ifreq is required in order to comply with the
|
||||||
|
// unsafe.Pointer rules since the "pointer-ness" of data would not be
|
||||||
|
// preserved if it were cast into the byte array of a raw ifreq.
|
||||||
|
data unsafe.Pointer
|
||||||
|
// Pad to the same size as ifreq.
|
||||||
|
_ [len(ifreq{}.Ifru) - SizeofPtr]byte
|
||||||
|
}
|
||||||
|
|
||||||
|
// withData produces an ifreqData with the pointer p set for ioctls which require
|
||||||
|
// arbitrary pointer data.
|
||||||
|
func (ifr Ifreq) withData(p unsafe.Pointer) ifreqData {
|
||||||
|
return ifreqData{
|
||||||
|
name: ifr.raw.Ifrn,
|
||||||
|
data: p,
|
||||||
|
}
|
||||||
|
}
|
1
vendor/golang.org/x/sys/unix/ioctl.go
generated
vendored
1
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
|
||||||
|
|
219
vendor/golang.org/x/sys/unix/ioctl_linux.go
generated
vendored
Normal file
219
vendor/golang.org/x/sys/unix/ioctl_linux.go
generated
vendored
Normal file
|
@ -0,0 +1,219 @@
|
||||||
|
// Copyright 2021 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package unix
|
||||||
|
|
||||||
|
import (
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
// IoctlRetInt performs an ioctl operation specified by req on a device
|
||||||
|
// associated with opened file descriptor fd, and returns a non-negative
|
||||||
|
// integer that is returned by the ioctl syscall.
|
||||||
|
func IoctlRetInt(fd int, req uint) (int, error) {
|
||||||
|
ret, _, err := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), 0)
|
||||||
|
if err != 0 {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
return int(ret), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func IoctlGetUint32(fd int, req uint) (uint32, error) {
|
||||||
|
var value uint32
|
||||||
|
err := ioctlPtr(fd, req, unsafe.Pointer(&value))
|
||||||
|
return value, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func IoctlGetRTCTime(fd int) (*RTCTime, error) {
|
||||||
|
var value RTCTime
|
||||||
|
err := ioctlPtr(fd, RTC_RD_TIME, unsafe.Pointer(&value))
|
||||||
|
return &value, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func IoctlSetRTCTime(fd int, value *RTCTime) error {
|
||||||
|
return ioctlPtr(fd, RTC_SET_TIME, unsafe.Pointer(value))
|
||||||
|
}
|
||||||
|
|
||||||
|
func IoctlGetRTCWkAlrm(fd int) (*RTCWkAlrm, error) {
|
||||||
|
var value RTCWkAlrm
|
||||||
|
err := ioctlPtr(fd, RTC_WKALM_RD, unsafe.Pointer(&value))
|
||||||
|
return &value, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func IoctlSetRTCWkAlrm(fd int, value *RTCWkAlrm) error {
|
||||||
|
return ioctlPtr(fd, RTC_WKALM_SET, unsafe.Pointer(value))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlGetEthtoolDrvinfo fetches ethtool driver information for the network
|
||||||
|
// device specified by ifname.
|
||||||
|
func IoctlGetEthtoolDrvinfo(fd int, ifname string) (*EthtoolDrvinfo, error) {
|
||||||
|
ifr, err := NewIfreq(ifname)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
value := EthtoolDrvinfo{Cmd: ETHTOOL_GDRVINFO}
|
||||||
|
ifrd := ifr.withData(unsafe.Pointer(&value))
|
||||||
|
|
||||||
|
err = ioctlIfreqData(fd, SIOCETHTOOL, &ifrd)
|
||||||
|
return &value, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlGetWatchdogInfo fetches information about a watchdog device from the
|
||||||
|
// Linux watchdog API. For more information, see:
|
||||||
|
// https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html.
|
||||||
|
func IoctlGetWatchdogInfo(fd int) (*WatchdogInfo, error) {
|
||||||
|
var value WatchdogInfo
|
||||||
|
err := ioctlPtr(fd, WDIOC_GETSUPPORT, unsafe.Pointer(&value))
|
||||||
|
return &value, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlWatchdogKeepalive issues a keepalive ioctl to a watchdog device. For
|
||||||
|
// more information, see:
|
||||||
|
// https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html.
|
||||||
|
func IoctlWatchdogKeepalive(fd int) error {
|
||||||
|
// arg is ignored and not a pointer, so ioctl is fine instead of ioctlPtr.
|
||||||
|
return ioctl(fd, WDIOC_KEEPALIVE, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlFileCloneRange performs an FICLONERANGE ioctl operation to clone the
|
||||||
|
// range of data conveyed in value to the file associated with the file
|
||||||
|
// descriptor destFd. See the ioctl_ficlonerange(2) man page for details.
|
||||||
|
func IoctlFileCloneRange(destFd int, value *FileCloneRange) error {
|
||||||
|
return ioctlPtr(destFd, FICLONERANGE, unsafe.Pointer(value))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlFileClone performs an FICLONE ioctl operation to clone the entire file
|
||||||
|
// associated with the file description srcFd to the file associated with the
|
||||||
|
// file descriptor destFd. See the ioctl_ficlone(2) man page for details.
|
||||||
|
func IoctlFileClone(destFd, srcFd int) error {
|
||||||
|
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
|
||||||
|
// range of data conveyed in value from the file associated with the file
|
||||||
|
// descriptor srcFd to the value.Info destinations. See the
|
||||||
|
// ioctl_fideduperange(2) man page for details.
|
||||||
|
func IoctlFileDedupeRange(srcFd int, value *FileDedupeRange) error {
|
||||||
|
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 := ioctlPtr(srcFd, FIDEDUPERANGE, 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
|
||||||
|
}
|
||||||
|
|
||||||
|
func IoctlHIDGetDesc(fd int, value *HIDRawReportDescriptor) error {
|
||||||
|
return ioctlPtr(fd, HIDIOCGRDESC, unsafe.Pointer(value))
|
||||||
|
}
|
||||||
|
|
||||||
|
func IoctlHIDGetRawInfo(fd int) (*HIDRawDevInfo, error) {
|
||||||
|
var value HIDRawDevInfo
|
||||||
|
err := ioctlPtr(fd, HIDIOCGRAWINFO, unsafe.Pointer(&value))
|
||||||
|
return &value, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func IoctlHIDGetRawName(fd int) (string, error) {
|
||||||
|
var value [_HIDIOCGRAWNAME_LEN]byte
|
||||||
|
err := ioctlPtr(fd, _HIDIOCGRAWNAME, unsafe.Pointer(&value[0]))
|
||||||
|
return ByteSliceToString(value[:]), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func IoctlHIDGetRawPhys(fd int) (string, error) {
|
||||||
|
var value [_HIDIOCGRAWPHYS_LEN]byte
|
||||||
|
err := ioctlPtr(fd, _HIDIOCGRAWPHYS, unsafe.Pointer(&value[0]))
|
||||||
|
return ByteSliceToString(value[:]), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func IoctlHIDGetRawUniq(fd int) (string, error) {
|
||||||
|
var value [_HIDIOCGRAWUNIQ_LEN]byte
|
||||||
|
err := ioctlPtr(fd, _HIDIOCGRAWUNIQ, unsafe.Pointer(&value[0]))
|
||||||
|
return ByteSliceToString(value[:]), err
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlIfreq performs an ioctl using an Ifreq structure for input and/or
|
||||||
|
// output. See the netdevice(7) man page for details.
|
||||||
|
func IoctlIfreq(fd int, req uint, value *Ifreq) error {
|
||||||
|
// It is possible we will add more fields to *Ifreq itself later to prevent
|
||||||
|
// misuse, so pass the raw *ifreq directly.
|
||||||
|
return ioctlPtr(fd, req, unsafe.Pointer(&value.raw))
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO(mdlayher): export if and when IfreqData is exported.
|
||||||
|
|
||||||
|
// ioctlIfreqData performs an ioctl using an ifreqData structure for input
|
||||||
|
// and/or output. See the netdevice(7) man page for details.
|
||||||
|
func ioctlIfreqData(fd int, req uint, value *ifreqData) error {
|
||||||
|
// The memory layout of IfreqData (type-safe) and ifreq (not type-safe) are
|
||||||
|
// identical so pass *IfreqData directly.
|
||||||
|
return ioctlPtr(fd, req, unsafe.Pointer(value))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlKCMClone attaches a new file descriptor to a multiplexor by cloning an
|
||||||
|
// existing KCM socket, returning a structure containing the file descriptor of
|
||||||
|
// the new socket.
|
||||||
|
func IoctlKCMClone(fd int) (*KCMClone, error) {
|
||||||
|
var info KCMClone
|
||||||
|
if err := ioctlPtr(fd, SIOCKCMCLONE, unsafe.Pointer(&info)); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return &info, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlKCMAttach attaches a TCP socket and associated BPF program file
|
||||||
|
// descriptor to a multiplexor.
|
||||||
|
func IoctlKCMAttach(fd int, info KCMAttach) error {
|
||||||
|
return ioctlPtr(fd, SIOCKCMATTACH, unsafe.Pointer(&info))
|
||||||
|
}
|
||||||
|
|
||||||
|
// IoctlKCMUnattach unattaches a TCP socket file descriptor from a multiplexor.
|
||||||
|
func IoctlKCMUnattach(fd int, info KCMUnattach) error {
|
||||||
|
return ioctlPtr(fd, SIOCKCMUNATTACH, unsafe.Pointer(&info))
|
||||||
|
}
|
74
vendor/golang.org/x/sys/unix/ioctl_zos.go
generated
vendored
Normal file
74
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
|
||||||
|
}
|
16
vendor/golang.org/x/sys/unix/mkall.sh
generated
vendored
16
vendor/golang.org/x/sys/unix/mkall.sh
generated
vendored
|
@ -50,7 +50,7 @@ if [[ "$GOOS" = "linux" ]]; then
|
||||||
# Use the Docker-based build system
|
# Use the Docker-based build system
|
||||||
# Files generated through docker (use $cmd so you can Ctl-C the build or run)
|
# Files generated through docker (use $cmd so you can Ctl-C the build or run)
|
||||||
$cmd docker build --tag generate:$GOOS $GOOS
|
$cmd docker build --tag generate:$GOOS $GOOS
|
||||||
$cmd docker run --interactive --tty --volume $(cd -- "$(dirname -- "$0")" && /bin/pwd):/build generate:$GOOS
|
$cmd docker run --interactive --tty --volume $(cd -- "$(dirname -- "$0")/.." && /bin/pwd):/build generate:$GOOS
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -70,23 +70,11 @@ aix_ppc64)
|
||||||
mksyscall="go run mksyscall_aix_ppc64.go -aix"
|
mksyscall="go run mksyscall_aix_ppc64.go -aix"
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||||
;;
|
;;
|
||||||
darwin_386)
|
|
||||||
mkerrors="$mkerrors -m32"
|
|
||||||
mksyscall="go run mksyscall.go -l32"
|
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
|
||||||
mkasm="go run mkasm_darwin.go"
|
|
||||||
;;
|
|
||||||
darwin_amd64)
|
darwin_amd64)
|
||||||
mkerrors="$mkerrors -m64"
|
mkerrors="$mkerrors -m64"
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||||
mkasm="go run mkasm_darwin.go"
|
mkasm="go run mkasm_darwin.go"
|
||||||
;;
|
;;
|
||||||
darwin_arm)
|
|
||||||
mkerrors="$mkerrors"
|
|
||||||
mksyscall="go run mksyscall.go -l32"
|
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
|
||||||
mkasm="go run mkasm_darwin.go"
|
|
||||||
;;
|
|
||||||
darwin_arm64)
|
darwin_arm64)
|
||||||
mkerrors="$mkerrors -m64"
|
mkerrors="$mkerrors -m64"
|
||||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||||
|
@ -199,7 +187,7 @@ illumos_amd64)
|
||||||
mksyscall="go run mksyscall_solaris.go"
|
mksyscall="go run mksyscall_solaris.go"
|
||||||
mkerrors=
|
mkerrors=
|
||||||
mksysnum=
|
mksysnum=
|
||||||
mktypes=
|
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo 'unrecognized $GOOS_$GOARCH: ' "$GOOSARCH" 1>&2
|
echo 'unrecognized $GOOS_$GOARCH: ' "$GOOSARCH" 1>&2
|
||||||
|
|
56
vendor/golang.org/x/sys/unix/mkerrors.sh
generated
vendored
56
vendor/golang.org/x/sys/unix/mkerrors.sh
generated
vendored
|
@ -54,8 +54,9 @@ includes_AIX='
|
||||||
|
|
||||||
includes_Darwin='
|
includes_Darwin='
|
||||||
#define _DARWIN_C_SOURCE
|
#define _DARWIN_C_SOURCE
|
||||||
#define KERNEL
|
#define KERNEL 1
|
||||||
#define _DARWIN_USE_64_BIT_INODE
|
#define _DARWIN_USE_64_BIT_INODE
|
||||||
|
#define __APPLE_USE_RFC_3542
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <sys/attr.h>
|
#include <sys/attr.h>
|
||||||
#include <sys/clonefile.h>
|
#include <sys/clonefile.h>
|
||||||
|
@ -65,6 +66,7 @@ includes_Darwin='
|
||||||
#include <sys/ptrace.h>
|
#include <sys/ptrace.h>
|
||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
#include <sys/un.h>
|
||||||
#include <sys/sockio.h>
|
#include <sys/sockio.h>
|
||||||
#include <sys/sys_domain.h>
|
#include <sys/sys_domain.h>
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
|
@ -73,6 +75,7 @@ includes_Darwin='
|
||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <sys/xattr.h>
|
#include <sys/xattr.h>
|
||||||
|
#include <sys/vsock.h>
|
||||||
#include <net/bpf.h>
|
#include <net/bpf.h>
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
#include <net/if_types.h>
|
#include <net/if_types.h>
|
||||||
|
@ -80,6 +83,9 @@ includes_Darwin='
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <netinet/ip.h>
|
#include <netinet/ip.h>
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
|
|
||||||
|
// for backwards compatibility because moved TIOCREMOTE to Kernel.framework after MacOSX12.0.sdk.
|
||||||
|
#define TIOCREMOTE 0x80047469
|
||||||
'
|
'
|
||||||
|
|
||||||
includes_DragonFly='
|
includes_DragonFly='
|
||||||
|
@ -114,6 +120,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>
|
||||||
|
@ -198,6 +205,7 @@ struct ltchars {
|
||||||
#include <linux/bpf.h>
|
#include <linux/bpf.h>
|
||||||
#include <linux/can.h>
|
#include <linux/can.h>
|
||||||
#include <linux/can/error.h>
|
#include <linux/can/error.h>
|
||||||
|
#include <linux/can/netlink.h>
|
||||||
#include <linux/can/raw.h>
|
#include <linux/can/raw.h>
|
||||||
#include <linux/capability.h>
|
#include <linux/capability.h>
|
||||||
#include <linux/cryptouser.h>
|
#include <linux/cryptouser.h>
|
||||||
|
@ -213,7 +221,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/icmpv6.h>
|
#include <linux/hidraw.h>
|
||||||
#include <linux/if.h>
|
#include <linux/if.h>
|
||||||
#include <linux/if_addr.h>
|
#include <linux/if_addr.h>
|
||||||
#include <linux/if_alg.h>
|
#include <linux/if_alg.h>
|
||||||
|
@ -223,16 +231,21 @@ 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/kcm.h>
|
||||||
#include <linux/kexec.h>
|
#include <linux/kexec.h>
|
||||||
#include <linux/keyctl.h>
|
#include <linux/keyctl.h>
|
||||||
|
#include <linux/landlock.h>
|
||||||
#include <linux/loop.h>
|
#include <linux/loop.h>
|
||||||
#include <linux/lwtunnel.h>
|
#include <linux/lwtunnel.h>
|
||||||
#include <linux/magic.h>
|
#include <linux/magic.h>
|
||||||
#include <linux/memfd.h>
|
#include <linux/memfd.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
|
#include <linux/mount.h>
|
||||||
#include <linux/netfilter/nfnetlink.h>
|
#include <linux/netfilter/nfnetlink.h>
|
||||||
#include <linux/netlink.h>
|
#include <linux/netlink.h>
|
||||||
#include <linux/net_namespace.h>
|
#include <linux/net_namespace.h>
|
||||||
|
#include <linux/nfc.h>
|
||||||
#include <linux/nsfs.h>
|
#include <linux/nsfs.h>
|
||||||
#include <linux/perf_event.h>
|
#include <linux/perf_event.h>
|
||||||
#include <linux/pps.h>
|
#include <linux/pps.h>
|
||||||
|
@ -250,8 +263,10 @@ struct ltchars {
|
||||||
#include <linux/vm_sockets.h>
|
#include <linux/vm_sockets.h>
|
||||||
#include <linux/wait.h>
|
#include <linux/wait.h>
|
||||||
#include <linux/watchdog.h>
|
#include <linux/watchdog.h>
|
||||||
|
#include <linux/wireguard.h>
|
||||||
|
|
||||||
#include <mtd/ubi-user.h>
|
#include <mtd/ubi-user.h>
|
||||||
|
#include <mtd/mtd-user.h>
|
||||||
#include <net/route.h>
|
#include <net/route.h>
|
||||||
|
|
||||||
#if defined(__sparc__)
|
#if defined(__sparc__)
|
||||||
|
@ -299,6 +314,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='
|
||||||
|
@ -388,10 +414,11 @@ includes_SunOS='
|
||||||
#include <net/if_arp.h>
|
#include <net/if_arp.h>
|
||||||
#include <net/if_types.h>
|
#include <net/if_types.h>
|
||||||
#include <net/route.h>
|
#include <net/route.h>
|
||||||
|
#include <netinet/icmp6.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <termios.h>
|
|
||||||
#include <netinet/ip.h>
|
#include <netinet/ip.h>
|
||||||
#include <netinet/ip_mroute.h>
|
#include <netinet/ip_mroute.h>
|
||||||
|
#include <termios.h>
|
||||||
'
|
'
|
||||||
|
|
||||||
|
|
||||||
|
@ -446,6 +473,7 @@ ccflags="$@"
|
||||||
$2 !~ /^EPROC_/ &&
|
$2 !~ /^EPROC_/ &&
|
||||||
$2 !~ /^EQUIV_/ &&
|
$2 !~ /^EQUIV_/ &&
|
||||||
$2 !~ /^EXPR_/ &&
|
$2 !~ /^EXPR_/ &&
|
||||||
|
$2 !~ /^EVIOC/ &&
|
||||||
$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$/ ||
|
||||||
|
@ -477,13 +505,18 @@ ccflags="$@"
|
||||||
$2 ~ /^O?XTABS$/ ||
|
$2 ~ /^O?XTABS$/ ||
|
||||||
$2 ~ /^TC[IO](ON|OFF)$/ ||
|
$2 ~ /^TC[IO](ON|OFF)$/ ||
|
||||||
$2 ~ /^IN_/ ||
|
$2 ~ /^IN_/ ||
|
||||||
|
$2 ~ /^KCM/ ||
|
||||||
|
$2 ~ /^LANDLOCK_/ ||
|
||||||
$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)_/ ||
|
$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|TCP|MCAST|EVFILT|NOTE|SHUT|PROT|MAP|MFD|T?PACKET|MSG|SCM|MCL|DT|MADV|PR|LOCAL|TCPOPT)_/ ||
|
||||||
|
$2 ~ /^NFC_(GENL|PROTO|COMM|RF|SE|DIRECTION|LLCP|SOCKPROTO)_/ ||
|
||||||
|
$2 ~ /^NFC_.*_(MAX)?SIZE$/ ||
|
||||||
|
$2 ~ /^RAW_PAYLOAD_/ ||
|
||||||
$2 ~ /^TP_STATUS_/ ||
|
$2 ~ /^TP_STATUS_/ ||
|
||||||
$2 ~ /^FALLOC_/ ||
|
$2 ~ /^FALLOC_/ ||
|
||||||
$2 == "ICMPV6_FILTER" ||
|
$2 ~ /^ICMPV?6?_(FILTER|SEC)/ ||
|
||||||
$2 == "SOMAXCONN" ||
|
$2 == "SOMAXCONN" ||
|
||||||
$2 == "NAME_MAX" ||
|
$2 == "NAME_MAX" ||
|
||||||
$2 == "IFNAMSIZ" ||
|
$2 == "IFNAMSIZ" ||
|
||||||
|
@ -492,7 +525,7 @@ ccflags="$@"
|
||||||
$2 ~ /^HW_MACHINE$/ ||
|
$2 ~ /^HW_MACHINE$/ ||
|
||||||
$2 ~ /^SYSCTL_VERS/ ||
|
$2 ~ /^SYSCTL_VERS/ ||
|
||||||
$2 !~ "MNT_BITS" &&
|
$2 !~ "MNT_BITS" &&
|
||||||
$2 ~ /^(MS|MNT|UMOUNT)_/ ||
|
$2 ~ /^(MS|MNT|MOUNT|UMOUNT)_/ ||
|
||||||
$2 ~ /^NS_GET_/ ||
|
$2 ~ /^NS_GET_/ ||
|
||||||
$2 ~ /^TUN(SET|GET|ATTACH|DETACH)/ ||
|
$2 ~ /^TUN(SET|GET|ATTACH|DETACH)/ ||
|
||||||
$2 ~ /^(O|F|[ES]?FD|NAME|S|PTRACE|PT|TFD)_/ ||
|
$2 ~ /^(O|F|[ES]?FD|NAME|S|PTRACE|PT|TFD)_/ ||
|
||||||
|
@ -538,6 +571,7 @@ ccflags="$@"
|
||||||
$2 ~ /^KEYCTL_/ ||
|
$2 ~ /^KEYCTL_/ ||
|
||||||
$2 ~ /^PERF_/ ||
|
$2 ~ /^PERF_/ ||
|
||||||
$2 ~ /^SECCOMP_MODE_/ ||
|
$2 ~ /^SECCOMP_MODE_/ ||
|
||||||
|
$2 ~ /^SEEK_/ ||
|
||||||
$2 ~ /^SPLICE_/ ||
|
$2 ~ /^SPLICE_/ ||
|
||||||
$2 ~ /^SYNC_FILE_RANGE_/ ||
|
$2 ~ /^SYNC_FILE_RANGE_/ ||
|
||||||
$2 !~ /^AUDIT_RECORD_MAGIC/ &&
|
$2 !~ /^AUDIT_RECORD_MAGIC/ &&
|
||||||
|
@ -566,10 +600,19 @@ ccflags="$@"
|
||||||
$2 ~ /^DEVLINK_/ ||
|
$2 ~ /^DEVLINK_/ ||
|
||||||
$2 ~ /^ETHTOOL_/ ||
|
$2 ~ /^ETHTOOL_/ ||
|
||||||
$2 ~ /^LWTUNNEL_IP/ ||
|
$2 ~ /^LWTUNNEL_IP/ ||
|
||||||
|
$2 ~ /^ITIMER_/ ||
|
||||||
$2 !~ "WMESGLEN" &&
|
$2 !~ "WMESGLEN" &&
|
||||||
$2 ~ /^W[A-Z0-9]+$/ ||
|
$2 ~ /^W[A-Z0-9]+$/ ||
|
||||||
|
$2 ~ /^P_/ ||
|
||||||
$2 ~/^PPPIOC/ ||
|
$2 ~/^PPPIOC/ ||
|
||||||
$2 ~ /^FAN_|FANOTIFY_/ ||
|
$2 ~ /^FAN_|FANOTIFY_/ ||
|
||||||
|
$2 == "HID_MAX_DESCRIPTOR_SIZE" ||
|
||||||
|
$2 ~ /^_?HIDIOC/ ||
|
||||||
|
$2 ~ /^BUS_(USB|HIL|BLUETOOTH|VIRTUAL)$/ ||
|
||||||
|
$2 ~ /^MTD/ ||
|
||||||
|
$2 ~ /^OTP/ ||
|
||||||
|
$2 ~ /^MEM/ ||
|
||||||
|
$2 ~ /^WG/ ||
|
||||||
$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)}
|
||||||
|
@ -607,6 +650,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
vendor/golang.org/x/sys/unix/pagesize_unix.go
generated
vendored
1
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
vendor/golang.org/x/sys/unix/ptrace_darwin.go
generated
vendored
1
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
vendor/golang.org/x/sys/unix/ptrace_ios.go
generated
vendored
1
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
vendor/golang.org/x/sys/unix/race.go
generated
vendored
1
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
vendor/golang.org/x/sys/unix/race0.go
generated
vendored
3
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
vendor/golang.org/x/sys/unix/readdirent_getdents.go
generated
vendored
1
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
vendor/golang.org/x/sys/unix/readdirent_getdirentries.go
generated
vendored
1
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
|
||||||
|
|
49
vendor/golang.org/x/sys/unix/sockcmsg_linux.go
generated
vendored
49
vendor/golang.org/x/sys/unix/sockcmsg_linux.go
generated
vendored
|
@ -34,3 +34,52 @@ func ParseUnixCredentials(m *SocketControlMessage) (*Ucred, error) {
|
||||||
ucred := *(*Ucred)(unsafe.Pointer(&m.Data[0]))
|
ucred := *(*Ucred)(unsafe.Pointer(&m.Data[0]))
|
||||||
return &ucred, nil
|
return &ucred, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PktInfo4 encodes Inet4Pktinfo into a socket control message of type IP_PKTINFO.
|
||||||
|
func PktInfo4(info *Inet4Pktinfo) []byte {
|
||||||
|
b := make([]byte, CmsgSpace(SizeofInet4Pktinfo))
|
||||||
|
h := (*Cmsghdr)(unsafe.Pointer(&b[0]))
|
||||||
|
h.Level = SOL_IP
|
||||||
|
h.Type = IP_PKTINFO
|
||||||
|
h.SetLen(CmsgLen(SizeofInet4Pktinfo))
|
||||||
|
*(*Inet4Pktinfo)(h.data(0)) = *info
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// PktInfo6 encodes Inet6Pktinfo into a socket control message of type IPV6_PKTINFO.
|
||||||
|
func PktInfo6(info *Inet6Pktinfo) []byte {
|
||||||
|
b := make([]byte, CmsgSpace(SizeofInet6Pktinfo))
|
||||||
|
h := (*Cmsghdr)(unsafe.Pointer(&b[0]))
|
||||||
|
h.Level = SOL_IPV6
|
||||||
|
h.Type = IPV6_PKTINFO
|
||||||
|
h.SetLen(CmsgLen(SizeofInet6Pktinfo))
|
||||||
|
*(*Inet6Pktinfo)(h.data(0)) = *info
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
// ParseOrigDstAddr decodes a socket control message containing the original
|
||||||
|
// destination address. To receive such a message the IP_RECVORIGDSTADDR or
|
||||||
|
// IPV6_RECVORIGDSTADDR option must be enabled on the socket.
|
||||||
|
func ParseOrigDstAddr(m *SocketControlMessage) (Sockaddr, error) {
|
||||||
|
switch {
|
||||||
|
case m.Header.Level == SOL_IP && m.Header.Type == IP_ORIGDSTADDR:
|
||||||
|
pp := (*RawSockaddrInet4)(unsafe.Pointer(&m.Data[0]))
|
||||||
|
sa := new(SockaddrInet4)
|
||||||
|
p := (*[2]byte)(unsafe.Pointer(&pp.Port))
|
||||||
|
sa.Port = int(p[0])<<8 + int(p[1])
|
||||||
|
sa.Addr = pp.Addr
|
||||||
|
return sa, nil
|
||||||
|
|
||||||
|
case m.Header.Level == SOL_IPV6 && m.Header.Type == IPV6_ORIGDSTADDR:
|
||||||
|
pp := (*RawSockaddrInet6)(unsafe.Pointer(&m.Data[0]))
|
||||||
|
sa := new(SockaddrInet6)
|
||||||
|
p := (*[2]byte)(unsafe.Pointer(&pp.Port))
|
||||||
|
sa.Port = int(p[0])<<8 + int(p[1])
|
||||||
|
sa.ZoneId = pp.Scope_id
|
||||||
|
sa.Addr = pp.Addr
|
||||||
|
return sa, nil
|
||||||
|
|
||||||
|
default:
|
||||||
|
return nil, EINVAL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
3
vendor/golang.org/x/sys/unix/sockcmsg_unix.go
generated
vendored
3
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
vendor/golang.org/x/sys/unix/sockcmsg_unix_other.go
generated
vendored
7
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
vendor/golang.org/x/sys/unix/str.go
generated
vendored
1
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
vendor/golang.org/x/sys/unix/syscall.go
generated
vendored
3
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
|
||||||
|
|
43
vendor/golang.org/x/sys/unix/syscall_aix.go
generated
vendored
43
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.
|
||||||
|
@ -69,9 +70,7 @@ func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||||
p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port))
|
p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port))
|
||||||
p[0] = byte(sa.Port >> 8)
|
p[0] = byte(sa.Port >> 8)
|
||||||
p[1] = byte(sa.Port)
|
p[1] = byte(sa.Port)
|
||||||
for i := 0; i < len(sa.Addr); i++ {
|
sa.raw.Addr = sa.Addr
|
||||||
sa.raw.Addr[i] = sa.Addr[i]
|
|
||||||
}
|
|
||||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrInet4, nil
|
return unsafe.Pointer(&sa.raw), SizeofSockaddrInet4, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,9 +83,7 @@ func (sa *SockaddrInet6) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||||
p[0] = byte(sa.Port >> 8)
|
p[0] = byte(sa.Port >> 8)
|
||||||
p[1] = byte(sa.Port)
|
p[1] = byte(sa.Port)
|
||||||
sa.raw.Scope_id = sa.ZoneId
|
sa.raw.Scope_id = sa.ZoneId
|
||||||
for i := 0; i < len(sa.Addr); i++ {
|
sa.raw.Addr = sa.Addr
|
||||||
sa.raw.Addr[i] = sa.Addr[i]
|
|
||||||
}
|
|
||||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrInet6, nil
|
return unsafe.Pointer(&sa.raw), SizeofSockaddrInet6, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,18 +215,12 @@ func Accept(fd int) (nfd int, sa Sockaddr, err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) {
|
func recvmsgRaw(fd int, p, oob []byte, flags int, rsa *RawSockaddrAny) (n, oobn int, recvflags int, err error) {
|
||||||
// Recvmsg not implemented on AIX
|
// Recvmsg not implemented on AIX
|
||||||
sa := new(SockaddrUnix)
|
return -1, -1, -1, ENOSYS
|
||||||
return -1, -1, -1, sa, ENOSYS
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func Sendmsg(fd int, p, oob []byte, to Sockaddr, flags int) (err error) {
|
func sendmsgN(fd int, p, oob []byte, ptr unsafe.Pointer, salen _Socklen, flags int) (n int, err error) {
|
||||||
_, err = SendmsgN(fd, p, oob, to, flags)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error) {
|
|
||||||
// SendmsgN not implemented on AIX
|
// SendmsgN not implemented on AIX
|
||||||
return -1, ENOSYS
|
return -1, ENOSYS
|
||||||
}
|
}
|
||||||
|
@ -251,7 +242,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes := (*[10000]byte)(unsafe.Pointer(&pp.Path[0]))[0:n]
|
bytes := (*[len(pp.Path)]byte)(unsafe.Pointer(&pp.Path[0]))[0:n]
|
||||||
sa.Name = string(bytes)
|
sa.Name = string(bytes)
|
||||||
return sa, nil
|
return sa, nil
|
||||||
|
|
||||||
|
@ -260,9 +251,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||||
sa := new(SockaddrInet4)
|
sa := new(SockaddrInet4)
|
||||||
p := (*[2]byte)(unsafe.Pointer(&pp.Port))
|
p := (*[2]byte)(unsafe.Pointer(&pp.Port))
|
||||||
sa.Port = int(p[0])<<8 + int(p[1])
|
sa.Port = int(p[0])<<8 + int(p[1])
|
||||||
for i := 0; i < len(sa.Addr); i++ {
|
sa.Addr = pp.Addr
|
||||||
sa.Addr[i] = pp.Addr[i]
|
|
||||||
}
|
|
||||||
return sa, nil
|
return sa, nil
|
||||||
|
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
|
@ -271,9 +260,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||||
p := (*[2]byte)(unsafe.Pointer(&pp.Port))
|
p := (*[2]byte)(unsafe.Pointer(&pp.Port))
|
||||||
sa.Port = int(p[0])<<8 + int(p[1])
|
sa.Port = int(p[0])<<8 + int(p[1])
|
||||||
sa.ZoneId = pp.Scope_id
|
sa.ZoneId = pp.Scope_id
|
||||||
for i := 0; i < len(sa.Addr); i++ {
|
sa.Addr = pp.Addr
|
||||||
sa.Addr[i] = pp.Addr[i]
|
|
||||||
}
|
|
||||||
return sa, nil
|
return sa, nil
|
||||||
}
|
}
|
||||||
return nil, EAFNOSUPPORT
|
return nil, EAFNOSUPPORT
|
||||||
|
@ -384,6 +371,11 @@ func (w WaitStatus) TrapCause() int { return -1 }
|
||||||
|
|
||||||
//sys fcntl(fd int, cmd int, arg int) (val int, err error)
|
//sys fcntl(fd int, cmd int, arg int) (val int, err error)
|
||||||
|
|
||||||
|
//sys fsyncRange(fd int, how int, start int64, length int64) (err error) = fsync_range
|
||||||
|
func Fsync(fd int) error {
|
||||||
|
return fsyncRange(fd, O_SYNC, 0, 0)
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Direct access
|
* Direct access
|
||||||
*/
|
*/
|
||||||
|
@ -400,7 +392,6 @@ func (w WaitStatus) TrapCause() int { return -1 }
|
||||||
//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error)
|
//sys Fchmodat(dirfd int, path string, mode uint32, flags int) (err error)
|
||||||
//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
|
//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
|
||||||
//sys Fdatasync(fd int) (err error)
|
//sys Fdatasync(fd int) (err error)
|
||||||
//sys Fsync(fd int) (err error)
|
|
||||||
// readdir_r
|
// readdir_r
|
||||||
//sysnb Getpgid(pid int) (pgid int, err error)
|
//sysnb Getpgid(pid int) (pgid int, err error)
|
||||||
|
|
||||||
|
@ -461,8 +452,8 @@ func (w WaitStatus) TrapCause() int { return -1 }
|
||||||
//sys Listen(s int, n int) (err error)
|
//sys Listen(s int, n int) (err error)
|
||||||
//sys lstat(path string, stat *Stat_t) (err error)
|
//sys lstat(path string, stat *Stat_t) (err error)
|
||||||
//sys Pause() (err error)
|
//sys Pause() (err error)
|
||||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = pread64
|
//sys pread(fd int, p []byte, offset int64) (n int, err error) = pread64
|
||||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = pwrite64
|
//sys pwrite(fd int, p []byte, offset int64) (n int, err error) = pwrite64
|
||||||
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
|
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
|
||||||
//sys Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error)
|
//sys Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error)
|
||||||
//sysnb Setregid(rgid int, egid int) (err error)
|
//sysnb Setregid(rgid int, egid int) (err error)
|
||||||
|
@ -522,8 +513,10 @@ func Pipe(p []int) (err error) {
|
||||||
}
|
}
|
||||||
var pp [2]_C_int
|
var pp [2]_C_int
|
||||||
err = pipe(&pp)
|
err = pipe(&pp)
|
||||||
|
if err == nil {
|
||||||
p[0] = int(pp[0])
|
p[0] = int(pp[0])
|
||||||
p[1] = int(pp[1])
|
p[1] = int(pp[1])
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4
vendor/golang.org/x/sys/unix/syscall_aix_ppc.go
generated
vendored
4
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
vendor/golang.org/x/sys/unix/syscall_aix_ppc64.go
generated
vendored
4
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
|
||||||
|
|
||||||
|
|
60
vendor/golang.org/x/sys/unix/syscall_bsd.go
generated
vendored
60
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
|
||||||
|
@ -162,9 +163,7 @@ func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||||
p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port))
|
p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port))
|
||||||
p[0] = byte(sa.Port >> 8)
|
p[0] = byte(sa.Port >> 8)
|
||||||
p[1] = byte(sa.Port)
|
p[1] = byte(sa.Port)
|
||||||
for i := 0; i < len(sa.Addr); i++ {
|
sa.raw.Addr = sa.Addr
|
||||||
sa.raw.Addr[i] = sa.Addr[i]
|
|
||||||
}
|
|
||||||
return unsafe.Pointer(&sa.raw), _Socklen(sa.raw.Len), nil
|
return unsafe.Pointer(&sa.raw), _Socklen(sa.raw.Len), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,9 +177,7 @@ func (sa *SockaddrInet6) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||||
p[0] = byte(sa.Port >> 8)
|
p[0] = byte(sa.Port >> 8)
|
||||||
p[1] = byte(sa.Port)
|
p[1] = byte(sa.Port)
|
||||||
sa.raw.Scope_id = sa.ZoneId
|
sa.raw.Scope_id = sa.ZoneId
|
||||||
for i := 0; i < len(sa.Addr); i++ {
|
sa.raw.Addr = sa.Addr
|
||||||
sa.raw.Addr[i] = sa.Addr[i]
|
|
||||||
}
|
|
||||||
return unsafe.Pointer(&sa.raw), _Socklen(sa.raw.Len), nil
|
return unsafe.Pointer(&sa.raw), _Socklen(sa.raw.Len), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,9 +206,7 @@ func (sa *SockaddrDatalink) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||||
sa.raw.Nlen = sa.Nlen
|
sa.raw.Nlen = sa.Nlen
|
||||||
sa.raw.Alen = sa.Alen
|
sa.raw.Alen = sa.Alen
|
||||||
sa.raw.Slen = sa.Slen
|
sa.raw.Slen = sa.Slen
|
||||||
for i := 0; i < len(sa.raw.Data); i++ {
|
sa.raw.Data = sa.Data
|
||||||
sa.raw.Data[i] = sa.Data[i]
|
|
||||||
}
|
|
||||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrDatalink, nil
|
return unsafe.Pointer(&sa.raw), SizeofSockaddrDatalink, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,9 +222,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||||
sa.Nlen = pp.Nlen
|
sa.Nlen = pp.Nlen
|
||||||
sa.Alen = pp.Alen
|
sa.Alen = pp.Alen
|
||||||
sa.Slen = pp.Slen
|
sa.Slen = pp.Slen
|
||||||
for i := 0; i < len(sa.Data); i++ {
|
sa.Data = pp.Data
|
||||||
sa.Data[i] = pp.Data[i]
|
|
||||||
}
|
|
||||||
return sa, nil
|
return sa, nil
|
||||||
|
|
||||||
case AF_UNIX:
|
case AF_UNIX:
|
||||||
|
@ -261,9 +254,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||||
sa := new(SockaddrInet4)
|
sa := new(SockaddrInet4)
|
||||||
p := (*[2]byte)(unsafe.Pointer(&pp.Port))
|
p := (*[2]byte)(unsafe.Pointer(&pp.Port))
|
||||||
sa.Port = int(p[0])<<8 + int(p[1])
|
sa.Port = int(p[0])<<8 + int(p[1])
|
||||||
for i := 0; i < len(sa.Addr); i++ {
|
sa.Addr = pp.Addr
|
||||||
sa.Addr[i] = pp.Addr[i]
|
|
||||||
}
|
|
||||||
return sa, nil
|
return sa, nil
|
||||||
|
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
|
@ -272,9 +263,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||||
p := (*[2]byte)(unsafe.Pointer(&pp.Port))
|
p := (*[2]byte)(unsafe.Pointer(&pp.Port))
|
||||||
sa.Port = int(p[0])<<8 + int(p[1])
|
sa.Port = int(p[0])<<8 + int(p[1])
|
||||||
sa.ZoneId = pp.Scope_id
|
sa.ZoneId = pp.Scope_id
|
||||||
for i := 0; i < len(sa.Addr); i++ {
|
sa.Addr = pp.Addr
|
||||||
sa.Addr[i] = pp.Addr[i]
|
|
||||||
}
|
|
||||||
return sa, nil
|
return sa, nil
|
||||||
}
|
}
|
||||||
return anyToSockaddrGOOS(fd, rsa)
|
return anyToSockaddrGOOS(fd, rsa)
|
||||||
|
@ -336,10 +325,9 @@ func GetsockoptString(fd, level, opt int) (string, error) {
|
||||||
//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
|
//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
|
||||||
//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
|
//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
|
||||||
|
|
||||||
func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) {
|
func recvmsgRaw(fd int, p, oob []byte, flags int, rsa *RawSockaddrAny) (n, oobn int, recvflags int, err error) {
|
||||||
var msg Msghdr
|
var msg Msghdr
|
||||||
var rsa RawSockaddrAny
|
msg.Name = (*byte)(unsafe.Pointer(rsa))
|
||||||
msg.Name = (*byte)(unsafe.Pointer(&rsa))
|
|
||||||
msg.Namelen = uint32(SizeofSockaddrAny)
|
msg.Namelen = uint32(SizeofSockaddrAny)
|
||||||
var iov Iovec
|
var iov Iovec
|
||||||
if len(p) > 0 {
|
if len(p) > 0 {
|
||||||
|
@ -363,29 +351,12 @@ func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from
|
||||||
}
|
}
|
||||||
oobn = int(msg.Controllen)
|
oobn = int(msg.Controllen)
|
||||||
recvflags = int(msg.Flags)
|
recvflags = int(msg.Flags)
|
||||||
// source address is only specified if the socket is unconnected
|
|
||||||
if rsa.Addr.Family != AF_UNSPEC {
|
|
||||||
from, err = anyToSockaddr(fd, &rsa)
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
|
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
|
||||||
|
|
||||||
func Sendmsg(fd int, p, oob []byte, to Sockaddr, flags int) (err error) {
|
func sendmsgN(fd int, p, oob []byte, ptr unsafe.Pointer, salen _Socklen, flags int) (n int, err error) {
|
||||||
_, err = SendmsgN(fd, p, oob, to, flags)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error) {
|
|
||||||
var ptr unsafe.Pointer
|
|
||||||
var salen _Socklen
|
|
||||||
if to != nil {
|
|
||||||
ptr, salen, err = to.sockaddr()
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var msg Msghdr
|
var msg Msghdr
|
||||||
msg.Name = (*byte)(unsafe.Pointer(ptr))
|
msg.Name = (*byte)(unsafe.Pointer(ptr))
|
||||||
msg.Namelen = uint32(salen)
|
msg.Namelen = uint32(salen)
|
||||||
|
@ -582,12 +553,7 @@ func UtimesNano(path string, ts []Timespec) error {
|
||||||
if len(ts) != 2 {
|
if len(ts) != 2 {
|
||||||
return EINVAL
|
return EINVAL
|
||||||
}
|
}
|
||||||
// Darwin setattrlist can set nanosecond timestamps
|
err := utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
|
||||||
err := setattrlistTimes(path, ts, 0)
|
|
||||||
if err != ENOSYS {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
err = utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
|
|
||||||
if err != ENOSYS {
|
if err != ENOSYS {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -607,10 +573,6 @@ func UtimesNanoAt(dirfd int, path string, ts []Timespec, flags int) error {
|
||||||
if len(ts) != 2 {
|
if len(ts) != 2 {
|
||||||
return EINVAL
|
return EINVAL
|
||||||
}
|
}
|
||||||
err := setattrlistTimes(path, ts, flags)
|
|
||||||
if err != ENOSYS {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return utimensat(dirfd, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), flags)
|
return utimensat(dirfd, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1
vendor/golang.org/x/sys/unix/syscall_darwin.1_12.go
generated
vendored
1
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
|
||||||
|
|
5
vendor/golang.org/x/sys/unix/syscall_darwin.1_13.go
generated
vendored
5
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
|
||||||
|
@ -16,7 +17,7 @@ import (
|
||||||
//sys readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno)
|
//sys readdir_r(dir uintptr, entry *Dirent, result **Dirent) (res Errno)
|
||||||
|
|
||||||
func fdopendir(fd int) (dir uintptr, err error) {
|
func fdopendir(fd int) (dir uintptr, err error) {
|
||||||
r0, _, e1 := syscall_syscallPtr(funcPC(libc_fdopendir_trampoline), uintptr(fd), 0, 0)
|
r0, _, e1 := syscall_syscallPtr(libc_fdopendir_trampoline_addr, uintptr(fd), 0, 0)
|
||||||
dir = uintptr(r0)
|
dir = uintptr(r0)
|
||||||
if e1 != 0 {
|
if e1 != 0 {
|
||||||
err = errnoErr(e1)
|
err = errnoErr(e1)
|
||||||
|
@ -24,7 +25,7 @@ func fdopendir(fd int) (dir uintptr, err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func libc_fdopendir_trampoline()
|
var libc_fdopendir_trampoline_addr uintptr
|
||||||
|
|
||||||
//go:cgo_import_dynamic libc_fdopendir fdopendir "/usr/lib/libSystem.B.dylib"
|
//go:cgo_import_dynamic libc_fdopendir fdopendir "/usr/lib/libSystem.B.dylib"
|
||||||
|
|
||||||
|
|
157
vendor/golang.org/x/sys/unix/syscall_darwin.go
generated
vendored
157
vendor/golang.org/x/sys/unix/syscall_darwin.go
generated
vendored
|
@ -13,6 +13,7 @@
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"runtime"
|
"runtime"
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
@ -47,6 +48,30 @@ func (sa *SockaddrCtl) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrCtl, nil
|
return unsafe.Pointer(&sa.raw), SizeofSockaddrCtl, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SockaddrVM implements the Sockaddr interface for AF_VSOCK type sockets.
|
||||||
|
// SockaddrVM provides access to Darwin VM sockets: a mechanism that enables
|
||||||
|
// bidirectional communication between a hypervisor and its guest virtual
|
||||||
|
// machines.
|
||||||
|
type SockaddrVM struct {
|
||||||
|
// CID and Port specify a context ID and port address for a VM socket.
|
||||||
|
// Guests have a unique CID, and hosts may have a well-known CID of:
|
||||||
|
// - VMADDR_CID_HYPERVISOR: refers to the hypervisor process.
|
||||||
|
// - VMADDR_CID_LOCAL: refers to local communication (loopback).
|
||||||
|
// - VMADDR_CID_HOST: refers to other processes on the host.
|
||||||
|
CID uint32
|
||||||
|
Port uint32
|
||||||
|
raw RawSockaddrVM
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sa *SockaddrVM) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||||
|
sa.raw.Len = SizeofSockaddrVM
|
||||||
|
sa.raw.Family = AF_VSOCK
|
||||||
|
sa.raw.Port = sa.Port
|
||||||
|
sa.raw.Cid = sa.CID
|
||||||
|
|
||||||
|
return unsafe.Pointer(&sa.raw), SizeofSockaddrVM, nil
|
||||||
|
}
|
||||||
|
|
||||||
func anyToSockaddrGOOS(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
func anyToSockaddrGOOS(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||||
switch rsa.Addr.Family {
|
switch rsa.Addr.Family {
|
||||||
case AF_SYSTEM:
|
case AF_SYSTEM:
|
||||||
|
@ -57,6 +82,13 @@ func anyToSockaddrGOOS(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||||
sa.Unit = pp.Sc_unit
|
sa.Unit = pp.Sc_unit
|
||||||
return sa, nil
|
return sa, nil
|
||||||
}
|
}
|
||||||
|
case AF_VSOCK:
|
||||||
|
pp := (*RawSockaddrVM)(unsafe.Pointer(rsa))
|
||||||
|
sa := &SockaddrVM{
|
||||||
|
CID: pp.Cid,
|
||||||
|
Port: pp.Port,
|
||||||
|
}
|
||||||
|
return sa, nil
|
||||||
}
|
}
|
||||||
return nil, EAFNOSUPPORT
|
return nil, EAFNOSUPPORT
|
||||||
}
|
}
|
||||||
|
@ -109,16 +141,6 @@ func direntNamlen(buf []byte) (uint64, bool) {
|
||||||
func PtraceAttach(pid int) (err error) { return ptrace(PT_ATTACH, pid, 0, 0) }
|
func PtraceAttach(pid int) (err error) { return ptrace(PT_ATTACH, pid, 0, 0) }
|
||||||
func PtraceDetach(pid int) (err error) { return ptrace(PT_DETACH, pid, 0, 0) }
|
func PtraceDetach(pid int) (err error) { return ptrace(PT_DETACH, pid, 0, 0) }
|
||||||
|
|
||||||
type attrList struct {
|
|
||||||
bitmapCount uint16
|
|
||||||
_ uint16
|
|
||||||
CommonAttr uint32
|
|
||||||
VolAttr uint32
|
|
||||||
DirAttr uint32
|
|
||||||
FileAttr uint32
|
|
||||||
Forkattr uint32
|
|
||||||
}
|
|
||||||
|
|
||||||
//sysnb pipe(p *[2]int32) (err error)
|
//sysnb pipe(p *[2]int32) (err error)
|
||||||
|
|
||||||
func Pipe(p []int) (err error) {
|
func Pipe(p []int) (err error) {
|
||||||
|
@ -127,8 +149,10 @@ func Pipe(p []int) (err error) {
|
||||||
}
|
}
|
||||||
var x [2]int32
|
var x [2]int32
|
||||||
err = pipe(&x)
|
err = pipe(&x)
|
||||||
|
if err == nil {
|
||||||
p[0] = int(x[0])
|
p[0] = int(x[0])
|
||||||
p[1] = int(x[1])
|
p[1] = int(x[1])
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,36 +272,7 @@ func Flistxattr(fd int, dest []byte) (sz int, err error) {
|
||||||
return flistxattr(fd, xattrPointer(dest), len(dest), 0)
|
return flistxattr(fd, xattrPointer(dest), len(dest), 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
func setattrlistTimes(path string, times []Timespec, flags int) error {
|
//sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error)
|
||||||
_p0, err := BytePtrFromString(path)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
var attrList attrList
|
|
||||||
attrList.bitmapCount = ATTR_BIT_MAP_COUNT
|
|
||||||
attrList.CommonAttr = ATTR_CMN_MODTIME | ATTR_CMN_ACCTIME
|
|
||||||
|
|
||||||
// order is mtime, atime: the opposite of Chtimes
|
|
||||||
attributes := [2]Timespec{times[1], times[0]}
|
|
||||||
options := 0
|
|
||||||
if flags&AT_SYMLINK_NOFOLLOW != 0 {
|
|
||||||
options |= FSOPT_NOFOLLOW
|
|
||||||
}
|
|
||||||
return setattrlist(
|
|
||||||
_p0,
|
|
||||||
unsafe.Pointer(&attrList),
|
|
||||||
unsafe.Pointer(&attributes),
|
|
||||||
unsafe.Sizeof(attributes),
|
|
||||||
options)
|
|
||||||
}
|
|
||||||
|
|
||||||
//sys setattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error)
|
|
||||||
|
|
||||||
func utimensat(dirfd int, path string, times *[2]Timespec, flags int) error {
|
|
||||||
// Darwin doesn't support SYS_UTIMENSAT
|
|
||||||
return ENOSYS
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Wrapped
|
* Wrapped
|
||||||
|
@ -378,8 +373,82 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetsockoptIPMreqn(fd, level, opt int) (*IPMreqn, error) {
|
||||||
|
var value IPMreqn
|
||||||
|
vallen := _Socklen(SizeofIPMreqn)
|
||||||
|
errno := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
|
||||||
|
return &value, errno
|
||||||
|
}
|
||||||
|
|
||||||
|
func SetsockoptIPMreqn(fd, level, opt int, mreq *IPMreqn) (err error) {
|
||||||
|
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 SysctlKinfoProc(name string, args ...int) (*KinfoProc, error) {
|
||||||
|
mib, err := sysctlmib(name, args...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var kinfo KinfoProc
|
||||||
|
n := uintptr(SizeofKinfoProc)
|
||||||
|
if err := sysctl(mib, (*byte)(unsafe.Pointer(&kinfo)), &n, nil, 0); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if n != SizeofKinfoProc {
|
||||||
|
return nil, EIO
|
||||||
|
}
|
||||||
|
return &kinfo, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, error) {
|
||||||
|
mib, err := sysctlmib(name, args...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find size.
|
||||||
|
n := uintptr(0)
|
||||||
|
if err := sysctl(mib, nil, &n, nil, 0); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if n == 0 {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
if n%SizeofKinfoProc != 0 {
|
||||||
|
return nil, fmt.Errorf("sysctl() returned a size of %d, which is not a multiple of %d", n, SizeofKinfoProc)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read into buffer of that size.
|
||||||
|
buf := make([]KinfoProc, n/SizeofKinfoProc)
|
||||||
|
if err := sysctl(mib, (*byte)(unsafe.Pointer(&buf[0])), &n, nil, 0); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if n%SizeofKinfoProc != 0 {
|
||||||
|
return nil, fmt.Errorf("sysctl() returned a size of %d, which is not a multiple of %d", n, SizeofKinfoProc)
|
||||||
|
}
|
||||||
|
|
||||||
|
// The actual call may return less than the original reported required
|
||||||
|
// size so ensure we deal with that.
|
||||||
|
return buf[:n/SizeofKinfoProc], nil
|
||||||
|
}
|
||||||
|
|
||||||
//sys sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error)
|
//sys sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error)
|
||||||
|
|
||||||
|
//sys shmat(id int, addr uintptr, flag int) (ret uintptr, err error)
|
||||||
|
//sys shmctl(id int, cmd int, buf *SysvShmDesc) (result int, err error)
|
||||||
|
//sys shmdt(addr uintptr) (err error)
|
||||||
|
//sys shmget(key int, size int, flag int) (id int, err error)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Exposed directly
|
* Exposed directly
|
||||||
*/
|
*/
|
||||||
|
@ -438,8 +507,8 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
|
||||||
//sys Open(path string, mode int, perm uint32) (fd int, err error)
|
//sys Open(path string, mode int, perm uint32) (fd int, err error)
|
||||||
//sys Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error)
|
//sys Openat(dirfd int, path string, mode int, perm uint32) (fd int, err error)
|
||||||
//sys Pathconf(path string, name int) (val int, err error)
|
//sys Pathconf(path string, name int) (val int, err error)
|
||||||
//sys Pread(fd int, p []byte, offset int64) (n 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 pwrite(fd int, p []byte, offset int64) (n int, err error)
|
||||||
//sys read(fd int, p []byte) (n int, err error)
|
//sys read(fd int, p []byte) (n int, err error)
|
||||||
//sys Readlink(path string, buf []byte) (n int, err error)
|
//sys Readlink(path string, buf []byte) (n int, err error)
|
||||||
//sys Readlinkat(dirfd int, path string, buf []byte) (n int, err error)
|
//sys Readlinkat(dirfd int, path string, buf []byte) (n int, err error)
|
||||||
|
@ -537,10 +606,6 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
|
||||||
// Msgget
|
// Msgget
|
||||||
// Msgsnd
|
// Msgsnd
|
||||||
// Msgrcv
|
// Msgrcv
|
||||||
// Shmat
|
|
||||||
// Shmctl
|
|
||||||
// Shmdt
|
|
||||||
// Shmget
|
|
||||||
// Shm_open
|
// Shm_open
|
||||||
// Shm_unlink
|
// Shm_unlink
|
||||||
// Sem_open
|
// Sem_open
|
||||||
|
|
50
vendor/golang.org/x/sys/unix/syscall_darwin_386.go
generated
vendored
50
vendor/golang.org/x/sys/unix/syscall_darwin_386.go
generated
vendored
|
@ -1,50 +0,0 @@
|
||||||
// Copyright 2009 The Go Authors. All rights reserved.
|
|
||||||
// Use of this source code is governed by a BSD-style
|
|
||||||
// license that can be found in the LICENSE file.
|
|
||||||
|
|
||||||
// +build 386,darwin
|
|
||||||
|
|
||||||
package unix
|
|
||||||
|
|
||||||
import "syscall"
|
|
||||||
|
|
||||||
func setTimespec(sec, nsec int64) Timespec {
|
|
||||||
return Timespec{Sec: int32(sec), Nsec: int32(nsec)}
|
|
||||||
}
|
|
||||||
|
|
||||||
func setTimeval(sec, usec int64) Timeval {
|
|
||||||
return Timeval{Sec: int32(sec), Usec: int32(usec)}
|
|
||||||
}
|
|
||||||
|
|
||||||
func SetKevent(k *Kevent_t, fd, mode, flags int) {
|
|
||||||
k.Ident = uint32(fd)
|
|
||||||
k.Filter = int16(mode)
|
|
||||||
k.Flags = uint16(flags)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (iov *Iovec) SetLen(length int) {
|
|
||||||
iov.Len = uint32(length)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (msghdr *Msghdr) SetControllen(length int) {
|
|
||||||
msghdr.Controllen = uint32(length)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (msghdr *Msghdr) SetIovlen(length int) {
|
|
||||||
msghdr.Iovlen = int32(length)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
|
||||||
cmsg.Len = uint32(length)
|
|
||||||
}
|
|
||||||
|
|
||||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
|
|
||||||
|
|
||||||
//sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64
|
|
||||||
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) = SYS_FSTATAT64
|
|
||||||
//sys Fstatfs(fd int, stat *Statfs_t) (err error) = SYS_FSTATFS64
|
|
||||||
//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT64
|
|
||||||
//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
|
|
||||||
//sys ptrace1(request int, pid int, addr uintptr, data uintptr) (err error) = SYS_ptrace
|
|
||||||
//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
|
|
||||||
//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64
|
|
1
vendor/golang.org/x/sys/unix/syscall_darwin_amd64.go
generated
vendored
1
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
|
||||||
|
|
51
vendor/golang.org/x/sys/unix/syscall_darwin_arm.go
generated
vendored
51
vendor/golang.org/x/sys/unix/syscall_darwin_arm.go
generated
vendored
|
@ -1,51 +0,0 @@
|
||||||
// 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.
|
|
||||||
|
|
||||||
package unix
|
|
||||||
|
|
||||||
import "syscall"
|
|
||||||
|
|
||||||
func ptrace1(request int, pid int, addr uintptr, data uintptr) error {
|
|
||||||
return ENOTSUP
|
|
||||||
}
|
|
||||||
|
|
||||||
func setTimespec(sec, nsec int64) Timespec {
|
|
||||||
return Timespec{Sec: int32(sec), Nsec: int32(nsec)}
|
|
||||||
}
|
|
||||||
|
|
||||||
func setTimeval(sec, usec int64) Timeval {
|
|
||||||
return Timeval{Sec: int32(sec), Usec: int32(usec)}
|
|
||||||
}
|
|
||||||
|
|
||||||
func SetKevent(k *Kevent_t, fd, mode, flags int) {
|
|
||||||
k.Ident = uint32(fd)
|
|
||||||
k.Filter = int16(mode)
|
|
||||||
k.Flags = uint16(flags)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (iov *Iovec) SetLen(length int) {
|
|
||||||
iov.Len = uint32(length)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (msghdr *Msghdr) SetControllen(length int) {
|
|
||||||
msghdr.Controllen = uint32(length)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (msghdr *Msghdr) SetIovlen(length int) {
|
|
||||||
msghdr.Iovlen = int32(length)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (cmsg *Cmsghdr) SetLen(length int) {
|
|
||||||
cmsg.Len = uint32(length)
|
|
||||||
}
|
|
||||||
|
|
||||||
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic
|
|
||||||
|
|
||||||
//sys Fstat(fd int, stat *Stat_t) (err error)
|
|
||||||
//sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error)
|
|
||||||
//sys Fstatfs(fd int, stat *Statfs_t) (err error)
|
|
||||||
//sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT
|
|
||||||
//sys Lstat(path string, stat *Stat_t) (err error)
|
|
||||||
//sys Stat(path string, stat *Stat_t) (err error)
|
|
||||||
//sys Statfs(path string, stat *Statfs_t) (err error)
|
|
1
vendor/golang.org/x/sys/unix/syscall_darwin_arm64.go
generated
vendored
1
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
|
||||||
|
|
10
vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go
generated
vendored
10
vendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go
generated
vendored
|
@ -2,11 +2,12 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build darwin && go1.12
|
||||||
// +build darwin,go1.12
|
// +build darwin,go1.12
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
import "unsafe"
|
import _ "unsafe"
|
||||||
|
|
||||||
// Implemented in the runtime package (runtime/sys_darwin.go)
|
// Implemented in the runtime package (runtime/sys_darwin.go)
|
||||||
func syscall_syscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)
|
func syscall_syscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)
|
||||||
|
@ -24,10 +25,3 @@ func syscall_syscallPtr(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)
|
||||||
//go:linkname syscall_rawSyscall syscall.rawSyscall
|
//go:linkname syscall_rawSyscall syscall.rawSyscall
|
||||||
//go:linkname syscall_rawSyscall6 syscall.rawSyscall6
|
//go:linkname syscall_rawSyscall6 syscall.rawSyscall6
|
||||||
//go:linkname syscall_syscallPtr syscall.syscallPtr
|
//go:linkname syscall_syscallPtr syscall.syscallPtr
|
||||||
|
|
||||||
// Find the entry point for f. See comments in runtime/proc.go for the
|
|
||||||
// function of the same name.
|
|
||||||
//go:nosplit
|
|
||||||
func funcPC(f func()) uintptr {
|
|
||||||
return **(**uintptr)(unsafe.Pointer(&f))
|
|
||||||
}
|
|
||||||
|
|
27
vendor/golang.org/x/sys/unix/syscall_dragonfly.go
generated
vendored
27
vendor/golang.org/x/sys/unix/syscall_dragonfly.go
generated
vendored
|
@ -101,30 +101,36 @@ func Pipe(p []int) (err error) {
|
||||||
if len(p) != 2 {
|
if len(p) != 2 {
|
||||||
return EINVAL
|
return EINVAL
|
||||||
}
|
}
|
||||||
p[0], p[1], err = pipe()
|
r, w, err := pipe()
|
||||||
|
if err == nil {
|
||||||
|
p[0], p[1] = r, w
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//sysnb pipe2(p *[2]_C_int, flags int) (err error)
|
//sysnb pipe2(p *[2]_C_int, flags int) (r int, w int, err error)
|
||||||
|
|
||||||
func Pipe2(p []int, flags int) error {
|
func Pipe2(p []int, flags int) (err error) {
|
||||||
if len(p) != 2 {
|
if len(p) != 2 {
|
||||||
return EINVAL
|
return EINVAL
|
||||||
}
|
}
|
||||||
var pp [2]_C_int
|
var pp [2]_C_int
|
||||||
err := pipe2(&pp, flags)
|
// pipe2 on dragonfly takes an fds array as an argument, but still
|
||||||
p[0] = int(pp[0])
|
// returns the file descriptors.
|
||||||
p[1] = int(pp[1])
|
r, w, err := pipe2(&pp, flags)
|
||||||
|
if err == nil {
|
||||||
|
p[0], p[1] = r, w
|
||||||
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
//sys extpread(fd int, p []byte, flags int, offset int64) (n int, err error)
|
//sys extpread(fd int, p []byte, flags int, offset int64) (n int, err error)
|
||||||
func Pread(fd int, p []byte, offset int64) (n int, err error) {
|
func pread(fd int, p []byte, offset int64) (n int, err error) {
|
||||||
return extpread(fd, p, 0, offset)
|
return extpread(fd, p, 0, offset)
|
||||||
}
|
}
|
||||||
|
|
||||||
//sys extpwrite(fd int, p []byte, flags int, offset int64) (n int, err error)
|
//sys extpwrite(fd int, p []byte, flags int, offset int64) (n int, err error)
|
||||||
func Pwrite(fd int, p []byte, offset int64) (n int, err error) {
|
func pwrite(fd int, p []byte, offset int64) (n int, err error) {
|
||||||
return extpwrite(fd, p, 0, offset)
|
return extpwrite(fd, p, 0, offset)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,11 +169,6 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func setattrlistTimes(path string, times []Timespec, flags int) error {
|
|
||||||
// used on Darwin for UtimesNano
|
|
||||||
return ENOSYS
|
|
||||||
}
|
|
||||||
|
|
||||||
//sys ioctl(fd int, req uint, arg uintptr) (err error)
|
//sys ioctl(fd int, req uint, arg uintptr) (err error)
|
||||||
|
|
||||||
//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
|
//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
|
||||||
|
|
1
vendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go
generated
vendored
1
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
|
||||||
|
|
20
vendor/golang.org/x/sys/unix/syscall_freebsd.go
generated
vendored
20
vendor/golang.org/x/sys/unix/syscall_freebsd.go
generated
vendored
|
@ -110,8 +110,10 @@ func Pipe2(p []int, flags int) error {
|
||||||
}
|
}
|
||||||
var pp [2]_C_int
|
var pp [2]_C_int
|
||||||
err := pipe2(&pp, flags)
|
err := pipe2(&pp, flags)
|
||||||
|
if err == nil {
|
||||||
p[0] = int(pp[0])
|
p[0] = int(pp[0])
|
||||||
p[1] = int(pp[1])
|
p[1] = int(pp[1])
|
||||||
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,6 +128,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
|
||||||
|
@ -183,11 +194,6 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func setattrlistTimes(path string, times []Timespec, flags int) error {
|
|
||||||
// used on Darwin for UtimesNano
|
|
||||||
return ENOSYS
|
|
||||||
}
|
|
||||||
|
|
||||||
//sys ioctl(fd int, req uint, arg uintptr) (err error)
|
//sys ioctl(fd int, req uint, arg uintptr) (err error)
|
||||||
|
|
||||||
//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
|
//sys sysctl(mib []_C_int, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) = SYS___SYSCTL
|
||||||
|
@ -627,8 +633,8 @@ func PtraceSingleStep(pid int) (err error) {
|
||||||
//sys Open(path string, mode int, perm uint32) (fd int, err error)
|
//sys Open(path string, mode int, perm uint32) (fd int, err error)
|
||||||
//sys Openat(fdat int, path string, mode int, perm uint32) (fd int, err error)
|
//sys Openat(fdat int, path string, mode int, perm uint32) (fd int, err error)
|
||||||
//sys Pathconf(path string, name int) (val int, err error)
|
//sys Pathconf(path string, name int) (val int, err error)
|
||||||
//sys Pread(fd int, p []byte, offset int64) (n 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 pwrite(fd int, p []byte, offset int64) (n int, err error)
|
||||||
//sys read(fd int, p []byte) (n int, err error)
|
//sys read(fd int, p []byte) (n int, err error)
|
||||||
//sys Readlink(path string, buf []byte) (n int, err error)
|
//sys Readlink(path string, buf []byte) (n int, err error)
|
||||||
//sys Readlinkat(dirfd int, path string, buf []byte) (n int, err error)
|
//sys Readlinkat(dirfd int, path string, buf []byte) (n int, err error)
|
||||||
|
|
1
vendor/golang.org/x/sys/unix/syscall_freebsd_386.go
generated
vendored
1
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
vendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go
generated
vendored
1
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
vendor/golang.org/x/sys/unix/syscall_freebsd_arm.go
generated
vendored
1
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
vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go
generated
vendored
1
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
|
||||||
|
|
113
vendor/golang.org/x/sys/unix/syscall_illumos.go
generated
vendored
113
vendor/golang.org/x/sys/unix/syscall_illumos.go
generated
vendored
|
@ -1,14 +1,19 @@
|
||||||
// Copyright 2009 The Go Authors. All rights reserved.
|
// Copyright 2021 The Go Authors. All rights reserved.
|
||||||
// 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.
|
||||||
|
|
||||||
// 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
|
||||||
|
|
||||||
import "unsafe"
|
import (
|
||||||
|
"fmt"
|
||||||
|
"runtime"
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
func bytes2iovec(bs [][]byte) []Iovec {
|
func bytes2iovec(bs [][]byte) []Iovec {
|
||||||
iovecs := make([]Iovec, len(bs))
|
iovecs := make([]Iovec, len(bs))
|
||||||
|
@ -75,3 +80,107 @@ func Accept4(fd int, flags int) (nfd int, sa Sockaddr, err error) {
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//sys putmsg(fd int, clptr *strbuf, dataptr *strbuf, flags int) (err error)
|
||||||
|
|
||||||
|
func Putmsg(fd int, cl []byte, data []byte, flags int) (err error) {
|
||||||
|
var clp, datap *strbuf
|
||||||
|
if len(cl) > 0 {
|
||||||
|
clp = &strbuf{
|
||||||
|
Len: int32(len(cl)),
|
||||||
|
Buf: (*int8)(unsafe.Pointer(&cl[0])),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(data) > 0 {
|
||||||
|
datap = &strbuf{
|
||||||
|
Len: int32(len(data)),
|
||||||
|
Buf: (*int8)(unsafe.Pointer(&data[0])),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return putmsg(fd, clp, datap, flags)
|
||||||
|
}
|
||||||
|
|
||||||
|
//sys getmsg(fd int, clptr *strbuf, dataptr *strbuf, flags *int) (err error)
|
||||||
|
|
||||||
|
func Getmsg(fd int, cl []byte, data []byte) (retCl []byte, retData []byte, flags int, err error) {
|
||||||
|
var clp, datap *strbuf
|
||||||
|
if len(cl) > 0 {
|
||||||
|
clp = &strbuf{
|
||||||
|
Maxlen: int32(len(cl)),
|
||||||
|
Buf: (*int8)(unsafe.Pointer(&cl[0])),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(data) > 0 {
|
||||||
|
datap = &strbuf{
|
||||||
|
Maxlen: int32(len(data)),
|
||||||
|
Buf: (*int8)(unsafe.Pointer(&data[0])),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if err = getmsg(fd, clp, datap, &flags); err != nil {
|
||||||
|
return nil, nil, 0, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(cl) > 0 {
|
||||||
|
retCl = cl[:clp.Len]
|
||||||
|
}
|
||||||
|
if len(data) > 0 {
|
||||||
|
retData = data[:datap.Len]
|
||||||
|
}
|
||||||
|
return retCl, retData, flags, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func IoctlSetIntRetInt(fd int, req uint, arg int) (int, error) {
|
||||||
|
return ioctlRet(fd, req, uintptr(arg))
|
||||||
|
}
|
||||||
|
|
||||||
|
func IoctlSetString(fd int, req uint, val string) error {
|
||||||
|
bs := make([]byte, len(val)+1)
|
||||||
|
copy(bs[:len(bs)-1], val)
|
||||||
|
err := ioctl(fd, req, uintptr(unsafe.Pointer(&bs[0])))
|
||||||
|
runtime.KeepAlive(&bs[0])
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lifreq Helpers
|
||||||
|
|
||||||
|
func (l *Lifreq) SetName(name string) error {
|
||||||
|
if len(name) >= len(l.Name) {
|
||||||
|
return fmt.Errorf("name cannot be more than %d characters", len(l.Name)-1)
|
||||||
|
}
|
||||||
|
for i := range name {
|
||||||
|
l.Name[i] = int8(name[i])
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *Lifreq) SetLifruInt(d int) {
|
||||||
|
*(*int)(unsafe.Pointer(&l.Lifru[0])) = d
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *Lifreq) GetLifruInt() int {
|
||||||
|
return *(*int)(unsafe.Pointer(&l.Lifru[0]))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *Lifreq) SetLifruUint(d uint) {
|
||||||
|
*(*uint)(unsafe.Pointer(&l.Lifru[0])) = d
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *Lifreq) GetLifruUint() uint {
|
||||||
|
return *(*uint)(unsafe.Pointer(&l.Lifru[0]))
|
||||||
|
}
|
||||||
|
|
||||||
|
func IoctlLifreq(fd int, req uint, l *Lifreq) error {
|
||||||
|
return ioctl(fd, req, uintptr(unsafe.Pointer(l)))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Strioctl Helpers
|
||||||
|
|
||||||
|
func (s *Strioctl) SetInt(i int) {
|
||||||
|
s.Len = int32(unsafe.Sizeof(i))
|
||||||
|
s.Dp = (*int8)(unsafe.Pointer(&i))
|
||||||
|
}
|
||||||
|
|
||||||
|
func IoctlSetStrioctlRetInt(fd int, req uint, s *Strioctl) (int, error) {
|
||||||
|
return ioctlRet(fd, req, uintptr(unsafe.Pointer(s)))
|
||||||
|
}
|
||||||
|
|
395
vendor/golang.org/x/sys/unix/syscall_linux.go
generated
vendored
395
vendor/golang.org/x/sys/unix/syscall_linux.go
generated
vendored
|
@ -13,8 +13,8 @@ package unix
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"runtime"
|
|
||||||
"syscall"
|
"syscall"
|
||||||
|
"time"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -38,6 +38,13 @@ func Creat(path string, mode uint32) (fd int, err error) {
|
||||||
return Open(path, O_CREAT|O_WRONLY|O_TRUNC, mode)
|
return Open(path, O_CREAT|O_WRONLY|O_TRUNC, mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func EpollCreate(size int) (fd int, err error) {
|
||||||
|
if size <= 0 {
|
||||||
|
return -1, EINVAL
|
||||||
|
}
|
||||||
|
return EpollCreate1(0)
|
||||||
|
}
|
||||||
|
|
||||||
//sys FanotifyInit(flags uint, event_f_flags uint) (fd int, err error)
|
//sys FanotifyInit(flags uint, event_f_flags uint) (fd int, err error)
|
||||||
//sys fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error)
|
//sys fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error)
|
||||||
|
|
||||||
|
@ -66,92 +73,22 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
|
||||||
return fchmodat(dirfd, path, mode)
|
return fchmodat(dirfd, path, mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
//sys ioctl(fd int, req uint, arg uintptr) (err error)
|
func InotifyInit() (fd int, err error) {
|
||||||
|
return InotifyInit1(0)
|
||||||
// ioctl itself should not be exposed directly, but additional get/set
|
|
||||||
// functions for specific types are permissible.
|
|
||||||
|
|
||||||
// IoctlRetInt performs an ioctl operation specified by req on a device
|
|
||||||
// associated with opened file descriptor fd, and returns a non-negative
|
|
||||||
// integer that is returned by the ioctl syscall.
|
|
||||||
func IoctlRetInt(fd int, req uint) (int, error) {
|
|
||||||
ret, _, err := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), 0)
|
|
||||||
if err != 0 {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
return int(ret), nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func IoctlSetRTCTime(fd int, value *RTCTime) error {
|
//sys ioctl(fd int, req uint, arg uintptr) (err error) = SYS_IOCTL
|
||||||
err := ioctl(fd, RTC_SET_TIME, uintptr(unsafe.Pointer(value)))
|
//sys ioctlPtr(fd int, req uint, arg unsafe.Pointer) (err error) = SYS_IOCTL
|
||||||
runtime.KeepAlive(value)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
func IoctlSetRTCWkAlrm(fd int, value *RTCWkAlrm) error {
|
// ioctl itself should not be exposed directly, but additional get/set functions
|
||||||
err := ioctl(fd, RTC_WKALM_SET, uintptr(unsafe.Pointer(value)))
|
// for specific types are permissible. These are defined in ioctl.go and
|
||||||
runtime.KeepAlive(value)
|
// ioctl_linux.go.
|
||||||
return err
|
//
|
||||||
}
|
// The third argument to ioctl is often a pointer but sometimes an integer.
|
||||||
|
// Callers should use ioctlPtr when the third argument is a pointer and ioctl
|
||||||
func IoctlGetUint32(fd int, req uint) (uint32, error) {
|
// when the third argument is an integer.
|
||||||
var value uint32
|
//
|
||||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
|
// TODO: some existing code incorrectly uses ioctl when it should use ioctlPtr.
|
||||||
return value, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func IoctlGetRTCTime(fd int) (*RTCTime, error) {
|
|
||||||
var value RTCTime
|
|
||||||
err := ioctl(fd, RTC_RD_TIME, uintptr(unsafe.Pointer(&value)))
|
|
||||||
return &value, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// IoctlGetWatchdogInfo fetches information about a watchdog device from the
|
|
||||||
// Linux watchdog API. For more information, see:
|
|
||||||
// https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html.
|
|
||||||
func IoctlGetWatchdogInfo(fd int) (*WatchdogInfo, error) {
|
|
||||||
var value WatchdogInfo
|
|
||||||
err := ioctl(fd, WDIOC_GETSUPPORT, uintptr(unsafe.Pointer(&value)))
|
|
||||||
return &value, err
|
|
||||||
}
|
|
||||||
|
|
||||||
func IoctlGetRTCWkAlrm(fd int) (*RTCWkAlrm, error) {
|
|
||||||
var value RTCWkAlrm
|
|
||||||
err := ioctl(fd, RTC_WKALM_RD, uintptr(unsafe.Pointer(&value)))
|
|
||||||
return &value, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// IoctlFileCloneRange performs an FICLONERANGE ioctl operation to clone the
|
|
||||||
// range of data conveyed in value to the file associated with the file
|
|
||||||
// descriptor destFd. See the ioctl_ficlonerange(2) man page for details.
|
|
||||||
func IoctlFileCloneRange(destFd int, value *FileCloneRange) error {
|
|
||||||
err := ioctl(destFd, FICLONERANGE, uintptr(unsafe.Pointer(value)))
|
|
||||||
runtime.KeepAlive(value)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// IoctlFileClone performs an FICLONE ioctl operation to clone the entire file
|
|
||||||
// associated with the file description srcFd to the file associated with the
|
|
||||||
// file descriptor destFd. See the ioctl_ficlone(2) man page for details.
|
|
||||||
func IoctlFileClone(destFd, srcFd int) error {
|
|
||||||
return ioctl(destFd, FICLONE, uintptr(srcFd))
|
|
||||||
}
|
|
||||||
|
|
||||||
// IoctlFileDedupeRange performs an FIDEDUPERANGE ioctl operation to share the
|
|
||||||
// range of data conveyed in value with the file associated with the file
|
|
||||||
// descriptor destFd. See the ioctl_fideduperange(2) man page for details.
|
|
||||||
func IoctlFileDedupeRange(destFd int, value *FileDedupeRange) error {
|
|
||||||
err := ioctl(destFd, FIDEDUPERANGE, uintptr(unsafe.Pointer(value)))
|
|
||||||
runtime.KeepAlive(value)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// IoctlWatchdogKeepalive issues a keepalive ioctl to a watchdog device. For
|
|
||||||
// more information, see:
|
|
||||||
// https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html.
|
|
||||||
func IoctlWatchdogKeepalive(fd int) error {
|
|
||||||
return ioctl(fd, WDIOC_KEEPALIVE, 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
//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)
|
||||||
|
|
||||||
|
@ -183,6 +120,25 @@ func Openat2(dirfd int, path string, how *OpenHow) (fd int, err error) {
|
||||||
return openat2(dirfd, path, how, SizeofOpenHow)
|
return openat2(dirfd, path, how, SizeofOpenHow)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Pipe(p []int) error {
|
||||||
|
return Pipe2(p, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
//sysnb pipe2(p *[2]_C_int, flags int) (err error)
|
||||||
|
|
||||||
|
func Pipe2(p []int, flags int) error {
|
||||||
|
if len(p) != 2 {
|
||||||
|
return EINVAL
|
||||||
|
}
|
||||||
|
var pp [2]_C_int
|
||||||
|
err := pipe2(&pp, flags)
|
||||||
|
if err == nil {
|
||||||
|
p[0] = int(pp[0])
|
||||||
|
p[1] = int(pp[1])
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
//sys ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error)
|
//sys ppoll(fds *PollFd, nfds int, timeout *Timespec, sigmask *Sigset_t) (n int, err error)
|
||||||
|
|
||||||
func Ppoll(fds []PollFd, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
|
func Ppoll(fds []PollFd, timeout *Timespec, sigmask *Sigset_t) (n int, err error) {
|
||||||
|
@ -192,6 +148,15 @@ func Ppoll(fds []PollFd, timeout *Timespec, sigmask *Sigset_t) (n int, err error
|
||||||
return ppoll(&fds[0], len(fds), timeout, sigmask)
|
return ppoll(&fds[0], len(fds), timeout, sigmask)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Poll(fds []PollFd, timeout int) (n int, err error) {
|
||||||
|
var ts *Timespec
|
||||||
|
if timeout >= 0 {
|
||||||
|
ts = new(Timespec)
|
||||||
|
*ts = NsecToTimespec(int64(timeout) * 1e6)
|
||||||
|
}
|
||||||
|
return Ppoll(fds, ts, nil)
|
||||||
|
}
|
||||||
|
|
||||||
//sys Readlinkat(dirfd int, path string, buf []byte) (n int, err error)
|
//sys Readlinkat(dirfd int, path string, buf []byte) (n int, err error)
|
||||||
|
|
||||||
func Readlink(path string, buf []byte) (n int, err error) {
|
func Readlink(path string, buf []byte) (n int, err error) {
|
||||||
|
@ -242,27 +207,7 @@ func Utimes(path string, tv []Timeval) error {
|
||||||
//sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error)
|
//sys utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error)
|
||||||
|
|
||||||
func UtimesNano(path string, ts []Timespec) error {
|
func UtimesNano(path string, ts []Timespec) error {
|
||||||
if ts == nil {
|
return UtimesNanoAt(AT_FDCWD, path, ts, 0)
|
||||||
err := utimensat(AT_FDCWD, path, nil, 0)
|
|
||||||
if err != ENOSYS {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return utimes(path, nil)
|
|
||||||
}
|
|
||||||
if len(ts) != 2 {
|
|
||||||
return EINVAL
|
|
||||||
}
|
|
||||||
err := utimensat(AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
|
|
||||||
if err != ENOSYS {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
// If the utimensat syscall isn't available (utimensat was added to Linux
|
|
||||||
// in 2.6.22, Released, 8 July 2007) then fall back to utimes
|
|
||||||
var tv [2]Timeval
|
|
||||||
for i := 0; i < 2; i++ {
|
|
||||||
tv[i] = NsecToTimeval(TimespecToNsec(ts[i]))
|
|
||||||
}
|
|
||||||
return utimes(path, (*[2]Timeval)(unsafe.Pointer(&tv[0])))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func UtimesNanoAt(dirfd int, path string, ts []Timespec, flags int) error {
|
func UtimesNanoAt(dirfd int, path string, ts []Timespec, flags int) error {
|
||||||
|
@ -305,6 +250,13 @@ func Getwd() (wd string, err error) {
|
||||||
if n < 1 || n > len(buf) || buf[n-1] != 0 {
|
if n < 1 || n > len(buf) || buf[n-1] != 0 {
|
||||||
return "", EINVAL
|
return "", EINVAL
|
||||||
}
|
}
|
||||||
|
// In some cases, Linux can return a path that starts with the
|
||||||
|
// "(unreachable)" prefix, which can potentially be a valid relative
|
||||||
|
// path. To work around that, return ENOENT if path is not absolute.
|
||||||
|
if buf[0] != '/' {
|
||||||
|
return "", ENOENT
|
||||||
|
}
|
||||||
|
|
||||||
return string(buf[0 : n-1]), nil
|
return string(buf[0 : n-1]), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -414,6 +366,8 @@ func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int,
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//sys Waitid(idType int, id int, info *Siginfo, options int, rusage *Rusage) (err error)
|
||||||
|
|
||||||
func Mkfifo(path string, mode uint32) error {
|
func Mkfifo(path string, mode uint32) error {
|
||||||
return Mknod(path, mode|S_IFIFO, 0)
|
return Mknod(path, mode|S_IFIFO, 0)
|
||||||
}
|
}
|
||||||
|
@ -430,9 +384,7 @@ func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||||
p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port))
|
p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port))
|
||||||
p[0] = byte(sa.Port >> 8)
|
p[0] = byte(sa.Port >> 8)
|
||||||
p[1] = byte(sa.Port)
|
p[1] = byte(sa.Port)
|
||||||
for i := 0; i < len(sa.Addr); i++ {
|
sa.raw.Addr = sa.Addr
|
||||||
sa.raw.Addr[i] = sa.Addr[i]
|
|
||||||
}
|
|
||||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrInet4, nil
|
return unsafe.Pointer(&sa.raw), SizeofSockaddrInet4, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,9 +397,7 @@ func (sa *SockaddrInet6) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||||
p[0] = byte(sa.Port >> 8)
|
p[0] = byte(sa.Port >> 8)
|
||||||
p[1] = byte(sa.Port)
|
p[1] = byte(sa.Port)
|
||||||
sa.raw.Scope_id = sa.ZoneId
|
sa.raw.Scope_id = sa.ZoneId
|
||||||
for i := 0; i < len(sa.Addr); i++ {
|
sa.raw.Addr = sa.Addr
|
||||||
sa.raw.Addr[i] = sa.Addr[i]
|
|
||||||
}
|
|
||||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrInet6, nil
|
return unsafe.Pointer(&sa.raw), SizeofSockaddrInet6, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -496,9 +446,7 @@ func (sa *SockaddrLinklayer) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||||
sa.raw.Hatype = sa.Hatype
|
sa.raw.Hatype = sa.Hatype
|
||||||
sa.raw.Pkttype = sa.Pkttype
|
sa.raw.Pkttype = sa.Pkttype
|
||||||
sa.raw.Halen = sa.Halen
|
sa.raw.Halen = sa.Halen
|
||||||
for i := 0; i < len(sa.Addr); i++ {
|
sa.raw.Addr = sa.Addr
|
||||||
sa.raw.Addr[i] = sa.Addr[i]
|
|
||||||
}
|
|
||||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrLinklayer, nil
|
return unsafe.Pointer(&sa.raw), SizeofSockaddrLinklayer, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -778,9 +726,11 @@ type SockaddrVM struct {
|
||||||
// CID and Port specify a context ID and port address for a VM socket.
|
// CID and Port specify a context ID and port address for a VM socket.
|
||||||
// Guests have a unique CID, and hosts may have a well-known CID of:
|
// Guests have a unique CID, and hosts may have a well-known CID of:
|
||||||
// - VMADDR_CID_HYPERVISOR: refers to the hypervisor process.
|
// - VMADDR_CID_HYPERVISOR: refers to the hypervisor process.
|
||||||
|
// - VMADDR_CID_LOCAL: refers to local communication (loopback).
|
||||||
// - VMADDR_CID_HOST: refers to other processes on the host.
|
// - VMADDR_CID_HOST: refers to other processes on the host.
|
||||||
CID uint32
|
CID uint32
|
||||||
Port uint32
|
Port uint32
|
||||||
|
Flags uint8
|
||||||
raw RawSockaddrVM
|
raw RawSockaddrVM
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -788,6 +738,7 @@ func (sa *SockaddrVM) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||||
sa.raw.Family = AF_VSOCK
|
sa.raw.Family = AF_VSOCK
|
||||||
sa.raw.Port = sa.Port
|
sa.raw.Port = sa.Port
|
||||||
sa.raw.Cid = sa.CID
|
sa.raw.Cid = sa.CID
|
||||||
|
sa.raw.Flags = sa.Flags
|
||||||
|
|
||||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrVM, nil
|
return unsafe.Pointer(&sa.raw), SizeofSockaddrVM, nil
|
||||||
}
|
}
|
||||||
|
@ -910,12 +861,10 @@ func (sa *SockaddrTIPC) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||||
if sa.Addr == nil {
|
if sa.Addr == nil {
|
||||||
return nil, 0, EINVAL
|
return nil, 0, EINVAL
|
||||||
}
|
}
|
||||||
|
|
||||||
sa.raw.Family = AF_TIPC
|
sa.raw.Family = AF_TIPC
|
||||||
sa.raw.Scope = int8(sa.Scope)
|
sa.raw.Scope = int8(sa.Scope)
|
||||||
sa.raw.Addrtype = sa.Addr.tipcAddrtype()
|
sa.raw.Addrtype = sa.Addr.tipcAddrtype()
|
||||||
sa.raw.Addr = sa.Addr.tipcAddr()
|
sa.raw.Addr = sa.Addr.tipcAddr()
|
||||||
|
|
||||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrTIPC, nil
|
return unsafe.Pointer(&sa.raw), SizeofSockaddrTIPC, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -929,9 +878,7 @@ type SockaddrL2TPIP struct {
|
||||||
func (sa *SockaddrL2TPIP) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
func (sa *SockaddrL2TPIP) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||||
sa.raw.Family = AF_INET
|
sa.raw.Family = AF_INET
|
||||||
sa.raw.Conn_id = sa.ConnId
|
sa.raw.Conn_id = sa.ConnId
|
||||||
for i := 0; i < len(sa.Addr); i++ {
|
sa.raw.Addr = sa.Addr
|
||||||
sa.raw.Addr[i] = sa.Addr[i]
|
|
||||||
}
|
|
||||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrL2TPIP, nil
|
return unsafe.Pointer(&sa.raw), SizeofSockaddrL2TPIP, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -947,9 +894,7 @@ func (sa *SockaddrL2TPIP6) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||||
sa.raw.Family = AF_INET6
|
sa.raw.Family = AF_INET6
|
||||||
sa.raw.Conn_id = sa.ConnId
|
sa.raw.Conn_id = sa.ConnId
|
||||||
sa.raw.Scope_id = sa.ZoneId
|
sa.raw.Scope_id = sa.ZoneId
|
||||||
for i := 0; i < len(sa.Addr); i++ {
|
sa.raw.Addr = sa.Addr
|
||||||
sa.raw.Addr[i] = sa.Addr[i]
|
|
||||||
}
|
|
||||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrL2TPIP6, nil
|
return unsafe.Pointer(&sa.raw), SizeofSockaddrL2TPIP6, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -982,6 +927,46 @@ func (sa *SockaddrIUCV) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrIUCV, nil
|
return unsafe.Pointer(&sa.raw), SizeofSockaddrIUCV, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type SockaddrNFC struct {
|
||||||
|
DeviceIdx uint32
|
||||||
|
TargetIdx uint32
|
||||||
|
NFCProtocol uint32
|
||||||
|
raw RawSockaddrNFC
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sa *SockaddrNFC) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||||
|
sa.raw.Sa_family = AF_NFC
|
||||||
|
sa.raw.Dev_idx = sa.DeviceIdx
|
||||||
|
sa.raw.Target_idx = sa.TargetIdx
|
||||||
|
sa.raw.Nfc_protocol = sa.NFCProtocol
|
||||||
|
return unsafe.Pointer(&sa.raw), SizeofSockaddrNFC, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type SockaddrNFCLLCP struct {
|
||||||
|
DeviceIdx uint32
|
||||||
|
TargetIdx uint32
|
||||||
|
NFCProtocol uint32
|
||||||
|
DestinationSAP uint8
|
||||||
|
SourceSAP uint8
|
||||||
|
ServiceName string
|
||||||
|
raw RawSockaddrNFCLLCP
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sa *SockaddrNFCLLCP) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||||
|
sa.raw.Sa_family = AF_NFC
|
||||||
|
sa.raw.Dev_idx = sa.DeviceIdx
|
||||||
|
sa.raw.Target_idx = sa.TargetIdx
|
||||||
|
sa.raw.Nfc_protocol = sa.NFCProtocol
|
||||||
|
sa.raw.Dsap = sa.DestinationSAP
|
||||||
|
sa.raw.Ssap = sa.SourceSAP
|
||||||
|
if len(sa.ServiceName) > len(sa.raw.Service_name) {
|
||||||
|
return nil, 0, EINVAL
|
||||||
|
}
|
||||||
|
copy(sa.raw.Service_name[:], sa.ServiceName)
|
||||||
|
sa.raw.SetServiceNameLen(len(sa.ServiceName))
|
||||||
|
return unsafe.Pointer(&sa.raw), SizeofSockaddrNFCLLCP, nil
|
||||||
|
}
|
||||||
|
|
||||||
var socketProtocol = func(fd int) (int, error) {
|
var socketProtocol = func(fd int) (int, error) {
|
||||||
return GetsockoptInt(fd, SOL_SOCKET, SO_PROTOCOL)
|
return GetsockoptInt(fd, SOL_SOCKET, SO_PROTOCOL)
|
||||||
}
|
}
|
||||||
|
@ -1005,9 +990,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||||
sa.Hatype = pp.Hatype
|
sa.Hatype = pp.Hatype
|
||||||
sa.Pkttype = pp.Pkttype
|
sa.Pkttype = pp.Pkttype
|
||||||
sa.Halen = pp.Halen
|
sa.Halen = pp.Halen
|
||||||
for i := 0; i < len(sa.Addr); i++ {
|
sa.Addr = pp.Addr
|
||||||
sa.Addr[i] = pp.Addr[i]
|
|
||||||
}
|
|
||||||
return sa, nil
|
return sa, nil
|
||||||
|
|
||||||
case AF_UNIX:
|
case AF_UNIX:
|
||||||
|
@ -1046,18 +1029,14 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||||
pp := (*RawSockaddrL2TPIP)(unsafe.Pointer(rsa))
|
pp := (*RawSockaddrL2TPIP)(unsafe.Pointer(rsa))
|
||||||
sa := new(SockaddrL2TPIP)
|
sa := new(SockaddrL2TPIP)
|
||||||
sa.ConnId = pp.Conn_id
|
sa.ConnId = pp.Conn_id
|
||||||
for i := 0; i < len(sa.Addr); i++ {
|
sa.Addr = pp.Addr
|
||||||
sa.Addr[i] = pp.Addr[i]
|
|
||||||
}
|
|
||||||
return sa, nil
|
return sa, nil
|
||||||
default:
|
default:
|
||||||
pp := (*RawSockaddrInet4)(unsafe.Pointer(rsa))
|
pp := (*RawSockaddrInet4)(unsafe.Pointer(rsa))
|
||||||
sa := new(SockaddrInet4)
|
sa := new(SockaddrInet4)
|
||||||
p := (*[2]byte)(unsafe.Pointer(&pp.Port))
|
p := (*[2]byte)(unsafe.Pointer(&pp.Port))
|
||||||
sa.Port = int(p[0])<<8 + int(p[1])
|
sa.Port = int(p[0])<<8 + int(p[1])
|
||||||
for i := 0; i < len(sa.Addr); i++ {
|
sa.Addr = pp.Addr
|
||||||
sa.Addr[i] = pp.Addr[i]
|
|
||||||
}
|
|
||||||
return sa, nil
|
return sa, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1073,9 +1052,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||||
sa := new(SockaddrL2TPIP6)
|
sa := new(SockaddrL2TPIP6)
|
||||||
sa.ConnId = pp.Conn_id
|
sa.ConnId = pp.Conn_id
|
||||||
sa.ZoneId = pp.Scope_id
|
sa.ZoneId = pp.Scope_id
|
||||||
for i := 0; i < len(sa.Addr); i++ {
|
sa.Addr = pp.Addr
|
||||||
sa.Addr[i] = pp.Addr[i]
|
|
||||||
}
|
|
||||||
return sa, nil
|
return sa, nil
|
||||||
default:
|
default:
|
||||||
pp := (*RawSockaddrInet6)(unsafe.Pointer(rsa))
|
pp := (*RawSockaddrInet6)(unsafe.Pointer(rsa))
|
||||||
|
@ -1083,9 +1060,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||||
p := (*[2]byte)(unsafe.Pointer(&pp.Port))
|
p := (*[2]byte)(unsafe.Pointer(&pp.Port))
|
||||||
sa.Port = int(p[0])<<8 + int(p[1])
|
sa.Port = int(p[0])<<8 + int(p[1])
|
||||||
sa.ZoneId = pp.Scope_id
|
sa.ZoneId = pp.Scope_id
|
||||||
for i := 0; i < len(sa.Addr); i++ {
|
sa.Addr = pp.Addr
|
||||||
sa.Addr[i] = pp.Addr[i]
|
|
||||||
}
|
|
||||||
return sa, nil
|
return sa, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1094,6 +1069,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||||
sa := &SockaddrVM{
|
sa := &SockaddrVM{
|
||||||
CID: pp.Cid,
|
CID: pp.Cid,
|
||||||
Port: pp.Port,
|
Port: pp.Port,
|
||||||
|
Flags: pp.Flags,
|
||||||
}
|
}
|
||||||
return sa, nil
|
return sa, nil
|
||||||
case AF_BLUETOOTH:
|
case AF_BLUETOOTH:
|
||||||
|
@ -1221,6 +1197,37 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||||
}
|
}
|
||||||
return sa, nil
|
return sa, nil
|
||||||
}
|
}
|
||||||
|
case AF_NFC:
|
||||||
|
proto, err := socketProtocol(fd)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
switch proto {
|
||||||
|
case NFC_SOCKPROTO_RAW:
|
||||||
|
pp := (*RawSockaddrNFC)(unsafe.Pointer(rsa))
|
||||||
|
sa := &SockaddrNFC{
|
||||||
|
DeviceIdx: pp.Dev_idx,
|
||||||
|
TargetIdx: pp.Target_idx,
|
||||||
|
NFCProtocol: pp.Nfc_protocol,
|
||||||
|
}
|
||||||
|
return sa, nil
|
||||||
|
case NFC_SOCKPROTO_LLCP:
|
||||||
|
pp := (*RawSockaddrNFCLLCP)(unsafe.Pointer(rsa))
|
||||||
|
if uint64(pp.Service_name_len) > uint64(len(pp.Service_name)) {
|
||||||
|
return nil, EINVAL
|
||||||
|
}
|
||||||
|
sa := &SockaddrNFCLLCP{
|
||||||
|
DeviceIdx: pp.Dev_idx,
|
||||||
|
TargetIdx: pp.Target_idx,
|
||||||
|
NFCProtocol: pp.Nfc_protocol,
|
||||||
|
DestinationSAP: pp.Dsap,
|
||||||
|
SourceSAP: pp.Ssap,
|
||||||
|
ServiceName: string(pp.Service_name[:pp.Service_name_len]),
|
||||||
|
}
|
||||||
|
return sa, nil
|
||||||
|
default:
|
||||||
|
return nil, EINVAL
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil, EAFNOSUPPORT
|
return nil, EAFNOSUPPORT
|
||||||
}
|
}
|
||||||
|
@ -1228,7 +1235,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||||
func Accept(fd int) (nfd int, sa Sockaddr, err error) {
|
func Accept(fd int) (nfd int, sa Sockaddr, err error) {
|
||||||
var rsa RawSockaddrAny
|
var rsa RawSockaddrAny
|
||||||
var len _Socklen = SizeofSockaddrAny
|
var len _Socklen = SizeofSockaddrAny
|
||||||
nfd, err = accept(fd, &rsa, &len)
|
nfd, err = accept4(fd, &rsa, &len, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1350,6 +1357,13 @@ func SetsockoptTpacketReq3(fd, level, opt int, tp *TpacketReq3) error {
|
||||||
return setsockopt(fd, level, opt, unsafe.Pointer(tp), unsafe.Sizeof(*tp))
|
return setsockopt(fd, level, opt, unsafe.Pointer(tp), unsafe.Sizeof(*tp))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SetsockoptTCPRepairOpt(fd, level, opt int, o []TCPRepairOpt) (err error) {
|
||||||
|
if len(o) == 0 {
|
||||||
|
return EINVAL
|
||||||
|
}
|
||||||
|
return setsockopt(fd, level, opt, unsafe.Pointer(&o[0]), uintptr(SizeofTCPRepairOpt*len(o)))
|
||||||
|
}
|
||||||
|
|
||||||
// Keyctl Commands (http://man7.org/linux/man-pages/man2/keyctl.2.html)
|
// Keyctl Commands (http://man7.org/linux/man-pages/man2/keyctl.2.html)
|
||||||
|
|
||||||
// KeyctlInt calls keyctl commands in which each argument is an int.
|
// KeyctlInt calls keyctl commands in which each argument is an int.
|
||||||
|
@ -1485,10 +1499,9 @@ func KeyctlRestrictKeyring(ringid int, keyType string, restriction string) error
|
||||||
//sys keyctlRestrictKeyringByType(cmd int, arg2 int, keyType string, restriction string) (err error) = SYS_KEYCTL
|
//sys keyctlRestrictKeyringByType(cmd int, arg2 int, keyType string, restriction string) (err error) = SYS_KEYCTL
|
||||||
//sys keyctlRestrictKeyring(cmd int, arg2 int) (err error) = SYS_KEYCTL
|
//sys keyctlRestrictKeyring(cmd int, arg2 int) (err error) = SYS_KEYCTL
|
||||||
|
|
||||||
func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) {
|
func recvmsgRaw(fd int, p, oob []byte, flags int, rsa *RawSockaddrAny) (n, oobn int, recvflags int, err error) {
|
||||||
var msg Msghdr
|
var msg Msghdr
|
||||||
var rsa RawSockaddrAny
|
msg.Name = (*byte)(unsafe.Pointer(rsa))
|
||||||
msg.Name = (*byte)(unsafe.Pointer(&rsa))
|
|
||||||
msg.Namelen = uint32(SizeofSockaddrAny)
|
msg.Namelen = uint32(SizeofSockaddrAny)
|
||||||
var iov Iovec
|
var iov Iovec
|
||||||
if len(p) > 0 {
|
if len(p) > 0 {
|
||||||
|
@ -1519,28 +1532,10 @@ func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from
|
||||||
}
|
}
|
||||||
oobn = int(msg.Controllen)
|
oobn = int(msg.Controllen)
|
||||||
recvflags = int(msg.Flags)
|
recvflags = int(msg.Flags)
|
||||||
// source address is only specified if the socket is unconnected
|
|
||||||
if rsa.Addr.Family != AF_UNSPEC {
|
|
||||||
from, err = anyToSockaddr(fd, &rsa)
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func Sendmsg(fd int, p, oob []byte, to Sockaddr, flags int) (err error) {
|
func sendmsgN(fd int, p, oob []byte, ptr unsafe.Pointer, salen _Socklen, flags int) (n int, err error) {
|
||||||
_, err = SendmsgN(fd, p, oob, to, flags)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error) {
|
|
||||||
var ptr unsafe.Pointer
|
|
||||||
var salen _Socklen
|
|
||||||
if to != nil {
|
|
||||||
var err error
|
|
||||||
ptr, salen, err = to.sockaddr()
|
|
||||||
if err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var msg Msghdr
|
var msg Msghdr
|
||||||
msg.Name = (*byte)(ptr)
|
msg.Name = (*byte)(ptr)
|
||||||
msg.Namelen = uint32(salen)
|
msg.Namelen = uint32(salen)
|
||||||
|
@ -1773,6 +1768,16 @@ func Mount(source string, target string, fstype string, flags uintptr, data stri
|
||||||
return mount(source, target, fstype, flags, datap)
|
return mount(source, target, fstype, flags, datap)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//sys mountSetattr(dirfd int, pathname string, flags uint, attr *MountAttr, size uintptr) (err error) = SYS_MOUNT_SETATTR
|
||||||
|
|
||||||
|
// MountSetattr is a wrapper for mount_setattr(2).
|
||||||
|
// https://man7.org/linux/man-pages/man2/mount_setattr.2.html
|
||||||
|
//
|
||||||
|
// Requires kernel >= 5.12.
|
||||||
|
func MountSetattr(dirfd int, pathname string, flags uint, attr *MountAttr) error {
|
||||||
|
return mountSetattr(dirfd, pathname, flags, attr, unsafe.Sizeof(*attr))
|
||||||
|
}
|
||||||
|
|
||||||
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
|
||||||
if raceenabled {
|
if raceenabled {
|
||||||
raceReleaseMerge(unsafe.Pointer(&ioSync))
|
raceReleaseMerge(unsafe.Pointer(&ioSync))
|
||||||
|
@ -1798,16 +1803,13 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
|
||||||
//sys ClockGettime(clockid int32, time *Timespec) (err error)
|
//sys ClockGettime(clockid int32, time *Timespec) (err error)
|
||||||
//sys ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error)
|
//sys ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error)
|
||||||
//sys Close(fd int) (err error)
|
//sys Close(fd int) (err error)
|
||||||
|
//sys CloseRange(first uint, last uint, flags uint) (err error)
|
||||||
//sys CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error)
|
//sys CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error)
|
||||||
//sys DeleteModule(name string, flags int) (err error)
|
//sys DeleteModule(name string, flags int) (err error)
|
||||||
//sys Dup(oldfd int) (fd int, err error)
|
//sys Dup(oldfd int) (fd int, err error)
|
||||||
|
|
||||||
func Dup2(oldfd, newfd int) error {
|
func Dup2(oldfd, newfd int) error {
|
||||||
// Android O and newer blocks dup2; riscv and arm64 don't implement dup2.
|
|
||||||
if runtime.GOOS == "android" || runtime.GOARCH == "riscv64" || runtime.GOARCH == "arm64" {
|
|
||||||
return Dup3(oldfd, newfd, 0)
|
return Dup3(oldfd, newfd, 0)
|
||||||
}
|
|
||||||
return dup2(oldfd, newfd)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//sys Dup3(oldfd int, newfd int, flags int) (err error)
|
//sys Dup3(oldfd int, newfd int, flags int) (err error)
|
||||||
|
@ -1858,9 +1860,10 @@ func Getpgrp() (pid int) {
|
||||||
//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
|
//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
|
||||||
//sys Mknodat(dirfd int, path string, mode uint32, dev int) (err error)
|
//sys Mknodat(dirfd int, path string, mode uint32, dev int) (err error)
|
||||||
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
|
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
|
||||||
|
//sys OpenTree(dfd int, fileName string, flags uint) (r int, err error)
|
||||||
//sys PerfEventOpen(attr *PerfEventAttr, pid int, cpu int, groupFd int, flags int) (fd int, err error)
|
//sys PerfEventOpen(attr *PerfEventAttr, pid int, cpu int, groupFd int, flags int) (fd int, err error)
|
||||||
//sys PivotRoot(newroot string, putold string) (err error) = SYS_PIVOT_ROOT
|
//sys PivotRoot(newroot string, putold string) (err error) = SYS_PIVOT_ROOT
|
||||||
//sysnb prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) = SYS_PRLIMIT64
|
//sysnb Prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) = SYS_PRLIMIT64
|
||||||
//sys Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error)
|
//sys Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error)
|
||||||
//sys Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) = SYS_PSELECT6
|
//sys Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) = SYS_PSELECT6
|
||||||
//sys read(fd int, p []byte) (n int, err error)
|
//sys read(fd int, p []byte) (n int, err error)
|
||||||
|
@ -2295,11 +2298,65 @@ type RemoteIovec struct {
|
||||||
//sys ProcessVMReadv(pid int, localIov []Iovec, remoteIov []RemoteIovec, flags uint) (n int, err error) = SYS_PROCESS_VM_READV
|
//sys ProcessVMReadv(pid int, localIov []Iovec, remoteIov []RemoteIovec, flags uint) (n int, err error) = SYS_PROCESS_VM_READV
|
||||||
//sys ProcessVMWritev(pid int, localIov []Iovec, remoteIov []RemoteIovec, flags uint) (n int, err error) = SYS_PROCESS_VM_WRITEV
|
//sys ProcessVMWritev(pid int, localIov []Iovec, remoteIov []RemoteIovec, flags uint) (n int, err error) = SYS_PROCESS_VM_WRITEV
|
||||||
|
|
||||||
|
//sys PidfdOpen(pid int, flags int) (fd int, err error) = SYS_PIDFD_OPEN
|
||||||
|
//sys PidfdGetfd(pidfd int, targetfd int, flags int) (fd int, err error) = SYS_PIDFD_GETFD
|
||||||
|
//sys PidfdSendSignal(pidfd int, sig Signal, info *Siginfo, flags int) (err error) = SYS_PIDFD_SEND_SIGNAL
|
||||||
|
|
||||||
|
//sys shmat(id int, addr uintptr, flag int) (ret uintptr, err error)
|
||||||
|
//sys shmctl(id int, cmd int, buf *SysvShmDesc) (result int, err error)
|
||||||
|
//sys shmdt(addr uintptr) (err error)
|
||||||
|
//sys shmget(key int, size int, flag int) (id int, err error)
|
||||||
|
|
||||||
|
//sys getitimer(which int, currValue *Itimerval) (err error)
|
||||||
|
//sys setitimer(which int, newValue *Itimerval, oldValue *Itimerval) (err error)
|
||||||
|
|
||||||
|
// MakeItimerval creates an Itimerval from interval and value durations.
|
||||||
|
func MakeItimerval(interval, value time.Duration) Itimerval {
|
||||||
|
return Itimerval{
|
||||||
|
Interval: NsecToTimeval(interval.Nanoseconds()),
|
||||||
|
Value: NsecToTimeval(value.Nanoseconds()),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// A value which may be passed to the which parameter for Getitimer and
|
||||||
|
// Setitimer.
|
||||||
|
type ItimerWhich int
|
||||||
|
|
||||||
|
// Possible which values for Getitimer and Setitimer.
|
||||||
|
const (
|
||||||
|
ItimerReal ItimerWhich = ITIMER_REAL
|
||||||
|
ItimerVirtual ItimerWhich = ITIMER_VIRTUAL
|
||||||
|
ItimerProf ItimerWhich = ITIMER_PROF
|
||||||
|
)
|
||||||
|
|
||||||
|
// Getitimer wraps getitimer(2) to return the current value of the timer
|
||||||
|
// specified by which.
|
||||||
|
func Getitimer(which ItimerWhich) (Itimerval, error) {
|
||||||
|
var it Itimerval
|
||||||
|
if err := getitimer(int(which), &it); err != nil {
|
||||||
|
return Itimerval{}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return it, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setitimer wraps setitimer(2) to arm or disarm the timer specified by which.
|
||||||
|
// It returns the previous value of the timer.
|
||||||
|
//
|
||||||
|
// If the Itimerval argument is the zero value, the timer will be disarmed.
|
||||||
|
func Setitimer(which ItimerWhich, it Itimerval) (Itimerval, error) {
|
||||||
|
var prev Itimerval
|
||||||
|
if err := setitimer(int(which), &it, &prev); err != nil {
|
||||||
|
return Itimerval{}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return prev, nil
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Unimplemented
|
* Unimplemented
|
||||||
*/
|
*/
|
||||||
// AfsSyscall
|
// AfsSyscall
|
||||||
// Alarm
|
|
||||||
// ArchPrctl
|
// ArchPrctl
|
||||||
// Brk
|
// Brk
|
||||||
// ClockNanosleep
|
// ClockNanosleep
|
||||||
|
@ -2315,7 +2372,6 @@ type RemoteIovec struct {
|
||||||
// GetMempolicy
|
// GetMempolicy
|
||||||
// GetRobustList
|
// GetRobustList
|
||||||
// GetThreadArea
|
// GetThreadArea
|
||||||
// Getitimer
|
|
||||||
// Getpmsg
|
// Getpmsg
|
||||||
// IoCancel
|
// IoCancel
|
||||||
// IoDestroy
|
// IoDestroy
|
||||||
|
@ -2376,10 +2432,6 @@ type RemoteIovec struct {
|
||||||
// SetRobustList
|
// SetRobustList
|
||||||
// SetThreadArea
|
// SetThreadArea
|
||||||
// SetTidAddress
|
// SetTidAddress
|
||||||
// Shmat
|
|
||||||
// Shmctl
|
|
||||||
// Shmdt
|
|
||||||
// Shmget
|
|
||||||
// Sigaltstack
|
// Sigaltstack
|
||||||
// Swapoff
|
// Swapoff
|
||||||
// Swapon
|
// Swapon
|
||||||
|
@ -2397,5 +2449,4 @@ type RemoteIovec struct {
|
||||||
// Vfork
|
// Vfork
|
||||||
// Vhangup
|
// Vhangup
|
||||||
// Vserver
|
// Vserver
|
||||||
// Waitid
|
|
||||||
// _Sysctl
|
// _Sysctl
|
||||||
|
|
55
vendor/golang.org/x/sys/unix/syscall_linux_386.go
generated
vendored
55
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
|
||||||
|
@ -18,36 +19,8 @@ func setTimeval(sec, usec int64) Timeval {
|
||||||
return Timeval{Sec: int32(sec), Usec: int32(usec)}
|
return Timeval{Sec: int32(sec), Usec: int32(usec)}
|
||||||
}
|
}
|
||||||
|
|
||||||
//sysnb pipe(p *[2]_C_int) (err error)
|
|
||||||
|
|
||||||
func Pipe(p []int) (err error) {
|
|
||||||
if len(p) != 2 {
|
|
||||||
return EINVAL
|
|
||||||
}
|
|
||||||
var pp [2]_C_int
|
|
||||||
err = pipe(&pp)
|
|
||||||
p[0] = int(pp[0])
|
|
||||||
p[1] = int(pp[1])
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
//sysnb pipe2(p *[2]_C_int, flags int) (err error)
|
|
||||||
|
|
||||||
func Pipe2(p []int, flags int) (err error) {
|
|
||||||
if len(p) != 2 {
|
|
||||||
return EINVAL
|
|
||||||
}
|
|
||||||
var pp [2]_C_int
|
|
||||||
err = pipe2(&pp, flags)
|
|
||||||
p[0] = int(pp[0])
|
|
||||||
p[1] = int(pp[1])
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// 64-bit file system and 32-bit uid calls
|
// 64-bit file system and 32-bit uid calls
|
||||||
// (386 default is 32-bit file system and 16-bit uid).
|
// (386 default is 32-bit file system and 16-bit uid).
|
||||||
//sys dup2(oldfd int, newfd int) (err error)
|
|
||||||
//sysnb EpollCreate(size int) (fd int, err error)
|
|
||||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
|
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
|
||||||
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64_64
|
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64_64
|
||||||
//sys Fchown(fd int, uid int, gid int) (err error) = SYS_FCHOWN32
|
//sys Fchown(fd int, uid int, gid int) (err error) = SYS_FCHOWN32
|
||||||
|
@ -58,13 +31,12 @@ func Pipe2(p []int, flags int) (err error) {
|
||||||
//sysnb Geteuid() (euid int) = SYS_GETEUID32
|
//sysnb Geteuid() (euid int) = SYS_GETEUID32
|
||||||
//sysnb Getgid() (gid int) = SYS_GETGID32
|
//sysnb Getgid() (gid int) = SYS_GETGID32
|
||||||
//sysnb Getuid() (uid int) = SYS_GETUID32
|
//sysnb Getuid() (uid int) = SYS_GETUID32
|
||||||
//sysnb InotifyInit() (fd int, err error)
|
|
||||||
//sys Ioperm(from int, num int, on int) (err error)
|
//sys Ioperm(from int, num int, on int) (err error)
|
||||||
//sys Iopl(level int) (err error)
|
//sys Iopl(level int) (err error)
|
||||||
//sys Lchown(path string, uid int, gid int) (err error) = SYS_LCHOWN32
|
//sys Lchown(path string, uid int, gid int) (err error) = SYS_LCHOWN32
|
||||||
//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
|
//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
|
||||||
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
//sys pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
|
||||||
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
//sys pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
|
||||||
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
|
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
|
||||||
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64
|
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64
|
||||||
//sys setfsgid(gid int) (prev int, err error) = SYS_SETFSGID32
|
//sys setfsgid(gid int) (prev int, err error) = SYS_SETFSGID32
|
||||||
|
@ -104,7 +76,7 @@ const rlimInf32 = ^uint32(0)
|
||||||
const rlimInf64 = ^uint64(0)
|
const rlimInf64 = ^uint64(0)
|
||||||
|
|
||||||
func Getrlimit(resource int, rlim *Rlimit) (err error) {
|
func Getrlimit(resource int, rlim *Rlimit) (err error) {
|
||||||
err = prlimit(0, resource, nil, rlim)
|
err = Prlimit(0, resource, nil, rlim)
|
||||||
if err != ENOSYS {
|
if err != ENOSYS {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -132,7 +104,7 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) {
|
||||||
//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT
|
//sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT
|
||||||
|
|
||||||
func Setrlimit(resource int, rlim *Rlimit) (err error) {
|
func Setrlimit(resource int, rlim *Rlimit) (err error) {
|
||||||
err = prlimit(0, resource, rlim, nil)
|
err = Prlimit(0, resource, rlim, nil)
|
||||||
if err != ENOSYS {
|
if err != ENOSYS {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -201,14 +173,6 @@ const (
|
||||||
_SENDMMSG = 20
|
_SENDMMSG = 20
|
||||||
)
|
)
|
||||||
|
|
||||||
func accept(s int, rsa *RawSockaddrAny, addrlen *_Socklen) (fd int, err error) {
|
|
||||||
fd, e := socketcall(_ACCEPT, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), 0, 0, 0)
|
|
||||||
if e != 0 {
|
|
||||||
err = e
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) {
|
func accept4(s int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (fd int, err error) {
|
||||||
fd, e := socketcall(_ACCEPT4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0)
|
fd, e := socketcall(_ACCEPT4, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0)
|
||||||
if e != 0 {
|
if e != 0 {
|
||||||
|
@ -377,11 +341,6 @@ func (cmsg *Cmsghdr) SetLen(length int) {
|
||||||
cmsg.Len = uint32(length)
|
cmsg.Len = uint32(length)
|
||||||
}
|
}
|
||||||
|
|
||||||
//sys poll(fds *PollFd, nfds int, timeout int) (n int, err error)
|
func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) {
|
||||||
|
rsa.Service_name_len = uint32(length)
|
||||||
func Poll(fds []PollFd, timeout int) (n int, err error) {
|
|
||||||
if len(fds) == 0 {
|
|
||||||
return poll(nil, 0, timeout)
|
|
||||||
}
|
|
||||||
return poll(&fds[0], len(fds), timeout)
|
|
||||||
}
|
}
|
||||||
|
|
14
vendor/golang.org/x/sys/unix/syscall_linux_alarm.go
generated
vendored
Normal file
14
vendor/golang.org/x/sys/unix/syscall_linux_alarm.go
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
// Copyright 2022 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
//go:build linux && (386 || amd64 || mips || mipsle || mips64 || mipsle || ppc64 || ppc64le || ppc || s390x || sparc64)
|
||||||
|
// +build linux
|
||||||
|
// +build 386 amd64 mips mipsle mips64 mipsle ppc64 ppc64le ppc s390x sparc64
|
||||||
|
|
||||||
|
package unix
|
||||||
|
|
||||||
|
// SYS_ALARM is not defined on arm or riscv, but is available for other GOARCH
|
||||||
|
// values.
|
||||||
|
|
||||||
|
//sys Alarm(seconds uint) (remaining uint, err error)
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue