Update logrus for AIX support

Signed-off-by: Matthias Rampke <mr@soundcloud.com>
This commit is contained in:
Matthias Rampke 2019-07-05 14:00:50 +00:00
parent bdfa130554
commit f7c7db0b8d
No known key found for this signature in database
GPG key ID: 2CDE413A9BD0A5BC
206 changed files with 43802 additions and 10202 deletions

1
go.mod
View file

@ -6,6 +6,7 @@ require (
github.com/prometheus/client_golang v1.0.0
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90
github.com/prometheus/common v0.4.1
github.com/sirupsen/logrus v1.4.2 // indirect
gopkg.in/alecthomas/kingpin.v2 v2.2.6
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
gopkg.in/yaml.v2 v2.2.1

4
go.sum
View file

@ -51,6 +51,8 @@ github.com/prometheus/procfs v0.0.2 h1:6LJUbpNm42llc4HRCuvApCSWB/WfhuNo9K98Q9sNG
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
@ -66,6 +68,8 @@ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5 h1:mzjBh+S5frKOsOBobWIMAbXavqjmgO17k/2puhcFR94=
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
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=
gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

View file

@ -1,51 +1,25 @@
language: go
go_import_path: github.com/sirupsen/logrus
git:
depth: 1
env:
- GOMAXPROCS=4 GORACE=halt_on_error=1
- GO111MODULE=on
- GO111MODULE=off
go: [ 1.11.x, 1.12.x ]
os: [ linux, osx ]
matrix:
include:
- go: 1.10.x
install:
- go get github.com/stretchr/testify/assert
- go get golang.org/x/crypto/ssh/terminal
- go get golang.org/x/sys/unix
- go get golang.org/x/sys/windows
script:
- go test -race -v ./...
- go: 1.11.x
env: GO111MODULE=on
install:
- go mod download
script:
- go test -race -v ./...
- go: 1.11.x
exclude:
- go: 1.12.x
env: GO111MODULE=off
install:
- go get github.com/stretchr/testify/assert
- go get golang.org/x/crypto/ssh/terminal
- go get golang.org/x/sys/unix
- go get golang.org/x/sys/windows
script:
- go test -race -v ./...
- go: 1.10.x
install:
- go get github.com/stretchr/testify/assert
- go get golang.org/x/crypto/ssh/terminal
- go get golang.org/x/sys/unix
- go get golang.org/x/sys/windows
script:
- go test -race -v -tags appengine ./...
- go: 1.11.x
env: GO111MODULE=on
install:
- go mod download
script:
- go test -race -v -tags appengine ./...
- go: 1.11.x
env: GO111MODULE=off
install:
- go get github.com/stretchr/testify/assert
- go get golang.org/x/crypto/ssh/terminal
- go get golang.org/x/sys/unix
- go get golang.org/x/sys/windows
script:
- go test -race -v -tags appengine ./...
os: osx
install:
- ./travis/install.sh
- if [[ "$GO111MODULE" == "on" ]]; then go mod download; fi
- if [[ "$GO111MODULE" == "off" ]]; then go get github.com/stretchr/testify/assert golang.org/x/sys/unix github.com/konsorten/go-windows-terminal-sequences; fi
script:
- ./travis/cross_build.sh
- export GOMAXPROCS=4
- export GORACE=halt_on_error=1
- go test -race -v ./...
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then go test -race -v -tags appengine ./... ; fi

View file

@ -1,3 +1,38 @@
# 1.4.2
* Fixes build break for plan9, nacl, solaris
# 1.4.1
This new release introduces:
* Enhance TextFormatter to not print caller information when they are empty (#944)
* Remove dependency on golang.org/x/crypto (#932, #943)
Fixes:
* Fix Entry.WithContext method to return a copy of the initial entry (#941)
# 1.4.0
This new release introduces:
* Add `DeferExitHandler`, similar to `RegisterExitHandler` but prepending the handler to the list of handlers (semantically like `defer`) (#848).
* Add `CallerPrettyfier` to `JSONFormatter` and `TextFormatter (#909, #911)
* Add `Entry.WithContext()` and `Entry.Context`, to set a context on entries to be used e.g. in hooks (#919).
Fixes:
* Fix wrong method calls `Logger.Print` and `Logger.Warningln` (#893).
* Update `Entry.Logf` to not do string formatting unless the log level is enabled (#903)
* Fix infinite recursion on unknown `Level.String()` (#907)
* Fix race condition in `getCaller` (#916).
# 1.3.0
This new release introduces:
* Log, Logf, Logln functions for Logger and Entry that take a Level
Fixes:
* Building prometheus node_exporter on AIX (#840)
* Race condition in TextFormatter (#468)
* Travis CI import path (#868)
* Remove coloured output on Windows (#862)
* Pointer to func as field in JSONFormatter (#870)
* Properly marshal Levels (#873)
# 1.2.0
This new release introduces:
* A new method `SetReportCaller` in the `Logger` to enable the file, line and calling function from which the trace has been issued

View file

@ -361,9 +361,11 @@ The built-in logging formatters are:
Third party logging formatters:
* [`FluentdFormatter`](https://github.com/joonix/log). Formats entries that can be parsed by Kubernetes and Google Container Engine.
* [`GELF`](https://github.com/fabienm/go-logrus-formatters). Formats entries so they comply to Graylog's [GELF 1.1 specification](http://docs.graylog.org/en/2.4/pages/gelf.html).
* [`logstash`](https://github.com/bshuster-repo/logrus-logstash-hook). Logs fields as [Logstash](http://logstash.net) Events.
* [`prefixed`](https://github.com/x-cray/logrus-prefixed-formatter). Displays log entry source along with alternative layout.
* [`zalgo`](https://github.com/aybabtme/logzalgo). Invoking the P͉̫o̳̼̊w̖͈̰͎e̬͔̭͂r͚̼̹̲ ̫͓͉̳͈ō̠͕͖̚f̝͍̠ ͕̲̞͖͑Z̖̫̤̫ͪa͉̬͈̗l͖͎g̳̥o̰̥̅!̣͔̲̻͊̄ ̙̘̦̹̦.
* [`nested-logrus-formatter`](https://github.com/antonfisher/nested-logrus-formatter). Converts logrus fields to a nested structure.
You can define your formatter by implementing the `Formatter` interface,
requiring a `Format` method. `Format` takes an `*Entry`. `entry.Data` is a

View file

@ -51,9 +51,9 @@ func Exit(code int) {
os.Exit(code)
}
// RegisterExitHandler adds a Logrus Exit handler, call logrus.Exit to invoke
// all handlers. The handlers will also be invoked when any Fatal log entry is
// made.
// RegisterExitHandler appends a Logrus Exit handler to the list of handlers,
// call logrus.Exit to invoke all handlers. The handlers will also be invoked when
// any Fatal log entry is made.
//
// This method is useful when a caller wishes to use logrus to log a fatal
// message but also needs to gracefully shutdown. An example usecase could be
@ -62,3 +62,15 @@ func Exit(code int) {
func RegisterExitHandler(handler func()) {
handlers = append(handlers, handler)
}
// DeferExitHandler prepends a Logrus Exit handler to the list of handlers,
// call logrus.Exit to invoke all handlers. The handlers will also be invoked when
// any Fatal log entry is made.
//
// This method is useful when a caller wishes to use logrus to log a fatal
// message but also needs to gracefully shutdown. An example usecase could be
// closing database connections, or sending a alert that the application is
// closing.
func DeferExitHandler(handler func()) {
handlers = append([]func(){handler}, handlers...)
}

View file

@ -2,6 +2,7 @@ package logrus
import (
"bytes"
"context"
"fmt"
"os"
"reflect"
@ -69,6 +70,9 @@ type Entry struct {
// When formatter is called in entry.log(), a Buffer may be set to entry
Buffer *bytes.Buffer
// Contains the context set by the user. Useful for hook processing etc.
Context context.Context
// err may contain a field formatting error
err string
}
@ -97,6 +101,11 @@ func (entry *Entry) WithError(err error) *Entry {
return entry.WithField(ErrorKey, err)
}
// Add a context to the Entry.
func (entry *Entry) WithContext(ctx context.Context) *Entry {
return &Entry{Logger: entry.Logger, Data: entry.Data, Time: entry.Time, err: entry.err, Context: ctx}
}
// Add a single field to the Entry.
func (entry *Entry) WithField(key string, value interface{}) *Entry {
return entry.WithFields(Fields{key: value})
@ -108,23 +117,34 @@ func (entry *Entry) WithFields(fields Fields) *Entry {
for k, v := range entry.Data {
data[k] = v
}
var field_err string
fieldErr := entry.err
for k, v := range fields {
if t := reflect.TypeOf(v); t != nil && t.Kind() == reflect.Func {
field_err = fmt.Sprintf("can not add field %q", k)
if entry.err != "" {
field_err = entry.err + ", " + field_err
isErrField := false
if t := reflect.TypeOf(v); t != nil {
switch t.Kind() {
case reflect.Func:
isErrField = true
case reflect.Ptr:
isErrField = t.Elem().Kind() == reflect.Func
}
}
if isErrField {
tmp := fmt.Sprintf("can not add field %q", k)
if fieldErr != "" {
fieldErr = entry.err + ", " + tmp
} else {
fieldErr = tmp
}
} else {
data[k] = v
}
}
return &Entry{Logger: entry.Logger, Data: data, Time: entry.Time, err: field_err}
return &Entry{Logger: entry.Logger, Data: data, Time: entry.Time, err: fieldErr, Context: entry.Context}
}
// Overrides the time of the Entry.
func (entry *Entry) WithTime(t time.Time) *Entry {
return &Entry{Logger: entry.Logger, Data: entry.Data, Time: t}
return &Entry{Logger: entry.Logger, Data: entry.Data, Time: t, err: entry.err, Context: entry.Context}
}
// getPackageName reduces a fully qualified function name to the package name
@ -145,20 +165,23 @@ func getPackageName(f string) string {
// getCaller retrieves the name of the first non-logrus calling function
func getCaller() *runtime.Frame {
// cache this package's fully-qualified name
callerInitOnce.Do(func() {
pcs := make([]uintptr, 2)
_ = runtime.Callers(0, pcs)
logrusPackage = getPackageName(runtime.FuncForPC(pcs[1]).Name())
// now that we have the cache, we can skip a minimum count of known-logrus functions
// XXX this is dubious, the number of frames may vary
minimumCallerDepth = knownLogrusFrames
})
// Restrict the lookback frames to avoid runaway lookups
pcs := make([]uintptr, maximumCallerDepth)
depth := runtime.Callers(minimumCallerDepth, pcs)
frames := runtime.CallersFrames(pcs[:depth])
// cache this package's fully-qualified name
callerInitOnce.Do(func() {
logrusPackage = getPackageName(runtime.FuncForPC(pcs[0]).Name())
// now that we have the cache, we can skip a minimum count of known-logrus functions
// XXX this is dubious, the number of frames may vary store an entry in a logger interface
minimumCallerDepth = knownLogrusFrames
})
for f, again := frames.Next(); again; f, again = frames.Next() {
pkg := getPackageName(f.Function)
@ -240,16 +263,18 @@ func (entry *Entry) write() {
}
}
func (entry *Entry) Trace(args ...interface{}) {
if entry.Logger.IsLevelEnabled(TraceLevel) {
entry.log(TraceLevel, fmt.Sprint(args...))
func (entry *Entry) Log(level Level, args ...interface{}) {
if entry.Logger.IsLevelEnabled(level) {
entry.log(level, fmt.Sprint(args...))
}
}
func (entry *Entry) Trace(args ...interface{}) {
entry.Log(TraceLevel, args...)
}
func (entry *Entry) Debug(args ...interface{}) {
if entry.Logger.IsLevelEnabled(DebugLevel) {
entry.log(DebugLevel, fmt.Sprint(args...))
}
entry.Log(DebugLevel, args...)
}
func (entry *Entry) Print(args ...interface{}) {
@ -257,15 +282,11 @@ func (entry *Entry) Print(args ...interface{}) {
}
func (entry *Entry) Info(args ...interface{}) {
if entry.Logger.IsLevelEnabled(InfoLevel) {
entry.log(InfoLevel, fmt.Sprint(args...))
}
entry.Log(InfoLevel, args...)
}
func (entry *Entry) Warn(args ...interface{}) {
if entry.Logger.IsLevelEnabled(WarnLevel) {
entry.log(WarnLevel, fmt.Sprint(args...))
}
entry.Log(WarnLevel, args...)
}
func (entry *Entry) Warning(args ...interface{}) {
@ -273,43 +294,37 @@ func (entry *Entry) Warning(args ...interface{}) {
}
func (entry *Entry) Error(args ...interface{}) {
if entry.Logger.IsLevelEnabled(ErrorLevel) {
entry.log(ErrorLevel, fmt.Sprint(args...))
}
entry.Log(ErrorLevel, args...)
}
func (entry *Entry) Fatal(args ...interface{}) {
if entry.Logger.IsLevelEnabled(FatalLevel) {
entry.log(FatalLevel, fmt.Sprint(args...))
}
entry.Log(FatalLevel, args...)
entry.Logger.Exit(1)
}
func (entry *Entry) Panic(args ...interface{}) {
if entry.Logger.IsLevelEnabled(PanicLevel) {
entry.log(PanicLevel, fmt.Sprint(args...))
}
entry.Log(PanicLevel, args...)
panic(fmt.Sprint(args...))
}
// Entry Printf family functions
func (entry *Entry) Tracef(format string, args ...interface{}) {
if entry.Logger.IsLevelEnabled(TraceLevel) {
entry.Trace(fmt.Sprintf(format, args...))
func (entry *Entry) Logf(level Level, format string, args ...interface{}) {
if entry.Logger.IsLevelEnabled(level) {
entry.Log(level, fmt.Sprintf(format, args...))
}
}
func (entry *Entry) Tracef(format string, args ...interface{}) {
entry.Logf(TraceLevel, format, args...)
}
func (entry *Entry) Debugf(format string, args ...interface{}) {
if entry.Logger.IsLevelEnabled(DebugLevel) {
entry.Debug(fmt.Sprintf(format, args...))
}
entry.Logf(DebugLevel, format, args...)
}
func (entry *Entry) Infof(format string, args ...interface{}) {
if entry.Logger.IsLevelEnabled(InfoLevel) {
entry.Info(fmt.Sprintf(format, args...))
}
entry.Logf(InfoLevel, format, args...)
}
func (entry *Entry) Printf(format string, args ...interface{}) {
@ -317,9 +332,7 @@ func (entry *Entry) Printf(format string, args ...interface{}) {
}
func (entry *Entry) Warnf(format string, args ...interface{}) {
if entry.Logger.IsLevelEnabled(WarnLevel) {
entry.Warn(fmt.Sprintf(format, args...))
}
entry.Logf(WarnLevel, format, args...)
}
func (entry *Entry) Warningf(format string, args ...interface{}) {
@ -327,42 +340,36 @@ func (entry *Entry) Warningf(format string, args ...interface{}) {
}
func (entry *Entry) Errorf(format string, args ...interface{}) {
if entry.Logger.IsLevelEnabled(ErrorLevel) {
entry.Error(fmt.Sprintf(format, args...))
}
entry.Logf(ErrorLevel, format, args...)
}
func (entry *Entry) Fatalf(format string, args ...interface{}) {
if entry.Logger.IsLevelEnabled(FatalLevel) {
entry.Fatal(fmt.Sprintf(format, args...))
}
entry.Logf(FatalLevel, format, args...)
entry.Logger.Exit(1)
}
func (entry *Entry) Panicf(format string, args ...interface{}) {
if entry.Logger.IsLevelEnabled(PanicLevel) {
entry.Panic(fmt.Sprintf(format, args...))
}
entry.Logf(PanicLevel, format, args...)
}
// Entry Println family functions
func (entry *Entry) Traceln(args ...interface{}) {
if entry.Logger.IsLevelEnabled(TraceLevel) {
entry.Trace(entry.sprintlnn(args...))
func (entry *Entry) Logln(level Level, args ...interface{}) {
if entry.Logger.IsLevelEnabled(level) {
entry.Log(level, entry.sprintlnn(args...))
}
}
func (entry *Entry) Traceln(args ...interface{}) {
entry.Logln(TraceLevel, args...)
}
func (entry *Entry) Debugln(args ...interface{}) {
if entry.Logger.IsLevelEnabled(DebugLevel) {
entry.Debug(entry.sprintlnn(args...))
}
entry.Logln(DebugLevel, args...)
}
func (entry *Entry) Infoln(args ...interface{}) {
if entry.Logger.IsLevelEnabled(InfoLevel) {
entry.Info(entry.sprintlnn(args...))
}
entry.Logln(InfoLevel, args...)
}
func (entry *Entry) Println(args ...interface{}) {
@ -370,9 +377,7 @@ func (entry *Entry) Println(args ...interface{}) {
}
func (entry *Entry) Warnln(args ...interface{}) {
if entry.Logger.IsLevelEnabled(WarnLevel) {
entry.Warn(entry.sprintlnn(args...))
}
entry.Logln(WarnLevel, args...)
}
func (entry *Entry) Warningln(args ...interface{}) {
@ -380,22 +385,16 @@ func (entry *Entry) Warningln(args ...interface{}) {
}
func (entry *Entry) Errorln(args ...interface{}) {
if entry.Logger.IsLevelEnabled(ErrorLevel) {
entry.Error(entry.sprintlnn(args...))
}
entry.Logln(ErrorLevel, args...)
}
func (entry *Entry) Fatalln(args ...interface{}) {
if entry.Logger.IsLevelEnabled(FatalLevel) {
entry.Fatal(entry.sprintlnn(args...))
}
entry.Logln(FatalLevel, args...)
entry.Logger.Exit(1)
}
func (entry *Entry) Panicln(args ...interface{}) {
if entry.Logger.IsLevelEnabled(PanicLevel) {
entry.Panic(entry.sprintlnn(args...))
}
entry.Logln(PanicLevel, args...)
}
// Sprintlnn => Sprint no newline. This is to get the behavior of how

View file

@ -1,6 +1,7 @@
package logrus
import (
"context"
"io"
"time"
)
@ -55,6 +56,11 @@ func WithError(err error) *Entry {
return std.WithField(ErrorKey, err)
}
// WithContext creates an entry from the standard logger and adds a context to it.
func WithContext(ctx context.Context) *Entry {
return std.WithContext(ctx)
}
// WithField creates an entry from the standard logger and adds a field to
// it. If you want multiple fields, use `WithFields`.
//

View file

@ -6,6 +6,5 @@ require (
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/objx v0.1.1 // indirect
github.com/stretchr/testify v1.2.2
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33
golang.org/x/sys v0.0.0-20190422165155-953cdadca894
)

View file

@ -2,6 +2,7 @@ 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/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe h1:CHRGQ8V7OlCYtwaKPJi3iA7J+YdNKdo8j7nG5IgDhjs=
github.com/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
@ -9,7 +10,7 @@ github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 h1:u+LnwYTOOW7Ukr/fppxEb1Nwz0AtPflrblfvUudpo+I=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33 h1:I6FyU15t786LL7oL/hn43zqTuEGr4PN7F4XJ1p4E3Y8=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
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=

View file

@ -4,6 +4,7 @@ import (
"bytes"
"encoding/json"
"fmt"
"runtime"
)
type fieldKey string
@ -42,6 +43,12 @@ type JSONFormatter struct {
// }
FieldMap FieldMap
// CallerPrettyfier can be set by the user to modify the content
// of the function and file keys in the json data when ReportCaller is
// activated. If any of the returned value is the empty string the
// corresponding key will be removed from json fields.
CallerPrettyfier func(*runtime.Frame) (function string, file string)
// PrettyPrint will indent all json logs
PrettyPrint bool
}
@ -82,8 +89,17 @@ func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) {
data[f.FieldMap.resolve(FieldKeyMsg)] = entry.Message
data[f.FieldMap.resolve(FieldKeyLevel)] = entry.Level.String()
if entry.HasCaller() {
data[f.FieldMap.resolve(FieldKeyFunc)] = entry.Caller.Function
data[f.FieldMap.resolve(FieldKeyFile)] = fmt.Sprintf("%s:%d", entry.Caller.File, entry.Caller.Line)
funcVal := entry.Caller.Function
fileVal := fmt.Sprintf("%s:%d", entry.Caller.File, entry.Caller.Line)
if f.CallerPrettyfier != nil {
funcVal, fileVal = f.CallerPrettyfier(entry.Caller)
}
if funcVal != "" {
data[f.FieldMap.resolve(FieldKeyFunc)] = funcVal
}
if fileVal != "" {
data[f.FieldMap.resolve(FieldKeyFile)] = fileVal
}
}
var b *bytes.Buffer
@ -98,7 +114,7 @@ func (f *JSONFormatter) Format(entry *Entry) ([]byte, error) {
encoder.SetIndent("", " ")
}
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, %v", err)
}
return b.Bytes(), nil

View file

@ -1,6 +1,7 @@
package logrus
import (
"context"
"io"
"os"
"sync"
@ -124,6 +125,13 @@ func (logger *Logger) WithError(err error) *Entry {
return entry.WithError(err)
}
// Add a context to the log entry.
func (logger *Logger) WithContext(ctx context.Context) *Entry {
entry := logger.newEntry()
defer logger.releaseEntry(entry)
return entry.WithContext(ctx)
}
// Overrides the time of the log entry.
func (logger *Logger) WithTime(t time.Time) *Entry {
entry := logger.newEntry()
@ -131,28 +139,24 @@ func (logger *Logger) WithTime(t time.Time) *Entry {
return entry.WithTime(t)
}
func (logger *Logger) Tracef(format string, args ...interface{}) {
if logger.IsLevelEnabled(TraceLevel) {
func (logger *Logger) Logf(level Level, format string, args ...interface{}) {
if logger.IsLevelEnabled(level) {
entry := logger.newEntry()
entry.Tracef(format, args...)
entry.Logf(level, format, args...)
logger.releaseEntry(entry)
}
}
func (logger *Logger) Tracef(format string, args ...interface{}) {
logger.Logf(TraceLevel, format, args...)
}
func (logger *Logger) Debugf(format string, args ...interface{}) {
if logger.IsLevelEnabled(DebugLevel) {
entry := logger.newEntry()
entry.Debugf(format, args...)
logger.releaseEntry(entry)
}
logger.Logf(DebugLevel, format, args...)
}
func (logger *Logger) Infof(format string, args ...interface{}) {
if logger.IsLevelEnabled(InfoLevel) {
entry := logger.newEntry()
entry.Infof(format, args...)
logger.releaseEntry(entry)
}
logger.Logf(InfoLevel, format, args...)
}
func (logger *Logger) Printf(format string, args ...interface{}) {
@ -162,139 +166,91 @@ func (logger *Logger) Printf(format string, args ...interface{}) {
}
func (logger *Logger) Warnf(format string, args ...interface{}) {
if logger.IsLevelEnabled(WarnLevel) {
entry := logger.newEntry()
entry.Warnf(format, args...)
logger.releaseEntry(entry)
}
logger.Logf(WarnLevel, format, args...)
}
func (logger *Logger) Warningf(format string, args ...interface{}) {
if logger.IsLevelEnabled(WarnLevel) {
entry := logger.newEntry()
entry.Warnf(format, args...)
logger.releaseEntry(entry)
}
logger.Warnf(format, args...)
}
func (logger *Logger) Errorf(format string, args ...interface{}) {
if logger.IsLevelEnabled(ErrorLevel) {
entry := logger.newEntry()
entry.Errorf(format, args...)
logger.releaseEntry(entry)
}
logger.Logf(ErrorLevel, format, args...)
}
func (logger *Logger) Fatalf(format string, args ...interface{}) {
if logger.IsLevelEnabled(FatalLevel) {
entry := logger.newEntry()
entry.Fatalf(format, args...)
logger.releaseEntry(entry)
}
logger.Logf(FatalLevel, format, args...)
logger.Exit(1)
}
func (logger *Logger) Panicf(format string, args ...interface{}) {
if logger.IsLevelEnabled(PanicLevel) {
logger.Logf(PanicLevel, format, args...)
}
func (logger *Logger) Log(level Level, args ...interface{}) {
if logger.IsLevelEnabled(level) {
entry := logger.newEntry()
entry.Panicf(format, args...)
entry.Log(level, args...)
logger.releaseEntry(entry)
}
}
func (logger *Logger) Trace(args ...interface{}) {
if logger.IsLevelEnabled(TraceLevel) {
entry := logger.newEntry()
entry.Trace(args...)
logger.releaseEntry(entry)
}
logger.Log(TraceLevel, args...)
}
func (logger *Logger) Debug(args ...interface{}) {
if logger.IsLevelEnabled(DebugLevel) {
entry := logger.newEntry()
entry.Debug(args...)
logger.releaseEntry(entry)
}
logger.Log(DebugLevel, args...)
}
func (logger *Logger) Info(args ...interface{}) {
if logger.IsLevelEnabled(InfoLevel) {
entry := logger.newEntry()
entry.Info(args...)
logger.releaseEntry(entry)
}
logger.Log(InfoLevel, args...)
}
func (logger *Logger) Print(args ...interface{}) {
entry := logger.newEntry()
entry.Info(args...)
entry.Print(args...)
logger.releaseEntry(entry)
}
func (logger *Logger) Warn(args ...interface{}) {
if logger.IsLevelEnabled(WarnLevel) {
entry := logger.newEntry()
entry.Warn(args...)
logger.releaseEntry(entry)
}
logger.Log(WarnLevel, args...)
}
func (logger *Logger) Warning(args ...interface{}) {
if logger.IsLevelEnabled(WarnLevel) {
entry := logger.newEntry()
entry.Warn(args...)
logger.releaseEntry(entry)
}
logger.Warn(args...)
}
func (logger *Logger) Error(args ...interface{}) {
if logger.IsLevelEnabled(ErrorLevel) {
entry := logger.newEntry()
entry.Error(args...)
logger.releaseEntry(entry)
}
logger.Log(ErrorLevel, args...)
}
func (logger *Logger) Fatal(args ...interface{}) {
if logger.IsLevelEnabled(FatalLevel) {
entry := logger.newEntry()
entry.Fatal(args...)
logger.releaseEntry(entry)
}
logger.Log(FatalLevel, args...)
logger.Exit(1)
}
func (logger *Logger) Panic(args ...interface{}) {
if logger.IsLevelEnabled(PanicLevel) {
logger.Log(PanicLevel, args...)
}
func (logger *Logger) Logln(level Level, args ...interface{}) {
if logger.IsLevelEnabled(level) {
entry := logger.newEntry()
entry.Panic(args...)
entry.Logln(level, args...)
logger.releaseEntry(entry)
}
}
func (logger *Logger) Traceln(args ...interface{}) {
if logger.IsLevelEnabled(TraceLevel) {
entry := logger.newEntry()
entry.Traceln(args...)
logger.releaseEntry(entry)
}
logger.Logln(TraceLevel, args...)
}
func (logger *Logger) Debugln(args ...interface{}) {
if logger.IsLevelEnabled(DebugLevel) {
entry := logger.newEntry()
entry.Debugln(args...)
logger.releaseEntry(entry)
}
logger.Logln(DebugLevel, args...)
}
func (logger *Logger) Infoln(args ...interface{}) {
if logger.IsLevelEnabled(InfoLevel) {
entry := logger.newEntry()
entry.Infoln(args...)
logger.releaseEntry(entry)
}
logger.Logln(InfoLevel, args...)
}
func (logger *Logger) Println(args ...interface{}) {
@ -304,44 +260,24 @@ func (logger *Logger) Println(args ...interface{}) {
}
func (logger *Logger) Warnln(args ...interface{}) {
if logger.IsLevelEnabled(WarnLevel) {
entry := logger.newEntry()
entry.Warnln(args...)
logger.releaseEntry(entry)
}
logger.Logln(WarnLevel, args...)
}
func (logger *Logger) Warningln(args ...interface{}) {
if logger.IsLevelEnabled(WarnLevel) {
entry := logger.newEntry()
entry.Warnln(args...)
logger.releaseEntry(entry)
}
logger.Warnln(args...)
}
func (logger *Logger) Errorln(args ...interface{}) {
if logger.IsLevelEnabled(ErrorLevel) {
entry := logger.newEntry()
entry.Errorln(args...)
logger.releaseEntry(entry)
}
logger.Logln(ErrorLevel, args...)
}
func (logger *Logger) Fatalln(args ...interface{}) {
if logger.IsLevelEnabled(FatalLevel) {
entry := logger.newEntry()
entry.Fatalln(args...)
logger.releaseEntry(entry)
}
logger.Logln(FatalLevel, args...)
logger.Exit(1)
}
func (logger *Logger) Panicln(args ...interface{}) {
if logger.IsLevelEnabled(PanicLevel) {
entry := logger.newEntry()
entry.Panicln(args...)
logger.releaseEntry(entry)
}
logger.Logln(PanicLevel, args...)
}
func (logger *Logger) Exit(code int) {

View file

@ -14,24 +14,11 @@ type Level uint32
// Convert the Level to a string. E.g. PanicLevel becomes "panic".
func (level Level) String() string {
switch level {
case TraceLevel:
return "trace"
case DebugLevel:
return "debug"
case InfoLevel:
return "info"
case WarnLevel:
return "warning"
case ErrorLevel:
return "error"
case FatalLevel:
return "fatal"
case PanicLevel:
return "panic"
if b, err := level.MarshalText(); err == nil {
return string(b)
} else {
return "unknown"
}
return "unknown"
}
// ParseLevel takes a string level and returns the Logrus log level constant.
@ -69,6 +56,27 @@ func (level *Level) UnmarshalText(text []byte) error {
return nil
}
func (level Level) MarshalText() ([]byte, error) {
switch level {
case TraceLevel:
return []byte("trace"), nil
case DebugLevel:
return []byte("debug"), nil
case InfoLevel:
return []byte("info"), nil
case WarnLevel:
return []byte("warning"), nil
case ErrorLevel:
return []byte("error"), nil
case FatalLevel:
return []byte("fatal"), nil
case PanicLevel:
return []byte("panic"), nil
}
return nil, fmt.Errorf("not a valid logrus level %d", level)
}
// A constant exposing all logging levels
var AllLevels = []Level{
PanicLevel,

View file

@ -0,0 +1,13 @@
// +build darwin dragonfly freebsd netbsd openbsd
package logrus
import "golang.org/x/sys/unix"
const ioctlReadTermios = unix.TIOCGETA
func isTerminal(fd int) bool {
_, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
return err == nil
}

View file

@ -1,4 +1,4 @@
// +build js
// +build js nacl plan9
package logrus

View file

@ -1,18 +1,16 @@
// +build !appengine,!js,!windows
// +build !appengine,!js,!windows,!nacl,!plan9
package logrus
import (
"io"
"os"
"golang.org/x/crypto/ssh/terminal"
)
func checkIfTerminal(w io.Writer) bool {
switch v := w.(type) {
case *os.File:
return terminal.IsTerminal(int(v.Fd()))
return isTerminal(int(v.Fd()))
default:
return false
}

View file

@ -0,0 +1,11 @@
package logrus
import (
"golang.org/x/sys/unix"
)
// IsTerminal returns true if the given file descriptor is a terminal.
func isTerminal(fd int) bool {
_, err := unix.IoctlGetTermio(fd, unix.TCGETA)
return err == nil
}

View file

@ -0,0 +1,13 @@
// +build linux aix
package logrus
import "golang.org/x/sys/unix"
const ioctlReadTermios = unix.TCGETS
func isTerminal(fd int) bool {
_, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
return err == nil
}

View file

@ -6,15 +6,29 @@ import (
"io"
"os"
"syscall"
sequences "github.com/konsorten/go-windows-terminal-sequences"
)
func initTerminal(w io.Writer) {
switch v := w.(type) {
case *os.File:
sequences.EnableVirtualTerminalProcessing(syscall.Handle(v.Fd()), true)
}
}
func checkIfTerminal(w io.Writer) bool {
var ret bool
switch v := w.(type) {
case *os.File:
var mode uint32
err := syscall.GetConsoleMode(syscall.Handle(v.Fd()), &mode)
return err == nil
ret = (err == nil)
default:
return false
ret = false
}
if ret {
initTerminal(w)
}
return ret
}

View file

@ -1,8 +0,0 @@
// +build !windows
package logrus
import "io"
func initTerminal(w io.Writer) {
}

View file

@ -1,18 +0,0 @@
// +build !appengine,!js,windows
package logrus
import (
"io"
"os"
"syscall"
sequences "github.com/konsorten/go-windows-terminal-sequences"
)
func initTerminal(w io.Writer) {
switch v := w.(type) {
case *os.File:
sequences.EnableVirtualTerminalProcessing(syscall.Handle(v.Fd()), true)
}
}

View file

@ -4,6 +4,7 @@ import (
"bytes"
"fmt"
"os"
"runtime"
"sort"
"strings"
"sync"
@ -11,18 +12,13 @@ import (
)
const (
nocolor = 0
red = 31
green = 32
yellow = 33
blue = 36
gray = 37
red = 31
yellow = 33
blue = 36
gray = 37
)
var (
baseTimestamp time.Time
emptyFieldMap FieldMap
)
var baseTimestamp time.Time
func init() {
baseTimestamp = time.Now()
@ -76,21 +72,23 @@ type TextFormatter struct {
// FieldKeyMsg: "@message"}}
FieldMap FieldMap
// CallerPrettyfier can be set by the user to modify the content
// of the function and file keys in the data when ReportCaller is
// activated. If any of the returned value is the empty string the
// corresponding key will be removed from fields.
CallerPrettyfier func(*runtime.Frame) (function string, file string)
terminalInitOnce sync.Once
}
func (f *TextFormatter) init(entry *Entry) {
if entry.Logger != nil {
f.isTerminal = checkIfTerminal(entry.Logger.Out)
if f.isTerminal {
initTerminal(entry.Logger.Out)
}
}
}
func (f *TextFormatter) isColored() bool {
isColored := f.ForceColors || f.isTerminal
isColored := f.ForceColors || (f.isTerminal && (runtime.GOOS != "windows"))
if f.EnvironmentOverrideColors {
if force, ok := os.LookupEnv("CLICOLOR_FORCE"); ok && force != "0" {
@ -107,14 +105,19 @@ func (f *TextFormatter) isColored() bool {
// Format renders a single log entry
func (f *TextFormatter) Format(entry *Entry) ([]byte, error) {
prefixFieldClashes(entry.Data, f.FieldMap, entry.HasCaller())
keys := make([]string, 0, len(entry.Data))
for k := range entry.Data {
data := make(Fields)
for k, v := range entry.Data {
data[k] = v
}
prefixFieldClashes(data, f.FieldMap, entry.HasCaller())
keys := make([]string, 0, len(data))
for k := range data {
keys = append(keys, k)
}
fixedKeys := make([]string, 0, 4+len(entry.Data))
var funcVal, fileVal string
fixedKeys := make([]string, 0, 4+len(data))
if !f.DisableTimestamp {
fixedKeys = append(fixedKeys, f.FieldMap.resolve(FieldKeyTime))
}
@ -126,8 +129,19 @@ func (f *TextFormatter) Format(entry *Entry) ([]byte, error) {
fixedKeys = append(fixedKeys, f.FieldMap.resolve(FieldKeyLogrusError))
}
if entry.HasCaller() {
fixedKeys = append(fixedKeys,
f.FieldMap.resolve(FieldKeyFunc), f.FieldMap.resolve(FieldKeyFile))
if f.CallerPrettyfier != nil {
funcVal, fileVal = f.CallerPrettyfier(entry.Caller)
} else {
funcVal = entry.Caller.Function
fileVal = fmt.Sprintf("%s:%d", entry.Caller.File, entry.Caller.Line)
}
if funcVal != "" {
fixedKeys = append(fixedKeys, f.FieldMap.resolve(FieldKeyFunc))
}
if fileVal != "" {
fixedKeys = append(fixedKeys, f.FieldMap.resolve(FieldKeyFile))
}
}
if !f.DisableSorting {
@ -160,8 +174,9 @@ func (f *TextFormatter) Format(entry *Entry) ([]byte, error) {
timestampFormat = defaultTimestampFormat
}
if f.isColored() {
f.printColored(b, entry, keys, timestampFormat)
f.printColored(b, entry, keys, data, timestampFormat)
} else {
for _, key := range fixedKeys {
var value interface{}
switch {
@ -174,11 +189,11 @@ func (f *TextFormatter) Format(entry *Entry) ([]byte, error) {
case key == f.FieldMap.resolve(FieldKeyLogrusError):
value = entry.err
case key == f.FieldMap.resolve(FieldKeyFunc) && entry.HasCaller():
value = entry.Caller.Function
value = funcVal
case key == f.FieldMap.resolve(FieldKeyFile) && entry.HasCaller():
value = fmt.Sprintf("%s:%d", entry.Caller.File, entry.Caller.Line)
value = fileVal
default:
value = entry.Data[key]
value = data[key]
}
f.appendKeyValue(b, key, value)
}
@ -188,7 +203,7 @@ func (f *TextFormatter) Format(entry *Entry) ([]byte, error) {
return b.Bytes(), nil
}
func (f *TextFormatter) printColored(b *bytes.Buffer, entry *Entry, keys []string, timestampFormat string) {
func (f *TextFormatter) printColored(b *bytes.Buffer, entry *Entry, keys []string, data Fields, timestampFormat string) {
var levelColor int
switch entry.Level {
case DebugLevel, TraceLevel:
@ -211,10 +226,21 @@ func (f *TextFormatter) printColored(b *bytes.Buffer, entry *Entry, keys []strin
entry.Message = strings.TrimSuffix(entry.Message, "\n")
caller := ""
if entry.HasCaller() {
caller = fmt.Sprintf("%s:%d %s()",
entry.Caller.File, entry.Caller.Line, entry.Caller.Function)
funcVal := fmt.Sprintf("%s()", entry.Caller.Function)
fileVal := fmt.Sprintf("%s:%d", entry.Caller.File, entry.Caller.Line)
if f.CallerPrettyfier != nil {
funcVal, fileVal = f.CallerPrettyfier(entry.Caller)
}
if fileVal == "" {
caller = funcVal
} else if funcVal == "" {
caller = fileVal
} else {
caller = fileVal + " " + funcVal
}
}
if f.DisableTimestamp {
@ -225,7 +251,7 @@ func (f *TextFormatter) printColored(b *bytes.Buffer, entry *Entry, keys []strin
fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%s]%s %-44s ", levelColor, levelText, entry.Time.Format(timestampFormat), caller, entry.Message)
}
for _, k := range keys {
v := entry.Data[k]
v := data[k]
fmt.Fprintf(b, " \x1b[%dm%s\x1b[0m=", levelColor, k)
f.appendValue(b, v)
}

3
vendor/golang.org/x/crypto/AUTHORS generated vendored
View file

@ -1,3 +0,0 @@
# This source code refers to The Go Authors for copyright purposes.
# The master list of authors is in the main Go distribution,
# visible at https://tip.golang.org/AUTHORS.

View file

@ -1,3 +0,0 @@
# This source code was written by the Go contributors.
# The master list of contributors is in the main Go distribution,
# visible at https://tip.golang.org/CONTRIBUTORS.

27
vendor/golang.org/x/crypto/LICENSE generated vendored
View file

@ -1,27 +0,0 @@
Copyright (c) 2009 The Go Authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

22
vendor/golang.org/x/crypto/PATENTS generated vendored
View file

@ -1,22 +0,0 @@
Additional IP Rights Grant (Patents)
"This implementation" means the copyrightable works distributed by
Google as part of the Go project.
Google hereby grants to You a perpetual, worldwide, non-exclusive,
no-charge, royalty-free, irrevocable (except as stated in this section)
patent license to make, have made, use, offer to sell, sell, import,
transfer and otherwise run, modify and propagate the contents of this
implementation of Go, where such license applies only to those patent
claims, both currently owned or controlled by Google and acquired in
the future, licensable by Google that are necessarily infringed by this
implementation of Go. This grant does not include claims that would be
infringed only as a consequence of further modification of this
implementation. If you or your agent or exclusive licensee institute or
order or agree to the institution of patent litigation against any
entity (including a cross-claim or counterclaim in a lawsuit) alleging
that this implementation of Go or any code incorporated within this
implementation of Go constitutes direct or contributory patent
infringement, or inducement of patent infringement, then any patent
rights granted to you under this License for this implementation of Go
shall terminate as of the date such litigation is filed.

View file

@ -1,951 +0,0 @@
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package terminal
import (
"bytes"
"io"
"sync"
"unicode/utf8"
)
// EscapeCodes contains escape sequences that can be written to the terminal in
// order to achieve different styles of text.
type EscapeCodes struct {
// Foreground colors
Black, Red, Green, Yellow, Blue, Magenta, Cyan, White []byte
// Reset all attributes
Reset []byte
}
var vt100EscapeCodes = EscapeCodes{
Black: []byte{keyEscape, '[', '3', '0', 'm'},
Red: []byte{keyEscape, '[', '3', '1', 'm'},
Green: []byte{keyEscape, '[', '3', '2', 'm'},
Yellow: []byte{keyEscape, '[', '3', '3', 'm'},
Blue: []byte{keyEscape, '[', '3', '4', 'm'},
Magenta: []byte{keyEscape, '[', '3', '5', 'm'},
Cyan: []byte{keyEscape, '[', '3', '6', 'm'},
White: []byte{keyEscape, '[', '3', '7', 'm'},
Reset: []byte{keyEscape, '[', '0', 'm'},
}
// Terminal contains the state for running a VT100 terminal that is capable of
// reading lines of input.
type Terminal struct {
// AutoCompleteCallback, if non-null, is called for each keypress with
// the full input line and the current position of the cursor (in
// bytes, as an index into |line|). If it returns ok=false, the key
// press is processed normally. Otherwise it returns a replacement line
// and the new cursor position.
AutoCompleteCallback func(line string, pos int, key rune) (newLine string, newPos int, ok bool)
// Escape contains a pointer to the escape codes for this terminal.
// It's always a valid pointer, although the escape codes themselves
// may be empty if the terminal doesn't support them.
Escape *EscapeCodes
// lock protects the terminal and the state in this object from
// concurrent processing of a key press and a Write() call.
lock sync.Mutex
c io.ReadWriter
prompt []rune
// line is the current line being entered.
line []rune
// pos is the logical position of the cursor in line
pos int
// echo is true if local echo is enabled
echo bool
// pasteActive is true iff there is a bracketed paste operation in
// progress.
pasteActive bool
// cursorX contains the current X value of the cursor where the left
// edge is 0. cursorY contains the row number where the first row of
// the current line is 0.
cursorX, cursorY int
// maxLine is the greatest value of cursorY so far.
maxLine int
termWidth, termHeight int
// outBuf contains the terminal data to be sent.
outBuf []byte
// remainder contains the remainder of any partial key sequences after
// a read. It aliases into inBuf.
remainder []byte
inBuf [256]byte
// history contains previously entered commands so that they can be
// accessed with the up and down keys.
history stRingBuffer
// historyIndex stores the currently accessed history entry, where zero
// means the immediately previous entry.
historyIndex int
// When navigating up and down the history it's possible to return to
// the incomplete, initial line. That value is stored in
// historyPending.
historyPending string
}
// NewTerminal runs a VT100 terminal on the given ReadWriter. If the ReadWriter is
// a local terminal, that terminal must first have been put into raw mode.
// prompt is a string that is written at the start of each input line (i.e.
// "> ").
func NewTerminal(c io.ReadWriter, prompt string) *Terminal {
return &Terminal{
Escape: &vt100EscapeCodes,
c: c,
prompt: []rune(prompt),
termWidth: 80,
termHeight: 24,
echo: true,
historyIndex: -1,
}
}
const (
keyCtrlD = 4
keyCtrlU = 21
keyEnter = '\r'
keyEscape = 27
keyBackspace = 127
keyUnknown = 0xd800 /* UTF-16 surrogate area */ + iota
keyUp
keyDown
keyLeft
keyRight
keyAltLeft
keyAltRight
keyHome
keyEnd
keyDeleteWord
keyDeleteLine
keyClearScreen
keyPasteStart
keyPasteEnd
)
var (
crlf = []byte{'\r', '\n'}
pasteStart = []byte{keyEscape, '[', '2', '0', '0', '~'}
pasteEnd = []byte{keyEscape, '[', '2', '0', '1', '~'}
)
// bytesToKey tries to parse a key sequence from b. If successful, it returns
// the key and the remainder of the input. Otherwise it returns utf8.RuneError.
func bytesToKey(b []byte, pasteActive bool) (rune, []byte) {
if len(b) == 0 {
return utf8.RuneError, nil
}
if !pasteActive {
switch b[0] {
case 1: // ^A
return keyHome, b[1:]
case 5: // ^E
return keyEnd, b[1:]
case 8: // ^H
return keyBackspace, b[1:]
case 11: // ^K
return keyDeleteLine, b[1:]
case 12: // ^L
return keyClearScreen, b[1:]
case 23: // ^W
return keyDeleteWord, b[1:]
}
}
if b[0] != keyEscape {
if !utf8.FullRune(b) {
return utf8.RuneError, b
}
r, l := utf8.DecodeRune(b)
return r, b[l:]
}
if !pasteActive && len(b) >= 3 && b[0] == keyEscape && b[1] == '[' {
switch b[2] {
case 'A':
return keyUp, b[3:]
case 'B':
return keyDown, b[3:]
case 'C':
return keyRight, b[3:]
case 'D':
return keyLeft, b[3:]
case 'H':
return keyHome, b[3:]
case 'F':
return keyEnd, b[3:]
}
}
if !pasteActive && len(b) >= 6 && b[0] == keyEscape && b[1] == '[' && b[2] == '1' && b[3] == ';' && b[4] == '3' {
switch b[5] {
case 'C':
return keyAltRight, b[6:]
case 'D':
return keyAltLeft, b[6:]
}
}
if !pasteActive && len(b) >= 6 && bytes.Equal(b[:6], pasteStart) {
return keyPasteStart, b[6:]
}
if pasteActive && len(b) >= 6 && bytes.Equal(b[:6], pasteEnd) {
return keyPasteEnd, b[6:]
}
// If we get here then we have a key that we don't recognise, or a
// partial sequence. It's not clear how one should find the end of a
// sequence without knowing them all, but it seems that [a-zA-Z~] only
// appears at the end of a sequence.
for i, c := range b[0:] {
if c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c == '~' {
return keyUnknown, b[i+1:]
}
}
return utf8.RuneError, b
}
// queue appends data to the end of t.outBuf
func (t *Terminal) queue(data []rune) {
t.outBuf = append(t.outBuf, []byte(string(data))...)
}
var eraseUnderCursor = []rune{' ', keyEscape, '[', 'D'}
var space = []rune{' '}
func isPrintable(key rune) bool {
isInSurrogateArea := key >= 0xd800 && key <= 0xdbff
return key >= 32 && !isInSurrogateArea
}
// moveCursorToPos appends data to t.outBuf which will move the cursor to the
// given, logical position in the text.
func (t *Terminal) moveCursorToPos(pos int) {
if !t.echo {
return
}
x := visualLength(t.prompt) + pos
y := x / t.termWidth
x = x % t.termWidth
up := 0
if y < t.cursorY {
up = t.cursorY - y
}
down := 0
if y > t.cursorY {
down = y - t.cursorY
}
left := 0
if x < t.cursorX {
left = t.cursorX - x
}
right := 0
if x > t.cursorX {
right = x - t.cursorX
}
t.cursorX = x
t.cursorY = y
t.move(up, down, left, right)
}
func (t *Terminal) move(up, down, left, right int) {
movement := make([]rune, 3*(up+down+left+right))
m := movement
for i := 0; i < up; i++ {
m[0] = keyEscape
m[1] = '['
m[2] = 'A'
m = m[3:]
}
for i := 0; i < down; i++ {
m[0] = keyEscape
m[1] = '['
m[2] = 'B'
m = m[3:]
}
for i := 0; i < left; i++ {
m[0] = keyEscape
m[1] = '['
m[2] = 'D'
m = m[3:]
}
for i := 0; i < right; i++ {
m[0] = keyEscape
m[1] = '['
m[2] = 'C'
m = m[3:]
}
t.queue(movement)
}
func (t *Terminal) clearLineToRight() {
op := []rune{keyEscape, '[', 'K'}
t.queue(op)
}
const maxLineLength = 4096
func (t *Terminal) setLine(newLine []rune, newPos int) {
if t.echo {
t.moveCursorToPos(0)
t.writeLine(newLine)
for i := len(newLine); i < len(t.line); i++ {
t.writeLine(space)
}
t.moveCursorToPos(newPos)
}
t.line = newLine
t.pos = newPos
}
func (t *Terminal) advanceCursor(places int) {
t.cursorX += places
t.cursorY += t.cursorX / t.termWidth
if t.cursorY > t.maxLine {
t.maxLine = t.cursorY
}
t.cursorX = t.cursorX % t.termWidth
if places > 0 && t.cursorX == 0 {
// Normally terminals will advance the current position
// when writing a character. But that doesn't happen
// for the last character in a line. However, when
// writing a character (except a new line) that causes
// a line wrap, the position will be advanced two
// places.
//
// So, if we are stopping at the end of a line, we
// need to write a newline so that our cursor can be
// advanced to the next line.
t.outBuf = append(t.outBuf, '\r', '\n')
}
}
func (t *Terminal) eraseNPreviousChars(n int) {
if n == 0 {
return
}
if t.pos < n {
n = t.pos
}
t.pos -= n
t.moveCursorToPos(t.pos)
copy(t.line[t.pos:], t.line[n+t.pos:])
t.line = t.line[:len(t.line)-n]
if t.echo {
t.writeLine(t.line[t.pos:])
for i := 0; i < n; i++ {
t.queue(space)
}
t.advanceCursor(n)
t.moveCursorToPos(t.pos)
}
}
// countToLeftWord returns then number of characters from the cursor to the
// start of the previous word.
func (t *Terminal) countToLeftWord() int {
if t.pos == 0 {
return 0
}
pos := t.pos - 1
for pos > 0 {
if t.line[pos] != ' ' {
break
}
pos--
}
for pos > 0 {
if t.line[pos] == ' ' {
pos++
break
}
pos--
}
return t.pos - pos
}
// countToRightWord returns then number of characters from the cursor to the
// start of the next word.
func (t *Terminal) countToRightWord() int {
pos := t.pos
for pos < len(t.line) {
if t.line[pos] == ' ' {
break
}
pos++
}
for pos < len(t.line) {
if t.line[pos] != ' ' {
break
}
pos++
}
return pos - t.pos
}
// visualLength returns the number of visible glyphs in s.
func visualLength(runes []rune) int {
inEscapeSeq := false
length := 0
for _, r := range runes {
switch {
case inEscapeSeq:
if (r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z') {
inEscapeSeq = false
}
case r == '\x1b':
inEscapeSeq = true
default:
length++
}
}
return length
}
// handleKey processes the given key and, optionally, returns a line of text
// that the user has entered.
func (t *Terminal) handleKey(key rune) (line string, ok bool) {
if t.pasteActive && key != keyEnter {
t.addKeyToLine(key)
return
}
switch key {
case keyBackspace:
if t.pos == 0 {
return
}
t.eraseNPreviousChars(1)
case keyAltLeft:
// move left by a word.
t.pos -= t.countToLeftWord()
t.moveCursorToPos(t.pos)
case keyAltRight:
// move right by a word.
t.pos += t.countToRightWord()
t.moveCursorToPos(t.pos)
case keyLeft:
if t.pos == 0 {
return
}
t.pos--
t.moveCursorToPos(t.pos)
case keyRight:
if t.pos == len(t.line) {
return
}
t.pos++
t.moveCursorToPos(t.pos)
case keyHome:
if t.pos == 0 {
return
}
t.pos = 0
t.moveCursorToPos(t.pos)
case keyEnd:
if t.pos == len(t.line) {
return
}
t.pos = len(t.line)
t.moveCursorToPos(t.pos)
case keyUp:
entry, ok := t.history.NthPreviousEntry(t.historyIndex + 1)
if !ok {
return "", false
}
if t.historyIndex == -1 {
t.historyPending = string(t.line)
}
t.historyIndex++
runes := []rune(entry)
t.setLine(runes, len(runes))
case keyDown:
switch t.historyIndex {
case -1:
return
case 0:
runes := []rune(t.historyPending)
t.setLine(runes, len(runes))
t.historyIndex--
default:
entry, ok := t.history.NthPreviousEntry(t.historyIndex - 1)
if ok {
t.historyIndex--
runes := []rune(entry)
t.setLine(runes, len(runes))
}
}
case keyEnter:
t.moveCursorToPos(len(t.line))
t.queue([]rune("\r\n"))
line = string(t.line)
ok = true
t.line = t.line[:0]
t.pos = 0
t.cursorX = 0
t.cursorY = 0
t.maxLine = 0
case keyDeleteWord:
// Delete zero or more spaces and then one or more characters.
t.eraseNPreviousChars(t.countToLeftWord())
case keyDeleteLine:
// Delete everything from the current cursor position to the
// end of line.
for i := t.pos; i < len(t.line); i++ {
t.queue(space)
t.advanceCursor(1)
}
t.line = t.line[:t.pos]
t.moveCursorToPos(t.pos)
case keyCtrlD:
// Erase the character under the current position.
// The EOF case when the line is empty is handled in
// readLine().
if t.pos < len(t.line) {
t.pos++
t.eraseNPreviousChars(1)
}
case keyCtrlU:
t.eraseNPreviousChars(t.pos)
case keyClearScreen:
// Erases the screen and moves the cursor to the home position.
t.queue([]rune("\x1b[2J\x1b[H"))
t.queue(t.prompt)
t.cursorX, t.cursorY = 0, 0
t.advanceCursor(visualLength(t.prompt))
t.setLine(t.line, t.pos)
default:
if t.AutoCompleteCallback != nil {
prefix := string(t.line[:t.pos])
suffix := string(t.line[t.pos:])
t.lock.Unlock()
newLine, newPos, completeOk := t.AutoCompleteCallback(prefix+suffix, len(prefix), key)
t.lock.Lock()
if completeOk {
t.setLine([]rune(newLine), utf8.RuneCount([]byte(newLine)[:newPos]))
return
}
}
if !isPrintable(key) {
return
}
if len(t.line) == maxLineLength {
return
}
t.addKeyToLine(key)
}
return
}
// addKeyToLine inserts the given key at the current position in the current
// line.
func (t *Terminal) addKeyToLine(key rune) {
if len(t.line) == cap(t.line) {
newLine := make([]rune, len(t.line), 2*(1+len(t.line)))
copy(newLine, t.line)
t.line = newLine
}
t.line = t.line[:len(t.line)+1]
copy(t.line[t.pos+1:], t.line[t.pos:])
t.line[t.pos] = key
if t.echo {
t.writeLine(t.line[t.pos:])
}
t.pos++
t.moveCursorToPos(t.pos)
}
func (t *Terminal) writeLine(line []rune) {
for len(line) != 0 {
remainingOnLine := t.termWidth - t.cursorX
todo := len(line)
if todo > remainingOnLine {
todo = remainingOnLine
}
t.queue(line[:todo])
t.advanceCursor(visualLength(line[:todo]))
line = line[todo:]
}
}
// writeWithCRLF writes buf to w but replaces all occurrences of \n with \r\n.
func writeWithCRLF(w io.Writer, buf []byte) (n int, err error) {
for len(buf) > 0 {
i := bytes.IndexByte(buf, '\n')
todo := len(buf)
if i >= 0 {
todo = i
}
var nn int
nn, err = w.Write(buf[:todo])
n += nn
if err != nil {
return n, err
}
buf = buf[todo:]
if i >= 0 {
if _, err = w.Write(crlf); err != nil {
return n, err
}
n++
buf = buf[1:]
}
}
return n, nil
}
func (t *Terminal) Write(buf []byte) (n int, err error) {
t.lock.Lock()
defer t.lock.Unlock()
if t.cursorX == 0 && t.cursorY == 0 {
// This is the easy case: there's nothing on the screen that we
// have to move out of the way.
return writeWithCRLF(t.c, buf)
}
// We have a prompt and possibly user input on the screen. We
// have to clear it first.
t.move(0 /* up */, 0 /* down */, t.cursorX /* left */, 0 /* right */)
t.cursorX = 0
t.clearLineToRight()
for t.cursorY > 0 {
t.move(1 /* up */, 0, 0, 0)
t.cursorY--
t.clearLineToRight()
}
if _, err = t.c.Write(t.outBuf); err != nil {
return
}
t.outBuf = t.outBuf[:0]
if n, err = writeWithCRLF(t.c, buf); err != nil {
return
}
t.writeLine(t.prompt)
if t.echo {
t.writeLine(t.line)
}
t.moveCursorToPos(t.pos)
if _, err = t.c.Write(t.outBuf); err != nil {
return
}
t.outBuf = t.outBuf[:0]
return
}
// ReadPassword temporarily changes the prompt and reads a password, without
// echo, from the terminal.
func (t *Terminal) ReadPassword(prompt string) (line string, err error) {
t.lock.Lock()
defer t.lock.Unlock()
oldPrompt := t.prompt
t.prompt = []rune(prompt)
t.echo = false
line, err = t.readLine()
t.prompt = oldPrompt
t.echo = true
return
}
// ReadLine returns a line of input from the terminal.
func (t *Terminal) ReadLine() (line string, err error) {
t.lock.Lock()
defer t.lock.Unlock()
return t.readLine()
}
func (t *Terminal) readLine() (line string, err error) {
// t.lock must be held at this point
if t.cursorX == 0 && t.cursorY == 0 {
t.writeLine(t.prompt)
t.c.Write(t.outBuf)
t.outBuf = t.outBuf[:0]
}
lineIsPasted := t.pasteActive
for {
rest := t.remainder
lineOk := false
for !lineOk {
var key rune
key, rest = bytesToKey(rest, t.pasteActive)
if key == utf8.RuneError {
break
}
if !t.pasteActive {
if key == keyCtrlD {
if len(t.line) == 0 {
return "", io.EOF
}
}
if key == keyPasteStart {
t.pasteActive = true
if len(t.line) == 0 {
lineIsPasted = true
}
continue
}
} else if key == keyPasteEnd {
t.pasteActive = false
continue
}
if !t.pasteActive {
lineIsPasted = false
}
line, lineOk = t.handleKey(key)
}
if len(rest) > 0 {
n := copy(t.inBuf[:], rest)
t.remainder = t.inBuf[:n]
} else {
t.remainder = nil
}
t.c.Write(t.outBuf)
t.outBuf = t.outBuf[:0]
if lineOk {
if t.echo {
t.historyIndex = -1
t.history.Add(line)
}
if lineIsPasted {
err = ErrPasteIndicator
}
return
}
// t.remainder is a slice at the beginning of t.inBuf
// containing a partial key sequence
readBuf := t.inBuf[len(t.remainder):]
var n int
t.lock.Unlock()
n, err = t.c.Read(readBuf)
t.lock.Lock()
if err != nil {
return
}
t.remainder = t.inBuf[:n+len(t.remainder)]
}
}
// SetPrompt sets the prompt to be used when reading subsequent lines.
func (t *Terminal) SetPrompt(prompt string) {
t.lock.Lock()
defer t.lock.Unlock()
t.prompt = []rune(prompt)
}
func (t *Terminal) clearAndRepaintLinePlusNPrevious(numPrevLines int) {
// Move cursor to column zero at the start of the line.
t.move(t.cursorY, 0, t.cursorX, 0)
t.cursorX, t.cursorY = 0, 0
t.clearLineToRight()
for t.cursorY < numPrevLines {
// Move down a line
t.move(0, 1, 0, 0)
t.cursorY++
t.clearLineToRight()
}
// Move back to beginning.
t.move(t.cursorY, 0, 0, 0)
t.cursorX, t.cursorY = 0, 0
t.queue(t.prompt)
t.advanceCursor(visualLength(t.prompt))
t.writeLine(t.line)
t.moveCursorToPos(t.pos)
}
func (t *Terminal) SetSize(width, height int) error {
t.lock.Lock()
defer t.lock.Unlock()
if width == 0 {
width = 1
}
oldWidth := t.termWidth
t.termWidth, t.termHeight = width, height
switch {
case width == oldWidth:
// If the width didn't change then nothing else needs to be
// done.
return nil
case len(t.line) == 0 && t.cursorX == 0 && t.cursorY == 0:
// If there is nothing on current line and no prompt printed,
// just do nothing
return nil
case width < oldWidth:
// Some terminals (e.g. xterm) will truncate lines that were
// too long when shinking. Others, (e.g. gnome-terminal) will
// attempt to wrap them. For the former, repainting t.maxLine
// works great, but that behaviour goes badly wrong in the case
// of the latter because they have doubled every full line.
// We assume that we are working on a terminal that wraps lines
// and adjust the cursor position based on every previous line
// wrapping and turning into two. This causes the prompt on
// xterms to move upwards, which isn't great, but it avoids a
// huge mess with gnome-terminal.
if t.cursorX >= t.termWidth {
t.cursorX = t.termWidth - 1
}
t.cursorY *= 2
t.clearAndRepaintLinePlusNPrevious(t.maxLine * 2)
case width > oldWidth:
// If the terminal expands then our position calculations will
// be wrong in the future because we think the cursor is
// |t.pos| chars into the string, but there will be a gap at
// the end of any wrapped line.
//
// But the position will actually be correct until we move, so
// we can move back to the beginning and repaint everything.
t.clearAndRepaintLinePlusNPrevious(t.maxLine)
}
_, err := t.c.Write(t.outBuf)
t.outBuf = t.outBuf[:0]
return err
}
type pasteIndicatorError struct{}
func (pasteIndicatorError) Error() string {
return "terminal: ErrPasteIndicator not correctly handled"
}
// ErrPasteIndicator may be returned from ReadLine as the error, in addition
// to valid line data. It indicates that bracketed paste mode is enabled and
// that the returned line consists only of pasted data. Programs may wish to
// interpret pasted data more literally than typed data.
var ErrPasteIndicator = pasteIndicatorError{}
// SetBracketedPasteMode requests that the terminal bracket paste operations
// with markers. Not all terminals support this but, if it is supported, then
// enabling this mode will stop any autocomplete callback from running due to
// pastes. Additionally, any lines that are completely pasted will be returned
// from ReadLine with the error set to ErrPasteIndicator.
func (t *Terminal) SetBracketedPasteMode(on bool) {
if on {
io.WriteString(t.c, "\x1b[?2004h")
} else {
io.WriteString(t.c, "\x1b[?2004l")
}
}
// stRingBuffer is a ring buffer of strings.
type stRingBuffer struct {
// entries contains max elements.
entries []string
max int
// head contains the index of the element most recently added to the ring.
head int
// size contains the number of elements in the ring.
size int
}
func (s *stRingBuffer) Add(a string) {
if s.entries == nil {
const defaultNumEntries = 100
s.entries = make([]string, defaultNumEntries)
s.max = defaultNumEntries
}
s.head = (s.head + 1) % s.max
s.entries[s.head] = a
if s.size < s.max {
s.size++
}
}
// NthPreviousEntry returns the value passed to the nth previous call to Add.
// If n is zero then the immediately prior value is returned, if one, then the
// next most recent, and so on. If such an element doesn't exist then ok is
// false.
func (s *stRingBuffer) NthPreviousEntry(n int) (value string, ok bool) {
if n >= s.size {
return "", false
}
index := s.head - n
if index < 0 {
index += s.max
}
return s.entries[index], true
}
// readPasswordLine reads from reader until it finds \n or io.EOF.
// The slice returned does not include the \n.
// readPasswordLine also ignores any \r it finds.
func readPasswordLine(reader io.Reader) ([]byte, error) {
var buf [1]byte
var ret []byte
for {
n, err := reader.Read(buf[:])
if n > 0 {
switch buf[0] {
case '\n':
return ret, nil
case '\r':
// remove \r from passwords on Windows
default:
ret = append(ret, buf[0])
}
continue
}
if err != nil {
if err == io.EOF && len(ret) > 0 {
return ret, nil
}
return ret, err
}
}
}

View file

@ -1,114 +0,0 @@
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin dragonfly freebsd linux,!appengine netbsd openbsd
// Package terminal provides support functions for dealing with terminals, as
// commonly found on UNIX systems.
//
// Putting a terminal into raw mode is the most common requirement:
//
// oldState, err := terminal.MakeRaw(0)
// if err != nil {
// panic(err)
// }
// defer terminal.Restore(0, oldState)
package terminal // import "golang.org/x/crypto/ssh/terminal"
import (
"golang.org/x/sys/unix"
)
// State contains the state of a terminal.
type State struct {
termios unix.Termios
}
// IsTerminal returns true if the given file descriptor is a terminal.
func IsTerminal(fd int) bool {
_, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
return err == nil
}
// MakeRaw put the terminal connected to the given file descriptor into raw
// mode and returns the previous state of the terminal so that it can be
// restored.
func MakeRaw(fd int) (*State, error) {
termios, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
if err != nil {
return nil, err
}
oldState := State{termios: *termios}
// This attempts to replicate the behaviour documented for cfmakeraw in
// the termios(3) manpage.
termios.Iflag &^= unix.IGNBRK | unix.BRKINT | unix.PARMRK | unix.ISTRIP | unix.INLCR | unix.IGNCR | unix.ICRNL | unix.IXON
termios.Oflag &^= unix.OPOST
termios.Lflag &^= unix.ECHO | unix.ECHONL | unix.ICANON | unix.ISIG | unix.IEXTEN
termios.Cflag &^= unix.CSIZE | unix.PARENB
termios.Cflag |= unix.CS8
termios.Cc[unix.VMIN] = 1
termios.Cc[unix.VTIME] = 0
if err := unix.IoctlSetTermios(fd, ioctlWriteTermios, termios); err != nil {
return nil, err
}
return &oldState, nil
}
// GetState returns the current state of a terminal which may be useful to
// restore the terminal after a signal.
func GetState(fd int) (*State, error) {
termios, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
if err != nil {
return nil, err
}
return &State{termios: *termios}, nil
}
// Restore restores the terminal connected to the given file descriptor to a
// previous state.
func Restore(fd int, state *State) error {
return unix.IoctlSetTermios(fd, ioctlWriteTermios, &state.termios)
}
// GetSize returns the dimensions of the given terminal.
func GetSize(fd int) (width, height int, err error) {
ws, err := unix.IoctlGetWinsize(fd, unix.TIOCGWINSZ)
if err != nil {
return -1, -1, err
}
return int(ws.Col), int(ws.Row), nil
}
// passwordReader is an io.Reader that reads from a specific file descriptor.
type passwordReader int
func (r passwordReader) Read(buf []byte) (int, error) {
return unix.Read(int(r), buf)
}
// ReadPassword reads a line of input from a terminal without local echo. This
// is commonly used for inputting passwords and other sensitive data. The slice
// returned does not include the \n.
func ReadPassword(fd int) ([]byte, error) {
termios, err := unix.IoctlGetTermios(fd, ioctlReadTermios)
if err != nil {
return nil, err
}
newState := *termios
newState.Lflag &^= unix.ECHO
newState.Lflag |= unix.ICANON | unix.ISIG
newState.Iflag |= unix.ICRNL
if err := unix.IoctlSetTermios(fd, ioctlWriteTermios, &newState); err != nil {
return nil, err
}
defer unix.IoctlSetTermios(fd, ioctlWriteTermios, termios)
return readPasswordLine(passwordReader(fd))
}

View file

@ -1,12 +0,0 @@
// Copyright 2013 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 darwin dragonfly freebsd netbsd openbsd
package terminal
import "golang.org/x/sys/unix"
const ioctlReadTermios = unix.TIOCGETA
const ioctlWriteTermios = unix.TIOCSETA

View file

@ -1,10 +0,0 @@
// Copyright 2013 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 terminal
import "golang.org/x/sys/unix"
const ioctlReadTermios = unix.TCGETS
const ioctlWriteTermios = unix.TCSETS

View file

@ -1,58 +0,0 @@
// Copyright 2016 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 terminal provides support functions for dealing with terminals, as
// commonly found on UNIX systems.
//
// Putting a terminal into raw mode is the most common requirement:
//
// oldState, err := terminal.MakeRaw(0)
// if err != nil {
// panic(err)
// }
// defer terminal.Restore(0, oldState)
package terminal
import (
"fmt"
"runtime"
)
type State struct{}
// IsTerminal returns true if the given file descriptor is a terminal.
func IsTerminal(fd int) bool {
return false
}
// MakeRaw put the terminal connected to the given file descriptor into raw
// mode and returns the previous state of the terminal so that it can be
// restored.
func MakeRaw(fd int) (*State, error) {
return nil, fmt.Errorf("terminal: MakeRaw not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
}
// GetState returns the current state of a terminal which may be useful to
// restore the terminal after a signal.
func GetState(fd int) (*State, error) {
return nil, fmt.Errorf("terminal: GetState not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
}
// Restore restores the terminal connected to the given file descriptor to a
// previous state.
func Restore(fd int, state *State) error {
return fmt.Errorf("terminal: Restore not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
}
// GetSize returns the dimensions of the given terminal.
func GetSize(fd int) (width, height int, err error) {
return 0, 0, fmt.Errorf("terminal: GetSize not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
}
// ReadPassword reads a line of input from a terminal without local echo. This
// is commonly used for inputting passwords and other sensitive data. The slice
// returned does not include the \n.
func ReadPassword(fd int) ([]byte, error) {
return nil, fmt.Errorf("terminal: ReadPassword not implemented on %s/%s", runtime.GOOS, runtime.GOARCH)
}

View file

@ -1,124 +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 solaris
package terminal // import "golang.org/x/crypto/ssh/terminal"
import (
"golang.org/x/sys/unix"
"io"
"syscall"
)
// State contains the state of a terminal.
type State struct {
termios unix.Termios
}
// IsTerminal returns true if the given file descriptor is a terminal.
func IsTerminal(fd int) bool {
_, err := unix.IoctlGetTermio(fd, unix.TCGETA)
return err == nil
}
// ReadPassword reads a line of input from a terminal without local echo. This
// is commonly used for inputting passwords and other sensitive data. The slice
// returned does not include the \n.
func ReadPassword(fd int) ([]byte, error) {
// see also: http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libast/common/uwin/getpass.c
val, err := unix.IoctlGetTermios(fd, unix.TCGETS)
if err != nil {
return nil, err
}
oldState := *val
newState := oldState
newState.Lflag &^= syscall.ECHO
newState.Lflag |= syscall.ICANON | syscall.ISIG
newState.Iflag |= syscall.ICRNL
err = unix.IoctlSetTermios(fd, unix.TCSETS, &newState)
if err != nil {
return nil, err
}
defer unix.IoctlSetTermios(fd, unix.TCSETS, &oldState)
var buf [16]byte
var ret []byte
for {
n, err := syscall.Read(fd, buf[:])
if err != nil {
return nil, err
}
if n == 0 {
if len(ret) == 0 {
return nil, io.EOF
}
break
}
if buf[n-1] == '\n' {
n--
}
ret = append(ret, buf[:n]...)
if n < len(buf) {
break
}
}
return ret, nil
}
// MakeRaw puts the terminal connected to the given file descriptor into raw
// mode and returns the previous state of the terminal so that it can be
// restored.
// see http://cr.illumos.org/~webrev/andy_js/1060/
func MakeRaw(fd int) (*State, error) {
termios, err := unix.IoctlGetTermios(fd, unix.TCGETS)
if err != nil {
return nil, err
}
oldState := State{termios: *termios}
termios.Iflag &^= unix.IGNBRK | unix.BRKINT | unix.PARMRK | unix.ISTRIP | unix.INLCR | unix.IGNCR | unix.ICRNL | unix.IXON
termios.Oflag &^= unix.OPOST
termios.Lflag &^= unix.ECHO | unix.ECHONL | unix.ICANON | unix.ISIG | unix.IEXTEN
termios.Cflag &^= unix.CSIZE | unix.PARENB
termios.Cflag |= unix.CS8
termios.Cc[unix.VMIN] = 1
termios.Cc[unix.VTIME] = 0
if err := unix.IoctlSetTermios(fd, unix.TCSETS, termios); err != nil {
return nil, err
}
return &oldState, nil
}
// Restore restores the terminal connected to the given file descriptor to a
// previous state.
func Restore(fd int, oldState *State) error {
return unix.IoctlSetTermios(fd, unix.TCSETS, &oldState.termios)
}
// GetState returns the current state of a terminal which may be useful to
// restore the terminal after a signal.
func GetState(fd int) (*State, error) {
termios, err := unix.IoctlGetTermios(fd, unix.TCGETS)
if err != nil {
return nil, err
}
return &State{termios: *termios}, nil
}
// GetSize returns the dimensions of the given terminal.
func GetSize(fd int) (width, height int, err error) {
ws, err := unix.IoctlGetWinsize(fd, unix.TIOCGWINSZ)
if err != nil {
return 0, 0, err
}
return int(ws.Col), int(ws.Row), nil
}

View file

@ -1,103 +0,0 @@
// Copyright 2011 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
// Package terminal provides support functions for dealing with terminals, as
// commonly found on UNIX systems.
//
// Putting a terminal into raw mode is the most common requirement:
//
// oldState, err := terminal.MakeRaw(0)
// if err != nil {
// panic(err)
// }
// defer terminal.Restore(0, oldState)
package terminal
import (
"os"
"golang.org/x/sys/windows"
)
type State struct {
mode uint32
}
// IsTerminal returns true if the given file descriptor is a terminal.
func IsTerminal(fd int) bool {
var st uint32
err := windows.GetConsoleMode(windows.Handle(fd), &st)
return err == nil
}
// MakeRaw put the terminal connected to the given file descriptor into raw
// mode and returns the previous state of the terminal so that it can be
// restored.
func MakeRaw(fd int) (*State, error) {
var st uint32
if err := windows.GetConsoleMode(windows.Handle(fd), &st); err != nil {
return nil, err
}
raw := st &^ (windows.ENABLE_ECHO_INPUT | windows.ENABLE_PROCESSED_INPUT | windows.ENABLE_LINE_INPUT | windows.ENABLE_PROCESSED_OUTPUT)
if err := windows.SetConsoleMode(windows.Handle(fd), raw); err != nil {
return nil, err
}
return &State{st}, nil
}
// GetState returns the current state of a terminal which may be useful to
// restore the terminal after a signal.
func GetState(fd int) (*State, error) {
var st uint32
if err := windows.GetConsoleMode(windows.Handle(fd), &st); err != nil {
return nil, err
}
return &State{st}, nil
}
// Restore restores the terminal connected to the given file descriptor to a
// previous state.
func Restore(fd int, state *State) error {
return windows.SetConsoleMode(windows.Handle(fd), state.mode)
}
// GetSize returns the dimensions of the given terminal.
func GetSize(fd int) (width, height int, err error) {
var info windows.ConsoleScreenBufferInfo
if err := windows.GetConsoleScreenBufferInfo(windows.Handle(fd), &info); err != nil {
return 0, 0, err
}
return int(info.Size.X), int(info.Size.Y), nil
}
// ReadPassword reads a line of input from a terminal without local echo. This
// is commonly used for inputting passwords and other sensitive data. The slice
// returned does not include the \n.
func ReadPassword(fd int) ([]byte, error) {
var st uint32
if err := windows.GetConsoleMode(windows.Handle(fd), &st); err != nil {
return nil, err
}
old := st
st &^= (windows.ENABLE_ECHO_INPUT)
st |= (windows.ENABLE_PROCESSED_INPUT | windows.ENABLE_LINE_INPUT | windows.ENABLE_PROCESSED_OUTPUT)
if err := windows.SetConsoleMode(windows.Handle(fd), st); err != nil {
return nil, err
}
defer windows.SetConsoleMode(windows.Handle(fd), old)
var h windows.Handle
p, _ := windows.GetCurrentProcess()
if err := windows.DuplicateHandle(p, windows.Handle(fd), p, &h, 0, false, windows.DUPLICATE_SAME_ACCESS); err != nil {
return nil, err
}
f := os.NewFile(uintptr(h), "stdin")
defer f.Close()
return readPasswordLine(f)
}

View file

@ -14,7 +14,7 @@ migrating the build system to use containers so the builds are reproducible.
This is being done on an OS-by-OS basis. Please update this documentation as
components of the build system change.
### Old Build System (currently for `GOOS != "Linux" || GOARCH == "sparc64"`)
### Old Build System (currently for `GOOS != "linux"`)
The old build system generates the Go files based on the C header files
present on your system. This means that files
@ -32,9 +32,9 @@ To build the files for your current OS and architecture, make sure GOOS and
GOARCH are set correctly and run `mkall.sh`. This will generate the files for
your specific system. Running `mkall.sh -n` shows the commands that will be run.
Requirements: bash, perl, go
Requirements: bash, go
### New Build System (currently for `GOOS == "Linux" && GOARCH != "sparc64"`)
### New Build System (currently for `GOOS == "linux"`)
The new build system uses a Docker container to generate the go files directly
from source checkouts of the kernel and various system libraries. This means
@ -52,14 +52,14 @@ system and have your GOOS and GOARCH set accordingly. Running `mkall.sh` will
then generate all of the files for all of the GOOS/GOARCH pairs in the new build
system. Running `mkall.sh -n` shows the commands that will be run.
Requirements: bash, perl, go, docker
Requirements: bash, go, docker
## Component files
This section describes the various files used in the code generation process.
It also contains instructions on how to modify these files to add a new
architecture/OS or to add additional syscalls, types, or constants. Note that
if you are using the new build system, the scripts cannot be called normally.
if you are using the new build system, the scripts/programs cannot be called normally.
They must be called from within the docker container.
### asm files
@ -81,8 +81,8 @@ each GOOS/GOARCH pair.
### mksysnum
Mksysnum is a script located at `${GOOS}/mksysnum.pl` (or `mksysnum_${GOOS}.pl`
for the old system). This script takes in a list of header files containing the
Mksysnum is a Go program located at `${GOOS}/mksysnum.go` (or `mksysnum_${GOOS}.go`
for the old system). This program takes in a list of header files containing the
syscall number declarations and parses them to produce the corresponding list of
Go numeric constants. See `zsysnum_${GOOS}_${GOARCH}.go` for the generated
constants.
@ -92,14 +92,14 @@ new installation of the target OS (or updating the source checkouts for the
new build system). However, depending on the OS, you make need to update the
parsing in mksysnum.
### mksyscall.pl
### mksyscall.go
The `syscall.go`, `syscall_${GOOS}.go`, `syscall_${GOOS}_${GOARCH}.go` are
hand-written Go files which implement system calls (for unix, the specific OS,
or the specific OS/Architecture pair respectively) that need special handling
and list `//sys` comments giving prototypes for ones that can be generated.
The mksyscall.pl script takes the `//sys` and `//sysnb` comments and converts
The mksyscall.go program takes the `//sys` and `//sysnb` comments and converts
them into syscalls. This requires the name of the prototype in the comment to
match a syscall number in the `zsysnum_${GOOS}_${GOARCH}.go` file. The function
prototype can be exported (capitalized) or not.
@ -160,7 +160,7 @@ signal numbers, and constants. Generated by `mkerrors.sh` (see above).
### `zsyscall_${GOOS}_${GOARCH}.go`
A file containing all the generated syscalls for a specific GOOS and GOARCH.
Generated by `mksyscall.pl` (see above).
Generated by `mksyscall.go` (see above).
### `zsysnum_${GOOS}_${GOARCH}.go`

29
vendor/golang.org/x/sys/unix/asm_freebsd_arm64.s generated vendored Normal file
View file

@ -0,0 +1,29 @@
// 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 !gccgo
#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)

29
vendor/golang.org/x/sys/unix/asm_netbsd_arm64.s generated vendored Normal file
View file

@ -0,0 +1,29 @@
// 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 !gccgo
#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)

View file

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin dragonfly freebsd linux netbsd openbsd
// +build dragonfly freebsd linux netbsd openbsd
package unix

18
vendor/golang.org/x/sys/unix/fcntl_darwin.go generated vendored Normal file
View file

@ -0,0 +1,18 @@
// 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.
package unix
import "unsafe"
// FcntlInt performs a fcntl syscall on fd with the provided command and argument.
func FcntlInt(fd uintptr, cmd, arg int) (int, error) {
return fcntl(int(fd), cmd, arg)
}
// FcntlFlock performs a fcntl syscall for the F_GETLK, F_SETLK or F_SETLKW command.
func FcntlFlock(fd uintptr, cmd int, lk *Flock_t) error {
_, err := fcntl(int(fd), cmd, int(uintptr(unsafe.Pointer(lk))))
return err
}

View file

@ -10,13 +10,14 @@
GOOSARCH="${GOOS}_${GOARCH}"
# defaults
mksyscall="./mksyscall.pl"
mksyscall="go run mksyscall.go"
mkerrors="./mkerrors.sh"
zerrors="zerrors_$GOOSARCH.go"
mksysctl=""
zsysctl="zsysctl_$GOOSARCH.go"
mksysnum=
mktypes=
mkasm=
run="sh"
cmd=""
@ -45,8 +46,8 @@ case "$#" in
exit 2
esac
if [[ "$GOOS" = "linux" ]] && [[ "$GOARCH" != "sparc64" ]]; then
# Use then new build system
if [[ "$GOOS" = "linux" ]]; then
# Use the Docker-based build system
# Files generated through docker (use $cmd so you can Ctl-C the build or run)
$cmd docker build --tag generate:$GOOS $GOOS
$cmd docker run --interactive --tty --volume $(dirname "$(readlink -f "$0")"):/build generate:$GOOS
@ -61,112 +62,115 @@ _* | *_ | _)
;;
aix_ppc)
mkerrors="$mkerrors -maix32"
mksyscall="./mksyscall_aix_ppc.pl -aix"
mksyscall="go run mksyscall_aix_ppc.go -aix"
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
;;
aix_ppc64)
mkerrors="$mkerrors -maix64"
mksyscall="./mksyscall_aix_ppc64.pl -aix"
mksyscall="go run mksyscall_aix_ppc64.go -aix"
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
;;
darwin_386)
mkerrors="$mkerrors -m32"
mksyscall="./mksyscall.pl -l32"
mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
mksyscall="go run mksyscall.go -l32"
mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
mkasm="go run mkasm_darwin.go"
;;
darwin_amd64)
mkerrors="$mkerrors -m64"
mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk macosx)/usr/include/sys/syscall.h"
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
mkasm="go run mkasm_darwin.go"
;;
darwin_arm)
mkerrors="$mkerrors"
mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
mksyscall="go run mksyscall.go -l32"
mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
mkasm="go run mkasm_darwin.go"
;;
darwin_arm64)
mkerrors="$mkerrors -m64"
mksysnum="./mksysnum_darwin.pl $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
mksysnum="go run mksysnum.go $(xcrun --show-sdk-path --sdk iphoneos)/usr/include/sys/syscall.h"
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
mkasm="go run mkasm_darwin.go"
;;
dragonfly_amd64)
mkerrors="$mkerrors -m64"
mksyscall="./mksyscall.pl -dragonfly"
mksysnum="curl -s 'http://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/sys/kern/syscalls.master' | ./mksysnum_dragonfly.pl"
mksyscall="go run mksyscall.go -dragonfly"
mksysnum="go run mksysnum.go 'https://gitweb.dragonflybsd.org/dragonfly.git/blob_plain/HEAD:/sys/kern/syscalls.master'"
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
;;
freebsd_386)
mkerrors="$mkerrors -m32"
mksyscall="./mksyscall.pl -l32"
mksysnum="curl -s 'http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master' | ./mksysnum_freebsd.pl"
mksyscall="go run mksyscall.go -l32"
mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'"
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
;;
freebsd_amd64)
mkerrors="$mkerrors -m64"
mksysnum="curl -s 'http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master' | ./mksysnum_freebsd.pl"
mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'"
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
;;
freebsd_arm)
mkerrors="$mkerrors"
mksyscall="./mksyscall.pl -l32 -arm"
mksysnum="curl -s 'http://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master' | ./mksysnum_freebsd.pl"
mksyscall="go run mksyscall.go -l32 -arm"
mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'"
# Let the type of C char be signed for making the bare syscall
# API consistent across platforms.
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
;;
linux_sparc64)
GOOSARCH_in=syscall_linux_sparc64.go
unistd_h=/usr/include/sparc64-linux-gnu/asm/unistd.h
freebsd_arm64)
mkerrors="$mkerrors -m64"
mksysnum="./mksysnum_linux.pl $unistd_h"
mksysnum="go run mksysnum.go 'https://svn.freebsd.org/base/stable/10/sys/kern/syscalls.master'"
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
;;
netbsd_386)
mkerrors="$mkerrors -m32"
mksyscall="./mksyscall.pl -l32 -netbsd"
mksysnum="curl -s 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_netbsd.pl"
mksyscall="go run mksyscall.go -l32 -netbsd"
mksysnum="go run mksysnum.go 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master'"
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
;;
netbsd_amd64)
mkerrors="$mkerrors -m64"
mksyscall="./mksyscall.pl -netbsd"
mksysnum="curl -s 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_netbsd.pl"
mksyscall="go run mksyscall.go -netbsd"
mksysnum="go run mksysnum.go 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master'"
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
;;
netbsd_arm)
mkerrors="$mkerrors"
mksyscall="./mksyscall.pl -l32 -netbsd -arm"
mksysnum="curl -s 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_netbsd.pl"
mksyscall="go run mksyscall.go -l32 -netbsd -arm"
mksysnum="go run mksysnum.go 'http://cvsweb.netbsd.org/bsdweb.cgi/~checkout~/src/sys/kern/syscalls.master'"
# Let the type of C char be signed for making the bare syscall
# API consistent across platforms.
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
;;
openbsd_386)
mkerrors="$mkerrors -m32"
mksyscall="./mksyscall.pl -l32 -openbsd"
mksyscall="go run mksyscall.go -l32 -openbsd"
mksysctl="./mksysctl_openbsd.pl"
mksysnum="curl -s 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl"
mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
;;
openbsd_amd64)
mkerrors="$mkerrors -m64"
mksyscall="./mksyscall.pl -openbsd"
mksyscall="go run mksyscall.go -openbsd"
mksysctl="./mksysctl_openbsd.pl"
mksysnum="curl -s 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl"
mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
;;
openbsd_arm)
mkerrors="$mkerrors"
mksyscall="./mksyscall.pl -l32 -openbsd -arm"
mksyscall="go run mksyscall.go -l32 -openbsd -arm"
mksysctl="./mksysctl_openbsd.pl"
mksysnum="curl -s 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl"
mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
# Let the type of C char be signed for making the bare syscall
# API consistent across platforms.
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
;;
solaris_amd64)
mksyscall="./mksyscall_solaris.pl"
mksyscall="go run mksyscall_solaris.go"
mkerrors="$mkerrors -m64"
mksysnum=
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
@ -191,6 +195,11 @@ esac
if [ "$GOOSARCH" == "aix_ppc64" ]; then
# aix/ppc64 script generates files instead of writing to stdin.
echo "$mksyscall -tags $GOOS,$GOARCH $syscall_goos $GOOSARCH_in && gofmt -w zsyscall_$GOOSARCH.go && gofmt -w zsyscall_"$GOOSARCH"_gccgo.go && gofmt -w zsyscall_"$GOOSARCH"_gc.go " ;
elif [ "$GOOS" == "darwin" ]; then
# pre-1.12, direct syscalls
echo "$mksyscall -tags $GOOS,$GOARCH,!go1.12 $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.1_11.go";
# 1.12 and later, syscalls via libSystem
echo "$mksyscall -tags $GOOS,$GOARCH,go1.12 $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go";
else
echo "$mksyscall -tags $GOOS,$GOARCH $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go";
fi
@ -198,7 +207,6 @@ esac
esac
if [ -n "$mksysctl" ]; then echo "$mksysctl |gofmt >$zsysctl"; fi
if [ -n "$mksysnum" ]; then echo "$mksysnum |gofmt >zsysnum_$GOOSARCH.go"; fi
if [ -n "$mktypes" ]; then
echo "$mktypes types_$GOOS.go | go run mkpost.go > ztypes_$GOOSARCH.go";
fi
if [ -n "$mktypes" ]; then echo "$mktypes types_$GOOS.go | go run mkpost.go > ztypes_$GOOSARCH.go"; fi
if [ -n "$mkasm" ]; then echo "$mkasm $GOARCH"; fi
) | $run

61
vendor/golang.org/x/sys/unix/mkasm_darwin.go generated vendored Normal file
View file

@ -0,0 +1,61 @@
// 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 ignore
// mkasm_darwin.go generates assembly trampolines to call libSystem routines from Go.
//This program must be run after mksyscall.go.
package main
import (
"bytes"
"fmt"
"io/ioutil"
"log"
"os"
"strings"
)
func main() {
in1, err := ioutil.ReadFile("syscall_darwin.go")
if err != nil {
log.Fatalf("can't open syscall_darwin.go: %s", err)
}
arch := os.Args[1]
in2, err := ioutil.ReadFile(fmt.Sprintf("syscall_darwin_%s.go", arch))
if err != nil {
log.Fatalf("can't open syscall_darwin_%s.go: %s", arch, err)
}
in3, err := ioutil.ReadFile(fmt.Sprintf("zsyscall_darwin_%s.go", arch))
if err != nil {
log.Fatalf("can't open zsyscall_darwin_%s.go: %s", arch, err)
}
in := string(in1) + string(in2) + string(in3)
trampolines := map[string]bool{}
var out bytes.Buffer
fmt.Fprintf(&out, "// go run mkasm_darwin.go %s\n", strings.Join(os.Args[1:], " "))
fmt.Fprintf(&out, "// Code generated by the command above; DO NOT EDIT.\n")
fmt.Fprintf(&out, "\n")
fmt.Fprintf(&out, "// +build go1.12\n")
fmt.Fprintf(&out, "\n")
fmt.Fprintf(&out, "#include \"textflag.h\"\n")
for _, line := range strings.Split(in, "\n") {
if !strings.HasPrefix(line, "func ") || !strings.HasSuffix(line, "_trampoline()") {
continue
}
fn := line[5 : len(line)-13]
if !trampolines[fn] {
trampolines[fn] = true
fmt.Fprintf(&out, "TEXT ·%s_trampoline(SB),NOSPLIT,$0-0\n", fn)
fmt.Fprintf(&out, "\tJMP\t%s(SB)\n", fn)
}
}
err = ioutil.WriteFile(fmt.Sprintf("zsyscall_darwin_%s.s", arch), out.Bytes(), 0644)
if err != nil {
log.Fatalf("can't write zsyscall_darwin_%s.s: %s", arch, err)
}
}

View file

@ -17,12 +17,10 @@ if test -z "$GOARCH" -o -z "$GOOS"; then
fi
# Check that we are using the new build system if we should
if [[ "$GOOS" = "linux" ]] && [[ "$GOARCH" != "sparc64" ]]; then
if [[ "$GOLANG_SYS_BUILD" != "docker" ]]; then
echo 1>&2 "In the new build system, mkerrors should not be called directly."
echo 1>&2 "See README.md"
exit 1
fi
if [[ "$GOOS" = "linux" ]] && [[ "$GOLANG_SYS_BUILD" != "docker" ]]; then
echo 1>&2 "In the Docker based build system, mkerrors should not be called directly."
echo 1>&2 "See README.md"
exit 1
fi
if [[ "$GOOS" = "aix" ]]; then
@ -181,16 +179,20 @@ struct ltchars {
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/signalfd.h>
#include <sys/socket.h>
#include <sys/xattr.h>
#include <linux/errqueue.h>
#include <linux/if.h>
#include <linux/if_alg.h>
#include <linux/if_arp.h>
#include <linux/if_ether.h>
#include <linux/if_ppp.h>
#include <linux/if_tun.h>
#include <linux/if_packet.h>
#include <linux/if_addr.h>
#include <linux/falloc.h>
#include <linux/fanotify.h>
#include <linux/filter.h>
#include <linux/fs.h>
#include <linux/kexec.h>
@ -222,7 +224,15 @@ struct ltchars {
#include <linux/if_xdp.h>
#include <mtd/ubi-user.h>
#include <net/route.h>
#if defined(__sparc__)
// On sparc{,64}, the kernel defines struct termios2 itself which clashes with the
// definition in glibc. As only the error constants are needed here, include the
// generic termibits.h (which is included by termbits.h on sparc).
#include <asm-generic/termbits.h>
#else
#include <asm/termbits.h>
#endif
#ifndef MSG_FASTOPEN
#define MSG_FASTOPEN 0x20000000
@ -250,16 +260,6 @@ struct ltchars {
#define FS_KEY_DESC_PREFIX "fscrypt:"
#define FS_KEY_DESC_PREFIX_SIZE 8
#define FS_MAX_KEY_SIZE 64
// XDP socket constants do not appear to be picked up otherwise.
// Copied from samples/bpf/xdpsock_user.c.
#ifndef SOL_XDP
#define SOL_XDP 283
#endif
#ifndef AF_XDP
#define AF_XDP 44
#endif
'
includes_NetBSD='
@ -446,7 +446,7 @@ ccflags="$@"
$2 !~ "MNT_BITS" &&
$2 ~ /^(MS|MNT|UMOUNT)_/ ||
$2 ~ /^TUN(SET|GET|ATTACH|DETACH)/ ||
$2 ~ /^(O|F|E?FD|NAME|S|PTRACE|PT)_/ ||
$2 ~ /^(O|F|[ES]?FD|NAME|S|PTRACE|PT)_/ ||
$2 ~ /^KEXEC_/ ||
$2 ~ /^LINUX_REBOOT_CMD_/ ||
$2 ~ /^LINUX_REBOOT_MAGIC[12]$/ ||
@ -467,12 +467,13 @@ ccflags="$@"
$2 ~ /^CLONE_[A-Z_]+/ ||
$2 !~ /^(BPF_TIMEVAL)$/ &&
$2 ~ /^(BPF|DLT)_/ ||
$2 ~ /^CLOCK_/ ||
$2 ~ /^(CLOCK|TIMER)_/ ||
$2 ~ /^CAN_/ ||
$2 ~ /^CAP_/ ||
$2 ~ /^ALG_/ ||
$2 ~ /^FS_(POLICY_FLAGS|KEY_DESC|ENCRYPTION_MODE|[A-Z0-9_]+_KEY_SIZE|IOC_(GET|SET)_ENCRYPTION)/ ||
$2 ~ /^GRND_/ ||
$2 ~ /^RND/ ||
$2 ~ /^KEY_(SPEC|REQKEY_DEFL)_/ ||
$2 ~ /^KEYCTL_/ ||
$2 ~ /^PERF_EVENT_IOC_/ ||
@ -500,6 +501,8 @@ ccflags="$@"
$2 ~ /^(HDIO|WIN|SMART)_/ ||
$2 !~ "WMESGLEN" &&
$2 ~ /^W[A-Z0-9]+$/ ||
$2 ~/^PPPIOC/ ||
$2 ~ /^FAN_|FANOTIFY_/ ||
$2 ~ /^BLK[A-Z]*(GET$|SET$|BUF$|PART$|SIZE)/ {printf("\t%s = C.%s\n", $2, $2)}
$2 ~ /^__WCOREFLAG$/ {next}
$2 ~ /^__W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", substr($2,3), $2)}

View file

@ -28,10 +28,10 @@ func main() {
if goarch == "" {
goarch = os.Getenv("GOARCH")
}
// Check that we are using the new build system if we should be.
if goos == "linux" && goarch != "sparc64" {
// Check that we are using the Docker-based build system if we should be.
if goos == "linux" {
if os.Getenv("GOLANG_SYS_BUILD") != "docker" {
os.Stderr.WriteString("In the new build system, mkpost should not be called directly.\n")
os.Stderr.WriteString("In the Docker-based build system, mkpost should not be called directly.\n")
os.Stderr.WriteString("See README.md\n")
os.Exit(1)
}

407
vendor/golang.org/x/sys/unix/mksyscall.go generated vendored Normal file
View file

@ -0,0 +1,407 @@
// 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 ignore
/*
This program reads a file containing function prototypes
(like syscall_darwin.go) and generates system call bodies.
The prototypes are marked by lines beginning with "//sys"
and read like func declarations if //sys is replaced by func, but:
* The parameter lists must give a name for each argument.
This includes return parameters.
* The parameter lists must give a type for each argument:
the (x, y, z int) shorthand is not allowed.
* If the return parameter is an error number, it must be named errno.
A line beginning with //sysnb is like //sys, except that the
goroutine will not be suspended during the execution of the system
call. This must only be used for system calls which can never
block, as otherwise the system call could cause all goroutines to
hang.
*/
package main
import (
"bufio"
"flag"
"fmt"
"os"
"regexp"
"strings"
)
var (
b32 = flag.Bool("b32", false, "32bit big-endian")
l32 = flag.Bool("l32", false, "32bit little-endian")
plan9 = flag.Bool("plan9", false, "plan9")
openbsd = flag.Bool("openbsd", false, "openbsd")
netbsd = flag.Bool("netbsd", false, "netbsd")
dragonfly = flag.Bool("dragonfly", false, "dragonfly")
arm = flag.Bool("arm", false, "arm") // 64-bit value should use (even, odd)-pair
tags = flag.String("tags", "", "build tags")
filename = flag.String("output", "", "output file name (standard output if omitted)")
)
// cmdLine returns this programs's commandline arguments
func cmdLine() string {
return "go run mksyscall.go " + strings.Join(os.Args[1:], " ")
}
// buildTags returns build tags
func buildTags() string {
return *tags
}
// Param is function parameter
type Param struct {
Name string
Type string
}
// usage prints the program usage
func usage() {
fmt.Fprintf(os.Stderr, "usage: go run mksyscall.go [-b32 | -l32] [-tags x,y] [file ...]\n")
os.Exit(1)
}
// parseParamList parses parameter list and returns a slice of parameters
func parseParamList(list string) []string {
list = strings.TrimSpace(list)
if list == "" {
return []string{}
}
return regexp.MustCompile(`\s*,\s*`).Split(list, -1)
}
// parseParam splits a parameter into name and type
func parseParam(p string) Param {
ps := regexp.MustCompile(`^(\S*) (\S*)$`).FindStringSubmatch(p)
if ps == nil {
fmt.Fprintf(os.Stderr, "malformed parameter: %s\n", p)
os.Exit(1)
}
return Param{ps[1], ps[2]}
}
func main() {
// Get the OS and architecture (using GOARCH_TARGET if it exists)
goos := os.Getenv("GOOS")
if goos == "" {
fmt.Fprintln(os.Stderr, "GOOS not defined in environment")
os.Exit(1)
}
goarch := os.Getenv("GOARCH_TARGET")
if goarch == "" {
goarch = os.Getenv("GOARCH")
}
// Check that we are using the Docker-based build system if we should
if goos == "linux" {
if os.Getenv("GOLANG_SYS_BUILD") != "docker" {
fmt.Fprintf(os.Stderr, "In the Docker-based build system, mksyscall should not be called directly.\n")
fmt.Fprintf(os.Stderr, "See README.md\n")
os.Exit(1)
}
}
flag.Usage = usage
flag.Parse()
if len(flag.Args()) <= 0 {
fmt.Fprintf(os.Stderr, "no files to parse provided\n")
usage()
}
endianness := ""
if *b32 {
endianness = "big-endian"
} else if *l32 {
endianness = "little-endian"
}
libc := false
if goos == "darwin" && strings.Contains(buildTags(), ",go1.12") {
libc = true
}
trampolines := map[string]bool{}
text := ""
for _, path := range flag.Args() {
file, err := os.Open(path)
if err != nil {
fmt.Fprintf(os.Stderr, err.Error())
os.Exit(1)
}
s := bufio.NewScanner(file)
for s.Scan() {
t := s.Text()
t = strings.TrimSpace(t)
t = regexp.MustCompile(`\s+`).ReplaceAllString(t, ` `)
nonblock := regexp.MustCompile(`^\/\/sysnb `).FindStringSubmatch(t)
if regexp.MustCompile(`^\/\/sys `).FindStringSubmatch(t) == nil && nonblock == nil {
continue
}
// Line must be of the form
// func Open(path string, mode int, perm int) (fd int, errno error)
// Split into name, in params, out params.
f := regexp.MustCompile(`^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*((?i)SYS_[A-Z0-9_]+))?$`).FindStringSubmatch(t)
if f == nil {
fmt.Fprintf(os.Stderr, "%s:%s\nmalformed //sys declaration\n", path, t)
os.Exit(1)
}
funct, inps, outps, sysname := f[2], f[3], f[4], f[5]
// ClockGettime doesn't have a syscall number on Darwin, only generate libc wrappers.
if goos == "darwin" && !libc && funct == "ClockGettime" {
continue
}
// Split argument lists on comma.
in := parseParamList(inps)
out := parseParamList(outps)
// Try in vain to keep people from editing this file.
// The theory is that they jump into the middle of the file
// without reading the header.
text += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"
// Go function header.
outDecl := ""
if len(out) > 0 {
outDecl = fmt.Sprintf(" (%s)", strings.Join(out, ", "))
}
text += fmt.Sprintf("func %s(%s)%s {\n", funct, strings.Join(in, ", "), outDecl)
// Check if err return available
errvar := ""
for _, param := range out {
p := parseParam(param)
if p.Type == "error" {
errvar = p.Name
break
}
}
// Prepare arguments to Syscall.
var args []string
n := 0
for _, param := range in {
p := parseParam(param)
if regexp.MustCompile(`^\*`).FindStringSubmatch(p.Type) != nil {
args = append(args, "uintptr(unsafe.Pointer("+p.Name+"))")
} else if p.Type == "string" && errvar != "" {
text += fmt.Sprintf("\tvar _p%d *byte\n", n)
text += fmt.Sprintf("\t_p%d, %s = BytePtrFromString(%s)\n", n, errvar, p.Name)
text += fmt.Sprintf("\tif %s != nil {\n\t\treturn\n\t}\n", errvar)
args = append(args, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n))
n++
} else if p.Type == "string" {
fmt.Fprintf(os.Stderr, path+":"+funct+" uses string arguments, but has no error return\n")
text += fmt.Sprintf("\tvar _p%d *byte\n", n)
text += fmt.Sprintf("\t_p%d, _ = BytePtrFromString(%s)\n", n, p.Name)
args = append(args, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n))
n++
} else if regexp.MustCompile(`^\[\](.*)`).FindStringSubmatch(p.Type) != nil {
// Convert slice into pointer, length.
// Have to be careful not to take address of &a[0] if len == 0:
// pass dummy pointer in that case.
// Used to pass nil, but some OSes or simulators reject write(fd, nil, 0).
text += fmt.Sprintf("\tvar _p%d unsafe.Pointer\n", n)
text += fmt.Sprintf("\tif len(%s) > 0 {\n\t\t_p%d = unsafe.Pointer(&%s[0])\n\t}", p.Name, n, p.Name)
text += fmt.Sprintf(" else {\n\t\t_p%d = unsafe.Pointer(&_zero)\n\t}\n", n)
args = append(args, fmt.Sprintf("uintptr(_p%d)", n), fmt.Sprintf("uintptr(len(%s))", p.Name))
n++
} else if p.Type == "int64" && (*openbsd || *netbsd) {
args = append(args, "0")
if endianness == "big-endian" {
args = append(args, fmt.Sprintf("uintptr(%s>>32)", p.Name), fmt.Sprintf("uintptr(%s)", p.Name))
} else if endianness == "little-endian" {
args = append(args, fmt.Sprintf("uintptr(%s)", p.Name), fmt.Sprintf("uintptr(%s>>32)", p.Name))
} else {
args = append(args, fmt.Sprintf("uintptr(%s)", p.Name))
}
} else if p.Type == "int64" && *dragonfly {
if regexp.MustCompile(`^(?i)extp(read|write)`).FindStringSubmatch(funct) == nil {
args = append(args, "0")
}
if endianness == "big-endian" {
args = append(args, fmt.Sprintf("uintptr(%s>>32)", p.Name), fmt.Sprintf("uintptr(%s)", p.Name))
} else if endianness == "little-endian" {
args = append(args, fmt.Sprintf("uintptr(%s)", p.Name), fmt.Sprintf("uintptr(%s>>32)", p.Name))
} else {
args = append(args, fmt.Sprintf("uintptr(%s)", p.Name))
}
} else if (p.Type == "int64" || p.Type == "uint64") && endianness != "" {
if len(args)%2 == 1 && *arm {
// arm abi specifies 64-bit argument uses
// (even, odd) pair
args = append(args, "0")
}
if endianness == "big-endian" {
args = append(args, fmt.Sprintf("uintptr(%s>>32)", p.Name), fmt.Sprintf("uintptr(%s)", p.Name))
} else {
args = append(args, fmt.Sprintf("uintptr(%s)", p.Name), fmt.Sprintf("uintptr(%s>>32)", p.Name))
}
} else {
args = append(args, fmt.Sprintf("uintptr(%s)", p.Name))
}
}
// Determine which form to use; pad args with zeros.
asm := "Syscall"
if nonblock != nil {
if errvar == "" && goos == "linux" {
asm = "RawSyscallNoError"
} else {
asm = "RawSyscall"
}
} else {
if errvar == "" && goos == "linux" {
asm = "SyscallNoError"
}
}
if len(args) <= 3 {
for len(args) < 3 {
args = append(args, "0")
}
} else if len(args) <= 6 {
asm += "6"
for len(args) < 6 {
args = append(args, "0")
}
} else if len(args) <= 9 {
asm += "9"
for len(args) < 9 {
args = append(args, "0")
}
} else {
fmt.Fprintf(os.Stderr, "%s:%s too many arguments to system call\n", path, funct)
}
// System call number.
if sysname == "" {
sysname = "SYS_" + funct
sysname = regexp.MustCompile(`([a-z])([A-Z])`).ReplaceAllString(sysname, `${1}_$2`)
sysname = strings.ToUpper(sysname)
}
var libcFn string
if libc {
asm = "syscall_" + strings.ToLower(asm[:1]) + asm[1:] // internal syscall call
sysname = strings.TrimPrefix(sysname, "SYS_") // remove SYS_
sysname = strings.ToLower(sysname) // lowercase
if sysname == "getdirentries64" {
// Special case - libSystem name and
// raw syscall name don't match.
sysname = "__getdirentries64"
}
libcFn = sysname
sysname = "funcPC(libc_" + sysname + "_trampoline)"
}
// Actual call.
arglist := strings.Join(args, ", ")
call := fmt.Sprintf("%s(%s, %s)", asm, sysname, arglist)
// Assign return values.
body := ""
ret := []string{"_", "_", "_"}
doErrno := false
for i := 0; i < len(out); i++ {
p := parseParam(out[i])
reg := ""
if p.Name == "err" && !*plan9 {
reg = "e1"
ret[2] = reg
doErrno = true
} else if p.Name == "err" && *plan9 {
ret[0] = "r0"
ret[2] = "e1"
break
} else {
reg = fmt.Sprintf("r%d", i)
ret[i] = reg
}
if p.Type == "bool" {
reg = fmt.Sprintf("%s != 0", reg)
}
if p.Type == "int64" && endianness != "" {
// 64-bit number in r1:r0 or r0:r1.
if i+2 > len(out) {
fmt.Fprintf(os.Stderr, "%s:%s not enough registers for int64 return\n", path, funct)
}
if endianness == "big-endian" {
reg = fmt.Sprintf("int64(r%d)<<32 | int64(r%d)", i, i+1)
} else {
reg = fmt.Sprintf("int64(r%d)<<32 | int64(r%d)", i+1, i)
}
ret[i] = fmt.Sprintf("r%d", i)
ret[i+1] = fmt.Sprintf("r%d", i+1)
}
if reg != "e1" || *plan9 {
body += fmt.Sprintf("\t%s = %s(%s)\n", p.Name, p.Type, reg)
}
}
if ret[0] == "_" && ret[1] == "_" && ret[2] == "_" {
text += fmt.Sprintf("\t%s\n", call)
} else {
if errvar == "" && goos == "linux" {
// raw syscall without error on Linux, see golang.org/issue/22924
text += fmt.Sprintf("\t%s, %s := %s\n", ret[0], ret[1], call)
} else {
text += fmt.Sprintf("\t%s, %s, %s := %s\n", ret[0], ret[1], ret[2], call)
}
}
text += body
if *plan9 && ret[2] == "e1" {
text += "\tif int32(r0) == -1 {\n"
text += "\t\terr = e1\n"
text += "\t}\n"
} else if doErrno {
text += "\tif e1 != 0 {\n"
text += "\t\terr = errnoErr(e1)\n"
text += "\t}\n"
}
text += "\treturn\n"
text += "}\n\n"
if libc && !trampolines[libcFn] {
// some system calls share a trampoline, like read and readlen.
trampolines[libcFn] = true
// Declare assembly trampoline.
text += fmt.Sprintf("func libc_%s_trampoline()\n", libcFn)
// Assembly trampoline calls the libc_* function, which this magic
// redirects to use the function from libSystem.
text += fmt.Sprintf("//go:linkname libc_%s libc_%s\n", libcFn, libcFn)
text += fmt.Sprintf("//go:cgo_import_dynamic libc_%s %s \"/usr/lib/libSystem.B.dylib\"\n", libcFn, libcFn)
text += "\n"
}
}
if err := s.Err(); err != nil {
fmt.Fprintf(os.Stderr, err.Error())
os.Exit(1)
}
file.Close()
}
fmt.Printf(srcTemplate, cmdLine(), buildTags(), text)
}
const srcTemplate = `// %s
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build %s
package unix
import (
"syscall"
"unsafe"
)
var _ syscall.Errno
%s
`

View file

@ -1,341 +0,0 @@
#!/usr/bin/env perl
# 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.
# This program reads a file containing function prototypes
# (like syscall_darwin.go) and generates system call bodies.
# The prototypes are marked by lines beginning with "//sys"
# and read like func declarations if //sys is replaced by func, but:
# * The parameter lists must give a name for each argument.
# This includes return parameters.
# * The parameter lists must give a type for each argument:
# the (x, y, z int) shorthand is not allowed.
# * If the return parameter is an error number, it must be named errno.
# A line beginning with //sysnb is like //sys, except that the
# goroutine will not be suspended during the execution of the system
# call. This must only be used for system calls which can never
# block, as otherwise the system call could cause all goroutines to
# hang.
use strict;
my $cmdline = "mksyscall.pl " . join(' ', @ARGV);
my $errors = 0;
my $_32bit = "";
my $plan9 = 0;
my $openbsd = 0;
my $netbsd = 0;
my $dragonfly = 0;
my $arm = 0; # 64-bit value should use (even, odd)-pair
my $tags = ""; # build tags
if($ARGV[0] eq "-b32") {
$_32bit = "big-endian";
shift;
} elsif($ARGV[0] eq "-l32") {
$_32bit = "little-endian";
shift;
}
if($ARGV[0] eq "-plan9") {
$plan9 = 1;
shift;
}
if($ARGV[0] eq "-openbsd") {
$openbsd = 1;
shift;
}
if($ARGV[0] eq "-netbsd") {
$netbsd = 1;
shift;
}
if($ARGV[0] eq "-dragonfly") {
$dragonfly = 1;
shift;
}
if($ARGV[0] eq "-arm") {
$arm = 1;
shift;
}
if($ARGV[0] eq "-tags") {
shift;
$tags = $ARGV[0];
shift;
}
if($ARGV[0] =~ /^-/) {
print STDERR "usage: mksyscall.pl [-b32 | -l32] [-tags x,y] [file ...]\n";
exit 1;
}
# Check that we are using the new build system if we should
if($ENV{'GOOS'} eq "linux" && $ENV{'GOARCH'} ne "sparc64") {
if($ENV{'GOLANG_SYS_BUILD'} ne "docker") {
print STDERR "In the new build system, mksyscall should not be called directly.\n";
print STDERR "See README.md\n";
exit 1;
}
}
sub parseparamlist($) {
my ($list) = @_;
$list =~ s/^\s*//;
$list =~ s/\s*$//;
if($list eq "") {
return ();
}
return split(/\s*,\s*/, $list);
}
sub parseparam($) {
my ($p) = @_;
if($p !~ /^(\S*) (\S*)$/) {
print STDERR "$ARGV:$.: malformed parameter: $p\n";
$errors = 1;
return ("xx", "int");
}
return ($1, $2);
}
my $text = "";
while(<>) {
chomp;
s/\s+/ /g;
s/^\s+//;
s/\s+$//;
my $nonblock = /^\/\/sysnb /;
next if !/^\/\/sys / && !$nonblock;
# Line must be of the form
# func Open(path string, mode int, perm int) (fd int, errno error)
# Split into name, in params, out params.
if(!/^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*((?i)SYS_[A-Z0-9_]+))?$/) {
print STDERR "$ARGV:$.: malformed //sys declaration\n";
$errors = 1;
next;
}
my ($func, $in, $out, $sysname) = ($2, $3, $4, $5);
# Split argument lists on comma.
my @in = parseparamlist($in);
my @out = parseparamlist($out);
# Try in vain to keep people from editing this file.
# The theory is that they jump into the middle of the file
# without reading the header.
$text .= "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n";
# Go function header.
my $out_decl = @out ? sprintf(" (%s)", join(', ', @out)) : "";
$text .= sprintf "func %s(%s)%s {\n", $func, join(', ', @in), $out_decl;
# Check if err return available
my $errvar = "";
foreach my $p (@out) {
my ($name, $type) = parseparam($p);
if($type eq "error") {
$errvar = $name;
last;
}
}
# Prepare arguments to Syscall.
my @args = ();
my $n = 0;
foreach my $p (@in) {
my ($name, $type) = parseparam($p);
if($type =~ /^\*/) {
push @args, "uintptr(unsafe.Pointer($name))";
} elsif($type eq "string" && $errvar ne "") {
$text .= "\tvar _p$n *byte\n";
$text .= "\t_p$n, $errvar = BytePtrFromString($name)\n";
$text .= "\tif $errvar != nil {\n\t\treturn\n\t}\n";
push @args, "uintptr(unsafe.Pointer(_p$n))";
$n++;
} elsif($type eq "string") {
print STDERR "$ARGV:$.: $func uses string arguments, but has no error return\n";
$text .= "\tvar _p$n *byte\n";
$text .= "\t_p$n, _ = BytePtrFromString($name)\n";
push @args, "uintptr(unsafe.Pointer(_p$n))";
$n++;
} elsif($type =~ /^\[\](.*)/) {
# Convert slice into pointer, length.
# Have to be careful not to take address of &a[0] if len == 0:
# pass dummy pointer in that case.
# Used to pass nil, but some OSes or simulators reject write(fd, nil, 0).
$text .= "\tvar _p$n unsafe.Pointer\n";
$text .= "\tif len($name) > 0 {\n\t\t_p$n = unsafe.Pointer(\&${name}[0])\n\t}";
$text .= " else {\n\t\t_p$n = unsafe.Pointer(&_zero)\n\t}";
$text .= "\n";
push @args, "uintptr(_p$n)", "uintptr(len($name))";
$n++;
} elsif($type eq "int64" && ($openbsd || $netbsd)) {
push @args, "0";
if($_32bit eq "big-endian") {
push @args, "uintptr($name>>32)", "uintptr($name)";
} elsif($_32bit eq "little-endian") {
push @args, "uintptr($name)", "uintptr($name>>32)";
} else {
push @args, "uintptr($name)";
}
} elsif($type eq "int64" && $dragonfly) {
if ($func !~ /^extp(read|write)/i) {
push @args, "0";
}
if($_32bit eq "big-endian") {
push @args, "uintptr($name>>32)", "uintptr($name)";
} elsif($_32bit eq "little-endian") {
push @args, "uintptr($name)", "uintptr($name>>32)";
} else {
push @args, "uintptr($name)";
}
} elsif($type eq "int64" && $_32bit ne "") {
if(@args % 2 && $arm) {
# arm abi specifies 64-bit argument uses
# (even, odd) pair
push @args, "0"
}
if($_32bit eq "big-endian") {
push @args, "uintptr($name>>32)", "uintptr($name)";
} else {
push @args, "uintptr($name)", "uintptr($name>>32)";
}
} else {
push @args, "uintptr($name)";
}
}
# Determine which form to use; pad args with zeros.
my $asm = "Syscall";
if ($nonblock) {
if ($errvar eq "" && $ENV{'GOOS'} eq "linux") {
$asm = "RawSyscallNoError";
} else {
$asm = "RawSyscall";
}
} else {
if ($errvar eq "" && $ENV{'GOOS'} eq "linux") {
$asm = "SyscallNoError";
}
}
if(@args <= 3) {
while(@args < 3) {
push @args, "0";
}
} elsif(@args <= 6) {
$asm .= "6";
while(@args < 6) {
push @args, "0";
}
} elsif(@args <= 9) {
$asm .= "9";
while(@args < 9) {
push @args, "0";
}
} else {
print STDERR "$ARGV:$.: too many arguments to system call\n";
}
# System call number.
if($sysname eq "") {
$sysname = "SYS_$func";
$sysname =~ s/([a-z])([A-Z])/${1}_$2/g; # turn FooBar into Foo_Bar
$sysname =~ y/a-z/A-Z/;
}
# Actual call.
my $args = join(', ', @args);
my $call = "$asm($sysname, $args)";
# Assign return values.
my $body = "";
my @ret = ("_", "_", "_");
my $do_errno = 0;
for(my $i=0; $i<@out; $i++) {
my $p = $out[$i];
my ($name, $type) = parseparam($p);
my $reg = "";
if($name eq "err" && !$plan9) {
$reg = "e1";
$ret[2] = $reg;
$do_errno = 1;
} elsif($name eq "err" && $plan9) {
$ret[0] = "r0";
$ret[2] = "e1";
next;
} else {
$reg = sprintf("r%d", $i);
$ret[$i] = $reg;
}
if($type eq "bool") {
$reg = "$reg != 0";
}
if($type eq "int64" && $_32bit ne "") {
# 64-bit number in r1:r0 or r0:r1.
if($i+2 > @out) {
print STDERR "$ARGV:$.: not enough registers for int64 return\n";
}
if($_32bit eq "big-endian") {
$reg = sprintf("int64(r%d)<<32 | int64(r%d)", $i, $i+1);
} else {
$reg = sprintf("int64(r%d)<<32 | int64(r%d)", $i+1, $i);
}
$ret[$i] = sprintf("r%d", $i);
$ret[$i+1] = sprintf("r%d", $i+1);
}
if($reg ne "e1" || $plan9) {
$body .= "\t$name = $type($reg)\n";
}
}
if ($ret[0] eq "_" && $ret[1] eq "_" && $ret[2] eq "_") {
$text .= "\t$call\n";
} else {
if ($errvar eq "" && $ENV{'GOOS'} eq "linux") {
# raw syscall without error on Linux, see golang.org/issue/22924
$text .= "\t$ret[0], $ret[1] := $call\n";
} else {
$text .= "\t$ret[0], $ret[1], $ret[2] := $call\n";
}
}
$text .= $body;
if ($plan9 && $ret[2] eq "e1") {
$text .= "\tif int32(r0) == -1 {\n";
$text .= "\t\terr = e1\n";
$text .= "\t}\n";
} elsif ($do_errno) {
$text .= "\tif e1 != 0 {\n";
$text .= "\t\terr = errnoErr(e1)\n";
$text .= "\t}\n";
}
$text .= "\treturn\n";
$text .= "}\n\n";
}
chomp $text;
chomp $text;
if($errors) {
exit 1;
}
print <<EOF;
// $cmdline
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build $tags
package unix
import (
"syscall"
"unsafe"
)
var _ syscall.Errno
$text
EOF
exit 0;

415
vendor/golang.org/x/sys/unix/mksyscall_aix_ppc.go generated vendored Normal file
View file

@ -0,0 +1,415 @@
// 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 ignore
/*
This program reads a file containing function prototypes
(like syscall_aix.go) and generates system call bodies.
The prototypes are marked by lines beginning with "//sys"
and read like func declarations if //sys is replaced by func, but:
* The parameter lists must give a name for each argument.
This includes return parameters.
* The parameter lists must give a type for each argument:
the (x, y, z int) shorthand is not allowed.
* If the return parameter is an error number, it must be named err.
* If go func name needs to be different than its libc name,
* or the function is not in libc, name could be specified
* at the end, after "=" sign, like
//sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt
*/
package main
import (
"bufio"
"flag"
"fmt"
"os"
"regexp"
"strings"
)
var (
b32 = flag.Bool("b32", false, "32bit big-endian")
l32 = flag.Bool("l32", false, "32bit little-endian")
aix = flag.Bool("aix", false, "aix")
tags = flag.String("tags", "", "build tags")
)
// cmdLine returns this programs's commandline arguments
func cmdLine() string {
return "go run mksyscall_aix_ppc.go " + strings.Join(os.Args[1:], " ")
}
// buildTags returns build tags
func buildTags() string {
return *tags
}
// Param is function parameter
type Param struct {
Name string
Type string
}
// usage prints the program usage
func usage() {
fmt.Fprintf(os.Stderr, "usage: go run mksyscall_aix_ppc.go [-b32 | -l32] [-tags x,y] [file ...]\n")
os.Exit(1)
}
// parseParamList parses parameter list and returns a slice of parameters
func parseParamList(list string) []string {
list = strings.TrimSpace(list)
if list == "" {
return []string{}
}
return regexp.MustCompile(`\s*,\s*`).Split(list, -1)
}
// parseParam splits a parameter into name and type
func parseParam(p string) Param {
ps := regexp.MustCompile(`^(\S*) (\S*)$`).FindStringSubmatch(p)
if ps == nil {
fmt.Fprintf(os.Stderr, "malformed parameter: %s\n", p)
os.Exit(1)
}
return Param{ps[1], ps[2]}
}
func main() {
flag.Usage = usage
flag.Parse()
if len(flag.Args()) <= 0 {
fmt.Fprintf(os.Stderr, "no files to parse provided\n")
usage()
}
endianness := ""
if *b32 {
endianness = "big-endian"
} else if *l32 {
endianness = "little-endian"
}
pack := ""
text := ""
cExtern := "/*\n#include <stdint.h>\n#include <stddef.h>\n"
for _, path := range flag.Args() {
file, err := os.Open(path)
if err != nil {
fmt.Fprintf(os.Stderr, err.Error())
os.Exit(1)
}
s := bufio.NewScanner(file)
for s.Scan() {
t := s.Text()
t = strings.TrimSpace(t)
t = regexp.MustCompile(`\s+`).ReplaceAllString(t, ` `)
if p := regexp.MustCompile(`^package (\S+)$`).FindStringSubmatch(t); p != nil && pack == "" {
pack = p[1]
}
nonblock := regexp.MustCompile(`^\/\/sysnb `).FindStringSubmatch(t)
if regexp.MustCompile(`^\/\/sys `).FindStringSubmatch(t) == nil && nonblock == nil {
continue
}
// Line must be of the form
// func Open(path string, mode int, perm int) (fd int, err error)
// Split into name, in params, out params.
f := regexp.MustCompile(`^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$`).FindStringSubmatch(t)
if f == nil {
fmt.Fprintf(os.Stderr, "%s:%s\nmalformed //sys declaration\n", path, t)
os.Exit(1)
}
funct, inps, outps, modname, sysname := f[2], f[3], f[4], f[5], f[6]
// Split argument lists on comma.
in := parseParamList(inps)
out := parseParamList(outps)
inps = strings.Join(in, ", ")
outps = strings.Join(out, ", ")
// Try in vain to keep people from editing this file.
// The theory is that they jump into the middle of the file
// without reading the header.
text += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"
// Check if value return, err return available
errvar := ""
retvar := ""
rettype := ""
for _, param := range out {
p := parseParam(param)
if p.Type == "error" {
errvar = p.Name
} else {
retvar = p.Name
rettype = p.Type
}
}
// System call name.
if sysname == "" {
sysname = funct
}
sysname = regexp.MustCompile(`([a-z])([A-Z])`).ReplaceAllString(sysname, `${1}_$2`)
sysname = strings.ToLower(sysname) // All libc functions are lowercase.
cRettype := ""
if rettype == "unsafe.Pointer" {
cRettype = "uintptr_t"
} else if rettype == "uintptr" {
cRettype = "uintptr_t"
} else if regexp.MustCompile(`^_`).FindStringSubmatch(rettype) != nil {
cRettype = "uintptr_t"
} else if rettype == "int" {
cRettype = "int"
} else if rettype == "int32" {
cRettype = "int"
} else if rettype == "int64" {
cRettype = "long long"
} else if rettype == "uint32" {
cRettype = "unsigned int"
} else if rettype == "uint64" {
cRettype = "unsigned long long"
} else {
cRettype = "int"
}
if sysname == "exit" {
cRettype = "void"
}
// Change p.Types to c
var cIn []string
for _, param := range in {
p := parseParam(param)
if regexp.MustCompile(`^\*`).FindStringSubmatch(p.Type) != nil {
cIn = append(cIn, "uintptr_t")
} else if p.Type == "string" {
cIn = append(cIn, "uintptr_t")
} else if regexp.MustCompile(`^\[\](.*)`).FindStringSubmatch(p.Type) != nil {
cIn = append(cIn, "uintptr_t", "size_t")
} else if p.Type == "unsafe.Pointer" {
cIn = append(cIn, "uintptr_t")
} else if p.Type == "uintptr" {
cIn = append(cIn, "uintptr_t")
} else if regexp.MustCompile(`^_`).FindStringSubmatch(p.Type) != nil {
cIn = append(cIn, "uintptr_t")
} else if p.Type == "int" {
cIn = append(cIn, "int")
} else if p.Type == "int32" {
cIn = append(cIn, "int")
} else if p.Type == "int64" {
cIn = append(cIn, "long long")
} else if p.Type == "uint32" {
cIn = append(cIn, "unsigned int")
} else if p.Type == "uint64" {
cIn = append(cIn, "unsigned long long")
} else {
cIn = append(cIn, "int")
}
}
if funct != "fcntl" && funct != "FcntlInt" && funct != "readlen" && funct != "writelen" {
if sysname == "select" {
// select is a keyword of Go. Its name is
// changed to c_select.
cExtern += "#define c_select select\n"
}
// Imports of system calls from libc
cExtern += fmt.Sprintf("%s %s", cRettype, sysname)
cIn := strings.Join(cIn, ", ")
cExtern += fmt.Sprintf("(%s);\n", cIn)
}
// So file name.
if *aix {
if modname == "" {
modname = "libc.a/shr_64.o"
} else {
fmt.Fprintf(os.Stderr, "%s: only syscall using libc are available\n", funct)
os.Exit(1)
}
}
strconvfunc := "C.CString"
// Go function header.
if outps != "" {
outps = fmt.Sprintf(" (%s)", outps)
}
if text != "" {
text += "\n"
}
text += fmt.Sprintf("func %s(%s)%s {\n", funct, strings.Join(in, ", "), outps)
// Prepare arguments to Syscall.
var args []string
n := 0
argN := 0
for _, param := range in {
p := parseParam(param)
if regexp.MustCompile(`^\*`).FindStringSubmatch(p.Type) != nil {
args = append(args, "C.uintptr_t(uintptr(unsafe.Pointer("+p.Name+")))")
} else if p.Type == "string" && errvar != "" {
text += fmt.Sprintf("\t_p%d := uintptr(unsafe.Pointer(%s(%s)))\n", n, strconvfunc, p.Name)
args = append(args, fmt.Sprintf("C.uintptr_t(_p%d)", n))
n++
} else if p.Type == "string" {
fmt.Fprintf(os.Stderr, path+":"+funct+" uses string arguments, but has no error return\n")
text += fmt.Sprintf("\t_p%d := uintptr(unsafe.Pointer(%s(%s)))\n", n, strconvfunc, p.Name)
args = append(args, fmt.Sprintf("C.uintptr_t(_p%d)", n))
n++
} else if m := regexp.MustCompile(`^\[\](.*)`).FindStringSubmatch(p.Type); m != nil {
// Convert slice into pointer, length.
// Have to be careful not to take address of &a[0] if len == 0:
// pass nil in that case.
text += fmt.Sprintf("\tvar _p%d *%s\n", n, m[1])
text += fmt.Sprintf("\tif len(%s) > 0 {\n\t\t_p%d = &%s[0]\n\t}\n", p.Name, n, p.Name)
args = append(args, fmt.Sprintf("C.uintptr_t(uintptr(unsafe.Pointer(_p%d)))", n))
n++
text += fmt.Sprintf("\tvar _p%d int\n", n)
text += fmt.Sprintf("\t_p%d = len(%s)\n", n, p.Name)
args = append(args, fmt.Sprintf("C.size_t(_p%d)", n))
n++
} else if p.Type == "int64" && endianness != "" {
if endianness == "big-endian" {
args = append(args, fmt.Sprintf("uintptr(%s>>32)", p.Name), fmt.Sprintf("uintptr(%s)", p.Name))
} else {
args = append(args, fmt.Sprintf("uintptr(%s)", p.Name), fmt.Sprintf("uintptr(%s>>32)", p.Name))
}
n++
} else if p.Type == "bool" {
text += fmt.Sprintf("\tvar _p%d uint32\n", n)
text += fmt.Sprintf("\tif %s {\n\t\t_p%d = 1\n\t} else {\n\t\t_p%d = 0\n\t}\n", p.Name, n, n)
args = append(args, fmt.Sprintf("_p%d", n))
} else if regexp.MustCompile(`^_`).FindStringSubmatch(p.Type) != nil {
args = append(args, fmt.Sprintf("C.uintptr_t(uintptr(%s))", p.Name))
} else if p.Type == "unsafe.Pointer" {
args = append(args, fmt.Sprintf("C.uintptr_t(uintptr(%s))", p.Name))
} else if p.Type == "int" {
if (argN == 2) && ((funct == "readlen") || (funct == "writelen")) {
args = append(args, fmt.Sprintf("C.size_t(%s)", p.Name))
} else if argN == 0 && funct == "fcntl" {
args = append(args, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
} else if (argN == 2) && ((funct == "fcntl") || (funct == "FcntlInt")) {
args = append(args, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
} else {
args = append(args, fmt.Sprintf("C.int(%s)", p.Name))
}
} else if p.Type == "int32" {
args = append(args, fmt.Sprintf("C.int(%s)", p.Name))
} else if p.Type == "int64" {
args = append(args, fmt.Sprintf("C.longlong(%s)", p.Name))
} else if p.Type == "uint32" {
args = append(args, fmt.Sprintf("C.uint(%s)", p.Name))
} else if p.Type == "uint64" {
args = append(args, fmt.Sprintf("C.ulonglong(%s)", p.Name))
} else if p.Type == "uintptr" {
args = append(args, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
} else {
args = append(args, fmt.Sprintf("C.int(%s)", p.Name))
}
argN++
}
// Actual call.
arglist := strings.Join(args, ", ")
call := ""
if sysname == "exit" {
if errvar != "" {
call += "er :="
} else {
call += ""
}
} else if errvar != "" {
call += "r0,er :="
} else if retvar != "" {
call += "r0,_ :="
} else {
call += ""
}
if sysname == "select" {
// select is a keyword of Go. Its name is
// changed to c_select.
call += fmt.Sprintf("C.c_%s(%s)", sysname, arglist)
} else {
call += fmt.Sprintf("C.%s(%s)", sysname, arglist)
}
// Assign return values.
body := ""
for i := 0; i < len(out); i++ {
p := parseParam(out[i])
reg := ""
if p.Name == "err" {
reg = "e1"
} else {
reg = "r0"
}
if reg != "e1" {
body += fmt.Sprintf("\t%s = %s(%s)\n", p.Name, p.Type, reg)
}
}
// verify return
if sysname != "exit" && errvar != "" {
if regexp.MustCompile(`^uintptr`).FindStringSubmatch(cRettype) != nil {
body += "\tif (uintptr(r0) ==^uintptr(0) && er != nil) {\n"
body += fmt.Sprintf("\t\t%s = er\n", errvar)
body += "\t}\n"
} else {
body += "\tif (r0 ==-1 && er != nil) {\n"
body += fmt.Sprintf("\t\t%s = er\n", errvar)
body += "\t}\n"
}
} else if errvar != "" {
body += "\tif (er != nil) {\n"
body += fmt.Sprintf("\t\t%s = er\n", errvar)
body += "\t}\n"
}
text += fmt.Sprintf("\t%s\n", call)
text += body
text += "\treturn\n"
text += "}\n"
}
if err := s.Err(); err != nil {
fmt.Fprintf(os.Stderr, err.Error())
os.Exit(1)
}
file.Close()
}
imp := ""
if pack != "unix" {
imp = "import \"golang.org/x/sys/unix\"\n"
}
fmt.Printf(srcTemplate, cmdLine(), buildTags(), pack, cExtern, imp, text)
}
const srcTemplate = `// %s
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build %s
package %s
%s
*/
import "C"
import (
"unsafe"
)
%s
%s
`

View file

@ -1,384 +0,0 @@
#!/usr/bin/env perl
# 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.
# This program reads a file containing function prototypes
# (like syscall_aix.go) and generates system call bodies.
# The prototypes are marked by lines beginning with "//sys"
# and read like func declarations if //sys is replaced by func, but:
# * The parameter lists must give a name for each argument.
# This includes return parameters.
# * The parameter lists must give a type for each argument:
# the (x, y, z int) shorthand is not allowed.
# * If the return parameter is an error number, it must be named err.
# * If go func name needs to be different than its libc name,
# * or the function is not in libc, name could be specified
# * at the end, after "=" sign, like
# //sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt
use strict;
my $cmdline = "mksyscall_aix_ppc.pl " . join(' ', @ARGV);
my $errors = 0;
my $_32bit = "";
my $tags = ""; # build tags
my $aix = 0;
my $solaris = 0;
binmode STDOUT;
if($ARGV[0] eq "-b32") {
$_32bit = "big-endian";
shift;
} elsif($ARGV[0] eq "-l32") {
$_32bit = "little-endian";
shift;
}
if($ARGV[0] eq "-aix") {
$aix = 1;
shift;
}
if($ARGV[0] eq "-tags") {
shift;
$tags = $ARGV[0];
shift;
}
if($ARGV[0] =~ /^-/) {
print STDERR "usage: mksyscall_aix.pl [-b32 | -l32] [-tags x,y] [file ...]\n";
exit 1;
}
sub parseparamlist($) {
my ($list) = @_;
$list =~ s/^\s*//;
$list =~ s/\s*$//;
if($list eq "") {
return ();
}
return split(/\s*,\s*/, $list);
}
sub parseparam($) {
my ($p) = @_;
if($p !~ /^(\S*) (\S*)$/) {
print STDERR "$ARGV:$.: malformed parameter: $p\n";
$errors = 1;
return ("xx", "int");
}
return ($1, $2);
}
my $package = "";
my $text = "";
my $c_extern = "/*\n#include <stdint.h>\n#include <stddef.h>\n";
my @vars = ();
while(<>) {
chomp;
s/\s+/ /g;
s/^\s+//;
s/\s+$//;
$package = $1 if !$package && /^package (\S+)$/;
my $nonblock = /^\/\/sysnb /;
next if !/^\/\/sys / && !$nonblock;
# Line must be of the form
# func Open(path string, mode int, perm int) (fd int, err error)
# Split into name, in params, out params.
if(!/^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$/) {
print STDERR "$ARGV:$.: malformed //sys declaration\n";
$errors = 1;
next;
}
my ($nb, $func, $in, $out, $modname, $sysname) = ($1, $2, $3, $4, $5, $6);
# Split argument lists on comma.
my @in = parseparamlist($in);
my @out = parseparamlist($out);
$in = join(', ', @in);
$out = join(', ', @out);
# Try in vain to keep people from editing this file.
# The theory is that they jump into the middle of the file
# without reading the header.
$text .= "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n";
# Check if value return, err return available
my $errvar = "";
my $retvar = "";
my $rettype = "";
foreach my $p (@out) {
my ($name, $type) = parseparam($p);
if($type eq "error") {
$errvar = $name;
} else {
$retvar = $name;
$rettype = $type;
}
}
# System call name.
#if($func ne "fcntl") {
if($sysname eq "") {
$sysname = "$func";
}
$sysname =~ s/([a-z])([A-Z])/${1}_$2/g;
$sysname =~ y/A-Z/a-z/; # All libc functions are lowercase.
my $C_rettype = "";
if($rettype eq "unsafe.Pointer") {
$C_rettype = "uintptr_t";
} elsif($rettype eq "uintptr") {
$C_rettype = "uintptr_t";
} elsif($rettype =~ /^_/) {
$C_rettype = "uintptr_t";
} elsif($rettype eq "int") {
$C_rettype = "int";
} elsif($rettype eq "int32") {
$C_rettype = "int";
} elsif($rettype eq "int64") {
$C_rettype = "long long";
} elsif($rettype eq "uint32") {
$C_rettype = "unsigned int";
} elsif($rettype eq "uint64") {
$C_rettype = "unsigned long long";
} else {
$C_rettype = "int";
}
if($sysname eq "exit") {
$C_rettype = "void";
}
# Change types to c
my @c_in = ();
foreach my $p (@in) {
my ($name, $type) = parseparam($p);
if($type =~ /^\*/) {
push @c_in, "uintptr_t";
} elsif($type eq "string") {
push @c_in, "uintptr_t";
} elsif($type =~ /^\[\](.*)/) {
push @c_in, "uintptr_t", "size_t";
} elsif($type eq "unsafe.Pointer") {
push @c_in, "uintptr_t";
} elsif($type eq "uintptr") {
push @c_in, "uintptr_t";
} elsif($type =~ /^_/) {
push @c_in, "uintptr_t";
} elsif($type eq "int") {
push @c_in, "int";
} elsif($type eq "int32") {
push @c_in, "int";
} elsif($type eq "int64") {
push @c_in, "long long";
} elsif($type eq "uint32") {
push @c_in, "unsigned int";
} elsif($type eq "uint64") {
push @c_in, "unsigned long long";
} else {
push @c_in, "int";
}
}
if ($func ne "fcntl" && $func ne "FcntlInt" && $func ne "readlen" && $func ne "writelen") {
# Imports of system calls from libc
$c_extern .= "$C_rettype $sysname";
my $c_in = join(', ', @c_in);
$c_extern .= "($c_in);\n";
}
# So file name.
if($aix) {
if($modname eq "") {
$modname = "libc.a/shr_64.o";
} else {
print STDERR "$func: only syscall using libc are available\n";
$errors = 1;
next;
}
}
my $strconvfunc = "C.CString";
my $strconvtype = "*byte";
# Go function header.
if($out ne "") {
$out = " ($out)";
}
if($text ne "") {
$text .= "\n"
}
$text .= sprintf "func %s(%s)%s {\n", $func, join(', ', @in), $out ;
# Prepare arguments to call.
my @args = ();
my $n = 0;
my $arg_n = 0;
foreach my $p (@in) {
my ($name, $type) = parseparam($p);
if($type =~ /^\*/) {
push @args, "C.uintptr_t(uintptr(unsafe.Pointer($name)))";
} elsif($type eq "string" && $errvar ne "") {
$text .= "\t_p$n := uintptr(unsafe.Pointer($strconvfunc($name)))\n";
push @args, "C.uintptr_t(_p$n)";
$n++;
} elsif($type eq "string") {
print STDERR "$ARGV:$.: $func uses string arguments, but has no error return\n";
$text .= "\t_p$n := uintptr(unsafe.Pointer($strconvfunc($name)))\n";
push @args, "C.uintptr_t(_p$n)";
$n++;
} elsif($type =~ /^\[\](.*)/) {
# Convert slice into pointer, length.
# Have to be careful not to take address of &a[0] if len == 0:
# pass nil in that case.
$text .= "\tvar _p$n *$1\n";
$text .= "\tif len($name) > 0 {\n\t\t_p$n = \&$name\[0]\n\t}\n";
push @args, "C.uintptr_t(uintptr(unsafe.Pointer(_p$n)))";
$n++;
$text .= "\tvar _p$n int\n";
$text .= "\t_p$n = len($name)\n";
push @args, "C.size_t(_p$n)";
$n++;
} elsif($type eq "int64" && $_32bit ne "") {
if($_32bit eq "big-endian") {
push @args, "uintptr($name >> 32)", "uintptr($name)";
} else {
push @args, "uintptr($name)", "uintptr($name >> 32)";
}
$n++;
} elsif($type eq "bool") {
$text .= "\tvar _p$n uint32\n";
$text .= "\tif $name {\n\t\t_p$n = 1\n\t} else {\n\t\t_p$n = 0\n\t}\n";
push @args, "_p$n";
$n++;
} elsif($type =~ /^_/) {
push @args, "C.uintptr_t(uintptr($name))";
} elsif($type eq "unsafe.Pointer") {
push @args, "C.uintptr_t(uintptr($name))";
} elsif($type eq "int") {
if (($arg_n == 2) && (($func eq "readlen") || ($func eq "writelen"))) {
push @args, "C.size_t($name)";
} elsif ($arg_n == 0 && $func eq "fcntl") {
push @args, "C.uintptr_t($name)";
} elsif (($arg_n == 2) && (($func eq "fcntl") || ($func eq "FcntlInt"))) {
push @args, "C.uintptr_t($name)";
} else {
push @args, "C.int($name)";
}
} elsif($type eq "int32") {
push @args, "C.int($name)";
} elsif($type eq "int64") {
push @args, "C.longlong($name)";
} elsif($type eq "uint32") {
push @args, "C.uint($name)";
} elsif($type eq "uint64") {
push @args, "C.ulonglong($name)";
} elsif($type eq "uintptr") {
push @args, "C.uintptr_t($name)";
} else {
push @args, "C.int($name)";
}
$arg_n++;
}
my $nargs = @args;
# Determine which form to use; pad args with zeros.
if ($nonblock) {
}
my $args = join(', ', @args);
my $call = "";
if ($sysname eq "exit") {
if ($errvar ne "") {
$call .= "er :=";
} else {
$call .= "";
}
} elsif ($errvar ne "") {
$call .= "r0,er :=";
} elsif ($retvar ne "") {
$call .= "r0,_ :=";
} else {
$call .= ""
}
$call .= "C.$sysname($args)";
# Assign return values.
my $body = "";
my $failexpr = "";
for(my $i=0; $i<@out; $i++) {
my $p = $out[$i];
my ($name, $type) = parseparam($p);
my $reg = "";
if($name eq "err") {
$reg = "e1";
} else {
$reg = "r0";
}
if($reg ne "e1" ) {
$body .= "\t$name = $type($reg)\n";
}
}
# verify return
if ($sysname ne "exit" && $errvar ne "") {
if ($C_rettype =~ /^uintptr/) {
$body .= "\tif \(uintptr\(r0\) ==\^uintptr\(0\) && er != nil\) {\n";
$body .= "\t\t$errvar = er\n";
$body .= "\t}\n";
} else {
$body .= "\tif \(r0 ==-1 && er != nil\) {\n";
$body .= "\t\t$errvar = er\n";
$body .= "\t}\n";
}
} elsif ($errvar ne "") {
$body .= "\tif \(er != nil\) {\n";
$body .= "\t\t$errvar = er\n";
$body .= "\t}\n";
}
$text .= "\t$call\n";
$text .= $body;
$text .= "\treturn\n";
$text .= "}\n";
}
if($errors) {
exit 1;
}
print <<EOF;
// $cmdline
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build $tags
package $package
$c_extern
*/
import "C"
import (
"unsafe"
)
EOF
print "import \"golang.org/x/sys/unix\"\n" if $package ne "unix";
chomp($_=<<EOF);
$text
EOF
print $_;
exit 0;

614
vendor/golang.org/x/sys/unix/mksyscall_aix_ppc64.go generated vendored Normal file
View file

@ -0,0 +1,614 @@
// 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 ignore
/*
This program reads a file containing function prototypes
(like syscall_aix.go) and generates system call bodies.
The prototypes are marked by lines beginning with "//sys"
and read like func declarations if //sys is replaced by func, but:
* The parameter lists must give a name for each argument.
This includes return parameters.
* The parameter lists must give a type for each argument:
the (x, y, z int) shorthand is not allowed.
* If the return parameter is an error number, it must be named err.
* If go func name needs to be different than its libc name,
* or the function is not in libc, name could be specified
* at the end, after "=" sign, like
//sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt
This program will generate three files and handle both gc and gccgo implementation:
- zsyscall_aix_ppc64.go: the common part of each implementation (error handler, pointer creation)
- zsyscall_aix_ppc64_gc.go: gc part with //go_cgo_import_dynamic and a call to syscall6
- zsyscall_aix_ppc64_gccgo.go: gccgo part with C function and conversion to C type.
The generated code looks like this
zsyscall_aix_ppc64.go
func asyscall(...) (n int, err error) {
// Pointer Creation
r1, e1 := callasyscall(...)
// Type Conversion
// Error Handler
return
}
zsyscall_aix_ppc64_gc.go
//go:cgo_import_dynamic libc_asyscall asyscall "libc.a/shr_64.o"
//go:linkname libc_asyscall libc_asyscall
var asyscall syscallFunc
func callasyscall(...) (r1 uintptr, e1 Errno) {
r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_asyscall)), "nb_args", ... )
return
}
zsyscall_aix_ppc64_ggcgo.go
// int asyscall(...)
import "C"
func callasyscall(...) (r1 uintptr, e1 Errno) {
r1 = uintptr(C.asyscall(...))
e1 = syscall.GetErrno()
return
}
*/
package main
import (
"bufio"
"flag"
"fmt"
"io/ioutil"
"os"
"regexp"
"strings"
)
var (
b32 = flag.Bool("b32", false, "32bit big-endian")
l32 = flag.Bool("l32", false, "32bit little-endian")
aix = flag.Bool("aix", false, "aix")
tags = flag.String("tags", "", "build tags")
)
// cmdLine returns this programs's commandline arguments
func cmdLine() string {
return "go run mksyscall_aix_ppc64.go " + strings.Join(os.Args[1:], " ")
}
// buildTags returns build tags
func buildTags() string {
return *tags
}
// Param is function parameter
type Param struct {
Name string
Type string
}
// usage prints the program usage
func usage() {
fmt.Fprintf(os.Stderr, "usage: go run mksyscall_aix_ppc64.go [-b32 | -l32] [-tags x,y] [file ...]\n")
os.Exit(1)
}
// parseParamList parses parameter list and returns a slice of parameters
func parseParamList(list string) []string {
list = strings.TrimSpace(list)
if list == "" {
return []string{}
}
return regexp.MustCompile(`\s*,\s*`).Split(list, -1)
}
// parseParam splits a parameter into name and type
func parseParam(p string) Param {
ps := regexp.MustCompile(`^(\S*) (\S*)$`).FindStringSubmatch(p)
if ps == nil {
fmt.Fprintf(os.Stderr, "malformed parameter: %s\n", p)
os.Exit(1)
}
return Param{ps[1], ps[2]}
}
func main() {
flag.Usage = usage
flag.Parse()
if len(flag.Args()) <= 0 {
fmt.Fprintf(os.Stderr, "no files to parse provided\n")
usage()
}
endianness := ""
if *b32 {
endianness = "big-endian"
} else if *l32 {
endianness = "little-endian"
}
pack := ""
// GCCGO
textgccgo := ""
cExtern := "/*\n#include <stdint.h>\n"
// GC
textgc := ""
dynimports := ""
linknames := ""
var vars []string
// COMMON
textcommon := ""
for _, path := range flag.Args() {
file, err := os.Open(path)
if err != nil {
fmt.Fprintf(os.Stderr, err.Error())
os.Exit(1)
}
s := bufio.NewScanner(file)
for s.Scan() {
t := s.Text()
t = strings.TrimSpace(t)
t = regexp.MustCompile(`\s+`).ReplaceAllString(t, ` `)
if p := regexp.MustCompile(`^package (\S+)$`).FindStringSubmatch(t); p != nil && pack == "" {
pack = p[1]
}
nonblock := regexp.MustCompile(`^\/\/sysnb `).FindStringSubmatch(t)
if regexp.MustCompile(`^\/\/sys `).FindStringSubmatch(t) == nil && nonblock == nil {
continue
}
// Line must be of the form
// func Open(path string, mode int, perm int) (fd int, err error)
// Split into name, in params, out params.
f := regexp.MustCompile(`^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$`).FindStringSubmatch(t)
if f == nil {
fmt.Fprintf(os.Stderr, "%s:%s\nmalformed //sys declaration\n", path, t)
os.Exit(1)
}
funct, inps, outps, modname, sysname := f[2], f[3], f[4], f[5], f[6]
// Split argument lists on comma.
in := parseParamList(inps)
out := parseParamList(outps)
inps = strings.Join(in, ", ")
outps = strings.Join(out, ", ")
if sysname == "" {
sysname = funct
}
onlyCommon := false
if funct == "readlen" || funct == "writelen" || funct == "FcntlInt" || funct == "FcntlFlock" {
// This function call another syscall which is already implemented.
// Therefore, the gc and gccgo part must not be generated.
onlyCommon = true
}
// Try in vain to keep people from editing this file.
// The theory is that they jump into the middle of the file
// without reading the header.
textcommon += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"
if !onlyCommon {
textgccgo += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"
textgc += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"
}
// Check if value return, err return available
errvar := ""
rettype := ""
for _, param := range out {
p := parseParam(param)
if p.Type == "error" {
errvar = p.Name
} else {
rettype = p.Type
}
}
sysname = regexp.MustCompile(`([a-z])([A-Z])`).ReplaceAllString(sysname, `${1}_$2`)
sysname = strings.ToLower(sysname) // All libc functions are lowercase.
// GCCGO Prototype return type
cRettype := ""
if rettype == "unsafe.Pointer" {
cRettype = "uintptr_t"
} else if rettype == "uintptr" {
cRettype = "uintptr_t"
} else if regexp.MustCompile(`^_`).FindStringSubmatch(rettype) != nil {
cRettype = "uintptr_t"
} else if rettype == "int" {
cRettype = "int"
} else if rettype == "int32" {
cRettype = "int"
} else if rettype == "int64" {
cRettype = "long long"
} else if rettype == "uint32" {
cRettype = "unsigned int"
} else if rettype == "uint64" {
cRettype = "unsigned long long"
} else {
cRettype = "int"
}
if sysname == "exit" {
cRettype = "void"
}
// GCCGO Prototype arguments type
var cIn []string
for i, param := range in {
p := parseParam(param)
if regexp.MustCompile(`^\*`).FindStringSubmatch(p.Type) != nil {
cIn = append(cIn, "uintptr_t")
} else if p.Type == "string" {
cIn = append(cIn, "uintptr_t")
} else if regexp.MustCompile(`^\[\](.*)`).FindStringSubmatch(p.Type) != nil {
cIn = append(cIn, "uintptr_t", "size_t")
} else if p.Type == "unsafe.Pointer" {
cIn = append(cIn, "uintptr_t")
} else if p.Type == "uintptr" {
cIn = append(cIn, "uintptr_t")
} else if regexp.MustCompile(`^_`).FindStringSubmatch(p.Type) != nil {
cIn = append(cIn, "uintptr_t")
} else if p.Type == "int" {
if (i == 0 || i == 2) && funct == "fcntl" {
// These fcntl arguments needs to be uintptr to be able to call FcntlInt and FcntlFlock
cIn = append(cIn, "uintptr_t")
} else {
cIn = append(cIn, "int")
}
} else if p.Type == "int32" {
cIn = append(cIn, "int")
} else if p.Type == "int64" {
cIn = append(cIn, "long long")
} else if p.Type == "uint32" {
cIn = append(cIn, "unsigned int")
} else if p.Type == "uint64" {
cIn = append(cIn, "unsigned long long")
} else {
cIn = append(cIn, "int")
}
}
if !onlyCommon {
// GCCGO Prototype Generation
// Imports of system calls from libc
if sysname == "select" {
// select is a keyword of Go. Its name is
// changed to c_select.
cExtern += "#define c_select select\n"
}
cExtern += fmt.Sprintf("%s %s", cRettype, sysname)
cIn := strings.Join(cIn, ", ")
cExtern += fmt.Sprintf("(%s);\n", cIn)
}
// GC Library name
if modname == "" {
modname = "libc.a/shr_64.o"
} else {
fmt.Fprintf(os.Stderr, "%s: only syscall using libc are available\n", funct)
os.Exit(1)
}
sysvarname := fmt.Sprintf("libc_%s", sysname)
if !onlyCommon {
// GC Runtime import of function to allow cross-platform builds.
dynimports += fmt.Sprintf("//go:cgo_import_dynamic %s %s \"%s\"\n", sysvarname, sysname, modname)
// GC Link symbol to proc address variable.
linknames += fmt.Sprintf("//go:linkname %s %s\n", sysvarname, sysvarname)
// GC Library proc address variable.
vars = append(vars, sysvarname)
}
strconvfunc := "BytePtrFromString"
strconvtype := "*byte"
// Go function header.
if outps != "" {
outps = fmt.Sprintf(" (%s)", outps)
}
if textcommon != "" {
textcommon += "\n"
}
textcommon += fmt.Sprintf("func %s(%s)%s {\n", funct, strings.Join(in, ", "), outps)
// Prepare arguments tocall.
var argscommon []string // Arguments in the common part
var argscall []string // Arguments for call prototype
var argsgc []string // Arguments for gc call (with syscall6)
var argsgccgo []string // Arguments for gccgo call (with C.name_of_syscall)
n := 0
argN := 0
for _, param := range in {
p := parseParam(param)
if regexp.MustCompile(`^\*`).FindStringSubmatch(p.Type) != nil {
argscommon = append(argscommon, fmt.Sprintf("uintptr(unsafe.Pointer(%s))", p.Name))
argscall = append(argscall, fmt.Sprintf("%s uintptr", p.Name))
argsgc = append(argsgc, p.Name)
argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
} else if p.Type == "string" && errvar != "" {
textcommon += fmt.Sprintf("\tvar _p%d %s\n", n, strconvtype)
textcommon += fmt.Sprintf("\t_p%d, %s = %s(%s)\n", n, errvar, strconvfunc, p.Name)
textcommon += fmt.Sprintf("\tif %s != nil {\n\t\treturn\n\t}\n", errvar)
argscommon = append(argscommon, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n))
argscall = append(argscall, fmt.Sprintf("_p%d uintptr ", n))
argsgc = append(argsgc, fmt.Sprintf("_p%d", n))
argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(_p%d)", n))
n++
} else if p.Type == "string" {
fmt.Fprintf(os.Stderr, path+":"+funct+" uses string arguments, but has no error return\n")
textcommon += fmt.Sprintf("\tvar _p%d %s\n", n, strconvtype)
textcommon += fmt.Sprintf("\t_p%d, %s = %s(%s)\n", n, errvar, strconvfunc, p.Name)
textcommon += fmt.Sprintf("\tif %s != nil {\n\t\treturn\n\t}\n", errvar)
argscommon = append(argscommon, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n))
argscall = append(argscall, fmt.Sprintf("_p%d uintptr", n))
argsgc = append(argsgc, fmt.Sprintf("_p%d", n))
argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(_p%d)", n))
n++
} else if m := regexp.MustCompile(`^\[\](.*)`).FindStringSubmatch(p.Type); m != nil {
// Convert slice into pointer, length.
// Have to be careful not to take address of &a[0] if len == 0:
// pass nil in that case.
textcommon += fmt.Sprintf("\tvar _p%d *%s\n", n, m[1])
textcommon += fmt.Sprintf("\tif len(%s) > 0 {\n\t\t_p%d = &%s[0]\n\t}\n", p.Name, n, p.Name)
argscommon = append(argscommon, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n), fmt.Sprintf("len(%s)", p.Name))
argscall = append(argscall, fmt.Sprintf("_p%d uintptr", n), fmt.Sprintf("_lenp%d int", n))
argsgc = append(argsgc, fmt.Sprintf("_p%d", n), fmt.Sprintf("uintptr(_lenp%d)", n))
argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(_p%d)", n), fmt.Sprintf("C.size_t(_lenp%d)", n))
n++
} else if p.Type == "int64" && endianness != "" {
fmt.Fprintf(os.Stderr, path+":"+funct+" uses int64 with 32 bits mode. Case not yet implemented\n")
} else if p.Type == "bool" {
fmt.Fprintf(os.Stderr, path+":"+funct+" uses bool. Case not yet implemented\n")
} else if regexp.MustCompile(`^_`).FindStringSubmatch(p.Type) != nil || p.Type == "unsafe.Pointer" {
argscommon = append(argscommon, fmt.Sprintf("uintptr(%s)", p.Name))
argscall = append(argscall, fmt.Sprintf("%s uintptr", p.Name))
argsgc = append(argsgc, p.Name)
argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
} else if p.Type == "int" {
if (argN == 0 || argN == 2) && ((funct == "fcntl") || (funct == "FcntlInt") || (funct == "FcntlFlock")) {
// These fcntl arguments need to be uintptr to be able to call FcntlInt and FcntlFlock
argscommon = append(argscommon, fmt.Sprintf("uintptr(%s)", p.Name))
argscall = append(argscall, fmt.Sprintf("%s uintptr", p.Name))
argsgc = append(argsgc, p.Name)
argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
} else {
argscommon = append(argscommon, p.Name)
argscall = append(argscall, fmt.Sprintf("%s int", p.Name))
argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name))
argsgccgo = append(argsgccgo, fmt.Sprintf("C.int(%s)", p.Name))
}
} else if p.Type == "int32" {
argscommon = append(argscommon, p.Name)
argscall = append(argscall, fmt.Sprintf("%s int32", p.Name))
argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name))
argsgccgo = append(argsgccgo, fmt.Sprintf("C.int(%s)", p.Name))
} else if p.Type == "int64" {
argscommon = append(argscommon, p.Name)
argscall = append(argscall, fmt.Sprintf("%s int64", p.Name))
argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name))
argsgccgo = append(argsgccgo, fmt.Sprintf("C.longlong(%s)", p.Name))
} else if p.Type == "uint32" {
argscommon = append(argscommon, p.Name)
argscall = append(argscall, fmt.Sprintf("%s uint32", p.Name))
argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name))
argsgccgo = append(argsgccgo, fmt.Sprintf("C.uint(%s)", p.Name))
} else if p.Type == "uint64" {
argscommon = append(argscommon, p.Name)
argscall = append(argscall, fmt.Sprintf("%s uint64", p.Name))
argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name))
argsgccgo = append(argsgccgo, fmt.Sprintf("C.ulonglong(%s)", p.Name))
} else if p.Type == "uintptr" {
argscommon = append(argscommon, p.Name)
argscall = append(argscall, fmt.Sprintf("%s uintptr", p.Name))
argsgc = append(argsgc, p.Name)
argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(%s)", p.Name))
} else {
argscommon = append(argscommon, fmt.Sprintf("int(%s)", p.Name))
argscall = append(argscall, fmt.Sprintf("%s int", p.Name))
argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name))
argsgccgo = append(argsgccgo, fmt.Sprintf("C.int(%s)", p.Name))
}
argN++
}
nargs := len(argsgc)
// COMMON function generation
argscommonlist := strings.Join(argscommon, ", ")
callcommon := fmt.Sprintf("call%s(%s)", sysname, argscommonlist)
ret := []string{"_", "_"}
body := ""
doErrno := false
for i := 0; i < len(out); i++ {
p := parseParam(out[i])
reg := ""
if p.Name == "err" {
reg = "e1"
ret[1] = reg
doErrno = true
} else {
reg = "r0"
ret[0] = reg
}
if p.Type == "bool" {
reg = fmt.Sprintf("%s != 0", reg)
}
if reg != "e1" {
body += fmt.Sprintf("\t%s = %s(%s)\n", p.Name, p.Type, reg)
}
}
if ret[0] == "_" && ret[1] == "_" {
textcommon += fmt.Sprintf("\t%s\n", callcommon)
} else {
textcommon += fmt.Sprintf("\t%s, %s := %s\n", ret[0], ret[1], callcommon)
}
textcommon += body
if doErrno {
textcommon += "\tif e1 != 0 {\n"
textcommon += "\t\terr = errnoErr(e1)\n"
textcommon += "\t}\n"
}
textcommon += "\treturn\n"
textcommon += "}\n"
if onlyCommon {
continue
}
// CALL Prototype
callProto := fmt.Sprintf("func call%s(%s) (r1 uintptr, e1 Errno) {\n", sysname, strings.Join(argscall, ", "))
// GC function generation
asm := "syscall6"
if nonblock != nil {
asm = "rawSyscall6"
}
if len(argsgc) <= 6 {
for len(argsgc) < 6 {
argsgc = append(argsgc, "0")
}
} else {
fmt.Fprintf(os.Stderr, "%s: too many arguments to system call", funct)
os.Exit(1)
}
argsgclist := strings.Join(argsgc, ", ")
callgc := fmt.Sprintf("%s(uintptr(unsafe.Pointer(&%s)), %d, %s)", asm, sysvarname, nargs, argsgclist)
textgc += callProto
textgc += fmt.Sprintf("\tr1, _, e1 = %s\n", callgc)
textgc += "\treturn\n}\n"
// GCCGO function generation
argsgccgolist := strings.Join(argsgccgo, ", ")
var callgccgo string
if sysname == "select" {
// select is a keyword of Go. Its name is
// changed to c_select.
callgccgo = fmt.Sprintf("C.c_%s(%s)", sysname, argsgccgolist)
} else {
callgccgo = fmt.Sprintf("C.%s(%s)", sysname, argsgccgolist)
}
textgccgo += callProto
textgccgo += fmt.Sprintf("\tr1 = uintptr(%s)\n", callgccgo)
textgccgo += "\te1 = syscall.GetErrno()\n"
textgccgo += "\treturn\n}\n"
}
if err := s.Err(); err != nil {
fmt.Fprintf(os.Stderr, err.Error())
os.Exit(1)
}
file.Close()
}
imp := ""
if pack != "unix" {
imp = "import \"golang.org/x/sys/unix\"\n"
}
// Print zsyscall_aix_ppc64.go
err := ioutil.WriteFile("zsyscall_aix_ppc64.go",
[]byte(fmt.Sprintf(srcTemplate1, cmdLine(), buildTags(), pack, imp, textcommon)),
0644)
if err != nil {
fmt.Fprintf(os.Stderr, err.Error())
os.Exit(1)
}
// Print zsyscall_aix_ppc64_gc.go
vardecls := "\t" + strings.Join(vars, ",\n\t")
vardecls += " syscallFunc"
err = ioutil.WriteFile("zsyscall_aix_ppc64_gc.go",
[]byte(fmt.Sprintf(srcTemplate2, cmdLine(), buildTags(), pack, imp, dynimports, linknames, vardecls, textgc)),
0644)
if err != nil {
fmt.Fprintf(os.Stderr, err.Error())
os.Exit(1)
}
// Print zsyscall_aix_ppc64_gccgo.go
err = ioutil.WriteFile("zsyscall_aix_ppc64_gccgo.go",
[]byte(fmt.Sprintf(srcTemplate3, cmdLine(), buildTags(), pack, cExtern, imp, textgccgo)),
0644)
if err != nil {
fmt.Fprintf(os.Stderr, err.Error())
os.Exit(1)
}
}
const srcTemplate1 = `// %s
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build %s
package %s
import (
"unsafe"
)
%s
%s
`
const srcTemplate2 = `// %s
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build %s
// +build !gccgo
package %s
import (
"unsafe"
)
%s
%s
%s
type syscallFunc uintptr
var (
%s
)
// Implemented in runtime/syscall_aix.go.
func rawSyscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
func syscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
%s
`
const srcTemplate3 = `// %s
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build %s
// +build gccgo
package %s
%s
*/
import "C"
import (
"syscall"
)
%s
%s
`

View file

@ -1,579 +0,0 @@
#!/usr/bin/env perl
# 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.
# This program reads a file containing function prototypes
# (like syscall_aix.go) and generates system call bodies.
# The prototypes are marked by lines beginning with "//sys"
# and read like func declarations if //sys is replaced by func, but:
# * The parameter lists must give a name for each argument.
# This includes return parameters.
# * The parameter lists must give a type for each argument:
# the (x, y, z int) shorthand is not allowed.
# * If the return parameter is an error number, it must be named err.
# * If go func name needs to be different than its libc name,
# * or the function is not in libc, name could be specified
# * at the end, after "=" sign, like
# //sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt
# This program will generate three files and handle both gc and gccgo implementation:
# - zsyscall_aix_ppc64.go: the common part of each implementation (error handler, pointer creation)
# - zsyscall_aix_ppc64_gc.go: gc part with //go_cgo_import_dynamic and a call to syscall6
# - zsyscall_aix_ppc64_gccgo.go: gccgo part with C function and conversion to C type.
# The generated code looks like this
#
# zsyscall_aix_ppc64.go
# func asyscall(...) (n int, err error) {
# // Pointer Creation
# r1, e1 := callasyscall(...)
# // Type Conversion
# // Error Handler
# return
# }
#
# zsyscall_aix_ppc64_gc.go
# //go:cgo_import_dynamic libc_asyscall asyscall "libc.a/shr_64.o"
# //go:linkname libc_asyscall libc_asyscall
# var asyscall syscallFunc
#
# func callasyscall(...) (r1 uintptr, e1 Errno) {
# r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_asyscall)), "nb_args", ... )
# return
# }
#
# zsyscall_aix_ppc64_ggcgo.go
# /*
# int asyscall(...)
#
# */
# import "C"
#
# func callasyscall(...) (r1 uintptr, e1 Errno) {
# r1 = uintptr(C.asyscall(...))
# e1 = syscall.GetErrno()
# return
# }
use strict;
my $cmdline = "mksyscall_aix_ppc64.pl " . join(' ', @ARGV);
my $errors = 0;
my $_32bit = "";
my $tags = ""; # build tags
my $aix = 0;
my $solaris = 0;
binmode STDOUT;
if($ARGV[0] eq "-b32") {
$_32bit = "big-endian";
shift;
} elsif($ARGV[0] eq "-l32") {
$_32bit = "little-endian";
shift;
}
if($ARGV[0] eq "-aix") {
$aix = 1;
shift;
}
if($ARGV[0] eq "-tags") {
shift;
$tags = $ARGV[0];
shift;
}
if($ARGV[0] =~ /^-/) {
print STDERR "usage: mksyscall_aix.pl [-b32 | -l32] [-tags x,y] [file ...]\n";
exit 1;
}
sub parseparamlist($) {
my ($list) = @_;
$list =~ s/^\s*//;
$list =~ s/\s*$//;
if($list eq "") {
return ();
}
return split(/\s*,\s*/, $list);
}
sub parseparam($) {
my ($p) = @_;
if($p !~ /^(\S*) (\S*)$/) {
print STDERR "$ARGV:$.: malformed parameter: $p\n";
$errors = 1;
return ("xx", "int");
}
return ($1, $2);
}
my $package = "";
# GCCGO
my $textgccgo = "";
my $c_extern = "/*\n#include <stdint.h>\n";
# GC
my $textgc = "";
my $dynimports = "";
my $linknames = "";
my @vars = ();
# COMMUN
my $textcommon = "";
while(<>) {
chomp;
s/\s+/ /g;
s/^\s+//;
s/\s+$//;
$package = $1 if !$package && /^package (\S+)$/;
my $nonblock = /^\/\/sysnb /;
next if !/^\/\/sys / && !$nonblock;
# Line must be of the form
# func Open(path string, mode int, perm int) (fd int, err error)
# Split into name, in params, out params.
if(!/^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$/) {
print STDERR "$ARGV:$.: malformed //sys declaration\n";
$errors = 1;
next;
}
my ($nb, $func, $in, $out, $modname, $sysname) = ($1, $2, $3, $4, $5, $6);
# Split argument lists on comma.
my @in = parseparamlist($in);
my @out = parseparamlist($out);
$in = join(', ', @in);
$out = join(', ', @out);
if($sysname eq "") {
$sysname = "$func";
}
my $onlyCommon = 0;
if ($func eq "readlen" || $func eq "writelen" || $func eq "FcntlInt" || $func eq "FcntlFlock") {
# This function call another syscall which is already implemented.
# Therefore, the gc and gccgo part must not be generated.
$onlyCommon = 1
}
# Try in vain to keep people from editing this file.
# The theory is that they jump into the middle of the file
# without reading the header.
$textcommon .= "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n";
if (!$onlyCommon) {
$textgccgo .= "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n";
$textgc .= "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n";
}
# Check if value return, err return available
my $errvar = "";
my $retvar = "";
my $rettype = "";
foreach my $p (@out) {
my ($name, $type) = parseparam($p);
if($type eq "error") {
$errvar = $name;
} else {
$retvar = $name;
$rettype = $type;
}
}
$sysname =~ s/([a-z])([A-Z])/${1}_$2/g;
$sysname =~ y/A-Z/a-z/; # All libc functions are lowercase.
# GCCGO Prototype return type
my $C_rettype = "";
if($rettype eq "unsafe.Pointer") {
$C_rettype = "uintptr_t";
} elsif($rettype eq "uintptr") {
$C_rettype = "uintptr_t";
} elsif($rettype =~ /^_/) {
$C_rettype = "uintptr_t";
} elsif($rettype eq "int") {
$C_rettype = "int";
} elsif($rettype eq "int32") {
$C_rettype = "int";
} elsif($rettype eq "int64") {
$C_rettype = "long long";
} elsif($rettype eq "uint32") {
$C_rettype = "unsigned int";
} elsif($rettype eq "uint64") {
$C_rettype = "unsigned long long";
} else {
$C_rettype = "int";
}
if($sysname eq "exit") {
$C_rettype = "void";
}
# GCCGO Prototype arguments type
my @c_in = ();
foreach my $i (0 .. $#in) {
my ($name, $type) = parseparam($in[$i]);
if($type =~ /^\*/) {
push @c_in, "uintptr_t";
} elsif($type eq "string") {
push @c_in, "uintptr_t";
} elsif($type =~ /^\[\](.*)/) {
push @c_in, "uintptr_t", "size_t";
} elsif($type eq "unsafe.Pointer") {
push @c_in, "uintptr_t";
} elsif($type eq "uintptr") {
push @c_in, "uintptr_t";
} elsif($type =~ /^_/) {
push @c_in, "uintptr_t";
} elsif($type eq "int") {
if (($i == 0 || $i == 2) && $func eq "fcntl"){
# These fcntl arguments needs to be uintptr to be able to call FcntlInt and FcntlFlock
push @c_in, "uintptr_t";
} else {
push @c_in, "int";
}
} elsif($type eq "int32") {
push @c_in, "int";
} elsif($type eq "int64") {
push @c_in, "long long";
} elsif($type eq "uint32") {
push @c_in, "unsigned int";
} elsif($type eq "uint64") {
push @c_in, "unsigned long long";
} else {
push @c_in, "int";
}
}
if (!$onlyCommon){
# GCCGO Prototype Generation
# Imports of system calls from libc
$c_extern .= "$C_rettype $sysname";
my $c_in = join(', ', @c_in);
$c_extern .= "($c_in);\n";
}
# GC Library name
if($modname eq "") {
$modname = "libc.a/shr_64.o";
} else {
print STDERR "$func: only syscall using libc are available\n";
$errors = 1;
next;
}
my $sysvarname = "libc_${sysname}";
if (!$onlyCommon){
# GC Runtime import of function to allow cross-platform builds.
$dynimports .= "//go:cgo_import_dynamic ${sysvarname} ${sysname} \"$modname\"\n";
# GC Link symbol to proc address variable.
$linknames .= "//go:linkname ${sysvarname} ${sysvarname}\n";
# GC Library proc address variable.
push @vars, $sysvarname;
}
my $strconvfunc ="BytePtrFromString";
my $strconvtype = "*byte";
# Go function header.
if($out ne "") {
$out = " ($out)";
}
if($textcommon ne "") {
$textcommon .= "\n"
}
$textcommon .= sprintf "func %s(%s)%s {\n", $func, join(', ', @in), $out ;
# Prepare arguments to call.
my @argscommun = (); # Arguments in the commun part
my @argscall = (); # Arguments for call prototype
my @argsgc = (); # Arguments for gc call (with syscall6)
my @argsgccgo = (); # Arguments for gccgo call (with C.name_of_syscall)
my $n = 0;
my $arg_n = 0;
foreach my $p (@in) {
my ($name, $type) = parseparam($p);
if($type =~ /^\*/) {
push @argscommun, "uintptr(unsafe.Pointer($name))";
push @argscall, "$name uintptr";
push @argsgc, "$name";
push @argsgccgo, "C.uintptr_t($name)";
} elsif($type eq "string" && $errvar ne "") {
$textcommon .= "\tvar _p$n $strconvtype\n";
$textcommon .= "\t_p$n, $errvar = $strconvfunc($name)\n";
$textcommon .= "\tif $errvar != nil {\n\t\treturn\n\t}\n";
push @argscommun, "uintptr(unsafe.Pointer(_p$n))";
push @argscall, "_p$n uintptr ";
push @argsgc, "_p$n";
push @argsgccgo, "C.uintptr_t(_p$n)";
$n++;
} elsif($type eq "string") {
print STDERR "$ARGV:$.: $func uses string arguments, but has no error return\n";
$textcommon .= "\tvar _p$n $strconvtype\n";
$textcommon .= "\t_p$n, $errvar = $strconvfunc($name)\n";
$textcommon .= "\tif $errvar != nil {\n\t\treturn\n\t}\n";
push @argscommun, "uintptr(unsafe.Pointer(_p$n))";
push @argscall, "_p$n uintptr";
push @argsgc, "_p$n";
push @argsgccgo, "C.uintptr_t(_p$n)";
$n++;
} elsif($type =~ /^\[\](.*)/) {
# Convert slice into pointer, length.
# Have to be careful not to take address of &a[0] if len == 0:
# pass nil in that case.
$textcommon .= "\tvar _p$n *$1\n";
$textcommon .= "\tif len($name) > 0 {\n\t\t_p$n = \&$name\[0]\n\t}\n";
push @argscommun, "uintptr(unsafe.Pointer(_p$n))", "len($name)";
push @argscall, "_p$n uintptr", "_lenp$n int";
push @argsgc, "_p$n", "uintptr(_lenp$n)";
push @argsgccgo, "C.uintptr_t(_p$n)", "C.size_t(_lenp$n)";
$n++;
} elsif($type eq "int64" && $_32bit ne "") {
print STDERR "$ARGV:$.: $func uses int64 with 32 bits mode. Case not yet implemented\n";
# if($_32bit eq "big-endian") {
# push @args, "uintptr($name >> 32)", "uintptr($name)";
# } else {
# push @args, "uintptr($name)", "uintptr($name >> 32)";
# }
# $n++;
} elsif($type eq "bool") {
print STDERR "$ARGV:$.: $func uses bool. Case not yet implemented\n";
# $text .= "\tvar _p$n uint32\n";
# $text .= "\tif $name {\n\t\t_p$n = 1\n\t} else {\n\t\t_p$n = 0\n\t}\n";
# push @args, "_p$n";
# $n++;
} elsif($type =~ /^_/ ||$type eq "unsafe.Pointer") {
push @argscommun, "uintptr($name)";
push @argscall, "$name uintptr";
push @argsgc, "$name";
push @argsgccgo, "C.uintptr_t($name)";
} elsif($type eq "int") {
if (($arg_n == 0 || $arg_n == 2) && ($func eq "fcntl" || $func eq "FcntlInt" || $func eq "FcntlFlock")) {
# These fcntl arguments need to be uintptr to be able to call FcntlInt and FcntlFlock
push @argscommun, "uintptr($name)";
push @argscall, "$name uintptr";
push @argsgc, "$name";
push @argsgccgo, "C.uintptr_t($name)";
} else {
push @argscommun, "$name";
push @argscall, "$name int";
push @argsgc, "uintptr($name)";
push @argsgccgo, "C.int($name)";
}
} elsif($type eq "int32") {
push @argscommun, "$name";
push @argscall, "$name int32";
push @argsgc, "uintptr($name)";
push @argsgccgo, "C.int($name)";
} elsif($type eq "int64") {
push @argscommun, "$name";
push @argscall, "$name int64";
push @argsgc, "uintptr($name)";
push @argsgccgo, "C.longlong($name)";
} elsif($type eq "uint32") {
push @argscommun, "$name";
push @argscall, "$name uint32";
push @argsgc, "uintptr($name)";
push @argsgccgo, "C.uint($name)";
} elsif($type eq "uint64") {
push @argscommun, "$name";
push @argscall, "$name uint64";
push @argsgc, "uintptr($name)";
push @argsgccgo, "C.ulonglong($name)";
} elsif($type eq "uintptr") {
push @argscommun, "$name";
push @argscall, "$name uintptr";
push @argsgc, "$name";
push @argsgccgo, "C.uintptr_t($name)";
} else {
push @argscommun, "int($name)";
push @argscall, "$name int";
push @argsgc, "uintptr($name)";
push @argsgccgo, "C.int($name)";
}
$arg_n++;
}
my $nargs = @argsgc;
# COMMUN function generation
my $argscommun = join(', ', @argscommun);
my $callcommun = "call$sysname($argscommun)";
my @ret = ("_", "_");
my $body = "";
my $do_errno = 0;
for(my $i=0; $i<@out; $i++) {
my $p = $out[$i];
my ($name, $type) = parseparam($p);
my $reg = "";
if($name eq "err") {
$reg = "e1";
$ret[1] = $reg;
$do_errno = 1;
} else {
$reg = "r0";
$ret[0] = $reg;
}
if($type eq "bool") {
$reg = "$reg != 0";
}
if($reg ne "e1") {
$body .= "\t$name = $type($reg)\n";
}
}
if ($ret[0] eq "_" && $ret[1] eq "_") {
$textcommon .= "\t$callcommun\n";
} else {
$textcommon .= "\t$ret[0], $ret[1] := $callcommun\n";
}
$textcommon .= $body;
if ($do_errno) {
$textcommon .= "\tif e1 != 0 {\n";
$textcommon .= "\t\terr = errnoErr(e1)\n";
$textcommon .= "\t}\n";
}
$textcommon .= "\treturn\n";
$textcommon .= "}\n";
if ($onlyCommon){
next
}
# CALL Prototype
my $callProto = sprintf "func call%s(%s) (r1 uintptr, e1 Errno) {\n", $sysname, join(', ', @argscall);
# GC function generation
my $asm = "syscall6";
if ($nonblock) {
$asm = "rawSyscall6";
}
if(@argsgc <= 6) {
while(@argsgc < 6) {
push @argsgc, "0";
}
} else {
print STDERR "$ARGV:$.: too many arguments to system call\n";
}
my $argsgc = join(', ', @argsgc);
my $callgc = "$asm(uintptr(unsafe.Pointer(&$sysvarname)), $nargs, $argsgc)";
$textgc .= $callProto;
$textgc .= "\tr1, _, e1 = $callgc\n";
$textgc .= "\treturn\n}\n";
# GCCGO function generation
my $argsgccgo = join(', ', @argsgccgo);
my $callgccgo = "C.$sysname($argsgccgo)";
$textgccgo .= $callProto;
$textgccgo .= "\tr1 = uintptr($callgccgo)\n";
$textgccgo .= "\te1 = syscall.GetErrno()\n";
$textgccgo .= "\treturn\n}\n";
}
if($errors) {
exit 1;
}
# Print zsyscall_aix_ppc64.go
open(my $fcommun, '>', 'zsyscall_aix_ppc64.go');
my $tofcommun = <<EOF;
// $cmdline
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build $tags
package $package
import (
"unsafe"
)
EOF
$tofcommun .= "import \"golang.org/x/sys/unix\"\n" if $package ne "unix";
$tofcommun .=<<EOF;
$textcommon
EOF
print $fcommun $tofcommun;
# Print zsyscall_aix_ppc64_gc.go
open(my $fgc, '>', 'zsyscall_aix_ppc64_gc.go');
my $tofgc = <<EOF;
// $cmdline
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build $tags
// +build !gccgo
package $package
import (
"unsafe"
)
EOF
$tofgc .= "import \"golang.org/x/sys/unix\"\n" if $package ne "unix";
my $vardecls = "\t" . join(",\n\t", @vars);
$vardecls .= " syscallFunc";
$tofgc .=<<EOF;
$dynimports
$linknames
type syscallFunc uintptr
var (
$vardecls
)
// Implemented in runtime/syscall_aix.go.
func rawSyscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
func syscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
$textgc
EOF
print $fgc $tofgc;
# Print zsyscall_aix_ppc64_gc.go
open(my $fgccgo, '>', 'zsyscall_aix_ppc64_gccgo.go');
my $tofgccgo = <<EOF;
// $cmdline
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build $tags
// +build gccgo
package $package
$c_extern
*/
import "C"
import (
"syscall"
)
EOF
$tofgccgo .= "import \"golang.org/x/sys/unix\"\n" if $package ne "unix";
$tofgccgo .=<<EOF;
$textgccgo
EOF
print $fgccgo $tofgccgo;
exit 0;

335
vendor/golang.org/x/sys/unix/mksyscall_solaris.go generated vendored Normal file
View file

@ -0,0 +1,335 @@
// 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 ignore
/*
This program reads a file containing function prototypes
(like syscall_solaris.go) and generates system call bodies.
The prototypes are marked by lines beginning with "//sys"
and read like func declarations if //sys is replaced by func, but:
* The parameter lists must give a name for each argument.
This includes return parameters.
* The parameter lists must give a type for each argument:
the (x, y, z int) shorthand is not allowed.
* If the return parameter is an error number, it must be named err.
* If go func name needs to be different than its libc name,
* or the function is not in libc, name could be specified
* at the end, after "=" sign, like
//sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt
*/
package main
import (
"bufio"
"flag"
"fmt"
"os"
"regexp"
"strings"
)
var (
b32 = flag.Bool("b32", false, "32bit big-endian")
l32 = flag.Bool("l32", false, "32bit little-endian")
tags = flag.String("tags", "", "build tags")
)
// cmdLine returns this programs's commandline arguments
func cmdLine() string {
return "go run mksyscall_solaris.go " + strings.Join(os.Args[1:], " ")
}
// buildTags returns build tags
func buildTags() string {
return *tags
}
// Param is function parameter
type Param struct {
Name string
Type string
}
// usage prints the program usage
func usage() {
fmt.Fprintf(os.Stderr, "usage: go run mksyscall_solaris.go [-b32 | -l32] [-tags x,y] [file ...]\n")
os.Exit(1)
}
// parseParamList parses parameter list and returns a slice of parameters
func parseParamList(list string) []string {
list = strings.TrimSpace(list)
if list == "" {
return []string{}
}
return regexp.MustCompile(`\s*,\s*`).Split(list, -1)
}
// parseParam splits a parameter into name and type
func parseParam(p string) Param {
ps := regexp.MustCompile(`^(\S*) (\S*)$`).FindStringSubmatch(p)
if ps == nil {
fmt.Fprintf(os.Stderr, "malformed parameter: %s\n", p)
os.Exit(1)
}
return Param{ps[1], ps[2]}
}
func main() {
flag.Usage = usage
flag.Parse()
if len(flag.Args()) <= 0 {
fmt.Fprintf(os.Stderr, "no files to parse provided\n")
usage()
}
endianness := ""
if *b32 {
endianness = "big-endian"
} else if *l32 {
endianness = "little-endian"
}
pack := ""
text := ""
dynimports := ""
linknames := ""
var vars []string
for _, path := range flag.Args() {
file, err := os.Open(path)
if err != nil {
fmt.Fprintf(os.Stderr, err.Error())
os.Exit(1)
}
s := bufio.NewScanner(file)
for s.Scan() {
t := s.Text()
t = strings.TrimSpace(t)
t = regexp.MustCompile(`\s+`).ReplaceAllString(t, ` `)
if p := regexp.MustCompile(`^package (\S+)$`).FindStringSubmatch(t); p != nil && pack == "" {
pack = p[1]
}
nonblock := regexp.MustCompile(`^\/\/sysnb `).FindStringSubmatch(t)
if regexp.MustCompile(`^\/\/sys `).FindStringSubmatch(t) == nil && nonblock == nil {
continue
}
// Line must be of the form
// func Open(path string, mode int, perm int) (fd int, err error)
// Split into name, in params, out params.
f := regexp.MustCompile(`^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$`).FindStringSubmatch(t)
if f == nil {
fmt.Fprintf(os.Stderr, "%s:%s\nmalformed //sys declaration\n", path, t)
os.Exit(1)
}
funct, inps, outps, modname, sysname := f[2], f[3], f[4], f[5], f[6]
// Split argument lists on comma.
in := parseParamList(inps)
out := parseParamList(outps)
inps = strings.Join(in, ", ")
outps = strings.Join(out, ", ")
// Try in vain to keep people from editing this file.
// The theory is that they jump into the middle of the file
// without reading the header.
text += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n"
// So file name.
if modname == "" {
modname = "libc"
}
// System call name.
if sysname == "" {
sysname = funct
}
// System call pointer variable name.
sysvarname := fmt.Sprintf("proc%s", sysname)
strconvfunc := "BytePtrFromString"
strconvtype := "*byte"
sysname = strings.ToLower(sysname) // All libc functions are lowercase.
// Runtime import of function to allow cross-platform builds.
dynimports += fmt.Sprintf("//go:cgo_import_dynamic libc_%s %s \"%s.so\"\n", sysname, sysname, modname)
// Link symbol to proc address variable.
linknames += fmt.Sprintf("//go:linkname %s libc_%s\n", sysvarname, sysname)
// Library proc address variable.
vars = append(vars, sysvarname)
// Go function header.
outlist := strings.Join(out, ", ")
if outlist != "" {
outlist = fmt.Sprintf(" (%s)", outlist)
}
if text != "" {
text += "\n"
}
text += fmt.Sprintf("func %s(%s)%s {\n", funct, strings.Join(in, ", "), outlist)
// Check if err return available
errvar := ""
for _, param := range out {
p := parseParam(param)
if p.Type == "error" {
errvar = p.Name
continue
}
}
// Prepare arguments to Syscall.
var args []string
n := 0
for _, param := range in {
p := parseParam(param)
if regexp.MustCompile(`^\*`).FindStringSubmatch(p.Type) != nil {
args = append(args, "uintptr(unsafe.Pointer("+p.Name+"))")
} else if p.Type == "string" && errvar != "" {
text += fmt.Sprintf("\tvar _p%d %s\n", n, strconvtype)
text += fmt.Sprintf("\t_p%d, %s = %s(%s)\n", n, errvar, strconvfunc, p.Name)
text += fmt.Sprintf("\tif %s != nil {\n\t\treturn\n\t}\n", errvar)
args = append(args, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n))
n++
} else if p.Type == "string" {
fmt.Fprintf(os.Stderr, path+":"+funct+" uses string arguments, but has no error return\n")
text += fmt.Sprintf("\tvar _p%d %s\n", n, strconvtype)
text += fmt.Sprintf("\t_p%d, _ = %s(%s)\n", n, strconvfunc, p.Name)
args = append(args, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n))
n++
} else if s := regexp.MustCompile(`^\[\](.*)`).FindStringSubmatch(p.Type); s != nil {
// Convert slice into pointer, length.
// Have to be careful not to take address of &a[0] if len == 0:
// pass nil in that case.
text += fmt.Sprintf("\tvar _p%d *%s\n", n, s[1])
text += fmt.Sprintf("\tif len(%s) > 0 {\n\t\t_p%d = &%s[0]\n\t}\n", p.Name, n, p.Name)
args = append(args, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n), fmt.Sprintf("uintptr(len(%s))", p.Name))
n++
} else if p.Type == "int64" && endianness != "" {
if endianness == "big-endian" {
args = append(args, fmt.Sprintf("uintptr(%s>>32)", p.Name), fmt.Sprintf("uintptr(%s)", p.Name))
} else {
args = append(args, fmt.Sprintf("uintptr(%s)", p.Name), fmt.Sprintf("uintptr(%s>>32)", p.Name))
}
} else if p.Type == "bool" {
text += fmt.Sprintf("\tvar _p%d uint32\n", n)
text += fmt.Sprintf("\tif %s {\n\t\t_p%d = 1\n\t} else {\n\t\t_p%d = 0\n\t}\n", p.Name, n, n)
args = append(args, fmt.Sprintf("uintptr(_p%d)", n))
n++
} else {
args = append(args, fmt.Sprintf("uintptr(%s)", p.Name))
}
}
nargs := len(args)
// Determine which form to use; pad args with zeros.
asm := "sysvicall6"
if nonblock != nil {
asm = "rawSysvicall6"
}
if len(args) <= 6 {
for len(args) < 6 {
args = append(args, "0")
}
} else {
fmt.Fprintf(os.Stderr, "%s: too many arguments to system call\n", path)
os.Exit(1)
}
// Actual call.
arglist := strings.Join(args, ", ")
call := fmt.Sprintf("%s(uintptr(unsafe.Pointer(&%s)), %d, %s)", asm, sysvarname, nargs, arglist)
// Assign return values.
body := ""
ret := []string{"_", "_", "_"}
doErrno := false
for i := 0; i < len(out); i++ {
p := parseParam(out[i])
reg := ""
if p.Name == "err" {
reg = "e1"
ret[2] = reg
doErrno = true
} else {
reg = fmt.Sprintf("r%d", i)
ret[i] = reg
}
if p.Type == "bool" {
reg = fmt.Sprintf("%d != 0", reg)
}
if p.Type == "int64" && endianness != "" {
// 64-bit number in r1:r0 or r0:r1.
if i+2 > len(out) {
fmt.Fprintf(os.Stderr, "%s: not enough registers for int64 return\n", path)
os.Exit(1)
}
if endianness == "big-endian" {
reg = fmt.Sprintf("int64(r%d)<<32 | int64(r%d)", i, i+1)
} else {
reg = fmt.Sprintf("int64(r%d)<<32 | int64(r%d)", i+1, i)
}
ret[i] = fmt.Sprintf("r%d", i)
ret[i+1] = fmt.Sprintf("r%d", i+1)
}
if reg != "e1" {
body += fmt.Sprintf("\t%s = %s(%s)\n", p.Name, p.Type, reg)
}
}
if ret[0] == "_" && ret[1] == "_" && ret[2] == "_" {
text += fmt.Sprintf("\t%s\n", call)
} else {
text += fmt.Sprintf("\t%s, %s, %s := %s\n", ret[0], ret[1], ret[2], call)
}
text += body
if doErrno {
text += "\tif e1 != 0 {\n"
text += "\t\terr = e1\n"
text += "\t}\n"
}
text += "\treturn\n"
text += "}\n"
}
if err := s.Err(); err != nil {
fmt.Fprintf(os.Stderr, err.Error())
os.Exit(1)
}
file.Close()
}
imp := ""
if pack != "unix" {
imp = "import \"golang.org/x/sys/unix\"\n"
}
vardecls := "\t" + strings.Join(vars, ",\n\t")
vardecls += " syscallFunc"
fmt.Printf(srcTemplate, cmdLine(), buildTags(), pack, imp, dynimports, linknames, vardecls, text)
}
const srcTemplate = `// %s
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build %s
package %s
import (
"syscall"
"unsafe"
)
%s
%s
%s
var (
%s
)
%s
`

View file

@ -1,294 +0,0 @@
#!/usr/bin/env perl
# 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.
# This program reads a file containing function prototypes
# (like syscall_solaris.go) and generates system call bodies.
# The prototypes are marked by lines beginning with "//sys"
# and read like func declarations if //sys is replaced by func, but:
# * The parameter lists must give a name for each argument.
# This includes return parameters.
# * The parameter lists must give a type for each argument:
# the (x, y, z int) shorthand is not allowed.
# * If the return parameter is an error number, it must be named err.
# * If go func name needs to be different than its libc name,
# * or the function is not in libc, name could be specified
# * at the end, after "=" sign, like
# //sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt
use strict;
my $cmdline = "mksyscall_solaris.pl " . join(' ', @ARGV);
my $errors = 0;
my $_32bit = "";
my $tags = ""; # build tags
binmode STDOUT;
if($ARGV[0] eq "-b32") {
$_32bit = "big-endian";
shift;
} elsif($ARGV[0] eq "-l32") {
$_32bit = "little-endian";
shift;
}
if($ARGV[0] eq "-tags") {
shift;
$tags = $ARGV[0];
shift;
}
if($ARGV[0] =~ /^-/) {
print STDERR "usage: mksyscall_solaris.pl [-b32 | -l32] [-tags x,y] [file ...]\n";
exit 1;
}
sub parseparamlist($) {
my ($list) = @_;
$list =~ s/^\s*//;
$list =~ s/\s*$//;
if($list eq "") {
return ();
}
return split(/\s*,\s*/, $list);
}
sub parseparam($) {
my ($p) = @_;
if($p !~ /^(\S*) (\S*)$/) {
print STDERR "$ARGV:$.: malformed parameter: $p\n";
$errors = 1;
return ("xx", "int");
}
return ($1, $2);
}
my $package = "";
my $text = "";
my $dynimports = "";
my $linknames = "";
my @vars = ();
while(<>) {
chomp;
s/\s+/ /g;
s/^\s+//;
s/\s+$//;
$package = $1 if !$package && /^package (\S+)$/;
my $nonblock = /^\/\/sysnb /;
next if !/^\/\/sys / && !$nonblock;
# Line must be of the form
# func Open(path string, mode int, perm int) (fd int, err error)
# Split into name, in params, out params.
if(!/^\/\/sys(nb)? (\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$/) {
print STDERR "$ARGV:$.: malformed //sys declaration\n";
$errors = 1;
next;
}
my ($nb, $func, $in, $out, $modname, $sysname) = ($1, $2, $3, $4, $5, $6);
# Split argument lists on comma.
my @in = parseparamlist($in);
my @out = parseparamlist($out);
# Try in vain to keep people from editing this file.
# The theory is that they jump into the middle of the file
# without reading the header.
$text .= "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n";
# So file name.
if($modname eq "") {
$modname = "libc";
}
# System call name.
if($sysname eq "") {
$sysname = "$func";
}
# System call pointer variable name.
my $sysvarname = "proc$sysname";
my $strconvfunc = "BytePtrFromString";
my $strconvtype = "*byte";
$sysname =~ y/A-Z/a-z/; # All libc functions are lowercase.
# Runtime import of function to allow cross-platform builds.
$dynimports .= "//go:cgo_import_dynamic libc_${sysname} ${sysname} \"$modname.so\"\n";
# Link symbol to proc address variable.
$linknames .= "//go:linkname ${sysvarname} libc_${sysname}\n";
# Library proc address variable.
push @vars, $sysvarname;
# Go function header.
$out = join(', ', @out);
if($out ne "") {
$out = " ($out)";
}
if($text ne "") {
$text .= "\n"
}
$text .= sprintf "func %s(%s)%s {\n", $func, join(', ', @in), $out;
# Check if err return available
my $errvar = "";
foreach my $p (@out) {
my ($name, $type) = parseparam($p);
if($type eq "error") {
$errvar = $name;
last;
}
}
# Prepare arguments to Syscall.
my @args = ();
my $n = 0;
foreach my $p (@in) {
my ($name, $type) = parseparam($p);
if($type =~ /^\*/) {
push @args, "uintptr(unsafe.Pointer($name))";
} elsif($type eq "string" && $errvar ne "") {
$text .= "\tvar _p$n $strconvtype\n";
$text .= "\t_p$n, $errvar = $strconvfunc($name)\n";
$text .= "\tif $errvar != nil {\n\t\treturn\n\t}\n";
push @args, "uintptr(unsafe.Pointer(_p$n))";
$n++;
} elsif($type eq "string") {
print STDERR "$ARGV:$.: $func uses string arguments, but has no error return\n";
$text .= "\tvar _p$n $strconvtype\n";
$text .= "\t_p$n, _ = $strconvfunc($name)\n";
push @args, "uintptr(unsafe.Pointer(_p$n))";
$n++;
} elsif($type =~ /^\[\](.*)/) {
# Convert slice into pointer, length.
# Have to be careful not to take address of &a[0] if len == 0:
# pass nil in that case.
$text .= "\tvar _p$n *$1\n";
$text .= "\tif len($name) > 0 {\n\t\t_p$n = \&$name\[0]\n\t}\n";
push @args, "uintptr(unsafe.Pointer(_p$n))", "uintptr(len($name))";
$n++;
} elsif($type eq "int64" && $_32bit ne "") {
if($_32bit eq "big-endian") {
push @args, "uintptr($name >> 32)", "uintptr($name)";
} else {
push @args, "uintptr($name)", "uintptr($name >> 32)";
}
} elsif($type eq "bool") {
$text .= "\tvar _p$n uint32\n";
$text .= "\tif $name {\n\t\t_p$n = 1\n\t} else {\n\t\t_p$n = 0\n\t}\n";
push @args, "uintptr(_p$n)";
$n++;
} else {
push @args, "uintptr($name)";
}
}
my $nargs = @args;
# Determine which form to use; pad args with zeros.
my $asm = "sysvicall6";
if ($nonblock) {
$asm = "rawSysvicall6";
}
if(@args <= 6) {
while(@args < 6) {
push @args, "0";
}
} else {
print STDERR "$ARGV:$.: too many arguments to system call\n";
}
# Actual call.
my $args = join(', ', @args);
my $call = "$asm(uintptr(unsafe.Pointer(&$sysvarname)), $nargs, $args)";
# Assign return values.
my $body = "";
my $failexpr = "";
my @ret = ("_", "_", "_");
my @pout= ();
my $do_errno = 0;
for(my $i=0; $i<@out; $i++) {
my $p = $out[$i];
my ($name, $type) = parseparam($p);
my $reg = "";
if($name eq "err") {
$reg = "e1";
$ret[2] = $reg;
$do_errno = 1;
} else {
$reg = sprintf("r%d", $i);
$ret[$i] = $reg;
}
if($type eq "bool") {
$reg = "$reg != 0";
}
if($type eq "int64" && $_32bit ne "") {
# 64-bit number in r1:r0 or r0:r1.
if($i+2 > @out) {
print STDERR "$ARGV:$.: not enough registers for int64 return\n";
}
if($_32bit eq "big-endian") {
$reg = sprintf("int64(r%d)<<32 | int64(r%d)", $i, $i+1);
} else {
$reg = sprintf("int64(r%d)<<32 | int64(r%d)", $i+1, $i);
}
$ret[$i] = sprintf("r%d", $i);
$ret[$i+1] = sprintf("r%d", $i+1);
}
if($reg ne "e1") {
$body .= "\t$name = $type($reg)\n";
}
}
if ($ret[0] eq "_" && $ret[1] eq "_" && $ret[2] eq "_") {
$text .= "\t$call\n";
} else {
$text .= "\t$ret[0], $ret[1], $ret[2] := $call\n";
}
$text .= $body;
if ($do_errno) {
$text .= "\tif e1 != 0 {\n";
$text .= "\t\terr = e1\n";
$text .= "\t}\n";
}
$text .= "\treturn\n";
$text .= "}\n";
}
if($errors) {
exit 1;
}
print <<EOF;
// $cmdline
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build $tags
package $package
import (
"syscall"
"unsafe"
)
EOF
print "import \"golang.org/x/sys/unix\"\n" if $package ne "unix";
my $vardecls = "\t" . join(",\n\t", @vars);
$vardecls .= " syscallFunc";
chomp($_=<<EOF);
$dynimports
$linknames
var (
$vardecls
)
$text
EOF
print $_;
exit 0;

190
vendor/golang.org/x/sys/unix/mksysnum.go generated vendored Normal file
View file

@ -0,0 +1,190 @@
// 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 ignore
// Generate system call table for DragonFly, NetBSD,
// FreeBSD, OpenBSD or Darwin from master list
// (for example, /usr/src/sys/kern/syscalls.master or
// sys/syscall.h).
package main
import (
"bufio"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"regexp"
"strings"
)
var (
goos, goarch string
)
// cmdLine returns this programs's commandline arguments
func cmdLine() string {
return "go run mksysnum.go " + strings.Join(os.Args[1:], " ")
}
// buildTags returns build tags
func buildTags() string {
return fmt.Sprintf("%s,%s", goarch, goos)
}
func checkErr(err error) {
if err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
os.Exit(1)
}
}
// source string and substring slice for regexp
type re struct {
str string // source string
sub []string // matched sub-string
}
// Match performs regular expression match
func (r *re) Match(exp string) bool {
r.sub = regexp.MustCompile(exp).FindStringSubmatch(r.str)
if r.sub != nil {
return true
}
return false
}
// fetchFile fetches a text file from URL
func fetchFile(URL string) io.Reader {
resp, err := http.Get(URL)
checkErr(err)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
checkErr(err)
return strings.NewReader(string(body))
}
// readFile reads a text file from path
func readFile(path string) io.Reader {
file, err := os.Open(os.Args[1])
checkErr(err)
return file
}
func format(name, num, proto string) string {
name = strings.ToUpper(name)
// There are multiple entries for enosys and nosys, so comment them out.
nm := re{str: name}
if nm.Match(`^SYS_E?NOSYS$`) {
name = fmt.Sprintf("// %s", name)
}
if name == `SYS_SYS_EXIT` {
name = `SYS_EXIT`
}
return fmt.Sprintf(" %s = %s; // %s\n", name, num, proto)
}
func main() {
// Get the OS (using GOOS_TARGET if it exist)
goos = os.Getenv("GOOS_TARGET")
if goos == "" {
goos = os.Getenv("GOOS")
}
// Get the architecture (using GOARCH_TARGET if it exists)
goarch = os.Getenv("GOARCH_TARGET")
if goarch == "" {
goarch = os.Getenv("GOARCH")
}
// Check if GOOS and GOARCH environment variables are defined
if goarch == "" || goos == "" {
fmt.Fprintf(os.Stderr, "GOARCH or GOOS not defined in environment\n")
os.Exit(1)
}
file := strings.TrimSpace(os.Args[1])
var syscalls io.Reader
if strings.HasPrefix(file, "https://") || strings.HasPrefix(file, "http://") {
// Download syscalls.master file
syscalls = fetchFile(file)
} else {
syscalls = readFile(file)
}
var text, line string
s := bufio.NewScanner(syscalls)
for s.Scan() {
t := re{str: line}
if t.Match(`^(.*)\\$`) {
// Handle continuation
line = t.sub[1]
line += strings.TrimLeft(s.Text(), " \t")
} else {
// New line
line = s.Text()
}
t = re{str: line}
if t.Match(`\\$`) {
continue
}
t = re{str: line}
switch goos {
case "dragonfly":
if t.Match(`^([0-9]+)\s+STD\s+({ \S+\s+(\w+).*)$`) {
num, proto := t.sub[1], t.sub[2]
name := fmt.Sprintf("SYS_%s", t.sub[3])
text += format(name, num, proto)
}
case "freebsd":
if t.Match(`^([0-9]+)\s+\S+\s+(?:NO)?STD\s+({ \S+\s+(\w+).*)$`) {
num, proto := t.sub[1], t.sub[2]
name := fmt.Sprintf("SYS_%s", t.sub[3])
text += format(name, num, proto)
}
case "openbsd":
if t.Match(`^([0-9]+)\s+STD\s+(NOLOCK\s+)?({ \S+\s+\*?(\w+).*)$`) {
num, proto, name := t.sub[1], t.sub[3], t.sub[4]
text += format(name, num, proto)
}
case "netbsd":
if t.Match(`^([0-9]+)\s+((STD)|(NOERR))\s+(RUMP\s+)?({\s+\S+\s*\*?\s*\|(\S+)\|(\S*)\|(\w+).*\s+})(\s+(\S+))?$`) {
num, proto, compat := t.sub[1], t.sub[6], t.sub[8]
name := t.sub[7] + "_" + t.sub[9]
if t.sub[11] != "" {
name = t.sub[7] + "_" + t.sub[11]
}
name = strings.ToUpper(name)
if compat == "" || compat == "13" || compat == "30" || compat == "50" {
text += fmt.Sprintf(" %s = %s; // %s\n", name, num, proto)
}
}
case "darwin":
if t.Match(`^#define\s+SYS_(\w+)\s+([0-9]+)`) {
name, num := t.sub[1], t.sub[2]
name = strings.ToUpper(name)
text += fmt.Sprintf(" SYS_%s = %s;\n", name, num)
}
default:
fmt.Fprintf(os.Stderr, "unrecognized GOOS=%s\n", goos)
os.Exit(1)
}
}
err := s.Err()
checkErr(err)
fmt.Printf(template, cmdLine(), buildTags(), text)
}
const template = `// %s
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build %s
package unix
const(
%s)`

View file

@ -1,39 +0,0 @@
#!/usr/bin/env perl
# Copyright 2009 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
#
# Generate system call table for Darwin from sys/syscall.h
use strict;
if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
print STDERR "GOARCH or GOOS not defined in environment\n";
exit 1;
}
my $command = "mksysnum_darwin.pl " . join(' ', @ARGV);
print <<EOF;
// $command
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
package unix
const (
EOF
while(<>){
if(/^#define\s+SYS_(\w+)\s+([0-9]+)/){
my $name = $1;
my $num = $2;
$name =~ y/a-z/A-Z/;
print " SYS_$name = $num;"
}
}
print <<EOF;
)
EOF

View file

@ -1,50 +0,0 @@
#!/usr/bin/env perl
# Copyright 2009 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
#
# Generate system call table for DragonFly from master list
# (for example, /usr/src/sys/kern/syscalls.master).
use strict;
if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
print STDERR "GOARCH or GOOS not defined in environment\n";
exit 1;
}
my $command = "mksysnum_dragonfly.pl " . join(' ', @ARGV);
print <<EOF;
// $command
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
package unix
const (
EOF
while(<>){
if(/^([0-9]+)\s+STD\s+({ \S+\s+(\w+).*)$/){
my $num = $1;
my $proto = $2;
my $name = "SYS_$3";
$name =~ y/a-z/A-Z/;
# There are multiple entries for enosys and nosys, so comment them out.
if($name =~ /^SYS_E?NOSYS$/){
$name = "// $name";
}
if($name eq 'SYS_SYS_EXIT'){
$name = 'SYS_EXIT';
}
print " $name = $num; // $proto\n";
}
}
print <<EOF;
)
EOF

View file

@ -1,50 +0,0 @@
#!/usr/bin/env perl
# Copyright 2009 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
#
# Generate system call table for FreeBSD from master list
# (for example, /usr/src/sys/kern/syscalls.master).
use strict;
if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
print STDERR "GOARCH or GOOS not defined in environment\n";
exit 1;
}
my $command = "mksysnum_freebsd.pl " . join(' ', @ARGV);
print <<EOF;
// $command
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
package unix
const (
EOF
while(<>){
if(/^([0-9]+)\s+\S+\s+(?:NO)?STD\s+({ \S+\s+(\w+).*)$/){
my $num = $1;
my $proto = $2;
my $name = "SYS_$3";
$name =~ y/a-z/A-Z/;
# There are multiple entries for enosys and nosys, so comment them out.
if($name =~ /^SYS_E?NOSYS$/){
$name = "// $name";
}
if($name eq 'SYS_SYS_EXIT'){
$name = 'SYS_EXIT';
}
print " $name = $num; // $proto\n";
}
}
print <<EOF;
)
EOF

View file

@ -1,58 +0,0 @@
#!/usr/bin/env perl
# Copyright 2009 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
#
# Generate system call table for OpenBSD from master list
# (for example, /usr/src/sys/kern/syscalls.master).
use strict;
if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
print STDERR "GOARCH or GOOS not defined in environment\n";
exit 1;
}
my $command = "mksysnum_netbsd.pl " . join(' ', @ARGV);
print <<EOF;
// $command
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
package unix
const (
EOF
my $line = '';
while(<>){
if($line =~ /^(.*)\\$/) {
# Handle continuation
$line = $1;
$_ =~ s/^\s+//;
$line .= $_;
} else {
# New line
$line = $_;
}
next if $line =~ /\\$/;
if($line =~ /^([0-9]+)\s+((STD)|(NOERR))\s+(RUMP\s+)?({\s+\S+\s*\*?\s*\|(\S+)\|(\S*)\|(\w+).*\s+})(\s+(\S+))?$/) {
my $num = $1;
my $proto = $6;
my $compat = $8;
my $name = "$7_$9";
$name = "$7_$11" if $11 ne '';
$name =~ y/a-z/A-Z/;
if($compat eq '' || $compat eq '13' || $compat eq '30' || $compat eq '50') {
print " $name = $num; // $proto\n";
}
}
}
print <<EOF;
)
EOF

View file

@ -1,50 +0,0 @@
#!/usr/bin/env perl
# Copyright 2009 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
#
# Generate system call table for OpenBSD from master list
# (for example, /usr/src/sys/kern/syscalls.master).
use strict;
if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
print STDERR "GOARCH or GOOS not defined in environment\n";
exit 1;
}
my $command = "mksysnum_openbsd.pl " . join(' ', @ARGV);
print <<EOF;
// $command
// Code generated by the command above; see README.md. DO NOT EDIT.
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
package unix
const (
EOF
while(<>){
if(/^([0-9]+)\s+STD\s+(NOLOCK\s+)?({ \S+\s+\*?(\w+).*)$/){
my $num = $1;
my $proto = $3;
my $name = $4;
$name =~ y/a-z/A-Z/;
# There are multiple entries for enosys and nosys, so comment them out.
if($name =~ /^SYS_E?NOSYS$/){
$name = "// $name";
}
if($name eq 'SYS_SYS_EXIT'){
$name = 'SYS_EXIT';
}
print " $name = $num; // $proto\n";
}
}
print <<EOF;
)
EOF

View file

@ -8,17 +8,33 @@
package unix
import "unsafe"
import (
"runtime"
"unsafe"
)
// Round the length of a raw sockaddr up to align it properly.
func cmsgAlignOf(salen int) int {
salign := SizeofPtr
// NOTE: It seems like 64-bit Darwin, DragonFly BSD and
// Solaris kernels still require 32-bit aligned access to
// network subsystem.
if darwin64Bit || dragonfly64Bit || solaris64Bit {
salign = 4
switch runtime.GOOS {
case "aix":
// There is no alignment on AIX.
salign = 1
case "darwin", "dragonfly", "solaris":
// NOTE: It seems like 64-bit Darwin, DragonFly BSD and
// Solaris kernels still require 32-bit aligned access to
// network subsystem.
if SizeofPtr == 8 {
salign = 4
}
case "netbsd", "openbsd":
// NetBSD and OpenBSD armv7 require 64-bit alignment.
if runtime.GOARCH == "arm" {
salign = 8
}
}
return (salen + salign - 1) & ^(salign - 1)
}

View file

@ -13,10 +13,7 @@
package unix
import (
"syscall"
"unsafe"
)
import "unsafe"
/*
* Wrapped
@ -230,7 +227,7 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
// Some versions of AIX have a bug in getsockname (see IV78655).
// We can't rely on sa.Len being set correctly.
n := SizeofSockaddrUnix - 3 // substract leading Family, Len, terminating NUL.
n := SizeofSockaddrUnix - 3 // subtract leading Family, Len, terminating NUL.
for i := 0; i < n; i++ {
if pp.Path[i] == 0 {
n = i
@ -271,6 +268,13 @@ func Gettimeofday(tv *Timeval) (err error) {
return
}
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
if raceenabled {
raceReleaseMerge(unsafe.Pointer(&ioSync))
}
return sendfile(outfd, infd, offset, count)
}
// TODO
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
return -1, ENOSYS
@ -385,10 +389,6 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
//sys fcntl(fd int, cmd int, arg int) (val int, err error)
func Flock(fd int, how int) (err error) {
return syscall.Flock(fd, how)
}
/*
* Direct access
*/
@ -444,8 +444,6 @@ func Flock(fd int, how int) (err error) {
//sysnb Times(tms *Tms) (ticks uintptr, err error)
//sysnb Umask(mask int) (oldmask int)
//sysnb Uname(buf *Utsname) (err error)
//TODO umount
// //sys Unmount(target string, flags int) (err error) = umount
//sys Unlink(path string) (err error)
//sys Unlinkat(dirfd int, path string, flags int) (err error)
//sys Ustat(dev int, ubuf *Ustat_t) (err error)
@ -470,8 +468,7 @@ func Flock(fd int, how int) (err error) {
//sys Pause() (err error)
//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
//TODO Select
// //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)
//sysnb Setregid(rgid int, egid int) (err error)
//sysnb Setreuid(ruid int, euid int) (err error)
@ -493,8 +490,10 @@ func Flock(fd int, how int) (err error) {
//sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error)
//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error)
//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error)
//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error)
// In order to use msghdr structure with Control, Controllen, nrecvmsg and nsendmsg must be used.
//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) = nrecvmsg
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) = nsendmsg
//sys munmap(addr uintptr, length uintptr) (err error)
@ -545,3 +544,14 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
//sys gettimeofday(tv *Timeval, tzp *Timezone) (err error)
//sysnb Time(t *Time_t) (tt Time_t, err error)
//sys Utime(path string, buf *Utimbuf) (err error)
//sys Getsystemcfg(label int) (n uint64)
//sys umount(target string) (err error)
func Unmount(target string, flags int) (err error) {
if flags != 0 {
// AIX doesn't have any flags for umount.
return ENOSYS
}
return umount(target)
}

View file

@ -108,17 +108,8 @@ func getAttrList(path string, attrList attrList, attrBuf []byte, options uint) (
return nil, err
}
_, _, e1 := Syscall6(
SYS_GETATTRLIST,
uintptr(unsafe.Pointer(_p0)),
uintptr(unsafe.Pointer(&attrList)),
uintptr(unsafe.Pointer(&attrBuf[0])),
uintptr(len(attrBuf)),
uintptr(options),
0,
)
if e1 != 0 {
return nil, e1
if err := getattrlist(_p0, unsafe.Pointer(&attrList), unsafe.Pointer(&attrBuf[0]), uintptr(len(attrBuf)), int(options)); err != nil {
return nil, err
}
size := *(*uint32)(unsafe.Pointer(&attrBuf[0]))
@ -151,6 +142,25 @@ func getAttrList(path string, attrList attrList, attrBuf []byte, options uint) (
return
}
//sys getattrlist(path *byte, list unsafe.Pointer, buf unsafe.Pointer, size uintptr, options int) (err error)
func SysctlClockinfo(name string) (*Clockinfo, error) {
mib, err := sysctlmib(name)
if err != nil {
return nil, err
}
n := uintptr(SizeofClockinfo)
var ci Clockinfo
if err := sysctl(mib, (*byte)(unsafe.Pointer(&ci)), &n, nil, 0); err != nil {
return nil, err
}
if n != SizeofClockinfo {
return nil, EIO
}
return &ci, nil
}
//sysnb pipe() (r int, w int, err error)
func Pipe(p []int) (err error) {
@ -168,12 +178,7 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
_p0 = unsafe.Pointer(&buf[0])
bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf))
}
r0, _, e1 := Syscall(SYS_GETFSSTAT64, uintptr(_p0), bufsize, uintptr(flags))
n = int(r0)
if e1 != 0 {
err = e1
}
return
return getfsstat(_p0, bufsize, flags)
}
func xattrPointer(dest []byte) *byte {
@ -298,21 +303,16 @@ func setattrlistTimes(path string, times []Timespec, flags int) error {
if flags&AT_SYMLINK_NOFOLLOW != 0 {
options |= FSOPT_NOFOLLOW
}
_, _, e1 := Syscall6(
SYS_SETATTRLIST,
uintptr(unsafe.Pointer(_p0)),
uintptr(unsafe.Pointer(&attrList)),
uintptr(unsafe.Pointer(&attributes)),
uintptr(unsafe.Sizeof(attributes)),
uintptr(options),
0,
)
if e1 != 0 {
return e1
}
return nil
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
@ -411,6 +411,18 @@ func Uname(uname *Utsname) error {
return nil
}
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
if raceenabled {
raceReleaseMerge(unsafe.Pointer(&ioSync))
}
var length = int64(count)
err = sendfile(infd, outfd, *offset, &length, nil, 0)
written = int(length)
return
}
//sys sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error)
/*
* Exposed directly
*/
@ -421,6 +433,7 @@ func Uname(uname *Utsname) error {
//sys Chmod(path string, mode uint32) (err error)
//sys Chown(path string, uid int, gid int) (err error)
//sys Chroot(path string) (err error)
//sys ClockGettime(clockid int32, time *Timespec) (err error)
//sys Close(fd int) (err error)
//sys Dup(fd int) (nfd int, err error)
//sys Dup2(from int, to int) (err error)
@ -435,12 +448,8 @@ func Uname(uname *Utsname) error {
//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
//sys Flock(fd int, how int) (err error)
//sys Fpathconf(fd int, name int) (val int, err error)
//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 Fsync(fd int) (err error)
//sys Ftruncate(fd int, length int64) (err error)
//sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) = SYS_GETDIRENTRIES64
//sys Getdtablesize() (size int)
//sysnb Getegid() (egid int)
//sysnb Geteuid() (uid int)
@ -460,7 +469,6 @@ func Uname(uname *Utsname) error {
//sys Link(path string, link string) (err error)
//sys Linkat(pathfd int, path string, linkfd int, link string, flags int) (err error)
//sys Listen(s int, backlog int) (err error)
//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
//sys Mkdir(path string, mode uint32) (err error)
//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
//sys Mkfifo(path string, mode uint32) (err error)
@ -492,8 +500,6 @@ func Uname(uname *Utsname) error {
//sysnb Setsid() (pid int, err error)
//sysnb Settimeofday(tp *Timeval) (err error)
//sysnb Setuid(uid int) (err error)
//sys Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64
//sys Symlink(path string, link string) (err error)
//sys Symlinkat(oldpath string, newdirfd int, newpath string) (err error)
//sys Sync() (err error)

View file

@ -8,7 +8,6 @@ package unix
import (
"syscall"
"unsafe"
)
func setTimespec(sec, nsec int64) Timespec {
@ -48,21 +47,17 @@ func (cmsg *Cmsghdr) SetLen(length int) {
cmsg.Len = uint32(length)
}
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
var length = uint64(count)
_, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(*offset>>32), uintptr(unsafe.Pointer(&length)), 0, 0, 0, 0)
written = int(length)
if e1 != 0 {
err = e1
}
return
}
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
// of darwin/386 the syscall is called sysctl instead of __sysctl.
const SYS___SYSCTL = SYS_SYSCTL
//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 Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) = SYS_GETDIRENTRIES64
//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 Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64

View file

@ -8,7 +8,6 @@ package unix
import (
"syscall"
"unsafe"
)
func setTimespec(sec, nsec int64) Timespec {
@ -48,21 +47,17 @@ func (cmsg *Cmsghdr) SetLen(length int) {
cmsg.Len = uint32(length)
}
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
var length = uint64(count)
_, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(unsafe.Pointer(&length)), 0, 0)
written = int(length)
if e1 != 0 {
err = e1
}
return
}
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
// of darwin/amd64 the syscall is called sysctl instead of __sysctl.
const SYS___SYSCTL = SYS_SYSCTL
//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 Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) = SYS_GETDIRENTRIES64
//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 Stat(path string, stat *Stat_t) (err error) = SYS_STAT64
//sys Statfs(path string, stat *Statfs_t) (err error) = SYS_STATFS64

View file

@ -6,7 +6,6 @@ package unix
import (
"syscall"
"unsafe"
)
func setTimespec(sec, nsec int64) Timespec {
@ -46,21 +45,20 @@ func (cmsg *Cmsghdr) SetLen(length int) {
cmsg.Len = uint32(length)
}
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
var length = uint64(count)
_, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(*offset>>32), uintptr(unsafe.Pointer(&length)), 0, 0, 0, 0)
written = int(length)
if e1 != 0 {
err = e1
}
return
}
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
// of darwin/arm the syscall is called sysctl instead of __sysctl.
const SYS___SYSCTL = SYS_SYSCTL
//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)
func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
return 0, ENOSYS
}

View file

@ -8,7 +8,6 @@ package unix
import (
"syscall"
"unsafe"
)
func setTimespec(sec, nsec int64) Timespec {
@ -48,21 +47,20 @@ func (cmsg *Cmsghdr) SetLen(length int) {
cmsg.Len = uint32(length)
}
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
var length = uint64(count)
_, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(unsafe.Pointer(&length)), 0, 0)
written = int(length)
if e1 != 0 {
err = e1
}
return
}
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic
// SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions
// of darwin/arm64 the syscall is called sysctl instead of __sysctl.
const SYS___SYSCTL = SYS_SYSCTL
//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)
func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
return 0, ENOSYS
}

View file

@ -0,0 +1,31 @@
// 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 darwin,go1.12
package unix
import "unsafe"
// Implemented in the runtime package (runtime/sys_darwin.go)
func syscall_syscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)
func syscall_syscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
func syscall_syscall6X(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
func syscall_syscall9(fn, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno) // 32-bit only
func syscall_rawSyscall(fn, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)
func syscall_rawSyscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
//go:linkname syscall_syscall syscall.syscall
//go:linkname syscall_syscall6 syscall.syscall6
//go:linkname syscall_syscall6X syscall.syscall6X
//go:linkname syscall_syscall9 syscall.syscall9
//go:linkname syscall_rawSyscall syscall.rawSyscall
//go:linkname syscall_rawSyscall6 syscall.rawSyscall6
// 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))
}

View file

@ -234,6 +234,13 @@ func Uname(uname *Utsname) error {
return nil
}
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
if raceenabled {
raceReleaseMerge(unsafe.Pointer(&ioSync))
}
return sendfile(outfd, infd, offset, count)
}
/*
* Exposed directly
*/
@ -297,6 +304,7 @@ func Uname(uname *Utsname) error {
//sys read(fd int, p []byte) (n int, err error)
//sys Readlink(path string, buf []byte) (n int, err error)
//sys Rename(from string, to string) (err error)
//sys Renameat(fromfd int, from string, tofd int, to string) (err error)
//sys Revoke(path string) (err error)
//sys Rmdir(path string) (err error)
//sys Seek(fd int, offset int64, whence int) (newoffset int64, err error) = SYS_LSEEK

View file

@ -500,6 +500,13 @@ func convertFromDirents11(buf []byte, old []byte) int {
return dstPos
}
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
if raceenabled {
raceReleaseMerge(unsafe.Pointer(&ioSync))
}
return sendfile(outfd, infd, offset, count)
}
/*
* Exposed directly
*/

52
vendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go generated vendored Normal file
View file

@ -0,0 +1,52 @@
// 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 arm64,freebsd
package unix
import (
"syscall"
"unsafe"
)
func setTimespec(sec, nsec int64) Timespec {
return Timespec{Sec: sec, Nsec: nsec}
}
func setTimeval(sec, usec int64) Timeval {
return Timeval{Sec: sec, Usec: usec}
}
func SetKevent(k *Kevent_t, fd, mode, flags int) {
k.Ident = uint64(fd)
k.Filter = int16(mode)
k.Flags = uint16(flags)
}
func (iov *Iovec) SetLen(length int) {
iov.Len = uint64(length)
}
func (msghdr *Msghdr) SetControllen(length int) {
msghdr.Controllen = uint32(length)
}
func (cmsg *Cmsghdr) SetLen(length int) {
cmsg.Len = uint32(length)
}
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
var writtenOut uint64 = 0
_, _, e1 := Syscall9(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(count), 0, uintptr(unsafe.Pointer(&writtenOut)), 0, 0, 0)
written = int(writtenOut)
if e1 != 0 {
err = e1
}
return
}
func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno)

View file

@ -12,6 +12,9 @@
package unix
import (
"encoding/binary"
"net"
"runtime"
"syscall"
"unsafe"
)
@ -36,6 +39,20 @@ func Creat(path string, mode uint32) (fd int, err error) {
return Open(path, O_CREAT|O_WRONLY|O_TRUNC, mode)
}
//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)
func FanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname string) (err error) {
if pathname == "" {
return fanotifyMark(fd, flags, mask, dirFd, nil)
}
p, err := BytePtrFromString(pathname)
if err != nil {
return err
}
return fanotifyMark(fd, flags, mask, dirFd, p)
}
//sys fchmodat(dirfd int, path string, mode uint32) (err error)
func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
@ -55,6 +72,15 @@ func Fchmodat(dirfd int, path string, mode uint32, flags int) (err error) {
// ioctl itself should not be exposed directly, but additional get/set
// functions for specific types are permissible.
// IoctlSetPointerInt performs an ioctl operation which sets an
// integer value on fd, using the specified request number. The ioctl
// argument is called with a pointer to the integer value, rather than
// passing the integer value directly.
func IoctlSetPointerInt(fd int, req uint, value int) error {
v := int32(value)
return ioctl(fd, req, uintptr(unsafe.Pointer(&v)))
}
// 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 {
@ -69,6 +95,12 @@ func ioctlSetTermios(fd int, req uint, value *Termios) error {
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
}
func IoctlSetRTCTime(fd int, value *RTCTime) error {
err := ioctl(fd, RTC_SET_TIME, uintptr(unsafe.Pointer(value)))
runtime.KeepAlive(value)
return err
}
// IoctlGetInt performs an ioctl operation which gets an integer value
// from fd, using the specified request number.
func IoctlGetInt(fd int, req uint) (int, error) {
@ -89,6 +121,12 @@ func IoctlGetTermios(fd int, req uint) (*Termios, error) {
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
}
//sys Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error)
func Link(oldpath string, newpath string) (err error) {
@ -710,6 +748,51 @@ func (sa *SockaddrXDP) sockaddr() (unsafe.Pointer, _Socklen, error) {
return unsafe.Pointer(&sa.raw), SizeofSockaddrXDP, nil
}
// This constant mirrors the #define of PX_PROTO_OE in
// linux/if_pppox.h. We're defining this by hand here instead of
// autogenerating through mkerrors.sh because including
// linux/if_pppox.h causes some declaration conflicts with other
// includes (linux/if_pppox.h includes linux/in.h, which conflicts
// with netinet/in.h). Given that we only need a single zero constant
// out of that file, it's cleaner to just define it by hand here.
const px_proto_oe = 0
type SockaddrPPPoE struct {
SID uint16
Remote net.HardwareAddr
Dev string
raw RawSockaddrPPPoX
}
func (sa *SockaddrPPPoE) sockaddr() (unsafe.Pointer, _Socklen, error) {
if len(sa.Remote) != 6 {
return nil, 0, EINVAL
}
if len(sa.Dev) > IFNAMSIZ-1 {
return nil, 0, EINVAL
}
*(*uint16)(unsafe.Pointer(&sa.raw[0])) = AF_PPPOX
// This next field is in host-endian byte order. We can't use the
// same unsafe pointer cast as above, because this value is not
// 32-bit aligned and some architectures don't allow unaligned
// access.
//
// However, the value of px_proto_oe is 0, so we can use
// encoding/binary helpers to write the bytes without worrying
// about the ordering.
binary.BigEndian.PutUint32(sa.raw[2:6], px_proto_oe)
// This field is deliberately big-endian, unlike the previous
// one. The kernel expects SID to be in network byte order.
binary.BigEndian.PutUint16(sa.raw[6:8], sa.SID)
copy(sa.raw[8:14], sa.Remote)
for i := 14; i < 14+IFNAMSIZ; i++ {
sa.raw[i] = 0
}
copy(sa.raw[14:], sa.Dev)
return unsafe.Pointer(&sa.raw), SizeofSockaddrPPPoX, nil
}
func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
switch rsa.Addr.Family {
case AF_NETLINK:
@ -820,6 +903,22 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
SharedUmemFD: pp.Shared_umem_fd,
}
return sa, nil
case AF_PPPOX:
pp := (*RawSockaddrPPPoX)(unsafe.Pointer(rsa))
if binary.BigEndian.Uint32(pp[2:6]) != px_proto_oe {
return nil, EINVAL
}
sa := &SockaddrPPPoE{
SID: binary.BigEndian.Uint16(pp[6:8]),
Remote: net.HardwareAddr(pp[8:14]),
}
for i := 14; i < 14+IFNAMSIZ; i++ {
if pp[i] == 0 {
sa.Dev = string(pp[14:i])
break
}
}
return sa, nil
}
return nil, EAFNOSUPPORT
}
@ -905,10 +1004,50 @@ func GetsockoptString(fd, level, opt int) (string, error) {
return string(buf[:vallen-1]), nil
}
func GetsockoptTpacketStats(fd, level, opt int) (*TpacketStats, error) {
var value TpacketStats
vallen := _Socklen(SizeofTpacketStats)
err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
return &value, err
}
func GetsockoptTpacketStatsV3(fd, level, opt int) (*TpacketStatsV3, error) {
var value TpacketStatsV3
vallen := _Socklen(SizeofTpacketStatsV3)
err := getsockopt(fd, level, opt, unsafe.Pointer(&value), &vallen)
return &value, err
}
func SetsockoptIPMreqn(fd, level, opt int, mreq *IPMreqn) (err error) {
return setsockopt(fd, level, opt, unsafe.Pointer(mreq), unsafe.Sizeof(*mreq))
}
func SetsockoptPacketMreq(fd, level, opt int, mreq *PacketMreq) error {
return setsockopt(fd, level, opt, unsafe.Pointer(mreq), unsafe.Sizeof(*mreq))
}
// SetsockoptSockFprog attaches a classic BPF or an extended BPF program to a
// socket to filter incoming packets. See 'man 7 socket' for usage information.
func SetsockoptSockFprog(fd, level, opt int, fprog *SockFprog) error {
return setsockopt(fd, level, opt, unsafe.Pointer(fprog), unsafe.Sizeof(*fprog))
}
func SetsockoptCanRawFilter(fd, level, opt int, filter []CanFilter) error {
var p unsafe.Pointer
if len(filter) > 0 {
p = unsafe.Pointer(&filter[0])
}
return setsockopt(fd, level, opt, p, uintptr(len(filter)*SizeofCanFilter))
}
func SetsockoptTpacketReq(fd, level, opt int, tp *TpacketReq) error {
return setsockopt(fd, level, opt, unsafe.Pointer(tp), unsafe.Sizeof(*tp))
}
func SetsockoptTpacketReq3(fd, level, opt int, tp *TpacketReq3) error {
return setsockopt(fd, level, opt, unsafe.Pointer(tp), unsafe.Sizeof(*tp))
}
// Keyctl Commands (http://man7.org/linux/man-pages/man2/keyctl.2.html)
// KeyctlInt calls keyctl commands in which each argument is an int.
@ -1288,6 +1427,13 @@ func Mount(source string, target string, fstype string, flags uintptr, data stri
return mount(source, target, fstype, flags, datap)
}
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
if raceenabled {
raceReleaseMerge(unsafe.Pointer(&ioSync))
}
return sendfile(outfd, infd, offset, count)
}
// Sendto
// Recvfrom
// Socketpair
@ -1302,6 +1448,7 @@ func Mount(source string, target string, fstype string, flags uintptr, data stri
//sys Chroot(path string) (err error)
//sys ClockGetres(clockid int32, res *Timespec) (err error)
//sys ClockGettime(clockid int32, time *Timespec) (err error)
//sys ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error)
//sys Close(fd 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)
@ -1362,7 +1509,6 @@ func Getpgrp() (pid int) {
//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 Removexattr(path string, attr string) (err error)
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
//sys Renameat2(olddirfd int, oldpath string, newdirfd int, newpath string, flags uint) (err error)
//sys RequestKey(keyType string, description string, callback string, destRingid int) (id int, err error)
//sys Setdomainname(p []byte) (err error)
@ -1387,6 +1533,7 @@ func Setgid(uid int) (err error) {
//sys Setpriority(which int, who int, prio int) (err error)
//sys Setxattr(path string, attr string, data []byte, flags int) (err error)
//sys Signalfd(fd int, mask *Sigset_t, flags int) = SYS_SIGNALFD4
//sys Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error)
//sys Sync()
//sys Syncfs(fd int) (err error)
@ -1431,15 +1578,12 @@ func Munmap(b []byte) (err error) {
// Vmsplice splices user pages from a slice of Iovecs into a pipe specified by fd,
// using the specified flags.
func Vmsplice(fd int, iovs []Iovec, flags int) (int, error) {
n, _, errno := Syscall6(
SYS_VMSPLICE,
uintptr(fd),
uintptr(unsafe.Pointer(&iovs[0])),
uintptr(len(iovs)),
uintptr(flags),
0,
0,
)
var p unsafe.Pointer
if len(iovs) > 0 {
p = unsafe.Pointer(&iovs[0])
}
n, _, errno := Syscall6(SYS_VMSPLICE, uintptr(fd), uintptr(p), uintptr(len(iovs)), uintptr(flags), 0, 0)
if errno != 0 {
return 0, syscall.Errno(errno)
}
@ -1518,6 +1662,19 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
return EACCES
}
//sys nameToHandleAt(dirFD int, pathname string, fh *fileHandle, mountID *_C_int, flags int) (err error) = SYS_NAME_TO_HANDLE_AT
//sys openByHandleAt(mountFD int, fh *fileHandle, flags int) (fd int, err error) = SYS_OPEN_BY_HANDLE_AT
// fileHandle is the argument to nameToHandleAt and openByHandleAt. We
// originally tried to generate it via unix/linux/types.go with "type
// fileHandle C.struct_file_handle" but that generated empty structs
// for mips64 and mips64le. Instead, hard code it for now (it's the
// same everywhere else) until the mips64 generator issue is fixed.
type fileHandle struct {
Bytes uint32
Type int32
}
/*
* Unimplemented
*/
@ -1606,7 +1763,6 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
// Shmdt
// Shmget
// Sigaltstack
// Signalfd
// Swapoff
// Swapon
// Sysfs

View file

@ -68,6 +68,7 @@ func Pipe2(p []int, flags int) (err error) {
//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 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 sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64
//sys Setfsgid(gid int) (err error) = SYS_SETFSGID32
//sys Setfsuid(uid int) (err error) = SYS_SETFSUID32

View file

@ -20,15 +20,30 @@ package unix
//sysnb Getgid() (gid int)
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
//sysnb Getuid() (uid int)
//sysnb InotifyInit() (fd int, err error)
//sysnb inotifyInit() (fd int, err error)
func InotifyInit() (fd int, err error) {
// First try inotify_init1, because Android's seccomp policy blocks the latter.
fd, err = InotifyInit1(0)
if err == ENOSYS {
fd, err = inotifyInit()
}
return
}
//sys Ioperm(from int, num int, on int) (err error)
//sys Iopl(level int) (err error)
//sys Lchown(path string, uid int, gid int) (err error)
//sys Listen(s int, n int) (err error)
//sys Lstat(path string, stat *Stat_t) (err error)
func Lstat(path string, stat *Stat_t) (err error) {
return Fstatat(AT_FDCWD, path, stat, AT_SYMLINK_NOFOLLOW)
}
//sys Pause() (err error)
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {

View file

@ -19,12 +19,18 @@ func setTimeval(sec, usec int64) Timeval {
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
// Try pipe2 first for Android O, then try pipe for kernel 2.6.23.
err = pipe2(&pp, 0)
if err == ENOSYS {
err = pipe(&pp)
}
p[0] = int(pp[0])
p[1] = int(pp[1])
return
@ -89,6 +95,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
//sys Listen(s int, n int) (err error)
//sys Lstat(path string, stat *Stat_t) (err error) = SYS_LSTAT64
//sys Pause() (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 Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT
//sys Setfsgid(gid int) (err error) = SYS_SETFSGID32
@ -257,3 +264,11 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
}
return poll(&fds[0], len(fds), timeout)
}
//sys armSyncFileRange(fd int, flags int, off int64, n int64) (err error) = SYS_ARM_SYNC_FILE_RANGE
func SyncFileRange(fd int, off int64, n int64, flags int) error {
// The sync_file_range and arm_sync_file_range syscalls differ only in the
// order of their arguments.
return armSyncFileRange(fd, flags, off, n)
}

View file

@ -30,6 +30,7 @@ func EpollCreate(size int) (fd int, err error) {
//sys Listen(s int, n int) (err error)
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {
@ -207,3 +208,16 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
}
return ppoll(&fds[0], len(fds), ts, nil)
}
//sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error)
func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error {
cmdlineLen := len(cmdline)
if cmdlineLen > 0 {
// Account for the additional NULL byte added by
// BytePtrFromString in kexecFileLoad. The kexec_file_load
// syscall expects a NULL-terminated string.
cmdlineLen++
}
return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags)
}

View file

@ -12,7 +12,6 @@ package unix
//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
//sys Fchown(fd int, uid int, gid int) (err error)
//sys Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) = SYS_NEWFSTATAT
//sys Fstatfs(fd int, buf *Statfs_t) (err error)
//sys Ftruncate(fd int, length int64) (err error)
//sysnb Getegid() (egid int)
@ -25,6 +24,7 @@ package unix
//sys Pause() (err error)
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {
@ -148,6 +148,7 @@ type stat_t struct {
}
//sys fstat(fd int, st *stat_t) (err error)
//sys fstatat(dirfd int, path string, st *stat_t, flags int) (err error) = SYS_NEWFSTATAT
//sys lstat(path string, st *stat_t) (err error)
//sys stat(path string, st *stat_t) (err error)
@ -158,6 +159,13 @@ func Fstat(fd int, s *Stat_t) (err error) {
return
}
func Fstatat(dirfd int, path string, s *Stat_t, flags int) (err error) {
st := &stat_t{}
err = fstatat(dirfd, path, st, flags)
fillStat_t(s, st)
return
}
func Lstat(path string, s *Stat_t) (err error) {
st := &stat_t{}
err = lstat(path, st)

View file

@ -28,6 +28,7 @@ func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr,
//sys Listen(s int, n int) (err error)
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) = SYS_SENDFILE64
//sys Setfsgid(gid int) (err error)

View file

@ -30,6 +30,7 @@ package unix
//sys Pause() (err error)
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS__NEWSELECT
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)

View file

@ -207,3 +207,20 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
}
return ppoll(&fds[0], len(fds), ts, nil)
}
func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) {
return Renameat2(olddirfd, oldpath, newdirfd, newpath, 0)
}
//sys kexecFileLoad(kernelFd int, initrdFd int, cmdlineLen int, cmdline string, flags int) (err error)
func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error {
cmdlineLen := len(cmdline)
if cmdlineLen > 0 {
// Account for the additional NULL byte added by
// BytePtrFromString in kexecFileLoad. The kexec_file_load
// syscall expects a NULL-terminated string.
cmdlineLen++
}
return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags)
}

View file

@ -30,6 +30,7 @@ import (
//sys Pause() (err error)
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)

View file

@ -26,6 +26,7 @@ package unix
//sys Pause() (err error)
//sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
//sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
//sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error)

View file

@ -244,6 +244,13 @@ func Uname(uname *Utsname) error {
return nil
}
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
if raceenabled {
raceReleaseMerge(unsafe.Pointer(&ioSync))
}
return sendfile(outfd, infd, offset, count)
}
/*
* Exposed directly
*/

33
vendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go generated vendored Normal file
View file

@ -0,0 +1,33 @@
// 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 arm64,netbsd
package unix
func setTimespec(sec, nsec int64) Timespec {
return Timespec{Sec: sec, Nsec: nsec}
}
func setTimeval(sec, usec int64) Timeval {
return Timeval{Sec: sec, Usec: int32(usec)}
}
func SetKevent(k *Kevent_t, fd, mode, flags int) {
k.Ident = uint64(fd)
k.Filter = uint32(mode)
k.Flags = uint32(flags)
}
func (iov *Iovec) SetLen(length int) {
iov.Len = uint64(length)
}
func (msghdr *Msghdr) SetControllen(length int) {
msghdr.Controllen = uint32(length)
}
func (cmsg *Cmsghdr) SetLen(length int) {
cmsg.Len = uint32(length)
}

View file

@ -43,6 +43,23 @@ func nametomib(name string) (mib []_C_int, err error) {
return nil, EINVAL
}
func SysctlClockinfo(name string) (*Clockinfo, error) {
mib, err := sysctlmib(name)
if err != nil {
return nil, err
}
n := uintptr(SizeofClockinfo)
var ci Clockinfo
if err := sysctl(mib, (*byte)(unsafe.Pointer(&ci)), &n, nil, 0); err != nil {
return nil, err
}
if n != SizeofClockinfo {
return nil, EIO
}
return &ci, nil
}
func SysctlUvmexp(name string) (*Uvmexp, error) {
mib, err := sysctlmib(name)
if err != nil {
@ -94,6 +111,13 @@ func Getwd() (string, error) {
return string(buf[:n]), nil
}
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
if raceenabled {
raceReleaseMerge(unsafe.Pointer(&ioSync))
}
return sendfile(outfd, infd, offset, count)
}
// TODO
func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
return -1, ENOSYS

View file

@ -585,6 +585,13 @@ func Poll(fds []PollFd, timeout int) (n int, err error) {
return poll(&fds[0], len(fds), timeout)
}
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
if raceenabled {
raceReleaseMerge(unsafe.Pointer(&ioSync))
}
return sendfile(outfd, infd, offset, count)
}
/*
* Exposed directly
*/

View file

@ -8,7 +8,6 @@ package unix
import (
"bytes"
"runtime"
"sort"
"sync"
"syscall"
@ -21,13 +20,6 @@ var (
Stderr = 2
)
const (
darwin64Bit = runtime.GOOS == "darwin" && SizeofPtr == 8
dragonfly64Bit = runtime.GOOS == "dragonfly" && SizeofPtr == 8
netbsd32Bit = runtime.GOOS == "netbsd" && SizeofPtr == 4
solaris64Bit = runtime.GOOS == "solaris" && SizeofPtr == 8
)
// Do the interface allocations only once for common
// Errno values.
var (
@ -36,6 +28,11 @@ var (
errENOENT error = syscall.ENOENT
)
var (
signalNameMapOnce sync.Once
signalNameMap map[string]syscall.Signal
)
// errnoErr returns common boxed Errno values, to prevent
// allocations at runtime.
func errnoErr(e syscall.Errno) error {
@ -74,6 +71,19 @@ func SignalName(s syscall.Signal) string {
return ""
}
// SignalNum returns the syscall.Signal for signal named s,
// or 0 if a signal with such name is not found.
// The signal name should start with "SIG".
func SignalNum(s string) syscall.Signal {
signalNameMapOnce.Do(func() {
signalNameMap = make(map[string]syscall.Signal)
for _, signal := range signalList {
signalNameMap[signal.name] = signal.num
}
})
return signalNameMap[s]
}
// clen returns the index of the first NULL byte in n or len(n) if n contains no NULL byte.
func clen(n []byte) int {
i := bytes.IndexByte(n, 0)
@ -284,6 +294,13 @@ func GetsockoptTimeval(fd, level, opt int) (*Timeval, error) {
return &tv, err
}
func GetsockoptUint64(fd, level, opt int) (value uint64, err error) {
var n uint64
vallen := _Socklen(8)
err = getsockopt(fd, level, opt, unsafe.Pointer(&n), &vallen)
return n, err
}
func Recvfrom(fd int, p []byte, flags int) (n int, from Sockaddr, err error) {
var rsa RawSockaddrAny
var len _Socklen = SizeofSockaddrAny
@ -334,13 +351,21 @@ func SetsockoptLinger(fd, level, opt int, l *Linger) (err error) {
}
func SetsockoptString(fd, level, opt int, s string) (err error) {
return setsockopt(fd, level, opt, unsafe.Pointer(&[]byte(s)[0]), uintptr(len(s)))
var p unsafe.Pointer
if len(s) > 0 {
p = unsafe.Pointer(&[]byte(s)[0])
}
return setsockopt(fd, level, opt, p, uintptr(len(s)))
}
func SetsockoptTimeval(fd, level, opt int, tv *Timeval) (err error) {
return setsockopt(fd, level, opt, unsafe.Pointer(tv), unsafe.Sizeof(*tv))
}
func SetsockoptUint64(fd, level, opt int, value uint64) (err error) {
return setsockopt(fd, level, opt, unsafe.Pointer(&value), 8)
}
func Socket(domain, typ, proto int) (fd int, err error) {
if domain == AF_INET6 && SocketDisableIPv6 {
return -1, EAFNOSUPPORT
@ -359,13 +384,6 @@ func Socketpair(domain, typ, proto int) (fd [2]int, err error) {
return
}
func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) {
if raceenabled {
raceReleaseMerge(unsafe.Pointer(&ioSync))
}
return sendfile(outfd, infd, offset, count)
}
var ioSync int64
func CloseOnExec(fd int) { fcntl(fd, F_SETFD, FD_CLOEXEC) }
@ -392,3 +410,22 @@ func SetNonblock(fd int, nonblocking bool) (err error) {
func Exec(argv0 string, argv []string, envv []string) error {
return syscall.Exec(argv0, argv, envv)
}
// Lutimes sets the access and modification times tv on path. If path refers to
// a symlink, it is not dereferenced and the timestamps are set on the symlink.
// If tv is nil, the access and modification times are set to the current time.
// Otherwise tv must contain exactly 2 elements, with access time as the first
// element and modification time as the second element.
func Lutimes(path string, tv []Timeval) error {
if tv == nil {
return UtimesNanoAt(AT_FDCWD, path, nil, AT_SYMLINK_NOFOLLOW)
}
if len(tv) != 2 {
return EINVAL
}
ts := []Timespec{
NsecToTimespec(TimevalToNsec(tv[0])),
NsecToTimespec(TimevalToNsec(tv[1])),
}
return UtimesNanoAt(AT_FDCWD, path, ts, AT_SYMLINK_NOFOLLOW)
}

View file

@ -275,3 +275,9 @@ const (
// uname
type Utsname C.struct_utsname
// Clockinfo
const SizeofClockinfo = C.sizeof_struct_clockinfo
type Clockinfo C.struct_clockinfo

View file

@ -274,3 +274,9 @@ type Utsname C.struct_utsname
const SizeofUvmexp = C.sizeof_struct_uvmexp
type Uvmexp C.struct_uvmexp
// Clockinfo
const SizeofClockinfo = C.sizeof_struct_clockinfo
type Clockinfo C.struct_clockinfo

View file

@ -926,6 +926,8 @@ const (
TCSETSF = 0x5404
TCSETSW = 0x5403
TCXONC = 0x540b
TIMER_ABSTIME = 0x3e7
TIMER_MAX = 0x20
TIOC = 0x5400
TIOCCBRK = 0x2000747a
TIOCCDTR = 0x20007478

View file

@ -3,7 +3,7 @@
// +build ppc64,aix
// Created by cgo -godefs - DO NOT EDIT
// Code generated by cmd/cgo -godefs; DO NOT EDIT.
// cgo -godefs -- -maix64 _const.go
package unix
@ -926,6 +926,8 @@ const (
TCSETSF = 0x5404
TCSETSW = 0x5403
TCXONC = 0x540b
TIMER_ABSTIME = 0x3e7
TIMER_MAX = 0x20
TIOC = 0x5400
TIOCCBRK = 0x2000747a
TIOCCDTR = 0x20007478

1794
vendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go generated vendored Normal file

File diff suppressed because it is too large Load diff

View file

@ -41,7 +41,7 @@ const (
AF_KEY = 0xf
AF_LLC = 0x1a
AF_LOCAL = 0x1
AF_MAX = 0x2c
AF_MAX = 0x2d
AF_MPLS = 0x1c
AF_NETBEUI = 0xd
AF_NETLINK = 0x10
@ -174,6 +174,7 @@ const (
B9600 = 0xd
BALLOON_KVM_MAGIC = 0x13661366
BDEVFS_MAGIC = 0x62646576
BINDERFS_SUPER_MAGIC = 0x6c6f6f70
BINFMTFS_MAGIC = 0x42494e4d
BLKBSZGET = 0x80041270
BLKBSZSET = 0x40041271
@ -486,6 +487,50 @@ const (
FALLOC_FL_PUNCH_HOLE = 0x2
FALLOC_FL_UNSHARE_RANGE = 0x40
FALLOC_FL_ZERO_RANGE = 0x10
FANOTIFY_METADATA_VERSION = 0x3
FAN_ACCESS = 0x1
FAN_ACCESS_PERM = 0x20000
FAN_ALLOW = 0x1
FAN_ALL_CLASS_BITS = 0xc
FAN_ALL_EVENTS = 0x3b
FAN_ALL_INIT_FLAGS = 0x3f
FAN_ALL_MARK_FLAGS = 0xff
FAN_ALL_OUTGOING_EVENTS = 0x3403b
FAN_ALL_PERM_EVENTS = 0x30000
FAN_AUDIT = 0x10
FAN_CLASS_CONTENT = 0x4
FAN_CLASS_NOTIF = 0x0
FAN_CLASS_PRE_CONTENT = 0x8
FAN_CLOEXEC = 0x1
FAN_CLOSE = 0x18
FAN_CLOSE_NOWRITE = 0x10
FAN_CLOSE_WRITE = 0x8
FAN_DENY = 0x2
FAN_ENABLE_AUDIT = 0x40
FAN_EVENT_METADATA_LEN = 0x18
FAN_EVENT_ON_CHILD = 0x8000000
FAN_MARK_ADD = 0x1
FAN_MARK_DONT_FOLLOW = 0x4
FAN_MARK_FILESYSTEM = 0x100
FAN_MARK_FLUSH = 0x80
FAN_MARK_IGNORED_MASK = 0x20
FAN_MARK_IGNORED_SURV_MODIFY = 0x40
FAN_MARK_INODE = 0x0
FAN_MARK_MOUNT = 0x10
FAN_MARK_ONLYDIR = 0x8
FAN_MARK_REMOVE = 0x2
FAN_MODIFY = 0x2
FAN_NOFD = -0x1
FAN_NONBLOCK = 0x2
FAN_ONDIR = 0x40000000
FAN_OPEN = 0x20
FAN_OPEN_EXEC = 0x1000
FAN_OPEN_EXEC_PERM = 0x40000
FAN_OPEN_PERM = 0x10000
FAN_Q_OVERFLOW = 0x4000
FAN_REPORT_TID = 0x100
FAN_UNLIMITED_MARKS = 0x20
FAN_UNLIMITED_QUEUE = 0x10
FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400
FF0 = 0x0
@ -493,6 +538,7 @@ const (
FFDLY = 0x8000
FLUSHO = 0x1000
FP_XSTATE_MAGIC2 = 0x46505845
FS_ENCRYPTION_MODE_ADIANTUM = 0x9
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
@ -514,7 +560,7 @@ const (
FS_POLICY_FLAGS_PAD_4 = 0x0
FS_POLICY_FLAGS_PAD_8 = 0x1
FS_POLICY_FLAGS_PAD_MASK = 0x3
FS_POLICY_FLAGS_VALID = 0x3
FS_POLICY_FLAGS_VALID = 0x7
FUTEXFS_SUPER_MAGIC = 0xbad1dea
F_ADD_SEALS = 0x409
F_DUPFD = 0x0
@ -639,7 +685,7 @@ const (
IFA_F_STABLE_PRIVACY = 0x800
IFA_F_TEMPORARY = 0x1
IFA_F_TENTATIVE = 0x40
IFA_MAX = 0x9
IFA_MAX = 0xa
IFF_ALLMULTI = 0x200
IFF_ATTACH_QUEUE = 0x200
IFF_AUTOMEDIA = 0x4000
@ -707,6 +753,7 @@ const (
IN_ISDIR = 0x40000000
IN_LOOPBACKNET = 0x7f
IN_MASK_ADD = 0x20000000
IN_MASK_CREATE = 0x10000000
IN_MODIFY = 0x2
IN_MOVE = 0xc0
IN_MOVED_FROM = 0x40
@ -778,6 +825,7 @@ const (
IPV6_MINHOPCOUNT = 0x49
IPV6_MTU = 0x18
IPV6_MTU_DISCOVER = 0x17
IPV6_MULTICAST_ALL = 0x1d
IPV6_MULTICAST_HOPS = 0x12
IPV6_MULTICAST_IF = 0x11
IPV6_MULTICAST_LOOP = 0x13
@ -913,6 +961,11 @@ const (
KEYCTL_JOIN_SESSION_KEYRING = 0x1
KEYCTL_LINK = 0x8
KEYCTL_NEGATE = 0xd
KEYCTL_PKEY_DECRYPT = 0x1a
KEYCTL_PKEY_ENCRYPT = 0x19
KEYCTL_PKEY_QUERY = 0x18
KEYCTL_PKEY_SIGN = 0x1b
KEYCTL_PKEY_VERIFY = 0x1c
KEYCTL_READ = 0xb
KEYCTL_REJECT = 0x13
KEYCTL_RESTRICT_KEYRING = 0x1d
@ -922,6 +975,10 @@ const (
KEYCTL_SETPERM = 0x5
KEYCTL_SET_REQKEY_KEYRING = 0xe
KEYCTL_SET_TIMEOUT = 0xf
KEYCTL_SUPPORTS_DECRYPT = 0x2
KEYCTL_SUPPORTS_ENCRYPT = 0x1
KEYCTL_SUPPORTS_SIGN = 0x4
KEYCTL_SUPPORTS_VERIFY = 0x8
KEYCTL_UNLINK = 0x9
KEYCTL_UPDATE = 0x2
KEY_REQKEY_DEFL_DEFAULT = 0x0
@ -1101,6 +1158,7 @@ const (
NETLINK_FIB_LOOKUP = 0xa
NETLINK_FIREWALL = 0x3
NETLINK_GENERIC = 0x10
NETLINK_GET_STRICT_CHK = 0xc
NETLINK_INET_DIAG = 0x4
NETLINK_IP6_FW = 0xd
NETLINK_ISCSI = 0x8
@ -1122,7 +1180,7 @@ const (
NETLINK_UNUSED = 0x1
NETLINK_USERSOCK = 0x2
NETLINK_XFRM = 0x6
NETNSA_MAX = 0x3
NETNSA_MAX = 0x5
NETNSA_NSID_NOT_ASSIGNED = -0x1
NFNETLINK_V0 = 0x0
NFNLGRP_ACCT_QUOTA = 0x8
@ -1244,6 +1302,7 @@ const (
PACKET_FASTROUTE = 0x6
PACKET_HDRLEN = 0xb
PACKET_HOST = 0x0
PACKET_IGNORE_OUTGOING = 0x17
PACKET_KERNEL = 0x7
PACKET_LOOPBACK = 0x5
PACKET_LOSS = 0xe
@ -1293,6 +1352,36 @@ const (
PERF_EVENT_IOC_SET_FILTER = 0x40042406
PERF_EVENT_IOC_SET_OUTPUT = 0x2405
PIPEFS_MAGIC = 0x50495045
PPPIOCATTACH = 0x4004743d
PPPIOCATTCHAN = 0x40047438
PPPIOCCONNECT = 0x4004743a
PPPIOCDETACH = 0x4004743c
PPPIOCDISCONN = 0x7439
PPPIOCGASYNCMAP = 0x80047458
PPPIOCGCHAN = 0x80047437
PPPIOCGDEBUG = 0x80047441
PPPIOCGFLAGS = 0x8004745a
PPPIOCGIDLE = 0x8008743f
PPPIOCGL2TPSTATS = 0x80487436
PPPIOCGMRU = 0x80047453
PPPIOCGNPMODE = 0xc008744c
PPPIOCGRASYNCMAP = 0x80047455
PPPIOCGUNIT = 0x80047456
PPPIOCGXASYNCMAP = 0x80207450
PPPIOCNEWUNIT = 0xc004743e
PPPIOCSACTIVE = 0x40087446
PPPIOCSASYNCMAP = 0x40047457
PPPIOCSCOMPRESS = 0x400c744d
PPPIOCSDEBUG = 0x40047440
PPPIOCSFLAGS = 0x40047459
PPPIOCSMAXCID = 0x40047451
PPPIOCSMRRU = 0x4004743b
PPPIOCSMRU = 0x40047452
PPPIOCSNPMODE = 0x4008744b
PPPIOCSPASS = 0x40087447
PPPIOCSRASYNCMAP = 0x40047454
PPPIOCSXASYNCMAP = 0x4020744f
PPPIOCXFERUNIT = 0x744e
PRIO_PGRP = 0x1
PRIO_PROCESS = 0x0
PRIO_USER = 0x2
@ -1355,6 +1444,12 @@ const (
PR_MCE_KILL_SET = 0x1
PR_MPX_DISABLE_MANAGEMENT = 0x2c
PR_MPX_ENABLE_MANAGEMENT = 0x2b
PR_PAC_APDAKEY = 0x4
PR_PAC_APDBKEY = 0x8
PR_PAC_APGAKEY = 0x10
PR_PAC_APIAKEY = 0x1
PR_PAC_APIBKEY = 0x2
PR_PAC_RESET_KEYS = 0x36
PR_SET_CHILD_SUBREAPER = 0x24
PR_SET_DUMPABLE = 0x4
PR_SET_ENDIAN = 0x14
@ -1394,6 +1489,7 @@ const (
PR_SPEC_DISABLE = 0x4
PR_SPEC_ENABLE = 0x2
PR_SPEC_FORCE_DISABLE = 0x8
PR_SPEC_INDIRECT_BRANCH = 0x1
PR_SPEC_NOT_AFFECTED = 0x0
PR_SPEC_PRCTL = 0x1
PR_SPEC_STORE_BYPASS = 0x0
@ -1495,6 +1591,13 @@ const (
RLIMIT_SIGPENDING = 0xb
RLIMIT_STACK = 0x3
RLIM_INFINITY = 0xffffffffffffffff
RNDADDENTROPY = 0x40085203
RNDADDTOENTCNT = 0x40045201
RNDCLEARPOOL = 0x5206
RNDGETENTCNT = 0x80045200
RNDGETPOOL = 0x80085202
RNDRESEEDCRNG = 0x5207
RNDZAPENTCNT = 0x5204
RTAX_ADVMSS = 0x8
RTAX_CC_ALGO = 0x10
RTAX_CWND = 0x7
@ -1696,11 +1799,14 @@ const (
SCM_TIMESTAMPNS = 0x23
SCM_TXTIME = 0x3d
SCM_WIFI_STATUS = 0x29
SC_LOG_FLUSH = 0x100000
SECCOMP_MODE_DISABLED = 0x0
SECCOMP_MODE_FILTER = 0x2
SECCOMP_MODE_STRICT = 0x1
SECURITYFS_MAGIC = 0x73636673
SELINUX_MAGIC = 0xf97cff8c
SFD_CLOEXEC = 0x80000
SFD_NONBLOCK = 0x800
SHUT_RD = 0x0
SHUT_RDWR = 0x2
SHUT_WR = 0x1
@ -1751,6 +1857,9 @@ const (
SIOCGMIIPHY = 0x8947
SIOCGMIIREG = 0x8948
SIOCGPGRP = 0x8904
SIOCGPPPCSTATS = 0x89f2
SIOCGPPPSTATS = 0x89f0
SIOCGPPPVER = 0x89f1
SIOCGRARP = 0x8961
SIOCGSKNS = 0x894c
SIOCGSTAMP = 0x8906
@ -1859,6 +1968,17 @@ const (
SO_DETACH_FILTER = 0x1b
SO_DOMAIN = 0x27
SO_DONTROUTE = 0x5
SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1
SO_EE_CODE_TXTIME_MISSED = 0x2
SO_EE_CODE_ZEROCOPY_COPIED = 0x1
SO_EE_ORIGIN_ICMP = 0x2
SO_EE_ORIGIN_ICMP6 = 0x3
SO_EE_ORIGIN_LOCAL = 0x1
SO_EE_ORIGIN_NONE = 0x0
SO_EE_ORIGIN_TIMESTAMPING = 0x4
SO_EE_ORIGIN_TXSTATUS = 0x4
SO_EE_ORIGIN_TXTIME = 0x6
SO_EE_ORIGIN_ZEROCOPY = 0x5
SO_ERROR = 0x4
SO_GET_FILTER = 0x1a
SO_INCOMING_CPU = 0x31
@ -1978,7 +2098,7 @@ const (
TASKSTATS_GENL_NAME = "TASKSTATS"
TASKSTATS_GENL_VERSION = 0x1
TASKSTATS_TYPE_MAX = 0x6
TASKSTATS_VERSION = 0x8
TASKSTATS_VERSION = 0x9
TCFLSH = 0x540b
TCGETA = 0x5405
TCGETS = 0x5401
@ -1992,6 +2112,7 @@ const (
TCOOFF = 0x0
TCOON = 0x1
TCP_CC_INFO = 0x1a
TCP_CM_INQ = 0x24
TCP_CONGESTION = 0xd
TCP_COOKIE_IN_ALWAYS = 0x1
TCP_COOKIE_MAX = 0x10
@ -2006,6 +2127,7 @@ const (
TCP_FASTOPEN_KEY = 0x21
TCP_FASTOPEN_NO_COOKIE = 0x22
TCP_INFO = 0xb
TCP_INQ = 0x24
TCP_KEEPCNT = 0x6
TCP_KEEPIDLE = 0x4
TCP_KEEPINTVL = 0x5
@ -2025,6 +2147,9 @@ const (
TCP_QUEUE_SEQ = 0x15
TCP_QUICKACK = 0xc
TCP_REPAIR = 0x13
TCP_REPAIR_OFF = 0x0
TCP_REPAIR_OFF_NO_WP = -0x1
TCP_REPAIR_ON = 0x1
TCP_REPAIR_OPTIONS = 0x16
TCP_REPAIR_QUEUE = 0x14
TCP_REPAIR_WINDOW = 0x1d
@ -2039,6 +2164,7 @@ const (
TCP_ULP = 0x1f
TCP_USER_TIMEOUT = 0x12
TCP_WINDOW_CLAMP = 0xa
TCP_ZEROCOPY_RECEIVE = 0x23
TCSAFLUSH = 0x2
TCSBRK = 0x5409
TCSBRKP = 0x5425
@ -2055,6 +2181,7 @@ const (
TCSETXF = 0x5434
TCSETXW = 0x5435
TCXONC = 0x540a
TIMER_ABSTIME = 0x1
TIOCCBRK = 0x5428
TIOCCONS = 0x541d
TIOCEXCL = 0x540c
@ -2062,6 +2189,7 @@ const (
TIOCGETD = 0x5424
TIOCGEXCL = 0x80045440
TIOCGICOUNT = 0x545d
TIOCGISO7816 = 0x80285442
TIOCGLCKTRMIOS = 0x5456
TIOCGPGRP = 0x540f
TIOCGPKT = 0x80045438
@ -2115,6 +2243,7 @@ const (
TIOCSER_TEMT = 0x1
TIOCSETD = 0x5423
TIOCSIG = 0x40045436
TIOCSISO7816 = 0xc0285443
TIOCSLCKTRMIOS = 0x5457
TIOCSPGRP = 0x5410
TIOCSPTLCK = 0x40045431
@ -2155,6 +2284,7 @@ const (
TUNGETVNETBE = 0x800454df
TUNGETVNETHDRSZ = 0x800454d7
TUNGETVNETLE = 0x800454dd
TUNSETCARRIER = 0x400454e2
TUNSETDEBUG = 0x400454c9
TUNSETFILTEREBPF = 0x800454e1
TUNSETGROUP = 0x400454ce
@ -2345,6 +2475,7 @@ const (
XDP_UMEM_REG = 0x4
XDP_ZEROCOPY = 0x4
XENFS_SUPER_MAGIC = 0xabba1974
XFS_SUPER_MAGIC = 0x58465342
XTABS = 0x1800
ZSMALLOC_MAGIC = 0x58295829
)

View file

@ -41,7 +41,7 @@ const (
AF_KEY = 0xf
AF_LLC = 0x1a
AF_LOCAL = 0x1
AF_MAX = 0x2c
AF_MAX = 0x2d
AF_MPLS = 0x1c
AF_NETBEUI = 0xd
AF_NETLINK = 0x10
@ -174,6 +174,7 @@ const (
B9600 = 0xd
BALLOON_KVM_MAGIC = 0x13661366
BDEVFS_MAGIC = 0x62646576
BINDERFS_SUPER_MAGIC = 0x6c6f6f70
BINFMTFS_MAGIC = 0x42494e4d
BLKBSZGET = 0x80081270
BLKBSZSET = 0x40081271
@ -486,6 +487,50 @@ const (
FALLOC_FL_PUNCH_HOLE = 0x2
FALLOC_FL_UNSHARE_RANGE = 0x40
FALLOC_FL_ZERO_RANGE = 0x10
FANOTIFY_METADATA_VERSION = 0x3
FAN_ACCESS = 0x1
FAN_ACCESS_PERM = 0x20000
FAN_ALLOW = 0x1
FAN_ALL_CLASS_BITS = 0xc
FAN_ALL_EVENTS = 0x3b
FAN_ALL_INIT_FLAGS = 0x3f
FAN_ALL_MARK_FLAGS = 0xff
FAN_ALL_OUTGOING_EVENTS = 0x3403b
FAN_ALL_PERM_EVENTS = 0x30000
FAN_AUDIT = 0x10
FAN_CLASS_CONTENT = 0x4
FAN_CLASS_NOTIF = 0x0
FAN_CLASS_PRE_CONTENT = 0x8
FAN_CLOEXEC = 0x1
FAN_CLOSE = 0x18
FAN_CLOSE_NOWRITE = 0x10
FAN_CLOSE_WRITE = 0x8
FAN_DENY = 0x2
FAN_ENABLE_AUDIT = 0x40
FAN_EVENT_METADATA_LEN = 0x18
FAN_EVENT_ON_CHILD = 0x8000000
FAN_MARK_ADD = 0x1
FAN_MARK_DONT_FOLLOW = 0x4
FAN_MARK_FILESYSTEM = 0x100
FAN_MARK_FLUSH = 0x80
FAN_MARK_IGNORED_MASK = 0x20
FAN_MARK_IGNORED_SURV_MODIFY = 0x40
FAN_MARK_INODE = 0x0
FAN_MARK_MOUNT = 0x10
FAN_MARK_ONLYDIR = 0x8
FAN_MARK_REMOVE = 0x2
FAN_MODIFY = 0x2
FAN_NOFD = -0x1
FAN_NONBLOCK = 0x2
FAN_ONDIR = 0x40000000
FAN_OPEN = 0x20
FAN_OPEN_EXEC = 0x1000
FAN_OPEN_EXEC_PERM = 0x40000
FAN_OPEN_PERM = 0x10000
FAN_Q_OVERFLOW = 0x4000
FAN_REPORT_TID = 0x100
FAN_UNLIMITED_MARKS = 0x20
FAN_UNLIMITED_QUEUE = 0x10
FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400
FF0 = 0x0
@ -493,6 +538,7 @@ const (
FFDLY = 0x8000
FLUSHO = 0x1000
FP_XSTATE_MAGIC2 = 0x46505845
FS_ENCRYPTION_MODE_ADIANTUM = 0x9
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
@ -514,7 +560,7 @@ const (
FS_POLICY_FLAGS_PAD_4 = 0x0
FS_POLICY_FLAGS_PAD_8 = 0x1
FS_POLICY_FLAGS_PAD_MASK = 0x3
FS_POLICY_FLAGS_VALID = 0x3
FS_POLICY_FLAGS_VALID = 0x7
FUTEXFS_SUPER_MAGIC = 0xbad1dea
F_ADD_SEALS = 0x409
F_DUPFD = 0x0
@ -639,7 +685,7 @@ const (
IFA_F_STABLE_PRIVACY = 0x800
IFA_F_TEMPORARY = 0x1
IFA_F_TENTATIVE = 0x40
IFA_MAX = 0x9
IFA_MAX = 0xa
IFF_ALLMULTI = 0x200
IFF_ATTACH_QUEUE = 0x200
IFF_AUTOMEDIA = 0x4000
@ -707,6 +753,7 @@ const (
IN_ISDIR = 0x40000000
IN_LOOPBACKNET = 0x7f
IN_MASK_ADD = 0x20000000
IN_MASK_CREATE = 0x10000000
IN_MODIFY = 0x2
IN_MOVE = 0xc0
IN_MOVED_FROM = 0x40
@ -778,6 +825,7 @@ const (
IPV6_MINHOPCOUNT = 0x49
IPV6_MTU = 0x18
IPV6_MTU_DISCOVER = 0x17
IPV6_MULTICAST_ALL = 0x1d
IPV6_MULTICAST_HOPS = 0x12
IPV6_MULTICAST_IF = 0x11
IPV6_MULTICAST_LOOP = 0x13
@ -913,6 +961,11 @@ const (
KEYCTL_JOIN_SESSION_KEYRING = 0x1
KEYCTL_LINK = 0x8
KEYCTL_NEGATE = 0xd
KEYCTL_PKEY_DECRYPT = 0x1a
KEYCTL_PKEY_ENCRYPT = 0x19
KEYCTL_PKEY_QUERY = 0x18
KEYCTL_PKEY_SIGN = 0x1b
KEYCTL_PKEY_VERIFY = 0x1c
KEYCTL_READ = 0xb
KEYCTL_REJECT = 0x13
KEYCTL_RESTRICT_KEYRING = 0x1d
@ -922,6 +975,10 @@ const (
KEYCTL_SETPERM = 0x5
KEYCTL_SET_REQKEY_KEYRING = 0xe
KEYCTL_SET_TIMEOUT = 0xf
KEYCTL_SUPPORTS_DECRYPT = 0x2
KEYCTL_SUPPORTS_ENCRYPT = 0x1
KEYCTL_SUPPORTS_SIGN = 0x4
KEYCTL_SUPPORTS_VERIFY = 0x8
KEYCTL_UNLINK = 0x9
KEYCTL_UPDATE = 0x2
KEY_REQKEY_DEFL_DEFAULT = 0x0
@ -1101,6 +1158,7 @@ const (
NETLINK_FIB_LOOKUP = 0xa
NETLINK_FIREWALL = 0x3
NETLINK_GENERIC = 0x10
NETLINK_GET_STRICT_CHK = 0xc
NETLINK_INET_DIAG = 0x4
NETLINK_IP6_FW = 0xd
NETLINK_ISCSI = 0x8
@ -1122,7 +1180,7 @@ const (
NETLINK_UNUSED = 0x1
NETLINK_USERSOCK = 0x2
NETLINK_XFRM = 0x6
NETNSA_MAX = 0x3
NETNSA_MAX = 0x5
NETNSA_NSID_NOT_ASSIGNED = -0x1
NFNETLINK_V0 = 0x0
NFNLGRP_ACCT_QUOTA = 0x8
@ -1244,6 +1302,7 @@ const (
PACKET_FASTROUTE = 0x6
PACKET_HDRLEN = 0xb
PACKET_HOST = 0x0
PACKET_IGNORE_OUTGOING = 0x17
PACKET_KERNEL = 0x7
PACKET_LOOPBACK = 0x5
PACKET_LOSS = 0xe
@ -1293,6 +1352,36 @@ const (
PERF_EVENT_IOC_SET_FILTER = 0x40082406
PERF_EVENT_IOC_SET_OUTPUT = 0x2405
PIPEFS_MAGIC = 0x50495045
PPPIOCATTACH = 0x4004743d
PPPIOCATTCHAN = 0x40047438
PPPIOCCONNECT = 0x4004743a
PPPIOCDETACH = 0x4004743c
PPPIOCDISCONN = 0x7439
PPPIOCGASYNCMAP = 0x80047458
PPPIOCGCHAN = 0x80047437
PPPIOCGDEBUG = 0x80047441
PPPIOCGFLAGS = 0x8004745a
PPPIOCGIDLE = 0x8010743f
PPPIOCGL2TPSTATS = 0x80487436
PPPIOCGMRU = 0x80047453
PPPIOCGNPMODE = 0xc008744c
PPPIOCGRASYNCMAP = 0x80047455
PPPIOCGUNIT = 0x80047456
PPPIOCGXASYNCMAP = 0x80207450
PPPIOCNEWUNIT = 0xc004743e
PPPIOCSACTIVE = 0x40107446
PPPIOCSASYNCMAP = 0x40047457
PPPIOCSCOMPRESS = 0x4010744d
PPPIOCSDEBUG = 0x40047440
PPPIOCSFLAGS = 0x40047459
PPPIOCSMAXCID = 0x40047451
PPPIOCSMRRU = 0x4004743b
PPPIOCSMRU = 0x40047452
PPPIOCSNPMODE = 0x4008744b
PPPIOCSPASS = 0x40107447
PPPIOCSRASYNCMAP = 0x40047454
PPPIOCSXASYNCMAP = 0x4020744f
PPPIOCXFERUNIT = 0x744e
PRIO_PGRP = 0x1
PRIO_PROCESS = 0x0
PRIO_USER = 0x2
@ -1355,6 +1444,12 @@ const (
PR_MCE_KILL_SET = 0x1
PR_MPX_DISABLE_MANAGEMENT = 0x2c
PR_MPX_ENABLE_MANAGEMENT = 0x2b
PR_PAC_APDAKEY = 0x4
PR_PAC_APDBKEY = 0x8
PR_PAC_APGAKEY = 0x10
PR_PAC_APIAKEY = 0x1
PR_PAC_APIBKEY = 0x2
PR_PAC_RESET_KEYS = 0x36
PR_SET_CHILD_SUBREAPER = 0x24
PR_SET_DUMPABLE = 0x4
PR_SET_ENDIAN = 0x14
@ -1394,6 +1489,7 @@ const (
PR_SPEC_DISABLE = 0x4
PR_SPEC_ENABLE = 0x2
PR_SPEC_FORCE_DISABLE = 0x8
PR_SPEC_INDIRECT_BRANCH = 0x1
PR_SPEC_NOT_AFFECTED = 0x0
PR_SPEC_PRCTL = 0x1
PR_SPEC_STORE_BYPASS = 0x0
@ -1496,6 +1592,13 @@ const (
RLIMIT_SIGPENDING = 0xb
RLIMIT_STACK = 0x3
RLIM_INFINITY = 0xffffffffffffffff
RNDADDENTROPY = 0x40085203
RNDADDTOENTCNT = 0x40045201
RNDCLEARPOOL = 0x5206
RNDGETENTCNT = 0x80045200
RNDGETPOOL = 0x80085202
RNDRESEEDCRNG = 0x5207
RNDZAPENTCNT = 0x5204
RTAX_ADVMSS = 0x8
RTAX_CC_ALGO = 0x10
RTAX_CWND = 0x7
@ -1697,11 +1800,14 @@ const (
SCM_TIMESTAMPNS = 0x23
SCM_TXTIME = 0x3d
SCM_WIFI_STATUS = 0x29
SC_LOG_FLUSH = 0x100000
SECCOMP_MODE_DISABLED = 0x0
SECCOMP_MODE_FILTER = 0x2
SECCOMP_MODE_STRICT = 0x1
SECURITYFS_MAGIC = 0x73636673
SELINUX_MAGIC = 0xf97cff8c
SFD_CLOEXEC = 0x80000
SFD_NONBLOCK = 0x800
SHUT_RD = 0x0
SHUT_RDWR = 0x2
SHUT_WR = 0x1
@ -1752,6 +1858,9 @@ const (
SIOCGMIIPHY = 0x8947
SIOCGMIIREG = 0x8948
SIOCGPGRP = 0x8904
SIOCGPPPCSTATS = 0x89f2
SIOCGPPPSTATS = 0x89f0
SIOCGPPPVER = 0x89f1
SIOCGRARP = 0x8961
SIOCGSKNS = 0x894c
SIOCGSTAMP = 0x8906
@ -1860,6 +1969,17 @@ const (
SO_DETACH_FILTER = 0x1b
SO_DOMAIN = 0x27
SO_DONTROUTE = 0x5
SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1
SO_EE_CODE_TXTIME_MISSED = 0x2
SO_EE_CODE_ZEROCOPY_COPIED = 0x1
SO_EE_ORIGIN_ICMP = 0x2
SO_EE_ORIGIN_ICMP6 = 0x3
SO_EE_ORIGIN_LOCAL = 0x1
SO_EE_ORIGIN_NONE = 0x0
SO_EE_ORIGIN_TIMESTAMPING = 0x4
SO_EE_ORIGIN_TXSTATUS = 0x4
SO_EE_ORIGIN_TXTIME = 0x6
SO_EE_ORIGIN_ZEROCOPY = 0x5
SO_ERROR = 0x4
SO_GET_FILTER = 0x1a
SO_INCOMING_CPU = 0x31
@ -1979,7 +2099,7 @@ const (
TASKSTATS_GENL_NAME = "TASKSTATS"
TASKSTATS_GENL_VERSION = 0x1
TASKSTATS_TYPE_MAX = 0x6
TASKSTATS_VERSION = 0x8
TASKSTATS_VERSION = 0x9
TCFLSH = 0x540b
TCGETA = 0x5405
TCGETS = 0x5401
@ -1993,6 +2113,7 @@ const (
TCOOFF = 0x0
TCOON = 0x1
TCP_CC_INFO = 0x1a
TCP_CM_INQ = 0x24
TCP_CONGESTION = 0xd
TCP_COOKIE_IN_ALWAYS = 0x1
TCP_COOKIE_MAX = 0x10
@ -2007,6 +2128,7 @@ const (
TCP_FASTOPEN_KEY = 0x21
TCP_FASTOPEN_NO_COOKIE = 0x22
TCP_INFO = 0xb
TCP_INQ = 0x24
TCP_KEEPCNT = 0x6
TCP_KEEPIDLE = 0x4
TCP_KEEPINTVL = 0x5
@ -2026,6 +2148,9 @@ const (
TCP_QUEUE_SEQ = 0x15
TCP_QUICKACK = 0xc
TCP_REPAIR = 0x13
TCP_REPAIR_OFF = 0x0
TCP_REPAIR_OFF_NO_WP = -0x1
TCP_REPAIR_ON = 0x1
TCP_REPAIR_OPTIONS = 0x16
TCP_REPAIR_QUEUE = 0x14
TCP_REPAIR_WINDOW = 0x1d
@ -2040,6 +2165,7 @@ const (
TCP_ULP = 0x1f
TCP_USER_TIMEOUT = 0x12
TCP_WINDOW_CLAMP = 0xa
TCP_ZEROCOPY_RECEIVE = 0x23
TCSAFLUSH = 0x2
TCSBRK = 0x5409
TCSBRKP = 0x5425
@ -2056,6 +2182,7 @@ const (
TCSETXF = 0x5434
TCSETXW = 0x5435
TCXONC = 0x540a
TIMER_ABSTIME = 0x1
TIOCCBRK = 0x5428
TIOCCONS = 0x541d
TIOCEXCL = 0x540c
@ -2063,6 +2190,7 @@ const (
TIOCGETD = 0x5424
TIOCGEXCL = 0x80045440
TIOCGICOUNT = 0x545d
TIOCGISO7816 = 0x80285442
TIOCGLCKTRMIOS = 0x5456
TIOCGPGRP = 0x540f
TIOCGPKT = 0x80045438
@ -2116,6 +2244,7 @@ const (
TIOCSER_TEMT = 0x1
TIOCSETD = 0x5423
TIOCSIG = 0x40045436
TIOCSISO7816 = 0xc0285443
TIOCSLCKTRMIOS = 0x5457
TIOCSPGRP = 0x5410
TIOCSPTLCK = 0x40045431
@ -2156,6 +2285,7 @@ const (
TUNGETVNETBE = 0x800454df
TUNGETVNETHDRSZ = 0x800454d7
TUNGETVNETLE = 0x800454dd
TUNSETCARRIER = 0x400454e2
TUNSETDEBUG = 0x400454c9
TUNSETFILTEREBPF = 0x800454e1
TUNSETGROUP = 0x400454ce
@ -2345,6 +2475,7 @@ const (
XDP_UMEM_REG = 0x4
XDP_ZEROCOPY = 0x4
XENFS_SUPER_MAGIC = 0xabba1974
XFS_SUPER_MAGIC = 0x58465342
XTABS = 0x1800
ZSMALLOC_MAGIC = 0x58295829
)

View file

@ -41,7 +41,7 @@ const (
AF_KEY = 0xf
AF_LLC = 0x1a
AF_LOCAL = 0x1
AF_MAX = 0x2c
AF_MAX = 0x2d
AF_MPLS = 0x1c
AF_NETBEUI = 0xd
AF_NETLINK = 0x10
@ -174,6 +174,7 @@ const (
B9600 = 0xd
BALLOON_KVM_MAGIC = 0x13661366
BDEVFS_MAGIC = 0x62646576
BINDERFS_SUPER_MAGIC = 0x6c6f6f70
BINFMTFS_MAGIC = 0x42494e4d
BLKBSZGET = 0x80041270
BLKBSZSET = 0x40041271
@ -486,12 +487,57 @@ const (
FALLOC_FL_PUNCH_HOLE = 0x2
FALLOC_FL_UNSHARE_RANGE = 0x40
FALLOC_FL_ZERO_RANGE = 0x10
FANOTIFY_METADATA_VERSION = 0x3
FAN_ACCESS = 0x1
FAN_ACCESS_PERM = 0x20000
FAN_ALLOW = 0x1
FAN_ALL_CLASS_BITS = 0xc
FAN_ALL_EVENTS = 0x3b
FAN_ALL_INIT_FLAGS = 0x3f
FAN_ALL_MARK_FLAGS = 0xff
FAN_ALL_OUTGOING_EVENTS = 0x3403b
FAN_ALL_PERM_EVENTS = 0x30000
FAN_AUDIT = 0x10
FAN_CLASS_CONTENT = 0x4
FAN_CLASS_NOTIF = 0x0
FAN_CLASS_PRE_CONTENT = 0x8
FAN_CLOEXEC = 0x1
FAN_CLOSE = 0x18
FAN_CLOSE_NOWRITE = 0x10
FAN_CLOSE_WRITE = 0x8
FAN_DENY = 0x2
FAN_ENABLE_AUDIT = 0x40
FAN_EVENT_METADATA_LEN = 0x18
FAN_EVENT_ON_CHILD = 0x8000000
FAN_MARK_ADD = 0x1
FAN_MARK_DONT_FOLLOW = 0x4
FAN_MARK_FILESYSTEM = 0x100
FAN_MARK_FLUSH = 0x80
FAN_MARK_IGNORED_MASK = 0x20
FAN_MARK_IGNORED_SURV_MODIFY = 0x40
FAN_MARK_INODE = 0x0
FAN_MARK_MOUNT = 0x10
FAN_MARK_ONLYDIR = 0x8
FAN_MARK_REMOVE = 0x2
FAN_MODIFY = 0x2
FAN_NOFD = -0x1
FAN_NONBLOCK = 0x2
FAN_ONDIR = 0x40000000
FAN_OPEN = 0x20
FAN_OPEN_EXEC = 0x1000
FAN_OPEN_EXEC_PERM = 0x40000
FAN_OPEN_PERM = 0x10000
FAN_Q_OVERFLOW = 0x4000
FAN_REPORT_TID = 0x100
FAN_UNLIMITED_MARKS = 0x20
FAN_UNLIMITED_QUEUE = 0x10
FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400
FF0 = 0x0
FF1 = 0x8000
FFDLY = 0x8000
FLUSHO = 0x1000
FS_ENCRYPTION_MODE_ADIANTUM = 0x9
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
@ -513,7 +559,7 @@ const (
FS_POLICY_FLAGS_PAD_4 = 0x0
FS_POLICY_FLAGS_PAD_8 = 0x1
FS_POLICY_FLAGS_PAD_MASK = 0x3
FS_POLICY_FLAGS_VALID = 0x3
FS_POLICY_FLAGS_VALID = 0x7
FUTEXFS_SUPER_MAGIC = 0xbad1dea
F_ADD_SEALS = 0x409
F_DUPFD = 0x0
@ -638,7 +684,7 @@ const (
IFA_F_STABLE_PRIVACY = 0x800
IFA_F_TEMPORARY = 0x1
IFA_F_TENTATIVE = 0x40
IFA_MAX = 0x9
IFA_MAX = 0xa
IFF_ALLMULTI = 0x200
IFF_ATTACH_QUEUE = 0x200
IFF_AUTOMEDIA = 0x4000
@ -706,6 +752,7 @@ const (
IN_ISDIR = 0x40000000
IN_LOOPBACKNET = 0x7f
IN_MASK_ADD = 0x20000000
IN_MASK_CREATE = 0x10000000
IN_MODIFY = 0x2
IN_MOVE = 0xc0
IN_MOVED_FROM = 0x40
@ -777,6 +824,7 @@ const (
IPV6_MINHOPCOUNT = 0x49
IPV6_MTU = 0x18
IPV6_MTU_DISCOVER = 0x17
IPV6_MULTICAST_ALL = 0x1d
IPV6_MULTICAST_HOPS = 0x12
IPV6_MULTICAST_IF = 0x11
IPV6_MULTICAST_LOOP = 0x13
@ -912,6 +960,11 @@ const (
KEYCTL_JOIN_SESSION_KEYRING = 0x1
KEYCTL_LINK = 0x8
KEYCTL_NEGATE = 0xd
KEYCTL_PKEY_DECRYPT = 0x1a
KEYCTL_PKEY_ENCRYPT = 0x19
KEYCTL_PKEY_QUERY = 0x18
KEYCTL_PKEY_SIGN = 0x1b
KEYCTL_PKEY_VERIFY = 0x1c
KEYCTL_READ = 0xb
KEYCTL_REJECT = 0x13
KEYCTL_RESTRICT_KEYRING = 0x1d
@ -921,6 +974,10 @@ const (
KEYCTL_SETPERM = 0x5
KEYCTL_SET_REQKEY_KEYRING = 0xe
KEYCTL_SET_TIMEOUT = 0xf
KEYCTL_SUPPORTS_DECRYPT = 0x2
KEYCTL_SUPPORTS_ENCRYPT = 0x1
KEYCTL_SUPPORTS_SIGN = 0x4
KEYCTL_SUPPORTS_VERIFY = 0x8
KEYCTL_UNLINK = 0x9
KEYCTL_UPDATE = 0x2
KEY_REQKEY_DEFL_DEFAULT = 0x0
@ -1099,6 +1156,7 @@ const (
NETLINK_FIB_LOOKUP = 0xa
NETLINK_FIREWALL = 0x3
NETLINK_GENERIC = 0x10
NETLINK_GET_STRICT_CHK = 0xc
NETLINK_INET_DIAG = 0x4
NETLINK_IP6_FW = 0xd
NETLINK_ISCSI = 0x8
@ -1120,7 +1178,7 @@ const (
NETLINK_UNUSED = 0x1
NETLINK_USERSOCK = 0x2
NETLINK_XFRM = 0x6
NETNSA_MAX = 0x3
NETNSA_MAX = 0x5
NETNSA_NSID_NOT_ASSIGNED = -0x1
NFNETLINK_V0 = 0x0
NFNLGRP_ACCT_QUOTA = 0x8
@ -1242,6 +1300,7 @@ const (
PACKET_FASTROUTE = 0x6
PACKET_HDRLEN = 0xb
PACKET_HOST = 0x0
PACKET_IGNORE_OUTGOING = 0x17
PACKET_KERNEL = 0x7
PACKET_LOOPBACK = 0x5
PACKET_LOSS = 0xe
@ -1291,6 +1350,36 @@ const (
PERF_EVENT_IOC_SET_FILTER = 0x40042406
PERF_EVENT_IOC_SET_OUTPUT = 0x2405
PIPEFS_MAGIC = 0x50495045
PPPIOCATTACH = 0x4004743d
PPPIOCATTCHAN = 0x40047438
PPPIOCCONNECT = 0x4004743a
PPPIOCDETACH = 0x4004743c
PPPIOCDISCONN = 0x7439
PPPIOCGASYNCMAP = 0x80047458
PPPIOCGCHAN = 0x80047437
PPPIOCGDEBUG = 0x80047441
PPPIOCGFLAGS = 0x8004745a
PPPIOCGIDLE = 0x8008743f
PPPIOCGL2TPSTATS = 0x80487436
PPPIOCGMRU = 0x80047453
PPPIOCGNPMODE = 0xc008744c
PPPIOCGRASYNCMAP = 0x80047455
PPPIOCGUNIT = 0x80047456
PPPIOCGXASYNCMAP = 0x80207450
PPPIOCNEWUNIT = 0xc004743e
PPPIOCSACTIVE = 0x40087446
PPPIOCSASYNCMAP = 0x40047457
PPPIOCSCOMPRESS = 0x400c744d
PPPIOCSDEBUG = 0x40047440
PPPIOCSFLAGS = 0x40047459
PPPIOCSMAXCID = 0x40047451
PPPIOCSMRRU = 0x4004743b
PPPIOCSMRU = 0x40047452
PPPIOCSNPMODE = 0x4008744b
PPPIOCSPASS = 0x40087447
PPPIOCSRASYNCMAP = 0x40047454
PPPIOCSXASYNCMAP = 0x4020744f
PPPIOCXFERUNIT = 0x744e
PRIO_PGRP = 0x1
PRIO_PROCESS = 0x0
PRIO_USER = 0x2
@ -1353,6 +1442,12 @@ const (
PR_MCE_KILL_SET = 0x1
PR_MPX_DISABLE_MANAGEMENT = 0x2c
PR_MPX_ENABLE_MANAGEMENT = 0x2b
PR_PAC_APDAKEY = 0x4
PR_PAC_APDBKEY = 0x8
PR_PAC_APGAKEY = 0x10
PR_PAC_APIAKEY = 0x1
PR_PAC_APIBKEY = 0x2
PR_PAC_RESET_KEYS = 0x36
PR_SET_CHILD_SUBREAPER = 0x24
PR_SET_DUMPABLE = 0x4
PR_SET_ENDIAN = 0x14
@ -1392,6 +1487,7 @@ const (
PR_SPEC_DISABLE = 0x4
PR_SPEC_ENABLE = 0x2
PR_SPEC_FORCE_DISABLE = 0x8
PR_SPEC_INDIRECT_BRANCH = 0x1
PR_SPEC_NOT_AFFECTED = 0x0
PR_SPEC_PRCTL = 0x1
PR_SPEC_STORE_BYPASS = 0x0
@ -1502,6 +1598,13 @@ const (
RLIMIT_SIGPENDING = 0xb
RLIMIT_STACK = 0x3
RLIM_INFINITY = 0xffffffffffffffff
RNDADDENTROPY = 0x40085203
RNDADDTOENTCNT = 0x40045201
RNDCLEARPOOL = 0x5206
RNDGETENTCNT = 0x80045200
RNDGETPOOL = 0x80085202
RNDRESEEDCRNG = 0x5207
RNDZAPENTCNT = 0x5204
RTAX_ADVMSS = 0x8
RTAX_CC_ALGO = 0x10
RTAX_CWND = 0x7
@ -1703,11 +1806,14 @@ const (
SCM_TIMESTAMPNS = 0x23
SCM_TXTIME = 0x3d
SCM_WIFI_STATUS = 0x29
SC_LOG_FLUSH = 0x100000
SECCOMP_MODE_DISABLED = 0x0
SECCOMP_MODE_FILTER = 0x2
SECCOMP_MODE_STRICT = 0x1
SECURITYFS_MAGIC = 0x73636673
SELINUX_MAGIC = 0xf97cff8c
SFD_CLOEXEC = 0x80000
SFD_NONBLOCK = 0x800
SHUT_RD = 0x0
SHUT_RDWR = 0x2
SHUT_WR = 0x1
@ -1758,6 +1864,9 @@ const (
SIOCGMIIPHY = 0x8947
SIOCGMIIREG = 0x8948
SIOCGPGRP = 0x8904
SIOCGPPPCSTATS = 0x89f2
SIOCGPPPSTATS = 0x89f0
SIOCGPPPVER = 0x89f1
SIOCGRARP = 0x8961
SIOCGSKNS = 0x894c
SIOCGSTAMP = 0x8906
@ -1866,6 +1975,17 @@ const (
SO_DETACH_FILTER = 0x1b
SO_DOMAIN = 0x27
SO_DONTROUTE = 0x5
SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1
SO_EE_CODE_TXTIME_MISSED = 0x2
SO_EE_CODE_ZEROCOPY_COPIED = 0x1
SO_EE_ORIGIN_ICMP = 0x2
SO_EE_ORIGIN_ICMP6 = 0x3
SO_EE_ORIGIN_LOCAL = 0x1
SO_EE_ORIGIN_NONE = 0x0
SO_EE_ORIGIN_TIMESTAMPING = 0x4
SO_EE_ORIGIN_TXSTATUS = 0x4
SO_EE_ORIGIN_TXTIME = 0x6
SO_EE_ORIGIN_ZEROCOPY = 0x5
SO_ERROR = 0x4
SO_GET_FILTER = 0x1a
SO_INCOMING_CPU = 0x31
@ -1985,7 +2105,7 @@ const (
TASKSTATS_GENL_NAME = "TASKSTATS"
TASKSTATS_GENL_VERSION = 0x1
TASKSTATS_TYPE_MAX = 0x6
TASKSTATS_VERSION = 0x8
TASKSTATS_VERSION = 0x9
TCFLSH = 0x540b
TCGETA = 0x5405
TCGETS = 0x5401
@ -1999,6 +2119,7 @@ const (
TCOOFF = 0x0
TCOON = 0x1
TCP_CC_INFO = 0x1a
TCP_CM_INQ = 0x24
TCP_CONGESTION = 0xd
TCP_COOKIE_IN_ALWAYS = 0x1
TCP_COOKIE_MAX = 0x10
@ -2013,6 +2134,7 @@ const (
TCP_FASTOPEN_KEY = 0x21
TCP_FASTOPEN_NO_COOKIE = 0x22
TCP_INFO = 0xb
TCP_INQ = 0x24
TCP_KEEPCNT = 0x6
TCP_KEEPIDLE = 0x4
TCP_KEEPINTVL = 0x5
@ -2032,6 +2154,9 @@ const (
TCP_QUEUE_SEQ = 0x15
TCP_QUICKACK = 0xc
TCP_REPAIR = 0x13
TCP_REPAIR_OFF = 0x0
TCP_REPAIR_OFF_NO_WP = -0x1
TCP_REPAIR_ON = 0x1
TCP_REPAIR_OPTIONS = 0x16
TCP_REPAIR_QUEUE = 0x14
TCP_REPAIR_WINDOW = 0x1d
@ -2046,6 +2171,7 @@ const (
TCP_ULP = 0x1f
TCP_USER_TIMEOUT = 0x12
TCP_WINDOW_CLAMP = 0xa
TCP_ZEROCOPY_RECEIVE = 0x23
TCSAFLUSH = 0x2
TCSBRK = 0x5409
TCSBRKP = 0x5425
@ -2062,6 +2188,7 @@ const (
TCSETXF = 0x5434
TCSETXW = 0x5435
TCXONC = 0x540a
TIMER_ABSTIME = 0x1
TIOCCBRK = 0x5428
TIOCCONS = 0x541d
TIOCEXCL = 0x540c
@ -2069,6 +2196,7 @@ const (
TIOCGETD = 0x5424
TIOCGEXCL = 0x80045440
TIOCGICOUNT = 0x545d
TIOCGISO7816 = 0x80285442
TIOCGLCKTRMIOS = 0x5456
TIOCGPGRP = 0x540f
TIOCGPKT = 0x80045438
@ -2122,6 +2250,7 @@ const (
TIOCSER_TEMT = 0x1
TIOCSETD = 0x5423
TIOCSIG = 0x40045436
TIOCSISO7816 = 0xc0285443
TIOCSLCKTRMIOS = 0x5457
TIOCSPGRP = 0x5410
TIOCSPTLCK = 0x40045431
@ -2162,6 +2291,7 @@ const (
TUNGETVNETBE = 0x800454df
TUNGETVNETHDRSZ = 0x800454d7
TUNGETVNETLE = 0x800454dd
TUNSETCARRIER = 0x400454e2
TUNSETDEBUG = 0x400454c9
TUNSETFILTEREBPF = 0x800454e1
TUNSETGROUP = 0x400454ce
@ -2351,6 +2481,7 @@ const (
XDP_UMEM_REG = 0x4
XDP_ZEROCOPY = 0x4
XENFS_SUPER_MAGIC = 0xabba1974
XFS_SUPER_MAGIC = 0x58465342
XTABS = 0x1800
ZSMALLOC_MAGIC = 0x58295829
)

View file

@ -41,7 +41,7 @@ const (
AF_KEY = 0xf
AF_LLC = 0x1a
AF_LOCAL = 0x1
AF_MAX = 0x2c
AF_MAX = 0x2d
AF_MPLS = 0x1c
AF_NETBEUI = 0xd
AF_NETLINK = 0x10
@ -174,6 +174,7 @@ const (
B9600 = 0xd
BALLOON_KVM_MAGIC = 0x13661366
BDEVFS_MAGIC = 0x62646576
BINDERFS_SUPER_MAGIC = 0x6c6f6f70
BINFMTFS_MAGIC = 0x42494e4d
BLKBSZGET = 0x80081270
BLKBSZSET = 0x40081271
@ -488,6 +489,50 @@ const (
FALLOC_FL_PUNCH_HOLE = 0x2
FALLOC_FL_UNSHARE_RANGE = 0x40
FALLOC_FL_ZERO_RANGE = 0x10
FANOTIFY_METADATA_VERSION = 0x3
FAN_ACCESS = 0x1
FAN_ACCESS_PERM = 0x20000
FAN_ALLOW = 0x1
FAN_ALL_CLASS_BITS = 0xc
FAN_ALL_EVENTS = 0x3b
FAN_ALL_INIT_FLAGS = 0x3f
FAN_ALL_MARK_FLAGS = 0xff
FAN_ALL_OUTGOING_EVENTS = 0x3403b
FAN_ALL_PERM_EVENTS = 0x30000
FAN_AUDIT = 0x10
FAN_CLASS_CONTENT = 0x4
FAN_CLASS_NOTIF = 0x0
FAN_CLASS_PRE_CONTENT = 0x8
FAN_CLOEXEC = 0x1
FAN_CLOSE = 0x18
FAN_CLOSE_NOWRITE = 0x10
FAN_CLOSE_WRITE = 0x8
FAN_DENY = 0x2
FAN_ENABLE_AUDIT = 0x40
FAN_EVENT_METADATA_LEN = 0x18
FAN_EVENT_ON_CHILD = 0x8000000
FAN_MARK_ADD = 0x1
FAN_MARK_DONT_FOLLOW = 0x4
FAN_MARK_FILESYSTEM = 0x100
FAN_MARK_FLUSH = 0x80
FAN_MARK_IGNORED_MASK = 0x20
FAN_MARK_IGNORED_SURV_MODIFY = 0x40
FAN_MARK_INODE = 0x0
FAN_MARK_MOUNT = 0x10
FAN_MARK_ONLYDIR = 0x8
FAN_MARK_REMOVE = 0x2
FAN_MODIFY = 0x2
FAN_NOFD = -0x1
FAN_NONBLOCK = 0x2
FAN_ONDIR = 0x40000000
FAN_OPEN = 0x20
FAN_OPEN_EXEC = 0x1000
FAN_OPEN_EXEC_PERM = 0x40000
FAN_OPEN_PERM = 0x10000
FAN_Q_OVERFLOW = 0x4000
FAN_REPORT_TID = 0x100
FAN_UNLIMITED_MARKS = 0x20
FAN_UNLIMITED_QUEUE = 0x10
FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400
FF0 = 0x0
@ -495,6 +540,7 @@ const (
FFDLY = 0x8000
FLUSHO = 0x1000
FPSIMD_MAGIC = 0x46508001
FS_ENCRYPTION_MODE_ADIANTUM = 0x9
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
@ -516,7 +562,7 @@ const (
FS_POLICY_FLAGS_PAD_4 = 0x0
FS_POLICY_FLAGS_PAD_8 = 0x1
FS_POLICY_FLAGS_PAD_MASK = 0x3
FS_POLICY_FLAGS_VALID = 0x3
FS_POLICY_FLAGS_VALID = 0x7
FUTEXFS_SUPER_MAGIC = 0xbad1dea
F_ADD_SEALS = 0x409
F_DUPFD = 0x0
@ -641,7 +687,7 @@ const (
IFA_F_STABLE_PRIVACY = 0x800
IFA_F_TEMPORARY = 0x1
IFA_F_TENTATIVE = 0x40
IFA_MAX = 0x9
IFA_MAX = 0xa
IFF_ALLMULTI = 0x200
IFF_ATTACH_QUEUE = 0x200
IFF_AUTOMEDIA = 0x4000
@ -709,6 +755,7 @@ const (
IN_ISDIR = 0x40000000
IN_LOOPBACKNET = 0x7f
IN_MASK_ADD = 0x20000000
IN_MASK_CREATE = 0x10000000
IN_MODIFY = 0x2
IN_MOVE = 0xc0
IN_MOVED_FROM = 0x40
@ -780,6 +827,7 @@ const (
IPV6_MINHOPCOUNT = 0x49
IPV6_MTU = 0x18
IPV6_MTU_DISCOVER = 0x17
IPV6_MULTICAST_ALL = 0x1d
IPV6_MULTICAST_HOPS = 0x12
IPV6_MULTICAST_IF = 0x11
IPV6_MULTICAST_LOOP = 0x13
@ -915,6 +963,11 @@ const (
KEYCTL_JOIN_SESSION_KEYRING = 0x1
KEYCTL_LINK = 0x8
KEYCTL_NEGATE = 0xd
KEYCTL_PKEY_DECRYPT = 0x1a
KEYCTL_PKEY_ENCRYPT = 0x19
KEYCTL_PKEY_QUERY = 0x18
KEYCTL_PKEY_SIGN = 0x1b
KEYCTL_PKEY_VERIFY = 0x1c
KEYCTL_READ = 0xb
KEYCTL_REJECT = 0x13
KEYCTL_RESTRICT_KEYRING = 0x1d
@ -924,6 +977,10 @@ const (
KEYCTL_SETPERM = 0x5
KEYCTL_SET_REQKEY_KEYRING = 0xe
KEYCTL_SET_TIMEOUT = 0xf
KEYCTL_SUPPORTS_DECRYPT = 0x2
KEYCTL_SUPPORTS_ENCRYPT = 0x1
KEYCTL_SUPPORTS_SIGN = 0x4
KEYCTL_SUPPORTS_VERIFY = 0x8
KEYCTL_UNLINK = 0x9
KEYCTL_UPDATE = 0x2
KEY_REQKEY_DEFL_DEFAULT = 0x0
@ -1102,6 +1159,7 @@ const (
NETLINK_FIB_LOOKUP = 0xa
NETLINK_FIREWALL = 0x3
NETLINK_GENERIC = 0x10
NETLINK_GET_STRICT_CHK = 0xc
NETLINK_INET_DIAG = 0x4
NETLINK_IP6_FW = 0xd
NETLINK_ISCSI = 0x8
@ -1123,7 +1181,7 @@ const (
NETLINK_UNUSED = 0x1
NETLINK_USERSOCK = 0x2
NETLINK_XFRM = 0x6
NETNSA_MAX = 0x3
NETNSA_MAX = 0x5
NETNSA_NSID_NOT_ASSIGNED = -0x1
NFNETLINK_V0 = 0x0
NFNLGRP_ACCT_QUOTA = 0x8
@ -1245,6 +1303,7 @@ const (
PACKET_FASTROUTE = 0x6
PACKET_HDRLEN = 0xb
PACKET_HOST = 0x0
PACKET_IGNORE_OUTGOING = 0x17
PACKET_KERNEL = 0x7
PACKET_LOOPBACK = 0x5
PACKET_LOSS = 0xe
@ -1294,6 +1353,36 @@ const (
PERF_EVENT_IOC_SET_FILTER = 0x40082406
PERF_EVENT_IOC_SET_OUTPUT = 0x2405
PIPEFS_MAGIC = 0x50495045
PPPIOCATTACH = 0x4004743d
PPPIOCATTCHAN = 0x40047438
PPPIOCCONNECT = 0x4004743a
PPPIOCDETACH = 0x4004743c
PPPIOCDISCONN = 0x7439
PPPIOCGASYNCMAP = 0x80047458
PPPIOCGCHAN = 0x80047437
PPPIOCGDEBUG = 0x80047441
PPPIOCGFLAGS = 0x8004745a
PPPIOCGIDLE = 0x8010743f
PPPIOCGL2TPSTATS = 0x80487436
PPPIOCGMRU = 0x80047453
PPPIOCGNPMODE = 0xc008744c
PPPIOCGRASYNCMAP = 0x80047455
PPPIOCGUNIT = 0x80047456
PPPIOCGXASYNCMAP = 0x80207450
PPPIOCNEWUNIT = 0xc004743e
PPPIOCSACTIVE = 0x40107446
PPPIOCSASYNCMAP = 0x40047457
PPPIOCSCOMPRESS = 0x4010744d
PPPIOCSDEBUG = 0x40047440
PPPIOCSFLAGS = 0x40047459
PPPIOCSMAXCID = 0x40047451
PPPIOCSMRRU = 0x4004743b
PPPIOCSMRU = 0x40047452
PPPIOCSNPMODE = 0x4008744b
PPPIOCSPASS = 0x40107447
PPPIOCSRASYNCMAP = 0x40047454
PPPIOCSXASYNCMAP = 0x4020744f
PPPIOCXFERUNIT = 0x744e
PRIO_PGRP = 0x1
PRIO_PROCESS = 0x0
PRIO_USER = 0x2
@ -1356,6 +1445,12 @@ const (
PR_MCE_KILL_SET = 0x1
PR_MPX_DISABLE_MANAGEMENT = 0x2c
PR_MPX_ENABLE_MANAGEMENT = 0x2b
PR_PAC_APDAKEY = 0x4
PR_PAC_APDBKEY = 0x8
PR_PAC_APGAKEY = 0x10
PR_PAC_APIAKEY = 0x1
PR_PAC_APIBKEY = 0x2
PR_PAC_RESET_KEYS = 0x36
PR_SET_CHILD_SUBREAPER = 0x24
PR_SET_DUMPABLE = 0x4
PR_SET_ENDIAN = 0x14
@ -1395,6 +1490,7 @@ const (
PR_SPEC_DISABLE = 0x4
PR_SPEC_ENABLE = 0x2
PR_SPEC_FORCE_DISABLE = 0x8
PR_SPEC_INDIRECT_BRANCH = 0x1
PR_SPEC_NOT_AFFECTED = 0x0
PR_SPEC_PRCTL = 0x1
PR_SPEC_STORE_BYPASS = 0x0
@ -1486,6 +1582,13 @@ const (
RLIMIT_SIGPENDING = 0xb
RLIMIT_STACK = 0x3
RLIM_INFINITY = 0xffffffffffffffff
RNDADDENTROPY = 0x40085203
RNDADDTOENTCNT = 0x40045201
RNDCLEARPOOL = 0x5206
RNDGETENTCNT = 0x80045200
RNDGETPOOL = 0x80085202
RNDRESEEDCRNG = 0x5207
RNDZAPENTCNT = 0x5204
RTAX_ADVMSS = 0x8
RTAX_CC_ALGO = 0x10
RTAX_CWND = 0x7
@ -1687,11 +1790,14 @@ const (
SCM_TIMESTAMPNS = 0x23
SCM_TXTIME = 0x3d
SCM_WIFI_STATUS = 0x29
SC_LOG_FLUSH = 0x100000
SECCOMP_MODE_DISABLED = 0x0
SECCOMP_MODE_FILTER = 0x2
SECCOMP_MODE_STRICT = 0x1
SECURITYFS_MAGIC = 0x73636673
SELINUX_MAGIC = 0xf97cff8c
SFD_CLOEXEC = 0x80000
SFD_NONBLOCK = 0x800
SHUT_RD = 0x0
SHUT_RDWR = 0x2
SHUT_WR = 0x1
@ -1742,6 +1848,9 @@ const (
SIOCGMIIPHY = 0x8947
SIOCGMIIREG = 0x8948
SIOCGPGRP = 0x8904
SIOCGPPPCSTATS = 0x89f2
SIOCGPPPSTATS = 0x89f0
SIOCGPPPVER = 0x89f1
SIOCGRARP = 0x8961
SIOCGSKNS = 0x894c
SIOCGSTAMP = 0x8906
@ -1850,6 +1959,17 @@ const (
SO_DETACH_FILTER = 0x1b
SO_DOMAIN = 0x27
SO_DONTROUTE = 0x5
SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1
SO_EE_CODE_TXTIME_MISSED = 0x2
SO_EE_CODE_ZEROCOPY_COPIED = 0x1
SO_EE_ORIGIN_ICMP = 0x2
SO_EE_ORIGIN_ICMP6 = 0x3
SO_EE_ORIGIN_LOCAL = 0x1
SO_EE_ORIGIN_NONE = 0x0
SO_EE_ORIGIN_TIMESTAMPING = 0x4
SO_EE_ORIGIN_TXSTATUS = 0x4
SO_EE_ORIGIN_TXTIME = 0x6
SO_EE_ORIGIN_ZEROCOPY = 0x5
SO_ERROR = 0x4
SO_GET_FILTER = 0x1a
SO_INCOMING_CPU = 0x31
@ -1970,7 +2090,7 @@ const (
TASKSTATS_GENL_NAME = "TASKSTATS"
TASKSTATS_GENL_VERSION = 0x1
TASKSTATS_TYPE_MAX = 0x6
TASKSTATS_VERSION = 0x8
TASKSTATS_VERSION = 0x9
TCFLSH = 0x540b
TCGETA = 0x5405
TCGETS = 0x5401
@ -1984,6 +2104,7 @@ const (
TCOOFF = 0x0
TCOON = 0x1
TCP_CC_INFO = 0x1a
TCP_CM_INQ = 0x24
TCP_CONGESTION = 0xd
TCP_COOKIE_IN_ALWAYS = 0x1
TCP_COOKIE_MAX = 0x10
@ -1998,6 +2119,7 @@ const (
TCP_FASTOPEN_KEY = 0x21
TCP_FASTOPEN_NO_COOKIE = 0x22
TCP_INFO = 0xb
TCP_INQ = 0x24
TCP_KEEPCNT = 0x6
TCP_KEEPIDLE = 0x4
TCP_KEEPINTVL = 0x5
@ -2017,6 +2139,9 @@ const (
TCP_QUEUE_SEQ = 0x15
TCP_QUICKACK = 0xc
TCP_REPAIR = 0x13
TCP_REPAIR_OFF = 0x0
TCP_REPAIR_OFF_NO_WP = -0x1
TCP_REPAIR_ON = 0x1
TCP_REPAIR_OPTIONS = 0x16
TCP_REPAIR_QUEUE = 0x14
TCP_REPAIR_WINDOW = 0x1d
@ -2031,6 +2156,7 @@ const (
TCP_ULP = 0x1f
TCP_USER_TIMEOUT = 0x12
TCP_WINDOW_CLAMP = 0xa
TCP_ZEROCOPY_RECEIVE = 0x23
TCSAFLUSH = 0x2
TCSBRK = 0x5409
TCSBRKP = 0x5425
@ -2047,6 +2173,7 @@ const (
TCSETXF = 0x5434
TCSETXW = 0x5435
TCXONC = 0x540a
TIMER_ABSTIME = 0x1
TIOCCBRK = 0x5428
TIOCCONS = 0x541d
TIOCEXCL = 0x540c
@ -2054,6 +2181,7 @@ const (
TIOCGETD = 0x5424
TIOCGEXCL = 0x80045440
TIOCGICOUNT = 0x545d
TIOCGISO7816 = 0x80285442
TIOCGLCKTRMIOS = 0x5456
TIOCGPGRP = 0x540f
TIOCGPKT = 0x80045438
@ -2107,6 +2235,7 @@ const (
TIOCSER_TEMT = 0x1
TIOCSETD = 0x5423
TIOCSIG = 0x40045436
TIOCSISO7816 = 0xc0285443
TIOCSLCKTRMIOS = 0x5457
TIOCSPGRP = 0x5410
TIOCSPTLCK = 0x40045431
@ -2147,6 +2276,7 @@ const (
TUNGETVNETBE = 0x800454df
TUNGETVNETHDRSZ = 0x800454d7
TUNGETVNETLE = 0x800454dd
TUNSETCARRIER = 0x400454e2
TUNSETDEBUG = 0x400454c9
TUNSETFILTEREBPF = 0x800454e1
TUNSETGROUP = 0x400454ce
@ -2336,6 +2466,7 @@ const (
XDP_UMEM_REG = 0x4
XDP_ZEROCOPY = 0x4
XENFS_SUPER_MAGIC = 0xabba1974
XFS_SUPER_MAGIC = 0x58465342
XTABS = 0x1800
ZSMALLOC_MAGIC = 0x58295829
)

View file

@ -41,7 +41,7 @@ const (
AF_KEY = 0xf
AF_LLC = 0x1a
AF_LOCAL = 0x1
AF_MAX = 0x2c
AF_MAX = 0x2d
AF_MPLS = 0x1c
AF_NETBEUI = 0xd
AF_NETLINK = 0x10
@ -174,6 +174,7 @@ const (
B9600 = 0xd
BALLOON_KVM_MAGIC = 0x13661366
BDEVFS_MAGIC = 0x62646576
BINDERFS_SUPER_MAGIC = 0x6c6f6f70
BINFMTFS_MAGIC = 0x42494e4d
BLKBSZGET = 0x40041270
BLKBSZSET = 0x80041271
@ -486,12 +487,57 @@ const (
FALLOC_FL_PUNCH_HOLE = 0x2
FALLOC_FL_UNSHARE_RANGE = 0x40
FALLOC_FL_ZERO_RANGE = 0x10
FANOTIFY_METADATA_VERSION = 0x3
FAN_ACCESS = 0x1
FAN_ACCESS_PERM = 0x20000
FAN_ALLOW = 0x1
FAN_ALL_CLASS_BITS = 0xc
FAN_ALL_EVENTS = 0x3b
FAN_ALL_INIT_FLAGS = 0x3f
FAN_ALL_MARK_FLAGS = 0xff
FAN_ALL_OUTGOING_EVENTS = 0x3403b
FAN_ALL_PERM_EVENTS = 0x30000
FAN_AUDIT = 0x10
FAN_CLASS_CONTENT = 0x4
FAN_CLASS_NOTIF = 0x0
FAN_CLASS_PRE_CONTENT = 0x8
FAN_CLOEXEC = 0x1
FAN_CLOSE = 0x18
FAN_CLOSE_NOWRITE = 0x10
FAN_CLOSE_WRITE = 0x8
FAN_DENY = 0x2
FAN_ENABLE_AUDIT = 0x40
FAN_EVENT_METADATA_LEN = 0x18
FAN_EVENT_ON_CHILD = 0x8000000
FAN_MARK_ADD = 0x1
FAN_MARK_DONT_FOLLOW = 0x4
FAN_MARK_FILESYSTEM = 0x100
FAN_MARK_FLUSH = 0x80
FAN_MARK_IGNORED_MASK = 0x20
FAN_MARK_IGNORED_SURV_MODIFY = 0x40
FAN_MARK_INODE = 0x0
FAN_MARK_MOUNT = 0x10
FAN_MARK_ONLYDIR = 0x8
FAN_MARK_REMOVE = 0x2
FAN_MODIFY = 0x2
FAN_NOFD = -0x1
FAN_NONBLOCK = 0x2
FAN_ONDIR = 0x40000000
FAN_OPEN = 0x20
FAN_OPEN_EXEC = 0x1000
FAN_OPEN_EXEC_PERM = 0x40000
FAN_OPEN_PERM = 0x10000
FAN_Q_OVERFLOW = 0x4000
FAN_REPORT_TID = 0x100
FAN_UNLIMITED_MARKS = 0x20
FAN_UNLIMITED_QUEUE = 0x10
FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400
FF0 = 0x0
FF1 = 0x8000
FFDLY = 0x8000
FLUSHO = 0x2000
FS_ENCRYPTION_MODE_ADIANTUM = 0x9
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
@ -513,7 +559,7 @@ const (
FS_POLICY_FLAGS_PAD_4 = 0x0
FS_POLICY_FLAGS_PAD_8 = 0x1
FS_POLICY_FLAGS_PAD_MASK = 0x3
FS_POLICY_FLAGS_VALID = 0x3
FS_POLICY_FLAGS_VALID = 0x7
FUTEXFS_SUPER_MAGIC = 0xbad1dea
F_ADD_SEALS = 0x409
F_DUPFD = 0x0
@ -638,7 +684,7 @@ const (
IFA_F_STABLE_PRIVACY = 0x800
IFA_F_TEMPORARY = 0x1
IFA_F_TENTATIVE = 0x40
IFA_MAX = 0x9
IFA_MAX = 0xa
IFF_ALLMULTI = 0x200
IFF_ATTACH_QUEUE = 0x200
IFF_AUTOMEDIA = 0x4000
@ -706,6 +752,7 @@ const (
IN_ISDIR = 0x40000000
IN_LOOPBACKNET = 0x7f
IN_MASK_ADD = 0x20000000
IN_MASK_CREATE = 0x10000000
IN_MODIFY = 0x2
IN_MOVE = 0xc0
IN_MOVED_FROM = 0x40
@ -777,6 +824,7 @@ const (
IPV6_MINHOPCOUNT = 0x49
IPV6_MTU = 0x18
IPV6_MTU_DISCOVER = 0x17
IPV6_MULTICAST_ALL = 0x1d
IPV6_MULTICAST_HOPS = 0x12
IPV6_MULTICAST_IF = 0x11
IPV6_MULTICAST_LOOP = 0x13
@ -912,6 +960,11 @@ const (
KEYCTL_JOIN_SESSION_KEYRING = 0x1
KEYCTL_LINK = 0x8
KEYCTL_NEGATE = 0xd
KEYCTL_PKEY_DECRYPT = 0x1a
KEYCTL_PKEY_ENCRYPT = 0x19
KEYCTL_PKEY_QUERY = 0x18
KEYCTL_PKEY_SIGN = 0x1b
KEYCTL_PKEY_VERIFY = 0x1c
KEYCTL_READ = 0xb
KEYCTL_REJECT = 0x13
KEYCTL_RESTRICT_KEYRING = 0x1d
@ -921,6 +974,10 @@ const (
KEYCTL_SETPERM = 0x5
KEYCTL_SET_REQKEY_KEYRING = 0xe
KEYCTL_SET_TIMEOUT = 0xf
KEYCTL_SUPPORTS_DECRYPT = 0x2
KEYCTL_SUPPORTS_ENCRYPT = 0x1
KEYCTL_SUPPORTS_SIGN = 0x4
KEYCTL_SUPPORTS_VERIFY = 0x8
KEYCTL_UNLINK = 0x9
KEYCTL_UPDATE = 0x2
KEY_REQKEY_DEFL_DEFAULT = 0x0
@ -1099,6 +1156,7 @@ const (
NETLINK_FIB_LOOKUP = 0xa
NETLINK_FIREWALL = 0x3
NETLINK_GENERIC = 0x10
NETLINK_GET_STRICT_CHK = 0xc
NETLINK_INET_DIAG = 0x4
NETLINK_IP6_FW = 0xd
NETLINK_ISCSI = 0x8
@ -1120,7 +1178,7 @@ const (
NETLINK_UNUSED = 0x1
NETLINK_USERSOCK = 0x2
NETLINK_XFRM = 0x6
NETNSA_MAX = 0x3
NETNSA_MAX = 0x5
NETNSA_NSID_NOT_ASSIGNED = -0x1
NFNETLINK_V0 = 0x0
NFNLGRP_ACCT_QUOTA = 0x8
@ -1242,6 +1300,7 @@ const (
PACKET_FASTROUTE = 0x6
PACKET_HDRLEN = 0xb
PACKET_HOST = 0x0
PACKET_IGNORE_OUTGOING = 0x17
PACKET_KERNEL = 0x7
PACKET_LOOPBACK = 0x5
PACKET_LOSS = 0xe
@ -1291,6 +1350,36 @@ const (
PERF_EVENT_IOC_SET_FILTER = 0x80042406
PERF_EVENT_IOC_SET_OUTPUT = 0x20002405
PIPEFS_MAGIC = 0x50495045
PPPIOCATTACH = 0x8004743d
PPPIOCATTCHAN = 0x80047438
PPPIOCCONNECT = 0x8004743a
PPPIOCDETACH = 0x8004743c
PPPIOCDISCONN = 0x20007439
PPPIOCGASYNCMAP = 0x40047458
PPPIOCGCHAN = 0x40047437
PPPIOCGDEBUG = 0x40047441
PPPIOCGFLAGS = 0x4004745a
PPPIOCGIDLE = 0x4008743f
PPPIOCGL2TPSTATS = 0x40487436
PPPIOCGMRU = 0x40047453
PPPIOCGNPMODE = 0xc008744c
PPPIOCGRASYNCMAP = 0x40047455
PPPIOCGUNIT = 0x40047456
PPPIOCGXASYNCMAP = 0x40207450
PPPIOCNEWUNIT = 0xc004743e
PPPIOCSACTIVE = 0x80087446
PPPIOCSASYNCMAP = 0x80047457
PPPIOCSCOMPRESS = 0x800c744d
PPPIOCSDEBUG = 0x80047440
PPPIOCSFLAGS = 0x80047459
PPPIOCSMAXCID = 0x80047451
PPPIOCSMRRU = 0x8004743b
PPPIOCSMRU = 0x80047452
PPPIOCSNPMODE = 0x8008744b
PPPIOCSPASS = 0x80087447
PPPIOCSRASYNCMAP = 0x80047454
PPPIOCSXASYNCMAP = 0x8020744f
PPPIOCXFERUNIT = 0x2000744e
PRIO_PGRP = 0x1
PRIO_PROCESS = 0x0
PRIO_USER = 0x2
@ -1353,6 +1442,12 @@ const (
PR_MCE_KILL_SET = 0x1
PR_MPX_DISABLE_MANAGEMENT = 0x2c
PR_MPX_ENABLE_MANAGEMENT = 0x2b
PR_PAC_APDAKEY = 0x4
PR_PAC_APDBKEY = 0x8
PR_PAC_APGAKEY = 0x10
PR_PAC_APIAKEY = 0x1
PR_PAC_APIBKEY = 0x2
PR_PAC_RESET_KEYS = 0x36
PR_SET_CHILD_SUBREAPER = 0x24
PR_SET_DUMPABLE = 0x4
PR_SET_ENDIAN = 0x14
@ -1392,6 +1487,7 @@ const (
PR_SPEC_DISABLE = 0x4
PR_SPEC_ENABLE = 0x2
PR_SPEC_FORCE_DISABLE = 0x8
PR_SPEC_INDIRECT_BRANCH = 0x1
PR_SPEC_NOT_AFFECTED = 0x0
PR_SPEC_PRCTL = 0x1
PR_SPEC_STORE_BYPASS = 0x0
@ -1495,6 +1591,13 @@ const (
RLIMIT_SIGPENDING = 0xb
RLIMIT_STACK = 0x3
RLIM_INFINITY = 0xffffffffffffffff
RNDADDENTROPY = 0x80085203
RNDADDTOENTCNT = 0x80045201
RNDCLEARPOOL = 0x20005206
RNDGETENTCNT = 0x40045200
RNDGETPOOL = 0x40085202
RNDRESEEDCRNG = 0x20005207
RNDZAPENTCNT = 0x20005204
RTAX_ADVMSS = 0x8
RTAX_CC_ALGO = 0x10
RTAX_CWND = 0x7
@ -1696,11 +1799,14 @@ const (
SCM_TIMESTAMPNS = 0x23
SCM_TXTIME = 0x3d
SCM_WIFI_STATUS = 0x29
SC_LOG_FLUSH = 0x100000
SECCOMP_MODE_DISABLED = 0x0
SECCOMP_MODE_FILTER = 0x2
SECCOMP_MODE_STRICT = 0x1
SECURITYFS_MAGIC = 0x73636673
SELINUX_MAGIC = 0xf97cff8c
SFD_CLOEXEC = 0x80000
SFD_NONBLOCK = 0x80
SHUT_RD = 0x0
SHUT_RDWR = 0x2
SHUT_WR = 0x1
@ -1751,6 +1857,9 @@ const (
SIOCGMIIPHY = 0x8947
SIOCGMIIREG = 0x8948
SIOCGPGRP = 0x40047309
SIOCGPPPCSTATS = 0x89f2
SIOCGPPPSTATS = 0x89f0
SIOCGPPPVER = 0x89f1
SIOCGRARP = 0x8961
SIOCGSKNS = 0x894c
SIOCGSTAMP = 0x8906
@ -1859,6 +1968,17 @@ const (
SO_DETACH_FILTER = 0x1b
SO_DOMAIN = 0x1029
SO_DONTROUTE = 0x10
SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1
SO_EE_CODE_TXTIME_MISSED = 0x2
SO_EE_CODE_ZEROCOPY_COPIED = 0x1
SO_EE_ORIGIN_ICMP = 0x2
SO_EE_ORIGIN_ICMP6 = 0x3
SO_EE_ORIGIN_LOCAL = 0x1
SO_EE_ORIGIN_NONE = 0x0
SO_EE_ORIGIN_TIMESTAMPING = 0x4
SO_EE_ORIGIN_TXSTATUS = 0x4
SO_EE_ORIGIN_TXTIME = 0x6
SO_EE_ORIGIN_ZEROCOPY = 0x5
SO_ERROR = 0x1007
SO_GET_FILTER = 0x1a
SO_INCOMING_CPU = 0x31
@ -1979,7 +2099,7 @@ const (
TASKSTATS_GENL_NAME = "TASKSTATS"
TASKSTATS_GENL_VERSION = 0x1
TASKSTATS_TYPE_MAX = 0x6
TASKSTATS_VERSION = 0x8
TASKSTATS_VERSION = 0x9
TCFLSH = 0x5407
TCGETA = 0x5401
TCGETS = 0x540d
@ -1992,6 +2112,7 @@ const (
TCOOFF = 0x0
TCOON = 0x1
TCP_CC_INFO = 0x1a
TCP_CM_INQ = 0x24
TCP_CONGESTION = 0xd
TCP_COOKIE_IN_ALWAYS = 0x1
TCP_COOKIE_MAX = 0x10
@ -2006,6 +2127,7 @@ const (
TCP_FASTOPEN_KEY = 0x21
TCP_FASTOPEN_NO_COOKIE = 0x22
TCP_INFO = 0xb
TCP_INQ = 0x24
TCP_KEEPCNT = 0x6
TCP_KEEPIDLE = 0x4
TCP_KEEPINTVL = 0x5
@ -2025,6 +2147,9 @@ const (
TCP_QUEUE_SEQ = 0x15
TCP_QUICKACK = 0xc
TCP_REPAIR = 0x13
TCP_REPAIR_OFF = 0x0
TCP_REPAIR_OFF_NO_WP = -0x1
TCP_REPAIR_ON = 0x1
TCP_REPAIR_OPTIONS = 0x16
TCP_REPAIR_QUEUE = 0x14
TCP_REPAIR_WINDOW = 0x1d
@ -2039,6 +2164,7 @@ const (
TCP_ULP = 0x1f
TCP_USER_TIMEOUT = 0x12
TCP_WINDOW_CLAMP = 0xa
TCP_ZEROCOPY_RECEIVE = 0x23
TCSAFLUSH = 0x5410
TCSBRK = 0x5405
TCSBRKP = 0x5486
@ -2052,6 +2178,7 @@ const (
TCSETSW = 0x540f
TCSETSW2 = 0x8030542c
TCXONC = 0x5406
TIMER_ABSTIME = 0x1
TIOCCBRK = 0x5428
TIOCCONS = 0x80047478
TIOCEXCL = 0x740d
@ -2060,6 +2187,7 @@ const (
TIOCGETP = 0x7408
TIOCGEXCL = 0x40045440
TIOCGICOUNT = 0x5492
TIOCGISO7816 = 0x40285442
TIOCGLCKTRMIOS = 0x548b
TIOCGLTC = 0x7474
TIOCGPGRP = 0x40047477
@ -2116,6 +2244,7 @@ const (
TIOCSETN = 0x740a
TIOCSETP = 0x7409
TIOCSIG = 0x80045436
TIOCSISO7816 = 0xc0285443
TIOCSLCKTRMIOS = 0x548c
TIOCSLTC = 0x7475
TIOCSPGRP = 0x80047476
@ -2157,6 +2286,7 @@ const (
TUNGETVNETBE = 0x400454df
TUNGETVNETHDRSZ = 0x400454d7
TUNGETVNETLE = 0x400454dd
TUNSETCARRIER = 0x800454e2
TUNSETDEBUG = 0x800454c9
TUNSETFILTEREBPF = 0x400454e1
TUNSETGROUP = 0x800454ce
@ -2347,6 +2477,7 @@ const (
XDP_UMEM_REG = 0x4
XDP_ZEROCOPY = 0x4
XENFS_SUPER_MAGIC = 0xabba1974
XFS_SUPER_MAGIC = 0x58465342
XTABS = 0x1800
ZSMALLOC_MAGIC = 0x58295829
)

View file

@ -41,7 +41,7 @@ const (
AF_KEY = 0xf
AF_LLC = 0x1a
AF_LOCAL = 0x1
AF_MAX = 0x2c
AF_MAX = 0x2d
AF_MPLS = 0x1c
AF_NETBEUI = 0xd
AF_NETLINK = 0x10
@ -174,6 +174,7 @@ const (
B9600 = 0xd
BALLOON_KVM_MAGIC = 0x13661366
BDEVFS_MAGIC = 0x62646576
BINDERFS_SUPER_MAGIC = 0x6c6f6f70
BINFMTFS_MAGIC = 0x42494e4d
BLKBSZGET = 0x40081270
BLKBSZSET = 0x80081271
@ -486,12 +487,57 @@ const (
FALLOC_FL_PUNCH_HOLE = 0x2
FALLOC_FL_UNSHARE_RANGE = 0x40
FALLOC_FL_ZERO_RANGE = 0x10
FANOTIFY_METADATA_VERSION = 0x3
FAN_ACCESS = 0x1
FAN_ACCESS_PERM = 0x20000
FAN_ALLOW = 0x1
FAN_ALL_CLASS_BITS = 0xc
FAN_ALL_EVENTS = 0x3b
FAN_ALL_INIT_FLAGS = 0x3f
FAN_ALL_MARK_FLAGS = 0xff
FAN_ALL_OUTGOING_EVENTS = 0x3403b
FAN_ALL_PERM_EVENTS = 0x30000
FAN_AUDIT = 0x10
FAN_CLASS_CONTENT = 0x4
FAN_CLASS_NOTIF = 0x0
FAN_CLASS_PRE_CONTENT = 0x8
FAN_CLOEXEC = 0x1
FAN_CLOSE = 0x18
FAN_CLOSE_NOWRITE = 0x10
FAN_CLOSE_WRITE = 0x8
FAN_DENY = 0x2
FAN_ENABLE_AUDIT = 0x40
FAN_EVENT_METADATA_LEN = 0x18
FAN_EVENT_ON_CHILD = 0x8000000
FAN_MARK_ADD = 0x1
FAN_MARK_DONT_FOLLOW = 0x4
FAN_MARK_FILESYSTEM = 0x100
FAN_MARK_FLUSH = 0x80
FAN_MARK_IGNORED_MASK = 0x20
FAN_MARK_IGNORED_SURV_MODIFY = 0x40
FAN_MARK_INODE = 0x0
FAN_MARK_MOUNT = 0x10
FAN_MARK_ONLYDIR = 0x8
FAN_MARK_REMOVE = 0x2
FAN_MODIFY = 0x2
FAN_NOFD = -0x1
FAN_NONBLOCK = 0x2
FAN_ONDIR = 0x40000000
FAN_OPEN = 0x20
FAN_OPEN_EXEC = 0x1000
FAN_OPEN_EXEC_PERM = 0x40000
FAN_OPEN_PERM = 0x10000
FAN_Q_OVERFLOW = 0x4000
FAN_REPORT_TID = 0x100
FAN_UNLIMITED_MARKS = 0x20
FAN_UNLIMITED_QUEUE = 0x10
FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400
FF0 = 0x0
FF1 = 0x8000
FFDLY = 0x8000
FLUSHO = 0x2000
FS_ENCRYPTION_MODE_ADIANTUM = 0x9
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
@ -513,7 +559,7 @@ const (
FS_POLICY_FLAGS_PAD_4 = 0x0
FS_POLICY_FLAGS_PAD_8 = 0x1
FS_POLICY_FLAGS_PAD_MASK = 0x3
FS_POLICY_FLAGS_VALID = 0x3
FS_POLICY_FLAGS_VALID = 0x7
FUTEXFS_SUPER_MAGIC = 0xbad1dea
F_ADD_SEALS = 0x409
F_DUPFD = 0x0
@ -638,7 +684,7 @@ const (
IFA_F_STABLE_PRIVACY = 0x800
IFA_F_TEMPORARY = 0x1
IFA_F_TENTATIVE = 0x40
IFA_MAX = 0x9
IFA_MAX = 0xa
IFF_ALLMULTI = 0x200
IFF_ATTACH_QUEUE = 0x200
IFF_AUTOMEDIA = 0x4000
@ -706,6 +752,7 @@ const (
IN_ISDIR = 0x40000000
IN_LOOPBACKNET = 0x7f
IN_MASK_ADD = 0x20000000
IN_MASK_CREATE = 0x10000000
IN_MODIFY = 0x2
IN_MOVE = 0xc0
IN_MOVED_FROM = 0x40
@ -777,6 +824,7 @@ const (
IPV6_MINHOPCOUNT = 0x49
IPV6_MTU = 0x18
IPV6_MTU_DISCOVER = 0x17
IPV6_MULTICAST_ALL = 0x1d
IPV6_MULTICAST_HOPS = 0x12
IPV6_MULTICAST_IF = 0x11
IPV6_MULTICAST_LOOP = 0x13
@ -912,6 +960,11 @@ const (
KEYCTL_JOIN_SESSION_KEYRING = 0x1
KEYCTL_LINK = 0x8
KEYCTL_NEGATE = 0xd
KEYCTL_PKEY_DECRYPT = 0x1a
KEYCTL_PKEY_ENCRYPT = 0x19
KEYCTL_PKEY_QUERY = 0x18
KEYCTL_PKEY_SIGN = 0x1b
KEYCTL_PKEY_VERIFY = 0x1c
KEYCTL_READ = 0xb
KEYCTL_REJECT = 0x13
KEYCTL_RESTRICT_KEYRING = 0x1d
@ -921,6 +974,10 @@ const (
KEYCTL_SETPERM = 0x5
KEYCTL_SET_REQKEY_KEYRING = 0xe
KEYCTL_SET_TIMEOUT = 0xf
KEYCTL_SUPPORTS_DECRYPT = 0x2
KEYCTL_SUPPORTS_ENCRYPT = 0x1
KEYCTL_SUPPORTS_SIGN = 0x4
KEYCTL_SUPPORTS_VERIFY = 0x8
KEYCTL_UNLINK = 0x9
KEYCTL_UPDATE = 0x2
KEY_REQKEY_DEFL_DEFAULT = 0x0
@ -1099,6 +1156,7 @@ const (
NETLINK_FIB_LOOKUP = 0xa
NETLINK_FIREWALL = 0x3
NETLINK_GENERIC = 0x10
NETLINK_GET_STRICT_CHK = 0xc
NETLINK_INET_DIAG = 0x4
NETLINK_IP6_FW = 0xd
NETLINK_ISCSI = 0x8
@ -1120,7 +1178,7 @@ const (
NETLINK_UNUSED = 0x1
NETLINK_USERSOCK = 0x2
NETLINK_XFRM = 0x6
NETNSA_MAX = 0x3
NETNSA_MAX = 0x5
NETNSA_NSID_NOT_ASSIGNED = -0x1
NFNETLINK_V0 = 0x0
NFNLGRP_ACCT_QUOTA = 0x8
@ -1242,6 +1300,7 @@ const (
PACKET_FASTROUTE = 0x6
PACKET_HDRLEN = 0xb
PACKET_HOST = 0x0
PACKET_IGNORE_OUTGOING = 0x17
PACKET_KERNEL = 0x7
PACKET_LOOPBACK = 0x5
PACKET_LOSS = 0xe
@ -1291,6 +1350,36 @@ const (
PERF_EVENT_IOC_SET_FILTER = 0x80082406
PERF_EVENT_IOC_SET_OUTPUT = 0x20002405
PIPEFS_MAGIC = 0x50495045
PPPIOCATTACH = 0x8004743d
PPPIOCATTCHAN = 0x80047438
PPPIOCCONNECT = 0x8004743a
PPPIOCDETACH = 0x8004743c
PPPIOCDISCONN = 0x20007439
PPPIOCGASYNCMAP = 0x40047458
PPPIOCGCHAN = 0x40047437
PPPIOCGDEBUG = 0x40047441
PPPIOCGFLAGS = 0x4004745a
PPPIOCGIDLE = 0x4010743f
PPPIOCGL2TPSTATS = 0x40487436
PPPIOCGMRU = 0x40047453
PPPIOCGNPMODE = 0xc008744c
PPPIOCGRASYNCMAP = 0x40047455
PPPIOCGUNIT = 0x40047456
PPPIOCGXASYNCMAP = 0x40207450
PPPIOCNEWUNIT = 0xc004743e
PPPIOCSACTIVE = 0x80107446
PPPIOCSASYNCMAP = 0x80047457
PPPIOCSCOMPRESS = 0x8010744d
PPPIOCSDEBUG = 0x80047440
PPPIOCSFLAGS = 0x80047459
PPPIOCSMAXCID = 0x80047451
PPPIOCSMRRU = 0x8004743b
PPPIOCSMRU = 0x80047452
PPPIOCSNPMODE = 0x8008744b
PPPIOCSPASS = 0x80107447
PPPIOCSRASYNCMAP = 0x80047454
PPPIOCSXASYNCMAP = 0x8020744f
PPPIOCXFERUNIT = 0x2000744e
PRIO_PGRP = 0x1
PRIO_PROCESS = 0x0
PRIO_USER = 0x2
@ -1353,6 +1442,12 @@ const (
PR_MCE_KILL_SET = 0x1
PR_MPX_DISABLE_MANAGEMENT = 0x2c
PR_MPX_ENABLE_MANAGEMENT = 0x2b
PR_PAC_APDAKEY = 0x4
PR_PAC_APDBKEY = 0x8
PR_PAC_APGAKEY = 0x10
PR_PAC_APIAKEY = 0x1
PR_PAC_APIBKEY = 0x2
PR_PAC_RESET_KEYS = 0x36
PR_SET_CHILD_SUBREAPER = 0x24
PR_SET_DUMPABLE = 0x4
PR_SET_ENDIAN = 0x14
@ -1392,6 +1487,7 @@ const (
PR_SPEC_DISABLE = 0x4
PR_SPEC_ENABLE = 0x2
PR_SPEC_FORCE_DISABLE = 0x8
PR_SPEC_INDIRECT_BRANCH = 0x1
PR_SPEC_NOT_AFFECTED = 0x0
PR_SPEC_PRCTL = 0x1
PR_SPEC_STORE_BYPASS = 0x0
@ -1495,6 +1591,13 @@ const (
RLIMIT_SIGPENDING = 0xb
RLIMIT_STACK = 0x3
RLIM_INFINITY = 0xffffffffffffffff
RNDADDENTROPY = 0x80085203
RNDADDTOENTCNT = 0x80045201
RNDCLEARPOOL = 0x20005206
RNDGETENTCNT = 0x40045200
RNDGETPOOL = 0x40085202
RNDRESEEDCRNG = 0x20005207
RNDZAPENTCNT = 0x20005204
RTAX_ADVMSS = 0x8
RTAX_CC_ALGO = 0x10
RTAX_CWND = 0x7
@ -1696,11 +1799,14 @@ const (
SCM_TIMESTAMPNS = 0x23
SCM_TXTIME = 0x3d
SCM_WIFI_STATUS = 0x29
SC_LOG_FLUSH = 0x100000
SECCOMP_MODE_DISABLED = 0x0
SECCOMP_MODE_FILTER = 0x2
SECCOMP_MODE_STRICT = 0x1
SECURITYFS_MAGIC = 0x73636673
SELINUX_MAGIC = 0xf97cff8c
SFD_CLOEXEC = 0x80000
SFD_NONBLOCK = 0x80
SHUT_RD = 0x0
SHUT_RDWR = 0x2
SHUT_WR = 0x1
@ -1751,6 +1857,9 @@ const (
SIOCGMIIPHY = 0x8947
SIOCGMIIREG = 0x8948
SIOCGPGRP = 0x40047309
SIOCGPPPCSTATS = 0x89f2
SIOCGPPPSTATS = 0x89f0
SIOCGPPPVER = 0x89f1
SIOCGRARP = 0x8961
SIOCGSKNS = 0x894c
SIOCGSTAMP = 0x8906
@ -1859,6 +1968,17 @@ const (
SO_DETACH_FILTER = 0x1b
SO_DOMAIN = 0x1029
SO_DONTROUTE = 0x10
SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1
SO_EE_CODE_TXTIME_MISSED = 0x2
SO_EE_CODE_ZEROCOPY_COPIED = 0x1
SO_EE_ORIGIN_ICMP = 0x2
SO_EE_ORIGIN_ICMP6 = 0x3
SO_EE_ORIGIN_LOCAL = 0x1
SO_EE_ORIGIN_NONE = 0x0
SO_EE_ORIGIN_TIMESTAMPING = 0x4
SO_EE_ORIGIN_TXSTATUS = 0x4
SO_EE_ORIGIN_TXTIME = 0x6
SO_EE_ORIGIN_ZEROCOPY = 0x5
SO_ERROR = 0x1007
SO_GET_FILTER = 0x1a
SO_INCOMING_CPU = 0x31
@ -1979,7 +2099,7 @@ const (
TASKSTATS_GENL_NAME = "TASKSTATS"
TASKSTATS_GENL_VERSION = 0x1
TASKSTATS_TYPE_MAX = 0x6
TASKSTATS_VERSION = 0x8
TASKSTATS_VERSION = 0x9
TCFLSH = 0x5407
TCGETA = 0x5401
TCGETS = 0x540d
@ -1992,6 +2112,7 @@ const (
TCOOFF = 0x0
TCOON = 0x1
TCP_CC_INFO = 0x1a
TCP_CM_INQ = 0x24
TCP_CONGESTION = 0xd
TCP_COOKIE_IN_ALWAYS = 0x1
TCP_COOKIE_MAX = 0x10
@ -2006,6 +2127,7 @@ const (
TCP_FASTOPEN_KEY = 0x21
TCP_FASTOPEN_NO_COOKIE = 0x22
TCP_INFO = 0xb
TCP_INQ = 0x24
TCP_KEEPCNT = 0x6
TCP_KEEPIDLE = 0x4
TCP_KEEPINTVL = 0x5
@ -2025,6 +2147,9 @@ const (
TCP_QUEUE_SEQ = 0x15
TCP_QUICKACK = 0xc
TCP_REPAIR = 0x13
TCP_REPAIR_OFF = 0x0
TCP_REPAIR_OFF_NO_WP = -0x1
TCP_REPAIR_ON = 0x1
TCP_REPAIR_OPTIONS = 0x16
TCP_REPAIR_QUEUE = 0x14
TCP_REPAIR_WINDOW = 0x1d
@ -2039,6 +2164,7 @@ const (
TCP_ULP = 0x1f
TCP_USER_TIMEOUT = 0x12
TCP_WINDOW_CLAMP = 0xa
TCP_ZEROCOPY_RECEIVE = 0x23
TCSAFLUSH = 0x5410
TCSBRK = 0x5405
TCSBRKP = 0x5486
@ -2052,6 +2178,7 @@ const (
TCSETSW = 0x540f
TCSETSW2 = 0x8030542c
TCXONC = 0x5406
TIMER_ABSTIME = 0x1
TIOCCBRK = 0x5428
TIOCCONS = 0x80047478
TIOCEXCL = 0x740d
@ -2060,6 +2187,7 @@ const (
TIOCGETP = 0x7408
TIOCGEXCL = 0x40045440
TIOCGICOUNT = 0x5492
TIOCGISO7816 = 0x40285442
TIOCGLCKTRMIOS = 0x548b
TIOCGLTC = 0x7474
TIOCGPGRP = 0x40047477
@ -2116,6 +2244,7 @@ const (
TIOCSETN = 0x740a
TIOCSETP = 0x7409
TIOCSIG = 0x80045436
TIOCSISO7816 = 0xc0285443
TIOCSLCKTRMIOS = 0x548c
TIOCSLTC = 0x7475
TIOCSPGRP = 0x80047476
@ -2157,6 +2286,7 @@ const (
TUNGETVNETBE = 0x400454df
TUNGETVNETHDRSZ = 0x400454d7
TUNGETVNETLE = 0x400454dd
TUNSETCARRIER = 0x800454e2
TUNSETDEBUG = 0x800454c9
TUNSETFILTEREBPF = 0x400454e1
TUNSETGROUP = 0x800454ce
@ -2347,6 +2477,7 @@ const (
XDP_UMEM_REG = 0x4
XDP_ZEROCOPY = 0x4
XENFS_SUPER_MAGIC = 0xabba1974
XFS_SUPER_MAGIC = 0x58465342
XTABS = 0x1800
ZSMALLOC_MAGIC = 0x58295829
)

View file

@ -41,7 +41,7 @@ const (
AF_KEY = 0xf
AF_LLC = 0x1a
AF_LOCAL = 0x1
AF_MAX = 0x2c
AF_MAX = 0x2d
AF_MPLS = 0x1c
AF_NETBEUI = 0xd
AF_NETLINK = 0x10
@ -174,6 +174,7 @@ const (
B9600 = 0xd
BALLOON_KVM_MAGIC = 0x13661366
BDEVFS_MAGIC = 0x62646576
BINDERFS_SUPER_MAGIC = 0x6c6f6f70
BINFMTFS_MAGIC = 0x42494e4d
BLKBSZGET = 0x40081270
BLKBSZSET = 0x80081271
@ -486,12 +487,57 @@ const (
FALLOC_FL_PUNCH_HOLE = 0x2
FALLOC_FL_UNSHARE_RANGE = 0x40
FALLOC_FL_ZERO_RANGE = 0x10
FANOTIFY_METADATA_VERSION = 0x3
FAN_ACCESS = 0x1
FAN_ACCESS_PERM = 0x20000
FAN_ALLOW = 0x1
FAN_ALL_CLASS_BITS = 0xc
FAN_ALL_EVENTS = 0x3b
FAN_ALL_INIT_FLAGS = 0x3f
FAN_ALL_MARK_FLAGS = 0xff
FAN_ALL_OUTGOING_EVENTS = 0x3403b
FAN_ALL_PERM_EVENTS = 0x30000
FAN_AUDIT = 0x10
FAN_CLASS_CONTENT = 0x4
FAN_CLASS_NOTIF = 0x0
FAN_CLASS_PRE_CONTENT = 0x8
FAN_CLOEXEC = 0x1
FAN_CLOSE = 0x18
FAN_CLOSE_NOWRITE = 0x10
FAN_CLOSE_WRITE = 0x8
FAN_DENY = 0x2
FAN_ENABLE_AUDIT = 0x40
FAN_EVENT_METADATA_LEN = 0x18
FAN_EVENT_ON_CHILD = 0x8000000
FAN_MARK_ADD = 0x1
FAN_MARK_DONT_FOLLOW = 0x4
FAN_MARK_FILESYSTEM = 0x100
FAN_MARK_FLUSH = 0x80
FAN_MARK_IGNORED_MASK = 0x20
FAN_MARK_IGNORED_SURV_MODIFY = 0x40
FAN_MARK_INODE = 0x0
FAN_MARK_MOUNT = 0x10
FAN_MARK_ONLYDIR = 0x8
FAN_MARK_REMOVE = 0x2
FAN_MODIFY = 0x2
FAN_NOFD = -0x1
FAN_NONBLOCK = 0x2
FAN_ONDIR = 0x40000000
FAN_OPEN = 0x20
FAN_OPEN_EXEC = 0x1000
FAN_OPEN_EXEC_PERM = 0x40000
FAN_OPEN_PERM = 0x10000
FAN_Q_OVERFLOW = 0x4000
FAN_REPORT_TID = 0x100
FAN_UNLIMITED_MARKS = 0x20
FAN_UNLIMITED_QUEUE = 0x10
FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400
FF0 = 0x0
FF1 = 0x8000
FFDLY = 0x8000
FLUSHO = 0x2000
FS_ENCRYPTION_MODE_ADIANTUM = 0x9
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
@ -513,7 +559,7 @@ const (
FS_POLICY_FLAGS_PAD_4 = 0x0
FS_POLICY_FLAGS_PAD_8 = 0x1
FS_POLICY_FLAGS_PAD_MASK = 0x3
FS_POLICY_FLAGS_VALID = 0x3
FS_POLICY_FLAGS_VALID = 0x7
FUTEXFS_SUPER_MAGIC = 0xbad1dea
F_ADD_SEALS = 0x409
F_DUPFD = 0x0
@ -638,7 +684,7 @@ const (
IFA_F_STABLE_PRIVACY = 0x800
IFA_F_TEMPORARY = 0x1
IFA_F_TENTATIVE = 0x40
IFA_MAX = 0x9
IFA_MAX = 0xa
IFF_ALLMULTI = 0x200
IFF_ATTACH_QUEUE = 0x200
IFF_AUTOMEDIA = 0x4000
@ -706,6 +752,7 @@ const (
IN_ISDIR = 0x40000000
IN_LOOPBACKNET = 0x7f
IN_MASK_ADD = 0x20000000
IN_MASK_CREATE = 0x10000000
IN_MODIFY = 0x2
IN_MOVE = 0xc0
IN_MOVED_FROM = 0x40
@ -777,6 +824,7 @@ const (
IPV6_MINHOPCOUNT = 0x49
IPV6_MTU = 0x18
IPV6_MTU_DISCOVER = 0x17
IPV6_MULTICAST_ALL = 0x1d
IPV6_MULTICAST_HOPS = 0x12
IPV6_MULTICAST_IF = 0x11
IPV6_MULTICAST_LOOP = 0x13
@ -912,6 +960,11 @@ const (
KEYCTL_JOIN_SESSION_KEYRING = 0x1
KEYCTL_LINK = 0x8
KEYCTL_NEGATE = 0xd
KEYCTL_PKEY_DECRYPT = 0x1a
KEYCTL_PKEY_ENCRYPT = 0x19
KEYCTL_PKEY_QUERY = 0x18
KEYCTL_PKEY_SIGN = 0x1b
KEYCTL_PKEY_VERIFY = 0x1c
KEYCTL_READ = 0xb
KEYCTL_REJECT = 0x13
KEYCTL_RESTRICT_KEYRING = 0x1d
@ -921,6 +974,10 @@ const (
KEYCTL_SETPERM = 0x5
KEYCTL_SET_REQKEY_KEYRING = 0xe
KEYCTL_SET_TIMEOUT = 0xf
KEYCTL_SUPPORTS_DECRYPT = 0x2
KEYCTL_SUPPORTS_ENCRYPT = 0x1
KEYCTL_SUPPORTS_SIGN = 0x4
KEYCTL_SUPPORTS_VERIFY = 0x8
KEYCTL_UNLINK = 0x9
KEYCTL_UPDATE = 0x2
KEY_REQKEY_DEFL_DEFAULT = 0x0
@ -1099,6 +1156,7 @@ const (
NETLINK_FIB_LOOKUP = 0xa
NETLINK_FIREWALL = 0x3
NETLINK_GENERIC = 0x10
NETLINK_GET_STRICT_CHK = 0xc
NETLINK_INET_DIAG = 0x4
NETLINK_IP6_FW = 0xd
NETLINK_ISCSI = 0x8
@ -1120,7 +1178,7 @@ const (
NETLINK_UNUSED = 0x1
NETLINK_USERSOCK = 0x2
NETLINK_XFRM = 0x6
NETNSA_MAX = 0x3
NETNSA_MAX = 0x5
NETNSA_NSID_NOT_ASSIGNED = -0x1
NFNETLINK_V0 = 0x0
NFNLGRP_ACCT_QUOTA = 0x8
@ -1242,6 +1300,7 @@ const (
PACKET_FASTROUTE = 0x6
PACKET_HDRLEN = 0xb
PACKET_HOST = 0x0
PACKET_IGNORE_OUTGOING = 0x17
PACKET_KERNEL = 0x7
PACKET_LOOPBACK = 0x5
PACKET_LOSS = 0xe
@ -1291,6 +1350,36 @@ const (
PERF_EVENT_IOC_SET_FILTER = 0x80082406
PERF_EVENT_IOC_SET_OUTPUT = 0x20002405
PIPEFS_MAGIC = 0x50495045
PPPIOCATTACH = 0x8004743d
PPPIOCATTCHAN = 0x80047438
PPPIOCCONNECT = 0x8004743a
PPPIOCDETACH = 0x8004743c
PPPIOCDISCONN = 0x20007439
PPPIOCGASYNCMAP = 0x40047458
PPPIOCGCHAN = 0x40047437
PPPIOCGDEBUG = 0x40047441
PPPIOCGFLAGS = 0x4004745a
PPPIOCGIDLE = 0x4010743f
PPPIOCGL2TPSTATS = 0x40487436
PPPIOCGMRU = 0x40047453
PPPIOCGNPMODE = 0xc008744c
PPPIOCGRASYNCMAP = 0x40047455
PPPIOCGUNIT = 0x40047456
PPPIOCGXASYNCMAP = 0x40207450
PPPIOCNEWUNIT = 0xc004743e
PPPIOCSACTIVE = 0x80107446
PPPIOCSASYNCMAP = 0x80047457
PPPIOCSCOMPRESS = 0x8010744d
PPPIOCSDEBUG = 0x80047440
PPPIOCSFLAGS = 0x80047459
PPPIOCSMAXCID = 0x80047451
PPPIOCSMRRU = 0x8004743b
PPPIOCSMRU = 0x80047452
PPPIOCSNPMODE = 0x8008744b
PPPIOCSPASS = 0x80107447
PPPIOCSRASYNCMAP = 0x80047454
PPPIOCSXASYNCMAP = 0x8020744f
PPPIOCXFERUNIT = 0x2000744e
PRIO_PGRP = 0x1
PRIO_PROCESS = 0x0
PRIO_USER = 0x2
@ -1353,6 +1442,12 @@ const (
PR_MCE_KILL_SET = 0x1
PR_MPX_DISABLE_MANAGEMENT = 0x2c
PR_MPX_ENABLE_MANAGEMENT = 0x2b
PR_PAC_APDAKEY = 0x4
PR_PAC_APDBKEY = 0x8
PR_PAC_APGAKEY = 0x10
PR_PAC_APIAKEY = 0x1
PR_PAC_APIBKEY = 0x2
PR_PAC_RESET_KEYS = 0x36
PR_SET_CHILD_SUBREAPER = 0x24
PR_SET_DUMPABLE = 0x4
PR_SET_ENDIAN = 0x14
@ -1392,6 +1487,7 @@ const (
PR_SPEC_DISABLE = 0x4
PR_SPEC_ENABLE = 0x2
PR_SPEC_FORCE_DISABLE = 0x8
PR_SPEC_INDIRECT_BRANCH = 0x1
PR_SPEC_NOT_AFFECTED = 0x0
PR_SPEC_PRCTL = 0x1
PR_SPEC_STORE_BYPASS = 0x0
@ -1495,6 +1591,13 @@ const (
RLIMIT_SIGPENDING = 0xb
RLIMIT_STACK = 0x3
RLIM_INFINITY = 0xffffffffffffffff
RNDADDENTROPY = 0x80085203
RNDADDTOENTCNT = 0x80045201
RNDCLEARPOOL = 0x20005206
RNDGETENTCNT = 0x40045200
RNDGETPOOL = 0x40085202
RNDRESEEDCRNG = 0x20005207
RNDZAPENTCNT = 0x20005204
RTAX_ADVMSS = 0x8
RTAX_CC_ALGO = 0x10
RTAX_CWND = 0x7
@ -1696,11 +1799,14 @@ const (
SCM_TIMESTAMPNS = 0x23
SCM_TXTIME = 0x3d
SCM_WIFI_STATUS = 0x29
SC_LOG_FLUSH = 0x100000
SECCOMP_MODE_DISABLED = 0x0
SECCOMP_MODE_FILTER = 0x2
SECCOMP_MODE_STRICT = 0x1
SECURITYFS_MAGIC = 0x73636673
SELINUX_MAGIC = 0xf97cff8c
SFD_CLOEXEC = 0x80000
SFD_NONBLOCK = 0x80
SHUT_RD = 0x0
SHUT_RDWR = 0x2
SHUT_WR = 0x1
@ -1751,6 +1857,9 @@ const (
SIOCGMIIPHY = 0x8947
SIOCGMIIREG = 0x8948
SIOCGPGRP = 0x40047309
SIOCGPPPCSTATS = 0x89f2
SIOCGPPPSTATS = 0x89f0
SIOCGPPPVER = 0x89f1
SIOCGRARP = 0x8961
SIOCGSKNS = 0x894c
SIOCGSTAMP = 0x8906
@ -1859,6 +1968,17 @@ const (
SO_DETACH_FILTER = 0x1b
SO_DOMAIN = 0x1029
SO_DONTROUTE = 0x10
SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1
SO_EE_CODE_TXTIME_MISSED = 0x2
SO_EE_CODE_ZEROCOPY_COPIED = 0x1
SO_EE_ORIGIN_ICMP = 0x2
SO_EE_ORIGIN_ICMP6 = 0x3
SO_EE_ORIGIN_LOCAL = 0x1
SO_EE_ORIGIN_NONE = 0x0
SO_EE_ORIGIN_TIMESTAMPING = 0x4
SO_EE_ORIGIN_TXSTATUS = 0x4
SO_EE_ORIGIN_TXTIME = 0x6
SO_EE_ORIGIN_ZEROCOPY = 0x5
SO_ERROR = 0x1007
SO_GET_FILTER = 0x1a
SO_INCOMING_CPU = 0x31
@ -1979,7 +2099,7 @@ const (
TASKSTATS_GENL_NAME = "TASKSTATS"
TASKSTATS_GENL_VERSION = 0x1
TASKSTATS_TYPE_MAX = 0x6
TASKSTATS_VERSION = 0x8
TASKSTATS_VERSION = 0x9
TCFLSH = 0x5407
TCGETA = 0x5401
TCGETS = 0x540d
@ -1992,6 +2112,7 @@ const (
TCOOFF = 0x0
TCOON = 0x1
TCP_CC_INFO = 0x1a
TCP_CM_INQ = 0x24
TCP_CONGESTION = 0xd
TCP_COOKIE_IN_ALWAYS = 0x1
TCP_COOKIE_MAX = 0x10
@ -2006,6 +2127,7 @@ const (
TCP_FASTOPEN_KEY = 0x21
TCP_FASTOPEN_NO_COOKIE = 0x22
TCP_INFO = 0xb
TCP_INQ = 0x24
TCP_KEEPCNT = 0x6
TCP_KEEPIDLE = 0x4
TCP_KEEPINTVL = 0x5
@ -2025,6 +2147,9 @@ const (
TCP_QUEUE_SEQ = 0x15
TCP_QUICKACK = 0xc
TCP_REPAIR = 0x13
TCP_REPAIR_OFF = 0x0
TCP_REPAIR_OFF_NO_WP = -0x1
TCP_REPAIR_ON = 0x1
TCP_REPAIR_OPTIONS = 0x16
TCP_REPAIR_QUEUE = 0x14
TCP_REPAIR_WINDOW = 0x1d
@ -2039,6 +2164,7 @@ const (
TCP_ULP = 0x1f
TCP_USER_TIMEOUT = 0x12
TCP_WINDOW_CLAMP = 0xa
TCP_ZEROCOPY_RECEIVE = 0x23
TCSAFLUSH = 0x5410
TCSBRK = 0x5405
TCSBRKP = 0x5486
@ -2052,6 +2178,7 @@ const (
TCSETSW = 0x540f
TCSETSW2 = 0x8030542c
TCXONC = 0x5406
TIMER_ABSTIME = 0x1
TIOCCBRK = 0x5428
TIOCCONS = 0x80047478
TIOCEXCL = 0x740d
@ -2060,6 +2187,7 @@ const (
TIOCGETP = 0x7408
TIOCGEXCL = 0x40045440
TIOCGICOUNT = 0x5492
TIOCGISO7816 = 0x40285442
TIOCGLCKTRMIOS = 0x548b
TIOCGLTC = 0x7474
TIOCGPGRP = 0x40047477
@ -2116,6 +2244,7 @@ const (
TIOCSETN = 0x740a
TIOCSETP = 0x7409
TIOCSIG = 0x80045436
TIOCSISO7816 = 0xc0285443
TIOCSLCKTRMIOS = 0x548c
TIOCSLTC = 0x7475
TIOCSPGRP = 0x80047476
@ -2157,6 +2286,7 @@ const (
TUNGETVNETBE = 0x400454df
TUNGETVNETHDRSZ = 0x400454d7
TUNGETVNETLE = 0x400454dd
TUNSETCARRIER = 0x800454e2
TUNSETDEBUG = 0x800454c9
TUNSETFILTEREBPF = 0x400454e1
TUNSETGROUP = 0x800454ce
@ -2347,6 +2477,7 @@ const (
XDP_UMEM_REG = 0x4
XDP_ZEROCOPY = 0x4
XENFS_SUPER_MAGIC = 0xabba1974
XFS_SUPER_MAGIC = 0x58465342
XTABS = 0x1800
ZSMALLOC_MAGIC = 0x58295829
)

View file

@ -41,7 +41,7 @@ const (
AF_KEY = 0xf
AF_LLC = 0x1a
AF_LOCAL = 0x1
AF_MAX = 0x2c
AF_MAX = 0x2d
AF_MPLS = 0x1c
AF_NETBEUI = 0xd
AF_NETLINK = 0x10
@ -174,6 +174,7 @@ const (
B9600 = 0xd
BALLOON_KVM_MAGIC = 0x13661366
BDEVFS_MAGIC = 0x62646576
BINDERFS_SUPER_MAGIC = 0x6c6f6f70
BINFMTFS_MAGIC = 0x42494e4d
BLKBSZGET = 0x40041270
BLKBSZSET = 0x80041271
@ -486,12 +487,57 @@ const (
FALLOC_FL_PUNCH_HOLE = 0x2
FALLOC_FL_UNSHARE_RANGE = 0x40
FALLOC_FL_ZERO_RANGE = 0x10
FANOTIFY_METADATA_VERSION = 0x3
FAN_ACCESS = 0x1
FAN_ACCESS_PERM = 0x20000
FAN_ALLOW = 0x1
FAN_ALL_CLASS_BITS = 0xc
FAN_ALL_EVENTS = 0x3b
FAN_ALL_INIT_FLAGS = 0x3f
FAN_ALL_MARK_FLAGS = 0xff
FAN_ALL_OUTGOING_EVENTS = 0x3403b
FAN_ALL_PERM_EVENTS = 0x30000
FAN_AUDIT = 0x10
FAN_CLASS_CONTENT = 0x4
FAN_CLASS_NOTIF = 0x0
FAN_CLASS_PRE_CONTENT = 0x8
FAN_CLOEXEC = 0x1
FAN_CLOSE = 0x18
FAN_CLOSE_NOWRITE = 0x10
FAN_CLOSE_WRITE = 0x8
FAN_DENY = 0x2
FAN_ENABLE_AUDIT = 0x40
FAN_EVENT_METADATA_LEN = 0x18
FAN_EVENT_ON_CHILD = 0x8000000
FAN_MARK_ADD = 0x1
FAN_MARK_DONT_FOLLOW = 0x4
FAN_MARK_FILESYSTEM = 0x100
FAN_MARK_FLUSH = 0x80
FAN_MARK_IGNORED_MASK = 0x20
FAN_MARK_IGNORED_SURV_MODIFY = 0x40
FAN_MARK_INODE = 0x0
FAN_MARK_MOUNT = 0x10
FAN_MARK_ONLYDIR = 0x8
FAN_MARK_REMOVE = 0x2
FAN_MODIFY = 0x2
FAN_NOFD = -0x1
FAN_NONBLOCK = 0x2
FAN_ONDIR = 0x40000000
FAN_OPEN = 0x20
FAN_OPEN_EXEC = 0x1000
FAN_OPEN_EXEC_PERM = 0x40000
FAN_OPEN_PERM = 0x10000
FAN_Q_OVERFLOW = 0x4000
FAN_REPORT_TID = 0x100
FAN_UNLIMITED_MARKS = 0x20
FAN_UNLIMITED_QUEUE = 0x10
FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400
FF0 = 0x0
FF1 = 0x8000
FFDLY = 0x8000
FLUSHO = 0x2000
FS_ENCRYPTION_MODE_ADIANTUM = 0x9
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
@ -513,7 +559,7 @@ const (
FS_POLICY_FLAGS_PAD_4 = 0x0
FS_POLICY_FLAGS_PAD_8 = 0x1
FS_POLICY_FLAGS_PAD_MASK = 0x3
FS_POLICY_FLAGS_VALID = 0x3
FS_POLICY_FLAGS_VALID = 0x7
FUTEXFS_SUPER_MAGIC = 0xbad1dea
F_ADD_SEALS = 0x409
F_DUPFD = 0x0
@ -638,7 +684,7 @@ const (
IFA_F_STABLE_PRIVACY = 0x800
IFA_F_TEMPORARY = 0x1
IFA_F_TENTATIVE = 0x40
IFA_MAX = 0x9
IFA_MAX = 0xa
IFF_ALLMULTI = 0x200
IFF_ATTACH_QUEUE = 0x200
IFF_AUTOMEDIA = 0x4000
@ -706,6 +752,7 @@ const (
IN_ISDIR = 0x40000000
IN_LOOPBACKNET = 0x7f
IN_MASK_ADD = 0x20000000
IN_MASK_CREATE = 0x10000000
IN_MODIFY = 0x2
IN_MOVE = 0xc0
IN_MOVED_FROM = 0x40
@ -777,6 +824,7 @@ const (
IPV6_MINHOPCOUNT = 0x49
IPV6_MTU = 0x18
IPV6_MTU_DISCOVER = 0x17
IPV6_MULTICAST_ALL = 0x1d
IPV6_MULTICAST_HOPS = 0x12
IPV6_MULTICAST_IF = 0x11
IPV6_MULTICAST_LOOP = 0x13
@ -912,6 +960,11 @@ const (
KEYCTL_JOIN_SESSION_KEYRING = 0x1
KEYCTL_LINK = 0x8
KEYCTL_NEGATE = 0xd
KEYCTL_PKEY_DECRYPT = 0x1a
KEYCTL_PKEY_ENCRYPT = 0x19
KEYCTL_PKEY_QUERY = 0x18
KEYCTL_PKEY_SIGN = 0x1b
KEYCTL_PKEY_VERIFY = 0x1c
KEYCTL_READ = 0xb
KEYCTL_REJECT = 0x13
KEYCTL_RESTRICT_KEYRING = 0x1d
@ -921,6 +974,10 @@ const (
KEYCTL_SETPERM = 0x5
KEYCTL_SET_REQKEY_KEYRING = 0xe
KEYCTL_SET_TIMEOUT = 0xf
KEYCTL_SUPPORTS_DECRYPT = 0x2
KEYCTL_SUPPORTS_ENCRYPT = 0x1
KEYCTL_SUPPORTS_SIGN = 0x4
KEYCTL_SUPPORTS_VERIFY = 0x8
KEYCTL_UNLINK = 0x9
KEYCTL_UPDATE = 0x2
KEY_REQKEY_DEFL_DEFAULT = 0x0
@ -1099,6 +1156,7 @@ const (
NETLINK_FIB_LOOKUP = 0xa
NETLINK_FIREWALL = 0x3
NETLINK_GENERIC = 0x10
NETLINK_GET_STRICT_CHK = 0xc
NETLINK_INET_DIAG = 0x4
NETLINK_IP6_FW = 0xd
NETLINK_ISCSI = 0x8
@ -1120,7 +1178,7 @@ const (
NETLINK_UNUSED = 0x1
NETLINK_USERSOCK = 0x2
NETLINK_XFRM = 0x6
NETNSA_MAX = 0x3
NETNSA_MAX = 0x5
NETNSA_NSID_NOT_ASSIGNED = -0x1
NFNETLINK_V0 = 0x0
NFNLGRP_ACCT_QUOTA = 0x8
@ -1242,6 +1300,7 @@ const (
PACKET_FASTROUTE = 0x6
PACKET_HDRLEN = 0xb
PACKET_HOST = 0x0
PACKET_IGNORE_OUTGOING = 0x17
PACKET_KERNEL = 0x7
PACKET_LOOPBACK = 0x5
PACKET_LOSS = 0xe
@ -1291,6 +1350,36 @@ const (
PERF_EVENT_IOC_SET_FILTER = 0x80042406
PERF_EVENT_IOC_SET_OUTPUT = 0x20002405
PIPEFS_MAGIC = 0x50495045
PPPIOCATTACH = 0x8004743d
PPPIOCATTCHAN = 0x80047438
PPPIOCCONNECT = 0x8004743a
PPPIOCDETACH = 0x8004743c
PPPIOCDISCONN = 0x20007439
PPPIOCGASYNCMAP = 0x40047458
PPPIOCGCHAN = 0x40047437
PPPIOCGDEBUG = 0x40047441
PPPIOCGFLAGS = 0x4004745a
PPPIOCGIDLE = 0x4008743f
PPPIOCGL2TPSTATS = 0x40487436
PPPIOCGMRU = 0x40047453
PPPIOCGNPMODE = 0xc008744c
PPPIOCGRASYNCMAP = 0x40047455
PPPIOCGUNIT = 0x40047456
PPPIOCGXASYNCMAP = 0x40207450
PPPIOCNEWUNIT = 0xc004743e
PPPIOCSACTIVE = 0x80087446
PPPIOCSASYNCMAP = 0x80047457
PPPIOCSCOMPRESS = 0x800c744d
PPPIOCSDEBUG = 0x80047440
PPPIOCSFLAGS = 0x80047459
PPPIOCSMAXCID = 0x80047451
PPPIOCSMRRU = 0x8004743b
PPPIOCSMRU = 0x80047452
PPPIOCSNPMODE = 0x8008744b
PPPIOCSPASS = 0x80087447
PPPIOCSRASYNCMAP = 0x80047454
PPPIOCSXASYNCMAP = 0x8020744f
PPPIOCXFERUNIT = 0x2000744e
PRIO_PGRP = 0x1
PRIO_PROCESS = 0x0
PRIO_USER = 0x2
@ -1353,6 +1442,12 @@ const (
PR_MCE_KILL_SET = 0x1
PR_MPX_DISABLE_MANAGEMENT = 0x2c
PR_MPX_ENABLE_MANAGEMENT = 0x2b
PR_PAC_APDAKEY = 0x4
PR_PAC_APDBKEY = 0x8
PR_PAC_APGAKEY = 0x10
PR_PAC_APIAKEY = 0x1
PR_PAC_APIBKEY = 0x2
PR_PAC_RESET_KEYS = 0x36
PR_SET_CHILD_SUBREAPER = 0x24
PR_SET_DUMPABLE = 0x4
PR_SET_ENDIAN = 0x14
@ -1392,6 +1487,7 @@ const (
PR_SPEC_DISABLE = 0x4
PR_SPEC_ENABLE = 0x2
PR_SPEC_FORCE_DISABLE = 0x8
PR_SPEC_INDIRECT_BRANCH = 0x1
PR_SPEC_NOT_AFFECTED = 0x0
PR_SPEC_PRCTL = 0x1
PR_SPEC_STORE_BYPASS = 0x0
@ -1495,6 +1591,13 @@ const (
RLIMIT_SIGPENDING = 0xb
RLIMIT_STACK = 0x3
RLIM_INFINITY = 0xffffffffffffffff
RNDADDENTROPY = 0x80085203
RNDADDTOENTCNT = 0x80045201
RNDCLEARPOOL = 0x20005206
RNDGETENTCNT = 0x40045200
RNDGETPOOL = 0x40085202
RNDRESEEDCRNG = 0x20005207
RNDZAPENTCNT = 0x20005204
RTAX_ADVMSS = 0x8
RTAX_CC_ALGO = 0x10
RTAX_CWND = 0x7
@ -1696,11 +1799,14 @@ const (
SCM_TIMESTAMPNS = 0x23
SCM_TXTIME = 0x3d
SCM_WIFI_STATUS = 0x29
SC_LOG_FLUSH = 0x100000
SECCOMP_MODE_DISABLED = 0x0
SECCOMP_MODE_FILTER = 0x2
SECCOMP_MODE_STRICT = 0x1
SECURITYFS_MAGIC = 0x73636673
SELINUX_MAGIC = 0xf97cff8c
SFD_CLOEXEC = 0x80000
SFD_NONBLOCK = 0x80
SHUT_RD = 0x0
SHUT_RDWR = 0x2
SHUT_WR = 0x1
@ -1751,6 +1857,9 @@ const (
SIOCGMIIPHY = 0x8947
SIOCGMIIREG = 0x8948
SIOCGPGRP = 0x40047309
SIOCGPPPCSTATS = 0x89f2
SIOCGPPPSTATS = 0x89f0
SIOCGPPPVER = 0x89f1
SIOCGRARP = 0x8961
SIOCGSKNS = 0x894c
SIOCGSTAMP = 0x8906
@ -1859,6 +1968,17 @@ const (
SO_DETACH_FILTER = 0x1b
SO_DOMAIN = 0x1029
SO_DONTROUTE = 0x10
SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1
SO_EE_CODE_TXTIME_MISSED = 0x2
SO_EE_CODE_ZEROCOPY_COPIED = 0x1
SO_EE_ORIGIN_ICMP = 0x2
SO_EE_ORIGIN_ICMP6 = 0x3
SO_EE_ORIGIN_LOCAL = 0x1
SO_EE_ORIGIN_NONE = 0x0
SO_EE_ORIGIN_TIMESTAMPING = 0x4
SO_EE_ORIGIN_TXSTATUS = 0x4
SO_EE_ORIGIN_TXTIME = 0x6
SO_EE_ORIGIN_ZEROCOPY = 0x5
SO_ERROR = 0x1007
SO_GET_FILTER = 0x1a
SO_INCOMING_CPU = 0x31
@ -1979,7 +2099,7 @@ const (
TASKSTATS_GENL_NAME = "TASKSTATS"
TASKSTATS_GENL_VERSION = 0x1
TASKSTATS_TYPE_MAX = 0x6
TASKSTATS_VERSION = 0x8
TASKSTATS_VERSION = 0x9
TCFLSH = 0x5407
TCGETA = 0x5401
TCGETS = 0x540d
@ -1992,6 +2112,7 @@ const (
TCOOFF = 0x0
TCOON = 0x1
TCP_CC_INFO = 0x1a
TCP_CM_INQ = 0x24
TCP_CONGESTION = 0xd
TCP_COOKIE_IN_ALWAYS = 0x1
TCP_COOKIE_MAX = 0x10
@ -2006,6 +2127,7 @@ const (
TCP_FASTOPEN_KEY = 0x21
TCP_FASTOPEN_NO_COOKIE = 0x22
TCP_INFO = 0xb
TCP_INQ = 0x24
TCP_KEEPCNT = 0x6
TCP_KEEPIDLE = 0x4
TCP_KEEPINTVL = 0x5
@ -2025,6 +2147,9 @@ const (
TCP_QUEUE_SEQ = 0x15
TCP_QUICKACK = 0xc
TCP_REPAIR = 0x13
TCP_REPAIR_OFF = 0x0
TCP_REPAIR_OFF_NO_WP = -0x1
TCP_REPAIR_ON = 0x1
TCP_REPAIR_OPTIONS = 0x16
TCP_REPAIR_QUEUE = 0x14
TCP_REPAIR_WINDOW = 0x1d
@ -2039,6 +2164,7 @@ const (
TCP_ULP = 0x1f
TCP_USER_TIMEOUT = 0x12
TCP_WINDOW_CLAMP = 0xa
TCP_ZEROCOPY_RECEIVE = 0x23
TCSAFLUSH = 0x5410
TCSBRK = 0x5405
TCSBRKP = 0x5486
@ -2052,6 +2178,7 @@ const (
TCSETSW = 0x540f
TCSETSW2 = 0x8030542c
TCXONC = 0x5406
TIMER_ABSTIME = 0x1
TIOCCBRK = 0x5428
TIOCCONS = 0x80047478
TIOCEXCL = 0x740d
@ -2060,6 +2187,7 @@ const (
TIOCGETP = 0x7408
TIOCGEXCL = 0x40045440
TIOCGICOUNT = 0x5492
TIOCGISO7816 = 0x40285442
TIOCGLCKTRMIOS = 0x548b
TIOCGLTC = 0x7474
TIOCGPGRP = 0x40047477
@ -2116,6 +2244,7 @@ const (
TIOCSETN = 0x740a
TIOCSETP = 0x7409
TIOCSIG = 0x80045436
TIOCSISO7816 = 0xc0285443
TIOCSLCKTRMIOS = 0x548c
TIOCSLTC = 0x7475
TIOCSPGRP = 0x80047476
@ -2157,6 +2286,7 @@ const (
TUNGETVNETBE = 0x400454df
TUNGETVNETHDRSZ = 0x400454d7
TUNGETVNETLE = 0x400454dd
TUNSETCARRIER = 0x800454e2
TUNSETDEBUG = 0x800454c9
TUNSETFILTEREBPF = 0x400454e1
TUNSETGROUP = 0x800454ce
@ -2347,6 +2477,7 @@ const (
XDP_UMEM_REG = 0x4
XDP_ZEROCOPY = 0x4
XENFS_SUPER_MAGIC = 0xabba1974
XFS_SUPER_MAGIC = 0x58465342
XTABS = 0x1800
ZSMALLOC_MAGIC = 0x58295829
)

View file

@ -41,7 +41,7 @@ const (
AF_KEY = 0xf
AF_LLC = 0x1a
AF_LOCAL = 0x1
AF_MAX = 0x2c
AF_MAX = 0x2d
AF_MPLS = 0x1c
AF_NETBEUI = 0xd
AF_NETLINK = 0x10
@ -174,6 +174,7 @@ const (
B9600 = 0xd
BALLOON_KVM_MAGIC = 0x13661366
BDEVFS_MAGIC = 0x62646576
BINDERFS_SUPER_MAGIC = 0x6c6f6f70
BINFMTFS_MAGIC = 0x42494e4d
BLKBSZGET = 0x40081270
BLKBSZSET = 0x80081271
@ -486,12 +487,57 @@ const (
FALLOC_FL_PUNCH_HOLE = 0x2
FALLOC_FL_UNSHARE_RANGE = 0x40
FALLOC_FL_ZERO_RANGE = 0x10
FANOTIFY_METADATA_VERSION = 0x3
FAN_ACCESS = 0x1
FAN_ACCESS_PERM = 0x20000
FAN_ALLOW = 0x1
FAN_ALL_CLASS_BITS = 0xc
FAN_ALL_EVENTS = 0x3b
FAN_ALL_INIT_FLAGS = 0x3f
FAN_ALL_MARK_FLAGS = 0xff
FAN_ALL_OUTGOING_EVENTS = 0x3403b
FAN_ALL_PERM_EVENTS = 0x30000
FAN_AUDIT = 0x10
FAN_CLASS_CONTENT = 0x4
FAN_CLASS_NOTIF = 0x0
FAN_CLASS_PRE_CONTENT = 0x8
FAN_CLOEXEC = 0x1
FAN_CLOSE = 0x18
FAN_CLOSE_NOWRITE = 0x10
FAN_CLOSE_WRITE = 0x8
FAN_DENY = 0x2
FAN_ENABLE_AUDIT = 0x40
FAN_EVENT_METADATA_LEN = 0x18
FAN_EVENT_ON_CHILD = 0x8000000
FAN_MARK_ADD = 0x1
FAN_MARK_DONT_FOLLOW = 0x4
FAN_MARK_FILESYSTEM = 0x100
FAN_MARK_FLUSH = 0x80
FAN_MARK_IGNORED_MASK = 0x20
FAN_MARK_IGNORED_SURV_MODIFY = 0x40
FAN_MARK_INODE = 0x0
FAN_MARK_MOUNT = 0x10
FAN_MARK_ONLYDIR = 0x8
FAN_MARK_REMOVE = 0x2
FAN_MODIFY = 0x2
FAN_NOFD = -0x1
FAN_NONBLOCK = 0x2
FAN_ONDIR = 0x40000000
FAN_OPEN = 0x20
FAN_OPEN_EXEC = 0x1000
FAN_OPEN_EXEC_PERM = 0x40000
FAN_OPEN_PERM = 0x10000
FAN_Q_OVERFLOW = 0x4000
FAN_REPORT_TID = 0x100
FAN_UNLIMITED_MARKS = 0x20
FAN_UNLIMITED_QUEUE = 0x10
FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400
FF0 = 0x0
FF1 = 0x4000
FFDLY = 0x4000
FLUSHO = 0x800000
FS_ENCRYPTION_MODE_ADIANTUM = 0x9
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
@ -513,7 +559,7 @@ const (
FS_POLICY_FLAGS_PAD_4 = 0x0
FS_POLICY_FLAGS_PAD_8 = 0x1
FS_POLICY_FLAGS_PAD_MASK = 0x3
FS_POLICY_FLAGS_VALID = 0x3
FS_POLICY_FLAGS_VALID = 0x7
FUTEXFS_SUPER_MAGIC = 0xbad1dea
F_ADD_SEALS = 0x409
F_DUPFD = 0x0
@ -638,7 +684,7 @@ const (
IFA_F_STABLE_PRIVACY = 0x800
IFA_F_TEMPORARY = 0x1
IFA_F_TENTATIVE = 0x40
IFA_MAX = 0x9
IFA_MAX = 0xa
IFF_ALLMULTI = 0x200
IFF_ATTACH_QUEUE = 0x200
IFF_AUTOMEDIA = 0x4000
@ -706,6 +752,7 @@ const (
IN_ISDIR = 0x40000000
IN_LOOPBACKNET = 0x7f
IN_MASK_ADD = 0x20000000
IN_MASK_CREATE = 0x10000000
IN_MODIFY = 0x2
IN_MOVE = 0xc0
IN_MOVED_FROM = 0x40
@ -777,6 +824,7 @@ const (
IPV6_MINHOPCOUNT = 0x49
IPV6_MTU = 0x18
IPV6_MTU_DISCOVER = 0x17
IPV6_MULTICAST_ALL = 0x1d
IPV6_MULTICAST_HOPS = 0x12
IPV6_MULTICAST_IF = 0x11
IPV6_MULTICAST_LOOP = 0x13
@ -912,6 +960,11 @@ const (
KEYCTL_JOIN_SESSION_KEYRING = 0x1
KEYCTL_LINK = 0x8
KEYCTL_NEGATE = 0xd
KEYCTL_PKEY_DECRYPT = 0x1a
KEYCTL_PKEY_ENCRYPT = 0x19
KEYCTL_PKEY_QUERY = 0x18
KEYCTL_PKEY_SIGN = 0x1b
KEYCTL_PKEY_VERIFY = 0x1c
KEYCTL_READ = 0xb
KEYCTL_REJECT = 0x13
KEYCTL_RESTRICT_KEYRING = 0x1d
@ -921,6 +974,10 @@ const (
KEYCTL_SETPERM = 0x5
KEYCTL_SET_REQKEY_KEYRING = 0xe
KEYCTL_SET_TIMEOUT = 0xf
KEYCTL_SUPPORTS_DECRYPT = 0x2
KEYCTL_SUPPORTS_ENCRYPT = 0x1
KEYCTL_SUPPORTS_SIGN = 0x4
KEYCTL_SUPPORTS_VERIFY = 0x8
KEYCTL_UNLINK = 0x9
KEYCTL_UPDATE = 0x2
KEY_REQKEY_DEFL_DEFAULT = 0x0
@ -1098,6 +1155,7 @@ const (
NETLINK_FIB_LOOKUP = 0xa
NETLINK_FIREWALL = 0x3
NETLINK_GENERIC = 0x10
NETLINK_GET_STRICT_CHK = 0xc
NETLINK_INET_DIAG = 0x4
NETLINK_IP6_FW = 0xd
NETLINK_ISCSI = 0x8
@ -1119,7 +1177,7 @@ const (
NETLINK_UNUSED = 0x1
NETLINK_USERSOCK = 0x2
NETLINK_XFRM = 0x6
NETNSA_MAX = 0x3
NETNSA_MAX = 0x5
NETNSA_NSID_NOT_ASSIGNED = -0x1
NFNETLINK_V0 = 0x0
NFNLGRP_ACCT_QUOTA = 0x8
@ -1243,6 +1301,7 @@ const (
PACKET_FASTROUTE = 0x6
PACKET_HDRLEN = 0xb
PACKET_HOST = 0x0
PACKET_IGNORE_OUTGOING = 0x17
PACKET_KERNEL = 0x7
PACKET_LOOPBACK = 0x5
PACKET_LOSS = 0xe
@ -1292,6 +1351,36 @@ const (
PERF_EVENT_IOC_SET_FILTER = 0x80082406
PERF_EVENT_IOC_SET_OUTPUT = 0x20002405
PIPEFS_MAGIC = 0x50495045
PPPIOCATTACH = 0x8004743d
PPPIOCATTCHAN = 0x80047438
PPPIOCCONNECT = 0x8004743a
PPPIOCDETACH = 0x8004743c
PPPIOCDISCONN = 0x20007439
PPPIOCGASYNCMAP = 0x40047458
PPPIOCGCHAN = 0x40047437
PPPIOCGDEBUG = 0x40047441
PPPIOCGFLAGS = 0x4004745a
PPPIOCGIDLE = 0x4010743f
PPPIOCGL2TPSTATS = 0x40487436
PPPIOCGMRU = 0x40047453
PPPIOCGNPMODE = 0xc008744c
PPPIOCGRASYNCMAP = 0x40047455
PPPIOCGUNIT = 0x40047456
PPPIOCGXASYNCMAP = 0x40207450
PPPIOCNEWUNIT = 0xc004743e
PPPIOCSACTIVE = 0x80107446
PPPIOCSASYNCMAP = 0x80047457
PPPIOCSCOMPRESS = 0x8010744d
PPPIOCSDEBUG = 0x80047440
PPPIOCSFLAGS = 0x80047459
PPPIOCSMAXCID = 0x80047451
PPPIOCSMRRU = 0x8004743b
PPPIOCSMRU = 0x80047452
PPPIOCSNPMODE = 0x8008744b
PPPIOCSPASS = 0x80107447
PPPIOCSRASYNCMAP = 0x80047454
PPPIOCSXASYNCMAP = 0x8020744f
PPPIOCXFERUNIT = 0x2000744e
PRIO_PGRP = 0x1
PRIO_PROCESS = 0x0
PRIO_USER = 0x2
@ -1355,6 +1444,12 @@ const (
PR_MCE_KILL_SET = 0x1
PR_MPX_DISABLE_MANAGEMENT = 0x2c
PR_MPX_ENABLE_MANAGEMENT = 0x2b
PR_PAC_APDAKEY = 0x4
PR_PAC_APDBKEY = 0x8
PR_PAC_APGAKEY = 0x10
PR_PAC_APIAKEY = 0x1
PR_PAC_APIBKEY = 0x2
PR_PAC_RESET_KEYS = 0x36
PR_SET_CHILD_SUBREAPER = 0x24
PR_SET_DUMPABLE = 0x4
PR_SET_ENDIAN = 0x14
@ -1394,6 +1489,7 @@ const (
PR_SPEC_DISABLE = 0x4
PR_SPEC_ENABLE = 0x2
PR_SPEC_FORCE_DISABLE = 0x8
PR_SPEC_INDIRECT_BRANCH = 0x1
PR_SPEC_NOT_AFFECTED = 0x0
PR_SPEC_PRCTL = 0x1
PR_SPEC_STORE_BYPASS = 0x0
@ -1472,6 +1568,8 @@ const (
PTRACE_SINGLEBLOCK = 0x100
PTRACE_SINGLESTEP = 0x9
PTRACE_SYSCALL = 0x18
PTRACE_SYSEMU = 0x1d
PTRACE_SYSEMU_SINGLESTEP = 0x1e
PTRACE_TRACEME = 0x0
PT_CCR = 0x26
PT_CTR = 0x23
@ -1551,6 +1649,13 @@ const (
RLIMIT_SIGPENDING = 0xb
RLIMIT_STACK = 0x3
RLIM_INFINITY = 0xffffffffffffffff
RNDADDENTROPY = 0x80085203
RNDADDTOENTCNT = 0x80045201
RNDCLEARPOOL = 0x20005206
RNDGETENTCNT = 0x40045200
RNDGETPOOL = 0x40085202
RNDRESEEDCRNG = 0x20005207
RNDZAPENTCNT = 0x20005204
RTAX_ADVMSS = 0x8
RTAX_CC_ALGO = 0x10
RTAX_CWND = 0x7
@ -1752,11 +1857,14 @@ const (
SCM_TIMESTAMPNS = 0x23
SCM_TXTIME = 0x3d
SCM_WIFI_STATUS = 0x29
SC_LOG_FLUSH = 0x100000
SECCOMP_MODE_DISABLED = 0x0
SECCOMP_MODE_FILTER = 0x2
SECCOMP_MODE_STRICT = 0x1
SECURITYFS_MAGIC = 0x73636673
SELINUX_MAGIC = 0xf97cff8c
SFD_CLOEXEC = 0x80000
SFD_NONBLOCK = 0x800
SHUT_RD = 0x0
SHUT_RDWR = 0x2
SHUT_WR = 0x1
@ -1807,6 +1915,9 @@ const (
SIOCGMIIPHY = 0x8947
SIOCGMIIREG = 0x8948
SIOCGPGRP = 0x8904
SIOCGPPPCSTATS = 0x89f2
SIOCGPPPSTATS = 0x89f0
SIOCGPPPVER = 0x89f1
SIOCGRARP = 0x8961
SIOCGSKNS = 0x894c
SIOCGSTAMP = 0x8906
@ -1915,6 +2026,17 @@ const (
SO_DETACH_FILTER = 0x1b
SO_DOMAIN = 0x27
SO_DONTROUTE = 0x5
SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1
SO_EE_CODE_TXTIME_MISSED = 0x2
SO_EE_CODE_ZEROCOPY_COPIED = 0x1
SO_EE_ORIGIN_ICMP = 0x2
SO_EE_ORIGIN_ICMP6 = 0x3
SO_EE_ORIGIN_LOCAL = 0x1
SO_EE_ORIGIN_NONE = 0x0
SO_EE_ORIGIN_TIMESTAMPING = 0x4
SO_EE_ORIGIN_TXSTATUS = 0x4
SO_EE_ORIGIN_TXTIME = 0x6
SO_EE_ORIGIN_ZEROCOPY = 0x5
SO_ERROR = 0x4
SO_GET_FILTER = 0x1a
SO_INCOMING_CPU = 0x31
@ -2034,7 +2156,7 @@ const (
TASKSTATS_GENL_NAME = "TASKSTATS"
TASKSTATS_GENL_VERSION = 0x1
TASKSTATS_TYPE_MAX = 0x6
TASKSTATS_VERSION = 0x8
TASKSTATS_VERSION = 0x9
TCFLSH = 0x2000741f
TCGETA = 0x40147417
TCGETS = 0x402c7413
@ -2046,6 +2168,7 @@ const (
TCOOFF = 0x0
TCOON = 0x1
TCP_CC_INFO = 0x1a
TCP_CM_INQ = 0x24
TCP_CONGESTION = 0xd
TCP_COOKIE_IN_ALWAYS = 0x1
TCP_COOKIE_MAX = 0x10
@ -2060,6 +2183,7 @@ const (
TCP_FASTOPEN_KEY = 0x21
TCP_FASTOPEN_NO_COOKIE = 0x22
TCP_INFO = 0xb
TCP_INQ = 0x24
TCP_KEEPCNT = 0x6
TCP_KEEPIDLE = 0x4
TCP_KEEPINTVL = 0x5
@ -2079,6 +2203,9 @@ const (
TCP_QUEUE_SEQ = 0x15
TCP_QUICKACK = 0xc
TCP_REPAIR = 0x13
TCP_REPAIR_OFF = 0x0
TCP_REPAIR_OFF_NO_WP = -0x1
TCP_REPAIR_ON = 0x1
TCP_REPAIR_OPTIONS = 0x16
TCP_REPAIR_QUEUE = 0x14
TCP_REPAIR_WINDOW = 0x1d
@ -2093,6 +2220,7 @@ const (
TCP_ULP = 0x1f
TCP_USER_TIMEOUT = 0x12
TCP_WINDOW_CLAMP = 0xa
TCP_ZEROCOPY_RECEIVE = 0x23
TCSAFLUSH = 0x2
TCSBRK = 0x2000741d
TCSBRKP = 0x5425
@ -2103,6 +2231,7 @@ const (
TCSETSF = 0x802c7416
TCSETSW = 0x802c7415
TCXONC = 0x2000741e
TIMER_ABSTIME = 0x1
TIOCCBRK = 0x5428
TIOCCONS = 0x541d
TIOCEXCL = 0x540c
@ -2112,6 +2241,7 @@ const (
TIOCGETP = 0x40067408
TIOCGEXCL = 0x40045440
TIOCGICOUNT = 0x545d
TIOCGISO7816 = 0x40285442
TIOCGLCKTRMIOS = 0x5456
TIOCGLTC = 0x40067474
TIOCGPGRP = 0x40047477
@ -2172,6 +2302,7 @@ const (
TIOCSETN = 0x8006740a
TIOCSETP = 0x80067409
TIOCSIG = 0x80045436
TIOCSISO7816 = 0xc0285443
TIOCSLCKTRMIOS = 0x5457
TIOCSLTC = 0x80067475
TIOCSPGRP = 0x80047476
@ -2215,6 +2346,7 @@ const (
TUNGETVNETBE = 0x400454df
TUNGETVNETHDRSZ = 0x400454d7
TUNGETVNETLE = 0x400454dd
TUNSETCARRIER = 0x800454e2
TUNSETDEBUG = 0x800454c9
TUNSETFILTEREBPF = 0x400454e1
TUNSETGROUP = 0x800454ce
@ -2404,6 +2536,7 @@ const (
XDP_UMEM_REG = 0x4
XDP_ZEROCOPY = 0x4
XENFS_SUPER_MAGIC = 0xabba1974
XFS_SUPER_MAGIC = 0x58465342
XTABS = 0xc00
ZSMALLOC_MAGIC = 0x58295829
)

View file

@ -41,7 +41,7 @@ const (
AF_KEY = 0xf
AF_LLC = 0x1a
AF_LOCAL = 0x1
AF_MAX = 0x2c
AF_MAX = 0x2d
AF_MPLS = 0x1c
AF_NETBEUI = 0xd
AF_NETLINK = 0x10
@ -174,6 +174,7 @@ const (
B9600 = 0xd
BALLOON_KVM_MAGIC = 0x13661366
BDEVFS_MAGIC = 0x62646576
BINDERFS_SUPER_MAGIC = 0x6c6f6f70
BINFMTFS_MAGIC = 0x42494e4d
BLKBSZGET = 0x40081270
BLKBSZSET = 0x80081271
@ -486,12 +487,57 @@ const (
FALLOC_FL_PUNCH_HOLE = 0x2
FALLOC_FL_UNSHARE_RANGE = 0x40
FALLOC_FL_ZERO_RANGE = 0x10
FANOTIFY_METADATA_VERSION = 0x3
FAN_ACCESS = 0x1
FAN_ACCESS_PERM = 0x20000
FAN_ALLOW = 0x1
FAN_ALL_CLASS_BITS = 0xc
FAN_ALL_EVENTS = 0x3b
FAN_ALL_INIT_FLAGS = 0x3f
FAN_ALL_MARK_FLAGS = 0xff
FAN_ALL_OUTGOING_EVENTS = 0x3403b
FAN_ALL_PERM_EVENTS = 0x30000
FAN_AUDIT = 0x10
FAN_CLASS_CONTENT = 0x4
FAN_CLASS_NOTIF = 0x0
FAN_CLASS_PRE_CONTENT = 0x8
FAN_CLOEXEC = 0x1
FAN_CLOSE = 0x18
FAN_CLOSE_NOWRITE = 0x10
FAN_CLOSE_WRITE = 0x8
FAN_DENY = 0x2
FAN_ENABLE_AUDIT = 0x40
FAN_EVENT_METADATA_LEN = 0x18
FAN_EVENT_ON_CHILD = 0x8000000
FAN_MARK_ADD = 0x1
FAN_MARK_DONT_FOLLOW = 0x4
FAN_MARK_FILESYSTEM = 0x100
FAN_MARK_FLUSH = 0x80
FAN_MARK_IGNORED_MASK = 0x20
FAN_MARK_IGNORED_SURV_MODIFY = 0x40
FAN_MARK_INODE = 0x0
FAN_MARK_MOUNT = 0x10
FAN_MARK_ONLYDIR = 0x8
FAN_MARK_REMOVE = 0x2
FAN_MODIFY = 0x2
FAN_NOFD = -0x1
FAN_NONBLOCK = 0x2
FAN_ONDIR = 0x40000000
FAN_OPEN = 0x20
FAN_OPEN_EXEC = 0x1000
FAN_OPEN_EXEC_PERM = 0x40000
FAN_OPEN_PERM = 0x10000
FAN_Q_OVERFLOW = 0x4000
FAN_REPORT_TID = 0x100
FAN_UNLIMITED_MARKS = 0x20
FAN_UNLIMITED_QUEUE = 0x10
FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400
FF0 = 0x0
FF1 = 0x4000
FFDLY = 0x4000
FLUSHO = 0x800000
FS_ENCRYPTION_MODE_ADIANTUM = 0x9
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
@ -513,7 +559,7 @@ const (
FS_POLICY_FLAGS_PAD_4 = 0x0
FS_POLICY_FLAGS_PAD_8 = 0x1
FS_POLICY_FLAGS_PAD_MASK = 0x3
FS_POLICY_FLAGS_VALID = 0x3
FS_POLICY_FLAGS_VALID = 0x7
FUTEXFS_SUPER_MAGIC = 0xbad1dea
F_ADD_SEALS = 0x409
F_DUPFD = 0x0
@ -638,7 +684,7 @@ const (
IFA_F_STABLE_PRIVACY = 0x800
IFA_F_TEMPORARY = 0x1
IFA_F_TENTATIVE = 0x40
IFA_MAX = 0x9
IFA_MAX = 0xa
IFF_ALLMULTI = 0x200
IFF_ATTACH_QUEUE = 0x200
IFF_AUTOMEDIA = 0x4000
@ -706,6 +752,7 @@ const (
IN_ISDIR = 0x40000000
IN_LOOPBACKNET = 0x7f
IN_MASK_ADD = 0x20000000
IN_MASK_CREATE = 0x10000000
IN_MODIFY = 0x2
IN_MOVE = 0xc0
IN_MOVED_FROM = 0x40
@ -777,6 +824,7 @@ const (
IPV6_MINHOPCOUNT = 0x49
IPV6_MTU = 0x18
IPV6_MTU_DISCOVER = 0x17
IPV6_MULTICAST_ALL = 0x1d
IPV6_MULTICAST_HOPS = 0x12
IPV6_MULTICAST_IF = 0x11
IPV6_MULTICAST_LOOP = 0x13
@ -912,6 +960,11 @@ const (
KEYCTL_JOIN_SESSION_KEYRING = 0x1
KEYCTL_LINK = 0x8
KEYCTL_NEGATE = 0xd
KEYCTL_PKEY_DECRYPT = 0x1a
KEYCTL_PKEY_ENCRYPT = 0x19
KEYCTL_PKEY_QUERY = 0x18
KEYCTL_PKEY_SIGN = 0x1b
KEYCTL_PKEY_VERIFY = 0x1c
KEYCTL_READ = 0xb
KEYCTL_REJECT = 0x13
KEYCTL_RESTRICT_KEYRING = 0x1d
@ -921,6 +974,10 @@ const (
KEYCTL_SETPERM = 0x5
KEYCTL_SET_REQKEY_KEYRING = 0xe
KEYCTL_SET_TIMEOUT = 0xf
KEYCTL_SUPPORTS_DECRYPT = 0x2
KEYCTL_SUPPORTS_ENCRYPT = 0x1
KEYCTL_SUPPORTS_SIGN = 0x4
KEYCTL_SUPPORTS_VERIFY = 0x8
KEYCTL_UNLINK = 0x9
KEYCTL_UPDATE = 0x2
KEY_REQKEY_DEFL_DEFAULT = 0x0
@ -1098,6 +1155,7 @@ const (
NETLINK_FIB_LOOKUP = 0xa
NETLINK_FIREWALL = 0x3
NETLINK_GENERIC = 0x10
NETLINK_GET_STRICT_CHK = 0xc
NETLINK_INET_DIAG = 0x4
NETLINK_IP6_FW = 0xd
NETLINK_ISCSI = 0x8
@ -1119,7 +1177,7 @@ const (
NETLINK_UNUSED = 0x1
NETLINK_USERSOCK = 0x2
NETLINK_XFRM = 0x6
NETNSA_MAX = 0x3
NETNSA_MAX = 0x5
NETNSA_NSID_NOT_ASSIGNED = -0x1
NFNETLINK_V0 = 0x0
NFNLGRP_ACCT_QUOTA = 0x8
@ -1243,6 +1301,7 @@ const (
PACKET_FASTROUTE = 0x6
PACKET_HDRLEN = 0xb
PACKET_HOST = 0x0
PACKET_IGNORE_OUTGOING = 0x17
PACKET_KERNEL = 0x7
PACKET_LOOPBACK = 0x5
PACKET_LOSS = 0xe
@ -1292,6 +1351,36 @@ const (
PERF_EVENT_IOC_SET_FILTER = 0x80082406
PERF_EVENT_IOC_SET_OUTPUT = 0x20002405
PIPEFS_MAGIC = 0x50495045
PPPIOCATTACH = 0x8004743d
PPPIOCATTCHAN = 0x80047438
PPPIOCCONNECT = 0x8004743a
PPPIOCDETACH = 0x8004743c
PPPIOCDISCONN = 0x20007439
PPPIOCGASYNCMAP = 0x40047458
PPPIOCGCHAN = 0x40047437
PPPIOCGDEBUG = 0x40047441
PPPIOCGFLAGS = 0x4004745a
PPPIOCGIDLE = 0x4010743f
PPPIOCGL2TPSTATS = 0x40487436
PPPIOCGMRU = 0x40047453
PPPIOCGNPMODE = 0xc008744c
PPPIOCGRASYNCMAP = 0x40047455
PPPIOCGUNIT = 0x40047456
PPPIOCGXASYNCMAP = 0x40207450
PPPIOCNEWUNIT = 0xc004743e
PPPIOCSACTIVE = 0x80107446
PPPIOCSASYNCMAP = 0x80047457
PPPIOCSCOMPRESS = 0x8010744d
PPPIOCSDEBUG = 0x80047440
PPPIOCSFLAGS = 0x80047459
PPPIOCSMAXCID = 0x80047451
PPPIOCSMRRU = 0x8004743b
PPPIOCSMRU = 0x80047452
PPPIOCSNPMODE = 0x8008744b
PPPIOCSPASS = 0x80107447
PPPIOCSRASYNCMAP = 0x80047454
PPPIOCSXASYNCMAP = 0x8020744f
PPPIOCXFERUNIT = 0x2000744e
PRIO_PGRP = 0x1
PRIO_PROCESS = 0x0
PRIO_USER = 0x2
@ -1355,6 +1444,12 @@ const (
PR_MCE_KILL_SET = 0x1
PR_MPX_DISABLE_MANAGEMENT = 0x2c
PR_MPX_ENABLE_MANAGEMENT = 0x2b
PR_PAC_APDAKEY = 0x4
PR_PAC_APDBKEY = 0x8
PR_PAC_APGAKEY = 0x10
PR_PAC_APIAKEY = 0x1
PR_PAC_APIBKEY = 0x2
PR_PAC_RESET_KEYS = 0x36
PR_SET_CHILD_SUBREAPER = 0x24
PR_SET_DUMPABLE = 0x4
PR_SET_ENDIAN = 0x14
@ -1394,6 +1489,7 @@ const (
PR_SPEC_DISABLE = 0x4
PR_SPEC_ENABLE = 0x2
PR_SPEC_FORCE_DISABLE = 0x8
PR_SPEC_INDIRECT_BRANCH = 0x1
PR_SPEC_NOT_AFFECTED = 0x0
PR_SPEC_PRCTL = 0x1
PR_SPEC_STORE_BYPASS = 0x0
@ -1472,6 +1568,8 @@ const (
PTRACE_SINGLEBLOCK = 0x100
PTRACE_SINGLESTEP = 0x9
PTRACE_SYSCALL = 0x18
PTRACE_SYSEMU = 0x1d
PTRACE_SYSEMU_SINGLESTEP = 0x1e
PTRACE_TRACEME = 0x0
PT_CCR = 0x26
PT_CTR = 0x23
@ -1551,6 +1649,13 @@ const (
RLIMIT_SIGPENDING = 0xb
RLIMIT_STACK = 0x3
RLIM_INFINITY = 0xffffffffffffffff
RNDADDENTROPY = 0x80085203
RNDADDTOENTCNT = 0x80045201
RNDCLEARPOOL = 0x20005206
RNDGETENTCNT = 0x40045200
RNDGETPOOL = 0x40085202
RNDRESEEDCRNG = 0x20005207
RNDZAPENTCNT = 0x20005204
RTAX_ADVMSS = 0x8
RTAX_CC_ALGO = 0x10
RTAX_CWND = 0x7
@ -1752,11 +1857,14 @@ const (
SCM_TIMESTAMPNS = 0x23
SCM_TXTIME = 0x3d
SCM_WIFI_STATUS = 0x29
SC_LOG_FLUSH = 0x100000
SECCOMP_MODE_DISABLED = 0x0
SECCOMP_MODE_FILTER = 0x2
SECCOMP_MODE_STRICT = 0x1
SECURITYFS_MAGIC = 0x73636673
SELINUX_MAGIC = 0xf97cff8c
SFD_CLOEXEC = 0x80000
SFD_NONBLOCK = 0x800
SHUT_RD = 0x0
SHUT_RDWR = 0x2
SHUT_WR = 0x1
@ -1807,6 +1915,9 @@ const (
SIOCGMIIPHY = 0x8947
SIOCGMIIREG = 0x8948
SIOCGPGRP = 0x8904
SIOCGPPPCSTATS = 0x89f2
SIOCGPPPSTATS = 0x89f0
SIOCGPPPVER = 0x89f1
SIOCGRARP = 0x8961
SIOCGSKNS = 0x894c
SIOCGSTAMP = 0x8906
@ -1915,6 +2026,17 @@ const (
SO_DETACH_FILTER = 0x1b
SO_DOMAIN = 0x27
SO_DONTROUTE = 0x5
SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1
SO_EE_CODE_TXTIME_MISSED = 0x2
SO_EE_CODE_ZEROCOPY_COPIED = 0x1
SO_EE_ORIGIN_ICMP = 0x2
SO_EE_ORIGIN_ICMP6 = 0x3
SO_EE_ORIGIN_LOCAL = 0x1
SO_EE_ORIGIN_NONE = 0x0
SO_EE_ORIGIN_TIMESTAMPING = 0x4
SO_EE_ORIGIN_TXSTATUS = 0x4
SO_EE_ORIGIN_TXTIME = 0x6
SO_EE_ORIGIN_ZEROCOPY = 0x5
SO_ERROR = 0x4
SO_GET_FILTER = 0x1a
SO_INCOMING_CPU = 0x31
@ -2034,7 +2156,7 @@ const (
TASKSTATS_GENL_NAME = "TASKSTATS"
TASKSTATS_GENL_VERSION = 0x1
TASKSTATS_TYPE_MAX = 0x6
TASKSTATS_VERSION = 0x8
TASKSTATS_VERSION = 0x9
TCFLSH = 0x2000741f
TCGETA = 0x40147417
TCGETS = 0x402c7413
@ -2046,6 +2168,7 @@ const (
TCOOFF = 0x0
TCOON = 0x1
TCP_CC_INFO = 0x1a
TCP_CM_INQ = 0x24
TCP_CONGESTION = 0xd
TCP_COOKIE_IN_ALWAYS = 0x1
TCP_COOKIE_MAX = 0x10
@ -2060,6 +2183,7 @@ const (
TCP_FASTOPEN_KEY = 0x21
TCP_FASTOPEN_NO_COOKIE = 0x22
TCP_INFO = 0xb
TCP_INQ = 0x24
TCP_KEEPCNT = 0x6
TCP_KEEPIDLE = 0x4
TCP_KEEPINTVL = 0x5
@ -2079,6 +2203,9 @@ const (
TCP_QUEUE_SEQ = 0x15
TCP_QUICKACK = 0xc
TCP_REPAIR = 0x13
TCP_REPAIR_OFF = 0x0
TCP_REPAIR_OFF_NO_WP = -0x1
TCP_REPAIR_ON = 0x1
TCP_REPAIR_OPTIONS = 0x16
TCP_REPAIR_QUEUE = 0x14
TCP_REPAIR_WINDOW = 0x1d
@ -2093,6 +2220,7 @@ const (
TCP_ULP = 0x1f
TCP_USER_TIMEOUT = 0x12
TCP_WINDOW_CLAMP = 0xa
TCP_ZEROCOPY_RECEIVE = 0x23
TCSAFLUSH = 0x2
TCSBRK = 0x2000741d
TCSBRKP = 0x5425
@ -2103,6 +2231,7 @@ const (
TCSETSF = 0x802c7416
TCSETSW = 0x802c7415
TCXONC = 0x2000741e
TIMER_ABSTIME = 0x1
TIOCCBRK = 0x5428
TIOCCONS = 0x541d
TIOCEXCL = 0x540c
@ -2112,6 +2241,7 @@ const (
TIOCGETP = 0x40067408
TIOCGEXCL = 0x40045440
TIOCGICOUNT = 0x545d
TIOCGISO7816 = 0x40285442
TIOCGLCKTRMIOS = 0x5456
TIOCGLTC = 0x40067474
TIOCGPGRP = 0x40047477
@ -2172,6 +2302,7 @@ const (
TIOCSETN = 0x8006740a
TIOCSETP = 0x80067409
TIOCSIG = 0x80045436
TIOCSISO7816 = 0xc0285443
TIOCSLCKTRMIOS = 0x5457
TIOCSLTC = 0x80067475
TIOCSPGRP = 0x80047476
@ -2215,6 +2346,7 @@ const (
TUNGETVNETBE = 0x400454df
TUNGETVNETHDRSZ = 0x400454d7
TUNGETVNETLE = 0x400454dd
TUNSETCARRIER = 0x800454e2
TUNSETDEBUG = 0x800454c9
TUNSETFILTEREBPF = 0x400454e1
TUNSETGROUP = 0x800454ce
@ -2404,6 +2536,7 @@ const (
XDP_UMEM_REG = 0x4
XDP_ZEROCOPY = 0x4
XENFS_SUPER_MAGIC = 0xabba1974
XFS_SUPER_MAGIC = 0x58465342
XTABS = 0xc00
ZSMALLOC_MAGIC = 0x58295829
)

View file

@ -41,7 +41,7 @@ const (
AF_KEY = 0xf
AF_LLC = 0x1a
AF_LOCAL = 0x1
AF_MAX = 0x2c
AF_MAX = 0x2d
AF_MPLS = 0x1c
AF_NETBEUI = 0xd
AF_NETLINK = 0x10
@ -174,6 +174,7 @@ const (
B9600 = 0xd
BALLOON_KVM_MAGIC = 0x13661366
BDEVFS_MAGIC = 0x62646576
BINDERFS_SUPER_MAGIC = 0x6c6f6f70
BINFMTFS_MAGIC = 0x42494e4d
BLKBSZGET = 0x80081270
BLKBSZSET = 0x40081271
@ -486,12 +487,57 @@ const (
FALLOC_FL_PUNCH_HOLE = 0x2
FALLOC_FL_UNSHARE_RANGE = 0x40
FALLOC_FL_ZERO_RANGE = 0x10
FANOTIFY_METADATA_VERSION = 0x3
FAN_ACCESS = 0x1
FAN_ACCESS_PERM = 0x20000
FAN_ALLOW = 0x1
FAN_ALL_CLASS_BITS = 0xc
FAN_ALL_EVENTS = 0x3b
FAN_ALL_INIT_FLAGS = 0x3f
FAN_ALL_MARK_FLAGS = 0xff
FAN_ALL_OUTGOING_EVENTS = 0x3403b
FAN_ALL_PERM_EVENTS = 0x30000
FAN_AUDIT = 0x10
FAN_CLASS_CONTENT = 0x4
FAN_CLASS_NOTIF = 0x0
FAN_CLASS_PRE_CONTENT = 0x8
FAN_CLOEXEC = 0x1
FAN_CLOSE = 0x18
FAN_CLOSE_NOWRITE = 0x10
FAN_CLOSE_WRITE = 0x8
FAN_DENY = 0x2
FAN_ENABLE_AUDIT = 0x40
FAN_EVENT_METADATA_LEN = 0x18
FAN_EVENT_ON_CHILD = 0x8000000
FAN_MARK_ADD = 0x1
FAN_MARK_DONT_FOLLOW = 0x4
FAN_MARK_FILESYSTEM = 0x100
FAN_MARK_FLUSH = 0x80
FAN_MARK_IGNORED_MASK = 0x20
FAN_MARK_IGNORED_SURV_MODIFY = 0x40
FAN_MARK_INODE = 0x0
FAN_MARK_MOUNT = 0x10
FAN_MARK_ONLYDIR = 0x8
FAN_MARK_REMOVE = 0x2
FAN_MODIFY = 0x2
FAN_NOFD = -0x1
FAN_NONBLOCK = 0x2
FAN_ONDIR = 0x40000000
FAN_OPEN = 0x20
FAN_OPEN_EXEC = 0x1000
FAN_OPEN_EXEC_PERM = 0x40000
FAN_OPEN_PERM = 0x10000
FAN_Q_OVERFLOW = 0x4000
FAN_REPORT_TID = 0x100
FAN_UNLIMITED_MARKS = 0x20
FAN_UNLIMITED_QUEUE = 0x10
FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400
FF0 = 0x0
FF1 = 0x8000
FFDLY = 0x8000
FLUSHO = 0x1000
FS_ENCRYPTION_MODE_ADIANTUM = 0x9
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
@ -513,7 +559,7 @@ const (
FS_POLICY_FLAGS_PAD_4 = 0x0
FS_POLICY_FLAGS_PAD_8 = 0x1
FS_POLICY_FLAGS_PAD_MASK = 0x3
FS_POLICY_FLAGS_VALID = 0x3
FS_POLICY_FLAGS_VALID = 0x7
FUTEXFS_SUPER_MAGIC = 0xbad1dea
F_ADD_SEALS = 0x409
F_DUPFD = 0x0
@ -638,7 +684,7 @@ const (
IFA_F_STABLE_PRIVACY = 0x800
IFA_F_TEMPORARY = 0x1
IFA_F_TENTATIVE = 0x40
IFA_MAX = 0x9
IFA_MAX = 0xa
IFF_ALLMULTI = 0x200
IFF_ATTACH_QUEUE = 0x200
IFF_AUTOMEDIA = 0x4000
@ -706,6 +752,7 @@ const (
IN_ISDIR = 0x40000000
IN_LOOPBACKNET = 0x7f
IN_MASK_ADD = 0x20000000
IN_MASK_CREATE = 0x10000000
IN_MODIFY = 0x2
IN_MOVE = 0xc0
IN_MOVED_FROM = 0x40
@ -777,6 +824,7 @@ const (
IPV6_MINHOPCOUNT = 0x49
IPV6_MTU = 0x18
IPV6_MTU_DISCOVER = 0x17
IPV6_MULTICAST_ALL = 0x1d
IPV6_MULTICAST_HOPS = 0x12
IPV6_MULTICAST_IF = 0x11
IPV6_MULTICAST_LOOP = 0x13
@ -912,6 +960,11 @@ const (
KEYCTL_JOIN_SESSION_KEYRING = 0x1
KEYCTL_LINK = 0x8
KEYCTL_NEGATE = 0xd
KEYCTL_PKEY_DECRYPT = 0x1a
KEYCTL_PKEY_ENCRYPT = 0x19
KEYCTL_PKEY_QUERY = 0x18
KEYCTL_PKEY_SIGN = 0x1b
KEYCTL_PKEY_VERIFY = 0x1c
KEYCTL_READ = 0xb
KEYCTL_REJECT = 0x13
KEYCTL_RESTRICT_KEYRING = 0x1d
@ -921,6 +974,10 @@ const (
KEYCTL_SETPERM = 0x5
KEYCTL_SET_REQKEY_KEYRING = 0xe
KEYCTL_SET_TIMEOUT = 0xf
KEYCTL_SUPPORTS_DECRYPT = 0x2
KEYCTL_SUPPORTS_ENCRYPT = 0x1
KEYCTL_SUPPORTS_SIGN = 0x4
KEYCTL_SUPPORTS_VERIFY = 0x8
KEYCTL_UNLINK = 0x9
KEYCTL_UPDATE = 0x2
KEY_REQKEY_DEFL_DEFAULT = 0x0
@ -1099,6 +1156,7 @@ const (
NETLINK_FIB_LOOKUP = 0xa
NETLINK_FIREWALL = 0x3
NETLINK_GENERIC = 0x10
NETLINK_GET_STRICT_CHK = 0xc
NETLINK_INET_DIAG = 0x4
NETLINK_IP6_FW = 0xd
NETLINK_ISCSI = 0x8
@ -1120,7 +1178,7 @@ const (
NETLINK_UNUSED = 0x1
NETLINK_USERSOCK = 0x2
NETLINK_XFRM = 0x6
NETNSA_MAX = 0x3
NETNSA_MAX = 0x5
NETNSA_NSID_NOT_ASSIGNED = -0x1
NFNETLINK_V0 = 0x0
NFNLGRP_ACCT_QUOTA = 0x8
@ -1242,6 +1300,7 @@ const (
PACKET_FASTROUTE = 0x6
PACKET_HDRLEN = 0xb
PACKET_HOST = 0x0
PACKET_IGNORE_OUTGOING = 0x17
PACKET_KERNEL = 0x7
PACKET_LOOPBACK = 0x5
PACKET_LOSS = 0xe
@ -1291,6 +1350,36 @@ const (
PERF_EVENT_IOC_SET_FILTER = 0x40082406
PERF_EVENT_IOC_SET_OUTPUT = 0x2405
PIPEFS_MAGIC = 0x50495045
PPPIOCATTACH = 0x4004743d
PPPIOCATTCHAN = 0x40047438
PPPIOCCONNECT = 0x4004743a
PPPIOCDETACH = 0x4004743c
PPPIOCDISCONN = 0x7439
PPPIOCGASYNCMAP = 0x80047458
PPPIOCGCHAN = 0x80047437
PPPIOCGDEBUG = 0x80047441
PPPIOCGFLAGS = 0x8004745a
PPPIOCGIDLE = 0x8010743f
PPPIOCGL2TPSTATS = 0x80487436
PPPIOCGMRU = 0x80047453
PPPIOCGNPMODE = 0xc008744c
PPPIOCGRASYNCMAP = 0x80047455
PPPIOCGUNIT = 0x80047456
PPPIOCGXASYNCMAP = 0x80207450
PPPIOCNEWUNIT = 0xc004743e
PPPIOCSACTIVE = 0x40107446
PPPIOCSASYNCMAP = 0x40047457
PPPIOCSCOMPRESS = 0x4010744d
PPPIOCSDEBUG = 0x40047440
PPPIOCSFLAGS = 0x40047459
PPPIOCSMAXCID = 0x40047451
PPPIOCSMRRU = 0x4004743b
PPPIOCSMRU = 0x40047452
PPPIOCSNPMODE = 0x4008744b
PPPIOCSPASS = 0x40107447
PPPIOCSRASYNCMAP = 0x40047454
PPPIOCSXASYNCMAP = 0x4020744f
PPPIOCXFERUNIT = 0x744e
PRIO_PGRP = 0x1
PRIO_PROCESS = 0x0
PRIO_USER = 0x2
@ -1353,6 +1442,12 @@ const (
PR_MCE_KILL_SET = 0x1
PR_MPX_DISABLE_MANAGEMENT = 0x2c
PR_MPX_ENABLE_MANAGEMENT = 0x2b
PR_PAC_APDAKEY = 0x4
PR_PAC_APDBKEY = 0x8
PR_PAC_APGAKEY = 0x10
PR_PAC_APIAKEY = 0x1
PR_PAC_APIBKEY = 0x2
PR_PAC_RESET_KEYS = 0x36
PR_SET_CHILD_SUBREAPER = 0x24
PR_SET_DUMPABLE = 0x4
PR_SET_ENDIAN = 0x14
@ -1392,6 +1487,7 @@ const (
PR_SPEC_DISABLE = 0x4
PR_SPEC_ENABLE = 0x2
PR_SPEC_FORCE_DISABLE = 0x8
PR_SPEC_INDIRECT_BRANCH = 0x1
PR_SPEC_NOT_AFFECTED = 0x0
PR_SPEC_PRCTL = 0x1
PR_SPEC_STORE_BYPASS = 0x0
@ -1483,6 +1579,13 @@ const (
RLIMIT_SIGPENDING = 0xb
RLIMIT_STACK = 0x3
RLIM_INFINITY = 0xffffffffffffffff
RNDADDENTROPY = 0x40085203
RNDADDTOENTCNT = 0x40045201
RNDCLEARPOOL = 0x5206
RNDGETENTCNT = 0x80045200
RNDGETPOOL = 0x80085202
RNDRESEEDCRNG = 0x5207
RNDZAPENTCNT = 0x5204
RTAX_ADVMSS = 0x8
RTAX_CC_ALGO = 0x10
RTAX_CWND = 0x7
@ -1684,11 +1787,14 @@ const (
SCM_TIMESTAMPNS = 0x23
SCM_TXTIME = 0x3d
SCM_WIFI_STATUS = 0x29
SC_LOG_FLUSH = 0x100000
SECCOMP_MODE_DISABLED = 0x0
SECCOMP_MODE_FILTER = 0x2
SECCOMP_MODE_STRICT = 0x1
SECURITYFS_MAGIC = 0x73636673
SELINUX_MAGIC = 0xf97cff8c
SFD_CLOEXEC = 0x80000
SFD_NONBLOCK = 0x800
SHUT_RD = 0x0
SHUT_RDWR = 0x2
SHUT_WR = 0x1
@ -1739,6 +1845,9 @@ const (
SIOCGMIIPHY = 0x8947
SIOCGMIIREG = 0x8948
SIOCGPGRP = 0x8904
SIOCGPPPCSTATS = 0x89f2
SIOCGPPPSTATS = 0x89f0
SIOCGPPPVER = 0x89f1
SIOCGRARP = 0x8961
SIOCGSKNS = 0x894c
SIOCGSTAMP = 0x8906
@ -1847,6 +1956,17 @@ const (
SO_DETACH_FILTER = 0x1b
SO_DOMAIN = 0x27
SO_DONTROUTE = 0x5
SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1
SO_EE_CODE_TXTIME_MISSED = 0x2
SO_EE_CODE_ZEROCOPY_COPIED = 0x1
SO_EE_ORIGIN_ICMP = 0x2
SO_EE_ORIGIN_ICMP6 = 0x3
SO_EE_ORIGIN_LOCAL = 0x1
SO_EE_ORIGIN_NONE = 0x0
SO_EE_ORIGIN_TIMESTAMPING = 0x4
SO_EE_ORIGIN_TXSTATUS = 0x4
SO_EE_ORIGIN_TXTIME = 0x6
SO_EE_ORIGIN_ZEROCOPY = 0x5
SO_ERROR = 0x4
SO_GET_FILTER = 0x1a
SO_INCOMING_CPU = 0x31
@ -1966,7 +2086,7 @@ const (
TASKSTATS_GENL_NAME = "TASKSTATS"
TASKSTATS_GENL_VERSION = 0x1
TASKSTATS_TYPE_MAX = 0x6
TASKSTATS_VERSION = 0x8
TASKSTATS_VERSION = 0x9
TCFLSH = 0x540b
TCGETA = 0x5405
TCGETS = 0x5401
@ -1980,6 +2100,7 @@ const (
TCOOFF = 0x0
TCOON = 0x1
TCP_CC_INFO = 0x1a
TCP_CM_INQ = 0x24
TCP_CONGESTION = 0xd
TCP_COOKIE_IN_ALWAYS = 0x1
TCP_COOKIE_MAX = 0x10
@ -1994,6 +2115,7 @@ const (
TCP_FASTOPEN_KEY = 0x21
TCP_FASTOPEN_NO_COOKIE = 0x22
TCP_INFO = 0xb
TCP_INQ = 0x24
TCP_KEEPCNT = 0x6
TCP_KEEPIDLE = 0x4
TCP_KEEPINTVL = 0x5
@ -2013,6 +2135,9 @@ const (
TCP_QUEUE_SEQ = 0x15
TCP_QUICKACK = 0xc
TCP_REPAIR = 0x13
TCP_REPAIR_OFF = 0x0
TCP_REPAIR_OFF_NO_WP = -0x1
TCP_REPAIR_ON = 0x1
TCP_REPAIR_OPTIONS = 0x16
TCP_REPAIR_QUEUE = 0x14
TCP_REPAIR_WINDOW = 0x1d
@ -2027,6 +2152,7 @@ const (
TCP_ULP = 0x1f
TCP_USER_TIMEOUT = 0x12
TCP_WINDOW_CLAMP = 0xa
TCP_ZEROCOPY_RECEIVE = 0x23
TCSAFLUSH = 0x2
TCSBRK = 0x5409
TCSBRKP = 0x5425
@ -2043,6 +2169,7 @@ const (
TCSETXF = 0x5434
TCSETXW = 0x5435
TCXONC = 0x540a
TIMER_ABSTIME = 0x1
TIOCCBRK = 0x5428
TIOCCONS = 0x541d
TIOCEXCL = 0x540c
@ -2050,6 +2177,7 @@ const (
TIOCGETD = 0x5424
TIOCGEXCL = 0x80045440
TIOCGICOUNT = 0x545d
TIOCGISO7816 = 0x80285442
TIOCGLCKTRMIOS = 0x5456
TIOCGPGRP = 0x540f
TIOCGPKT = 0x80045438
@ -2103,6 +2231,7 @@ const (
TIOCSER_TEMT = 0x1
TIOCSETD = 0x5423
TIOCSIG = 0x40045436
TIOCSISO7816 = 0xc0285443
TIOCSLCKTRMIOS = 0x5457
TIOCSPGRP = 0x5410
TIOCSPTLCK = 0x40045431
@ -2143,6 +2272,7 @@ const (
TUNGETVNETBE = 0x800454df
TUNGETVNETHDRSZ = 0x800454d7
TUNGETVNETLE = 0x800454dd
TUNSETCARRIER = 0x400454e2
TUNSETDEBUG = 0x400454c9
TUNSETFILTEREBPF = 0x800454e1
TUNSETGROUP = 0x400454ce
@ -2332,6 +2462,7 @@ const (
XDP_UMEM_REG = 0x4
XDP_ZEROCOPY = 0x4
XENFS_SUPER_MAGIC = 0xabba1974
XFS_SUPER_MAGIC = 0x58465342
XTABS = 0x1800
ZSMALLOC_MAGIC = 0x58295829
)

View file

@ -41,7 +41,7 @@ const (
AF_KEY = 0xf
AF_LLC = 0x1a
AF_LOCAL = 0x1
AF_MAX = 0x2c
AF_MAX = 0x2d
AF_MPLS = 0x1c
AF_NETBEUI = 0xd
AF_NETLINK = 0x10
@ -174,6 +174,7 @@ const (
B9600 = 0xd
BALLOON_KVM_MAGIC = 0x13661366
BDEVFS_MAGIC = 0x62646576
BINDERFS_SUPER_MAGIC = 0x6c6f6f70
BINFMTFS_MAGIC = 0x42494e4d
BLKBSZGET = 0x80081270
BLKBSZSET = 0x40081271
@ -486,12 +487,57 @@ const (
FALLOC_FL_PUNCH_HOLE = 0x2
FALLOC_FL_UNSHARE_RANGE = 0x40
FALLOC_FL_ZERO_RANGE = 0x10
FANOTIFY_METADATA_VERSION = 0x3
FAN_ACCESS = 0x1
FAN_ACCESS_PERM = 0x20000
FAN_ALLOW = 0x1
FAN_ALL_CLASS_BITS = 0xc
FAN_ALL_EVENTS = 0x3b
FAN_ALL_INIT_FLAGS = 0x3f
FAN_ALL_MARK_FLAGS = 0xff
FAN_ALL_OUTGOING_EVENTS = 0x3403b
FAN_ALL_PERM_EVENTS = 0x30000
FAN_AUDIT = 0x10
FAN_CLASS_CONTENT = 0x4
FAN_CLASS_NOTIF = 0x0
FAN_CLASS_PRE_CONTENT = 0x8
FAN_CLOEXEC = 0x1
FAN_CLOSE = 0x18
FAN_CLOSE_NOWRITE = 0x10
FAN_CLOSE_WRITE = 0x8
FAN_DENY = 0x2
FAN_ENABLE_AUDIT = 0x40
FAN_EVENT_METADATA_LEN = 0x18
FAN_EVENT_ON_CHILD = 0x8000000
FAN_MARK_ADD = 0x1
FAN_MARK_DONT_FOLLOW = 0x4
FAN_MARK_FILESYSTEM = 0x100
FAN_MARK_FLUSH = 0x80
FAN_MARK_IGNORED_MASK = 0x20
FAN_MARK_IGNORED_SURV_MODIFY = 0x40
FAN_MARK_INODE = 0x0
FAN_MARK_MOUNT = 0x10
FAN_MARK_ONLYDIR = 0x8
FAN_MARK_REMOVE = 0x2
FAN_MODIFY = 0x2
FAN_NOFD = -0x1
FAN_NONBLOCK = 0x2
FAN_ONDIR = 0x40000000
FAN_OPEN = 0x20
FAN_OPEN_EXEC = 0x1000
FAN_OPEN_EXEC_PERM = 0x40000
FAN_OPEN_PERM = 0x10000
FAN_Q_OVERFLOW = 0x4000
FAN_REPORT_TID = 0x100
FAN_UNLIMITED_MARKS = 0x20
FAN_UNLIMITED_QUEUE = 0x10
FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400
FF0 = 0x0
FF1 = 0x8000
FFDLY = 0x8000
FLUSHO = 0x1000
FS_ENCRYPTION_MODE_ADIANTUM = 0x9
FS_ENCRYPTION_MODE_AES_128_CBC = 0x5
FS_ENCRYPTION_MODE_AES_128_CTS = 0x6
FS_ENCRYPTION_MODE_AES_256_CBC = 0x3
@ -513,7 +559,7 @@ const (
FS_POLICY_FLAGS_PAD_4 = 0x0
FS_POLICY_FLAGS_PAD_8 = 0x1
FS_POLICY_FLAGS_PAD_MASK = 0x3
FS_POLICY_FLAGS_VALID = 0x3
FS_POLICY_FLAGS_VALID = 0x7
FUTEXFS_SUPER_MAGIC = 0xbad1dea
F_ADD_SEALS = 0x409
F_DUPFD = 0x0
@ -638,7 +684,7 @@ const (
IFA_F_STABLE_PRIVACY = 0x800
IFA_F_TEMPORARY = 0x1
IFA_F_TENTATIVE = 0x40
IFA_MAX = 0x9
IFA_MAX = 0xa
IFF_ALLMULTI = 0x200
IFF_ATTACH_QUEUE = 0x200
IFF_AUTOMEDIA = 0x4000
@ -706,6 +752,7 @@ const (
IN_ISDIR = 0x40000000
IN_LOOPBACKNET = 0x7f
IN_MASK_ADD = 0x20000000
IN_MASK_CREATE = 0x10000000
IN_MODIFY = 0x2
IN_MOVE = 0xc0
IN_MOVED_FROM = 0x40
@ -777,6 +824,7 @@ const (
IPV6_MINHOPCOUNT = 0x49
IPV6_MTU = 0x18
IPV6_MTU_DISCOVER = 0x17
IPV6_MULTICAST_ALL = 0x1d
IPV6_MULTICAST_HOPS = 0x12
IPV6_MULTICAST_IF = 0x11
IPV6_MULTICAST_LOOP = 0x13
@ -912,6 +960,11 @@ const (
KEYCTL_JOIN_SESSION_KEYRING = 0x1
KEYCTL_LINK = 0x8
KEYCTL_NEGATE = 0xd
KEYCTL_PKEY_DECRYPT = 0x1a
KEYCTL_PKEY_ENCRYPT = 0x19
KEYCTL_PKEY_QUERY = 0x18
KEYCTL_PKEY_SIGN = 0x1b
KEYCTL_PKEY_VERIFY = 0x1c
KEYCTL_READ = 0xb
KEYCTL_REJECT = 0x13
KEYCTL_RESTRICT_KEYRING = 0x1d
@ -921,6 +974,10 @@ const (
KEYCTL_SETPERM = 0x5
KEYCTL_SET_REQKEY_KEYRING = 0xe
KEYCTL_SET_TIMEOUT = 0xf
KEYCTL_SUPPORTS_DECRYPT = 0x2
KEYCTL_SUPPORTS_ENCRYPT = 0x1
KEYCTL_SUPPORTS_SIGN = 0x4
KEYCTL_SUPPORTS_VERIFY = 0x8
KEYCTL_UNLINK = 0x9
KEYCTL_UPDATE = 0x2
KEY_REQKEY_DEFL_DEFAULT = 0x0
@ -1099,6 +1156,7 @@ const (
NETLINK_FIB_LOOKUP = 0xa
NETLINK_FIREWALL = 0x3
NETLINK_GENERIC = 0x10
NETLINK_GET_STRICT_CHK = 0xc
NETLINK_INET_DIAG = 0x4
NETLINK_IP6_FW = 0xd
NETLINK_ISCSI = 0x8
@ -1120,7 +1178,7 @@ const (
NETLINK_UNUSED = 0x1
NETLINK_USERSOCK = 0x2
NETLINK_XFRM = 0x6
NETNSA_MAX = 0x3
NETNSA_MAX = 0x5
NETNSA_NSID_NOT_ASSIGNED = -0x1
NFNETLINK_V0 = 0x0
NFNLGRP_ACCT_QUOTA = 0x8
@ -1242,6 +1300,7 @@ const (
PACKET_FASTROUTE = 0x6
PACKET_HDRLEN = 0xb
PACKET_HOST = 0x0
PACKET_IGNORE_OUTGOING = 0x17
PACKET_KERNEL = 0x7
PACKET_LOOPBACK = 0x5
PACKET_LOSS = 0xe
@ -1291,6 +1350,36 @@ const (
PERF_EVENT_IOC_SET_FILTER = 0x40082406
PERF_EVENT_IOC_SET_OUTPUT = 0x2405
PIPEFS_MAGIC = 0x50495045
PPPIOCATTACH = 0x4004743d
PPPIOCATTCHAN = 0x40047438
PPPIOCCONNECT = 0x4004743a
PPPIOCDETACH = 0x4004743c
PPPIOCDISCONN = 0x7439
PPPIOCGASYNCMAP = 0x80047458
PPPIOCGCHAN = 0x80047437
PPPIOCGDEBUG = 0x80047441
PPPIOCGFLAGS = 0x8004745a
PPPIOCGIDLE = 0x8010743f
PPPIOCGL2TPSTATS = 0x80487436
PPPIOCGMRU = 0x80047453
PPPIOCGNPMODE = 0xc008744c
PPPIOCGRASYNCMAP = 0x80047455
PPPIOCGUNIT = 0x80047456
PPPIOCGXASYNCMAP = 0x80207450
PPPIOCNEWUNIT = 0xc004743e
PPPIOCSACTIVE = 0x40107446
PPPIOCSASYNCMAP = 0x40047457
PPPIOCSCOMPRESS = 0x4010744d
PPPIOCSDEBUG = 0x40047440
PPPIOCSFLAGS = 0x40047459
PPPIOCSMAXCID = 0x40047451
PPPIOCSMRRU = 0x4004743b
PPPIOCSMRU = 0x40047452
PPPIOCSNPMODE = 0x4008744b
PPPIOCSPASS = 0x40107447
PPPIOCSRASYNCMAP = 0x40047454
PPPIOCSXASYNCMAP = 0x4020744f
PPPIOCXFERUNIT = 0x744e
PRIO_PGRP = 0x1
PRIO_PROCESS = 0x0
PRIO_USER = 0x2
@ -1353,6 +1442,12 @@ const (
PR_MCE_KILL_SET = 0x1
PR_MPX_DISABLE_MANAGEMENT = 0x2c
PR_MPX_ENABLE_MANAGEMENT = 0x2b
PR_PAC_APDAKEY = 0x4
PR_PAC_APDBKEY = 0x8
PR_PAC_APGAKEY = 0x10
PR_PAC_APIAKEY = 0x1
PR_PAC_APIBKEY = 0x2
PR_PAC_RESET_KEYS = 0x36
PR_SET_CHILD_SUBREAPER = 0x24
PR_SET_DUMPABLE = 0x4
PR_SET_ENDIAN = 0x14
@ -1392,6 +1487,7 @@ const (
PR_SPEC_DISABLE = 0x4
PR_SPEC_ENABLE = 0x2
PR_SPEC_FORCE_DISABLE = 0x8
PR_SPEC_INDIRECT_BRANCH = 0x1
PR_SPEC_NOT_AFFECTED = 0x0
PR_SPEC_PRCTL = 0x1
PR_SPEC_STORE_BYPASS = 0x0
@ -1556,6 +1652,13 @@ const (
RLIMIT_SIGPENDING = 0xb
RLIMIT_STACK = 0x3
RLIM_INFINITY = 0xffffffffffffffff
RNDADDENTROPY = 0x40085203
RNDADDTOENTCNT = 0x40045201
RNDCLEARPOOL = 0x5206
RNDGETENTCNT = 0x80045200
RNDGETPOOL = 0x80085202
RNDRESEEDCRNG = 0x5207
RNDZAPENTCNT = 0x5204
RTAX_ADVMSS = 0x8
RTAX_CC_ALGO = 0x10
RTAX_CWND = 0x7
@ -1757,11 +1860,14 @@ const (
SCM_TIMESTAMPNS = 0x23
SCM_TXTIME = 0x3d
SCM_WIFI_STATUS = 0x29
SC_LOG_FLUSH = 0x100000
SECCOMP_MODE_DISABLED = 0x0
SECCOMP_MODE_FILTER = 0x2
SECCOMP_MODE_STRICT = 0x1
SECURITYFS_MAGIC = 0x73636673
SELINUX_MAGIC = 0xf97cff8c
SFD_CLOEXEC = 0x80000
SFD_NONBLOCK = 0x800
SHUT_RD = 0x0
SHUT_RDWR = 0x2
SHUT_WR = 0x1
@ -1812,6 +1918,9 @@ const (
SIOCGMIIPHY = 0x8947
SIOCGMIIREG = 0x8948
SIOCGPGRP = 0x8904
SIOCGPPPCSTATS = 0x89f2
SIOCGPPPSTATS = 0x89f0
SIOCGPPPVER = 0x89f1
SIOCGRARP = 0x8961
SIOCGSKNS = 0x894c
SIOCGSTAMP = 0x8906
@ -1920,6 +2029,17 @@ const (
SO_DETACH_FILTER = 0x1b
SO_DOMAIN = 0x27
SO_DONTROUTE = 0x5
SO_EE_CODE_TXTIME_INVALID_PARAM = 0x1
SO_EE_CODE_TXTIME_MISSED = 0x2
SO_EE_CODE_ZEROCOPY_COPIED = 0x1
SO_EE_ORIGIN_ICMP = 0x2
SO_EE_ORIGIN_ICMP6 = 0x3
SO_EE_ORIGIN_LOCAL = 0x1
SO_EE_ORIGIN_NONE = 0x0
SO_EE_ORIGIN_TIMESTAMPING = 0x4
SO_EE_ORIGIN_TXSTATUS = 0x4
SO_EE_ORIGIN_TXTIME = 0x6
SO_EE_ORIGIN_ZEROCOPY = 0x5
SO_ERROR = 0x4
SO_GET_FILTER = 0x1a
SO_INCOMING_CPU = 0x31
@ -2039,7 +2159,7 @@ const (
TASKSTATS_GENL_NAME = "TASKSTATS"
TASKSTATS_GENL_VERSION = 0x1
TASKSTATS_TYPE_MAX = 0x6
TASKSTATS_VERSION = 0x8
TASKSTATS_VERSION = 0x9
TCFLSH = 0x540b
TCGETA = 0x5405
TCGETS = 0x5401
@ -2053,6 +2173,7 @@ const (
TCOOFF = 0x0
TCOON = 0x1
TCP_CC_INFO = 0x1a
TCP_CM_INQ = 0x24
TCP_CONGESTION = 0xd
TCP_COOKIE_IN_ALWAYS = 0x1
TCP_COOKIE_MAX = 0x10
@ -2067,6 +2188,7 @@ const (
TCP_FASTOPEN_KEY = 0x21
TCP_FASTOPEN_NO_COOKIE = 0x22
TCP_INFO = 0xb
TCP_INQ = 0x24
TCP_KEEPCNT = 0x6
TCP_KEEPIDLE = 0x4
TCP_KEEPINTVL = 0x5
@ -2086,6 +2208,9 @@ const (
TCP_QUEUE_SEQ = 0x15
TCP_QUICKACK = 0xc
TCP_REPAIR = 0x13
TCP_REPAIR_OFF = 0x0
TCP_REPAIR_OFF_NO_WP = -0x1
TCP_REPAIR_ON = 0x1
TCP_REPAIR_OPTIONS = 0x16
TCP_REPAIR_QUEUE = 0x14
TCP_REPAIR_WINDOW = 0x1d
@ -2100,6 +2225,7 @@ const (
TCP_ULP = 0x1f
TCP_USER_TIMEOUT = 0x12
TCP_WINDOW_CLAMP = 0xa
TCP_ZEROCOPY_RECEIVE = 0x23
TCSAFLUSH = 0x2
TCSBRK = 0x5409
TCSBRKP = 0x5425
@ -2116,6 +2242,7 @@ const (
TCSETXF = 0x5434
TCSETXW = 0x5435
TCXONC = 0x540a
TIMER_ABSTIME = 0x1
TIOCCBRK = 0x5428
TIOCCONS = 0x541d
TIOCEXCL = 0x540c
@ -2123,6 +2250,7 @@ const (
TIOCGETD = 0x5424
TIOCGEXCL = 0x80045440
TIOCGICOUNT = 0x545d
TIOCGISO7816 = 0x80285442
TIOCGLCKTRMIOS = 0x5456
TIOCGPGRP = 0x540f
TIOCGPKT = 0x80045438
@ -2176,6 +2304,7 @@ const (
TIOCSER_TEMT = 0x1
TIOCSETD = 0x5423
TIOCSIG = 0x40045436
TIOCSISO7816 = 0xc0285443
TIOCSLCKTRMIOS = 0x5457
TIOCSPGRP = 0x5410
TIOCSPTLCK = 0x40045431
@ -2216,6 +2345,7 @@ const (
TUNGETVNETBE = 0x800454df
TUNGETVNETHDRSZ = 0x800454d7
TUNGETVNETLE = 0x800454dd
TUNSETCARRIER = 0x400454e2
TUNSETDEBUG = 0x400454c9
TUNSETFILTEREBPF = 0x800454e1
TUNSETGROUP = 0x400454ce
@ -2405,6 +2535,7 @@ const (
XDP_UMEM_REG = 0x4
XDP_ZEROCOPY = 0x4
XENFS_SUPER_MAGIC = 0xabba1974
XFS_SUPER_MAGIC = 0x58465342
XTABS = 0x1800
ZSMALLOC_MAGIC = 0x58295829
)

Some files were not shown because too many files have changed in this diff Show more