mirror of
https://github.com/go-task/task.git
synced 2025-01-12 04:34:11 +02:00
Update dependencies
This commit is contained in:
parent
f98bf6c4b1
commit
09e6d5269d
2
vendor/github.com/BurntSushi/toml/COMPATIBLE
generated
vendored
2
vendor/github.com/BurntSushi/toml/COMPATIBLE
generated
vendored
@ -1,3 +1,3 @@
|
||||
Compatible with TOML version
|
||||
[v0.2.0](https://github.com/mojombo/toml/blob/master/versions/toml-v0.2.0.md)
|
||||
[v0.4.0](https://github.com/toml-lang/toml/blob/v0.4.0/versions/en/toml-v0.4.0.md)
|
||||
|
||||
|
18
vendor/github.com/BurntSushi/toml/README.md
generated
vendored
18
vendor/github.com/BurntSushi/toml/README.md
generated
vendored
@ -1,17 +1,17 @@
|
||||
## TOML parser and encoder for Go with reflection
|
||||
|
||||
TOML stands for Tom's Obvious, Minimal Language. This Go package provides a
|
||||
reflection interface similar to Go's standard library `json` and `xml`
|
||||
reflection interface similar to Go's standard library `json` and `xml`
|
||||
packages. This package also supports the `encoding.TextUnmarshaler` and
|
||||
`encoding.TextMarshaler` interfaces so that you can define custom data
|
||||
`encoding.TextMarshaler` interfaces so that you can define custom data
|
||||
representations. (There is an example of this below.)
|
||||
|
||||
Spec: https://github.com/mojombo/toml
|
||||
Spec: https://github.com/toml-lang/toml
|
||||
|
||||
Compatible with TOML version
|
||||
[v0.2.0](https://github.com/toml-lang/toml/blob/master/versions/en/toml-v0.2.0.md)
|
||||
[v0.4.0](https://github.com/toml-lang/toml/blob/master/versions/en/toml-v0.4.0.md)
|
||||
|
||||
Documentation: http://godoc.org/github.com/BurntSushi/toml
|
||||
Documentation: https://godoc.org/github.com/BurntSushi/toml
|
||||
|
||||
Installation:
|
||||
|
||||
@ -26,8 +26,7 @@ go get github.com/BurntSushi/toml/cmd/tomlv
|
||||
tomlv some-toml-file.toml
|
||||
```
|
||||
|
||||
[![Build status](https://api.travis-ci.org/BurntSushi/toml.png)](https://travis-ci.org/BurntSushi/toml)
|
||||
|
||||
[![Build Status](https://travis-ci.org/BurntSushi/toml.svg?branch=master)](https://travis-ci.org/BurntSushi/toml) [![GoDoc](https://godoc.org/github.com/BurntSushi/toml?status.svg)](https://godoc.org/github.com/BurntSushi/toml)
|
||||
|
||||
### Testing
|
||||
|
||||
@ -87,7 +86,7 @@ type TOML struct {
|
||||
|
||||
### Using the `encoding.TextUnmarshaler` interface
|
||||
|
||||
Here's an example that automatically parses duration strings into
|
||||
Here's an example that automatically parses duration strings into
|
||||
`time.Duration` values:
|
||||
|
||||
```toml
|
||||
@ -120,7 +119,7 @@ for _, s := range favorites.Song {
|
||||
}
|
||||
```
|
||||
|
||||
And you'll also need a `duration` type that satisfies the
|
||||
And you'll also need a `duration` type that satisfies the
|
||||
`encoding.TextUnmarshaler` interface:
|
||||
|
||||
```go
|
||||
@ -217,4 +216,3 @@ Note that a case insensitive match will be tried if an exact match can't be
|
||||
found.
|
||||
|
||||
A working example of the above can be found in `_examples/example.{go,toml}`.
|
||||
|
||||
|
2
vendor/github.com/BurntSushi/toml/doc.go
generated
vendored
2
vendor/github.com/BurntSushi/toml/doc.go
generated
vendored
@ -4,7 +4,7 @@ files via reflection. There is also support for delaying decoding with
|
||||
the Primitive type, and querying the set of keys in a TOML document with the
|
||||
MetaData type.
|
||||
|
||||
The specification implemented: https://github.com/mojombo/toml
|
||||
The specification implemented: https://github.com/toml-lang/toml
|
||||
|
||||
The sub-command github.com/BurntSushi/toml/cmd/tomlv can be used to verify
|
||||
whether a file is a valid TOML document. It can also be used to print the
|
||||
|
2
vendor/github.com/BurntSushi/toml/encode.go
generated
vendored
2
vendor/github.com/BurntSushi/toml/encode.go
generated
vendored
@ -241,7 +241,7 @@ func (enc *Encoder) eArrayOfTables(key Key, rv reflect.Value) {
|
||||
func (enc *Encoder) eTable(key Key, rv reflect.Value) {
|
||||
panicIfInvalidKey(key)
|
||||
if len(key) == 1 {
|
||||
// Output an extra new line between top-level tables.
|
||||
// Output an extra newline between top-level tables.
|
||||
// (The newline isn't written if nothing else has been written though.)
|
||||
enc.newline()
|
||||
}
|
||||
|
261
vendor/github.com/BurntSushi/toml/lex.go
generated
vendored
261
vendor/github.com/BurntSushi/toml/lex.go
generated
vendored
@ -30,24 +30,28 @@ const (
|
||||
itemArrayTableEnd
|
||||
itemKeyStart
|
||||
itemCommentStart
|
||||
itemInlineTableStart
|
||||
itemInlineTableEnd
|
||||
)
|
||||
|
||||
const (
|
||||
eof = 0
|
||||
tableStart = '['
|
||||
tableEnd = ']'
|
||||
arrayTableStart = '['
|
||||
arrayTableEnd = ']'
|
||||
tableSep = '.'
|
||||
keySep = '='
|
||||
arrayStart = '['
|
||||
arrayEnd = ']'
|
||||
arrayValTerm = ','
|
||||
commentStart = '#'
|
||||
stringStart = '"'
|
||||
stringEnd = '"'
|
||||
rawStringStart = '\''
|
||||
rawStringEnd = '\''
|
||||
eof = 0
|
||||
comma = ','
|
||||
tableStart = '['
|
||||
tableEnd = ']'
|
||||
arrayTableStart = '['
|
||||
arrayTableEnd = ']'
|
||||
tableSep = '.'
|
||||
keySep = '='
|
||||
arrayStart = '['
|
||||
arrayEnd = ']'
|
||||
commentStart = '#'
|
||||
stringStart = '"'
|
||||
stringEnd = '"'
|
||||
rawStringStart = '\''
|
||||
rawStringEnd = '\''
|
||||
inlineTableStart = '{'
|
||||
inlineTableEnd = '}'
|
||||
)
|
||||
|
||||
type stateFn func(lx *lexer) stateFn
|
||||
@ -56,11 +60,18 @@ type lexer struct {
|
||||
input string
|
||||
start int
|
||||
pos int
|
||||
width int
|
||||
line int
|
||||
state stateFn
|
||||
items chan item
|
||||
|
||||
// Allow for backing up up to three runes.
|
||||
// This is necessary because TOML contains 3-rune tokens (""" and ''').
|
||||
prevWidths [3]int
|
||||
nprev int // how many of prevWidths are in use
|
||||
// If we emit an eof, we can still back up, but it is not OK to call
|
||||
// next again.
|
||||
atEOF bool
|
||||
|
||||
// A stack of state functions used to maintain context.
|
||||
// The idea is to reuse parts of the state machine in various places.
|
||||
// For example, values can appear at the top level or within arbitrarily
|
||||
@ -88,7 +99,7 @@ func (lx *lexer) nextItem() item {
|
||||
|
||||
func lex(input string) *lexer {
|
||||
lx := &lexer{
|
||||
input: input + "\n",
|
||||
input: input,
|
||||
state: lexTop,
|
||||
line: 1,
|
||||
items: make(chan item, 10),
|
||||
@ -103,7 +114,7 @@ func (lx *lexer) push(state stateFn) {
|
||||
|
||||
func (lx *lexer) pop() stateFn {
|
||||
if len(lx.stack) == 0 {
|
||||
return lx.errorf("BUG in lexer: no states to pop.")
|
||||
return lx.errorf("BUG in lexer: no states to pop")
|
||||
}
|
||||
last := lx.stack[len(lx.stack)-1]
|
||||
lx.stack = lx.stack[0 : len(lx.stack)-1]
|
||||
@ -125,16 +136,25 @@ func (lx *lexer) emitTrim(typ itemType) {
|
||||
}
|
||||
|
||||
func (lx *lexer) next() (r rune) {
|
||||
if lx.atEOF {
|
||||
panic("next called after EOF")
|
||||
}
|
||||
if lx.pos >= len(lx.input) {
|
||||
lx.width = 0
|
||||
lx.atEOF = true
|
||||
return eof
|
||||
}
|
||||
|
||||
if lx.input[lx.pos] == '\n' {
|
||||
lx.line++
|
||||
}
|
||||
r, lx.width = utf8.DecodeRuneInString(lx.input[lx.pos:])
|
||||
lx.pos += lx.width
|
||||
lx.prevWidths[2] = lx.prevWidths[1]
|
||||
lx.prevWidths[1] = lx.prevWidths[0]
|
||||
if lx.nprev < 3 {
|
||||
lx.nprev++
|
||||
}
|
||||
r, w := utf8.DecodeRuneInString(lx.input[lx.pos:])
|
||||
lx.prevWidths[0] = w
|
||||
lx.pos += w
|
||||
return r
|
||||
}
|
||||
|
||||
@ -143,9 +163,20 @@ func (lx *lexer) ignore() {
|
||||
lx.start = lx.pos
|
||||
}
|
||||
|
||||
// backup steps back one rune. Can be called only once per call of next.
|
||||
// backup steps back one rune. Can be called only twice between calls to next.
|
||||
func (lx *lexer) backup() {
|
||||
lx.pos -= lx.width
|
||||
if lx.atEOF {
|
||||
lx.atEOF = false
|
||||
return
|
||||
}
|
||||
if lx.nprev < 1 {
|
||||
panic("backed up too far")
|
||||
}
|
||||
w := lx.prevWidths[0]
|
||||
lx.prevWidths[0] = lx.prevWidths[1]
|
||||
lx.prevWidths[1] = lx.prevWidths[2]
|
||||
lx.nprev--
|
||||
lx.pos -= w
|
||||
if lx.pos < len(lx.input) && lx.input[lx.pos] == '\n' {
|
||||
lx.line--
|
||||
}
|
||||
@ -182,7 +213,7 @@ func (lx *lexer) skip(pred func(rune) bool) {
|
||||
|
||||
// errorf stops all lexing by emitting an error and returning `nil`.
|
||||
// Note that any value that is a character is escaped if it's a special
|
||||
// character (new lines, tabs, etc.).
|
||||
// character (newlines, tabs, etc.).
|
||||
func (lx *lexer) errorf(format string, values ...interface{}) stateFn {
|
||||
lx.items <- item{
|
||||
itemError,
|
||||
@ -198,7 +229,6 @@ func lexTop(lx *lexer) stateFn {
|
||||
if isWhitespace(r) || isNL(r) {
|
||||
return lexSkip(lx, lexTop)
|
||||
}
|
||||
|
||||
switch r {
|
||||
case commentStart:
|
||||
lx.push(lexTop)
|
||||
@ -207,7 +237,7 @@ func lexTop(lx *lexer) stateFn {
|
||||
return lexTableStart
|
||||
case eof:
|
||||
if lx.pos > lx.start {
|
||||
return lx.errorf("Unexpected EOF.")
|
||||
return lx.errorf("unexpected EOF")
|
||||
}
|
||||
lx.emit(itemEOF)
|
||||
return nil
|
||||
@ -222,12 +252,12 @@ func lexTop(lx *lexer) stateFn {
|
||||
|
||||
// lexTopEnd is entered whenever a top-level item has been consumed. (A value
|
||||
// or a table.) It must see only whitespace, and will turn back to lexTop
|
||||
// upon a new line. If it sees EOF, it will quit the lexer successfully.
|
||||
// upon a newline. If it sees EOF, it will quit the lexer successfully.
|
||||
func lexTopEnd(lx *lexer) stateFn {
|
||||
r := lx.next()
|
||||
switch {
|
||||
case r == commentStart:
|
||||
// a comment will read to a new line for us.
|
||||
// a comment will read to a newline for us.
|
||||
lx.push(lexTop)
|
||||
return lexCommentStart
|
||||
case isWhitespace(r):
|
||||
@ -236,11 +266,11 @@ func lexTopEnd(lx *lexer) stateFn {
|
||||
lx.ignore()
|
||||
return lexTop
|
||||
case r == eof:
|
||||
lx.ignore()
|
||||
return lexTop
|
||||
lx.emit(itemEOF)
|
||||
return nil
|
||||
}
|
||||
return lx.errorf("Expected a top-level item to end with a new line, "+
|
||||
"comment or EOF, but got %q instead.", r)
|
||||
return lx.errorf("expected a top-level item to end with a newline, "+
|
||||
"comment, or EOF, but got %q instead", r)
|
||||
}
|
||||
|
||||
// lexTable lexes the beginning of a table. Namely, it makes sure that
|
||||
@ -267,8 +297,8 @@ func lexTableEnd(lx *lexer) stateFn {
|
||||
|
||||
func lexArrayTableEnd(lx *lexer) stateFn {
|
||||
if r := lx.next(); r != arrayTableEnd {
|
||||
return lx.errorf("Expected end of table array name delimiter %q, "+
|
||||
"but got %q instead.", arrayTableEnd, r)
|
||||
return lx.errorf("expected end of table array name delimiter %q, "+
|
||||
"but got %q instead", arrayTableEnd, r)
|
||||
}
|
||||
lx.emit(itemArrayTableEnd)
|
||||
return lexTopEnd
|
||||
@ -278,11 +308,11 @@ func lexTableNameStart(lx *lexer) stateFn {
|
||||
lx.skip(isWhitespace)
|
||||
switch r := lx.peek(); {
|
||||
case r == tableEnd || r == eof:
|
||||
return lx.errorf("Unexpected end of table name. (Table names cannot " +
|
||||
"be empty.)")
|
||||
return lx.errorf("unexpected end of table name " +
|
||||
"(table names cannot be empty)")
|
||||
case r == tableSep:
|
||||
return lx.errorf("Unexpected table separator. (Table names cannot " +
|
||||
"be empty.)")
|
||||
return lx.errorf("unexpected table separator " +
|
||||
"(table names cannot be empty)")
|
||||
case r == stringStart || r == rawStringStart:
|
||||
lx.ignore()
|
||||
lx.push(lexTableNameEnd)
|
||||
@ -317,8 +347,8 @@ func lexTableNameEnd(lx *lexer) stateFn {
|
||||
case r == tableEnd:
|
||||
return lx.pop()
|
||||
default:
|
||||
return lx.errorf("Expected '.' or ']' to end table name, but got %q "+
|
||||
"instead.", r)
|
||||
return lx.errorf("expected '.' or ']' to end table name, "+
|
||||
"but got %q instead", r)
|
||||
}
|
||||
}
|
||||
|
||||
@ -328,7 +358,7 @@ func lexKeyStart(lx *lexer) stateFn {
|
||||
r := lx.peek()
|
||||
switch {
|
||||
case r == keySep:
|
||||
return lx.errorf("Unexpected key separator %q.", keySep)
|
||||
return lx.errorf("unexpected key separator %q", keySep)
|
||||
case isWhitespace(r) || isNL(r):
|
||||
lx.next()
|
||||
return lexSkip(lx, lexKeyStart)
|
||||
@ -359,7 +389,7 @@ func lexBareKey(lx *lexer) stateFn {
|
||||
lx.emit(itemText)
|
||||
return lexKeyEnd
|
||||
default:
|
||||
return lx.errorf("Bare keys cannot contain %q.", r)
|
||||
return lx.errorf("bare keys cannot contain %q", r)
|
||||
}
|
||||
}
|
||||
|
||||
@ -372,7 +402,7 @@ func lexKeyEnd(lx *lexer) stateFn {
|
||||
case isWhitespace(r):
|
||||
return lexSkip(lx, lexKeyEnd)
|
||||
default:
|
||||
return lx.errorf("Expected key separator %q, but got %q instead.",
|
||||
return lx.errorf("expected key separator %q, but got %q instead",
|
||||
keySep, r)
|
||||
}
|
||||
}
|
||||
@ -381,9 +411,8 @@ func lexKeyEnd(lx *lexer) stateFn {
|
||||
// lexValue will ignore whitespace.
|
||||
// After a value is lexed, the last state on the next is popped and returned.
|
||||
func lexValue(lx *lexer) stateFn {
|
||||
// We allow whitespace to precede a value, but NOT new lines.
|
||||
// In array syntax, the array states are responsible for ignoring new
|
||||
// lines.
|
||||
// We allow whitespace to precede a value, but NOT newlines.
|
||||
// In array syntax, the array states are responsible for ignoring newlines.
|
||||
r := lx.next()
|
||||
switch {
|
||||
case isWhitespace(r):
|
||||
@ -397,6 +426,10 @@ func lexValue(lx *lexer) stateFn {
|
||||
lx.ignore()
|
||||
lx.emit(itemArray)
|
||||
return lexArrayValue
|
||||
case inlineTableStart:
|
||||
lx.ignore()
|
||||
lx.emit(itemInlineTableStart)
|
||||
return lexInlineTableValue
|
||||
case stringStart:
|
||||
if lx.accept(stringStart) {
|
||||
if lx.accept(stringStart) {
|
||||
@ -420,7 +453,7 @@ func lexValue(lx *lexer) stateFn {
|
||||
case '+', '-':
|
||||
return lexNumberStart
|
||||
case '.': // special error case, be kind to users
|
||||
return lx.errorf("Floats must start with a digit, not '.'.")
|
||||
return lx.errorf("floats must start with a digit, not '.'")
|
||||
}
|
||||
if unicode.IsLetter(r) {
|
||||
// Be permissive here; lexBool will give a nice error if the
|
||||
@ -430,11 +463,11 @@ func lexValue(lx *lexer) stateFn {
|
||||
lx.backup()
|
||||
return lexBool
|
||||
}
|
||||
return lx.errorf("Expected value but found %q instead.", r)
|
||||
return lx.errorf("expected value but found %q instead", r)
|
||||
}
|
||||
|
||||
// lexArrayValue consumes one value in an array. It assumes that '[' or ','
|
||||
// have already been consumed. All whitespace and new lines are ignored.
|
||||
// have already been consumed. All whitespace and newlines are ignored.
|
||||
func lexArrayValue(lx *lexer) stateFn {
|
||||
r := lx.next()
|
||||
switch {
|
||||
@ -443,10 +476,11 @@ func lexArrayValue(lx *lexer) stateFn {
|
||||
case r == commentStart:
|
||||
lx.push(lexArrayValue)
|
||||
return lexCommentStart
|
||||
case r == arrayValTerm:
|
||||
return lx.errorf("Unexpected array value terminator %q.",
|
||||
arrayValTerm)
|
||||
case r == comma:
|
||||
return lx.errorf("unexpected comma")
|
||||
case r == arrayEnd:
|
||||
// NOTE(caleb): The spec isn't clear about whether you can have
|
||||
// a trailing comma or not, so we'll allow it.
|
||||
return lexArrayEnd
|
||||
}
|
||||
|
||||
@ -455,8 +489,9 @@ func lexArrayValue(lx *lexer) stateFn {
|
||||
return lexValue
|
||||
}
|
||||
|
||||
// lexArrayValueEnd consumes the cruft between values of an array. Namely,
|
||||
// it ignores whitespace and expects either a ',' or a ']'.
|
||||
// lexArrayValueEnd consumes everything between the end of an array value and
|
||||
// the next value (or the end of the array): it ignores whitespace and newlines
|
||||
// and expects either a ',' or a ']'.
|
||||
func lexArrayValueEnd(lx *lexer) stateFn {
|
||||
r := lx.next()
|
||||
switch {
|
||||
@ -465,31 +500,88 @@ func lexArrayValueEnd(lx *lexer) stateFn {
|
||||
case r == commentStart:
|
||||
lx.push(lexArrayValueEnd)
|
||||
return lexCommentStart
|
||||
case r == arrayValTerm:
|
||||
case r == comma:
|
||||
lx.ignore()
|
||||
return lexArrayValue // move on to the next value
|
||||
case r == arrayEnd:
|
||||
return lexArrayEnd
|
||||
}
|
||||
return lx.errorf("Expected an array value terminator %q or an array "+
|
||||
"terminator %q, but got %q instead.", arrayValTerm, arrayEnd, r)
|
||||
return lx.errorf(
|
||||
"expected a comma or array terminator %q, but got %q instead",
|
||||
arrayEnd, r,
|
||||
)
|
||||
}
|
||||
|
||||
// lexArrayEnd finishes the lexing of an array. It assumes that a ']' has
|
||||
// just been consumed.
|
||||
// lexArrayEnd finishes the lexing of an array.
|
||||
// It assumes that a ']' has just been consumed.
|
||||
func lexArrayEnd(lx *lexer) stateFn {
|
||||
lx.ignore()
|
||||
lx.emit(itemArrayEnd)
|
||||
return lx.pop()
|
||||
}
|
||||
|
||||
// lexInlineTableValue consumes one key/value pair in an inline table.
|
||||
// It assumes that '{' or ',' have already been consumed. Whitespace is ignored.
|
||||
func lexInlineTableValue(lx *lexer) stateFn {
|
||||
r := lx.next()
|
||||
switch {
|
||||
case isWhitespace(r):
|
||||
return lexSkip(lx, lexInlineTableValue)
|
||||
case isNL(r):
|
||||
return lx.errorf("newlines not allowed within inline tables")
|
||||
case r == commentStart:
|
||||
lx.push(lexInlineTableValue)
|
||||
return lexCommentStart
|
||||
case r == comma:
|
||||
return lx.errorf("unexpected comma")
|
||||
case r == inlineTableEnd:
|
||||
return lexInlineTableEnd
|
||||
}
|
||||
lx.backup()
|
||||
lx.push(lexInlineTableValueEnd)
|
||||
return lexKeyStart
|
||||
}
|
||||
|
||||
// lexInlineTableValueEnd consumes everything between the end of an inline table
|
||||
// key/value pair and the next pair (or the end of the table):
|
||||
// it ignores whitespace and expects either a ',' or a '}'.
|
||||
func lexInlineTableValueEnd(lx *lexer) stateFn {
|
||||
r := lx.next()
|
||||
switch {
|
||||
case isWhitespace(r):
|
||||
return lexSkip(lx, lexInlineTableValueEnd)
|
||||
case isNL(r):
|
||||
return lx.errorf("newlines not allowed within inline tables")
|
||||
case r == commentStart:
|
||||
lx.push(lexInlineTableValueEnd)
|
||||
return lexCommentStart
|
||||
case r == comma:
|
||||
lx.ignore()
|
||||
return lexInlineTableValue
|
||||
case r == inlineTableEnd:
|
||||
return lexInlineTableEnd
|
||||
}
|
||||
return lx.errorf("expected a comma or an inline table terminator %q, "+
|
||||
"but got %q instead", inlineTableEnd, r)
|
||||
}
|
||||
|
||||
// lexInlineTableEnd finishes the lexing of an inline table.
|
||||
// It assumes that a '}' has just been consumed.
|
||||
func lexInlineTableEnd(lx *lexer) stateFn {
|
||||
lx.ignore()
|
||||
lx.emit(itemInlineTableEnd)
|
||||
return lx.pop()
|
||||
}
|
||||
|
||||
// lexString consumes the inner contents of a string. It assumes that the
|
||||
// beginning '"' has already been consumed and ignored.
|
||||
func lexString(lx *lexer) stateFn {
|
||||
r := lx.next()
|
||||
switch {
|
||||
case r == eof:
|
||||
return lx.errorf("unexpected EOF")
|
||||
case isNL(r):
|
||||
return lx.errorf("Strings cannot contain new lines.")
|
||||
return lx.errorf("strings cannot contain newlines")
|
||||
case r == '\\':
|
||||
lx.push(lexString)
|
||||
return lexStringEscape
|
||||
@ -506,11 +598,12 @@ func lexString(lx *lexer) stateFn {
|
||||
// lexMultilineString consumes the inner contents of a string. It assumes that
|
||||
// the beginning '"""' has already been consumed and ignored.
|
||||
func lexMultilineString(lx *lexer) stateFn {
|
||||
r := lx.next()
|
||||
switch {
|
||||
case r == '\\':
|
||||
switch lx.next() {
|
||||
case eof:
|
||||
return lx.errorf("unexpected EOF")
|
||||
case '\\':
|
||||
return lexMultilineStringEscape
|
||||
case r == stringEnd:
|
||||
case stringEnd:
|
||||
if lx.accept(stringEnd) {
|
||||
if lx.accept(stringEnd) {
|
||||
lx.backup()
|
||||
@ -534,8 +627,10 @@ func lexMultilineString(lx *lexer) stateFn {
|
||||
func lexRawString(lx *lexer) stateFn {
|
||||
r := lx.next()
|
||||
switch {
|
||||
case r == eof:
|
||||
return lx.errorf("unexpected EOF")
|
||||
case isNL(r):
|
||||
return lx.errorf("Strings cannot contain new lines.")
|
||||
return lx.errorf("strings cannot contain newlines")
|
||||
case r == rawStringEnd:
|
||||
lx.backup()
|
||||
lx.emit(itemRawString)
|
||||
@ -547,12 +642,13 @@ func lexRawString(lx *lexer) stateFn {
|
||||
}
|
||||
|
||||
// lexMultilineRawString consumes a raw string. Nothing can be escaped in such
|
||||
// a string. It assumes that the beginning "'" has already been consumed and
|
||||
// a string. It assumes that the beginning "'''" has already been consumed and
|
||||
// ignored.
|
||||
func lexMultilineRawString(lx *lexer) stateFn {
|
||||
r := lx.next()
|
||||
switch {
|
||||
case r == rawStringEnd:
|
||||
switch lx.next() {
|
||||
case eof:
|
||||
return lx.errorf("unexpected EOF")
|
||||
case rawStringEnd:
|
||||
if lx.accept(rawStringEnd) {
|
||||
if lx.accept(rawStringEnd) {
|
||||
lx.backup()
|
||||
@ -605,10 +701,9 @@ func lexStringEscape(lx *lexer) stateFn {
|
||||
case 'U':
|
||||
return lexLongUnicodeEscape
|
||||
}
|
||||
return lx.errorf("Invalid escape character %q. Only the following "+
|
||||
return lx.errorf("invalid escape character %q; only the following "+
|
||||
"escape characters are allowed: "+
|
||||
"\\b, \\t, \\n, \\f, \\r, \\\", \\/, \\\\, "+
|
||||
"\\uXXXX and \\UXXXXXXXX.", r)
|
||||
`\b, \t, \n, \f, \r, \", \\, \uXXXX, and \UXXXXXXXX`, r)
|
||||
}
|
||||
|
||||
func lexShortUnicodeEscape(lx *lexer) stateFn {
|
||||
@ -616,8 +711,8 @@ func lexShortUnicodeEscape(lx *lexer) stateFn {
|
||||
for i := 0; i < 4; i++ {
|
||||
r = lx.next()
|
||||
if !isHexadecimal(r) {
|
||||
return lx.errorf("Expected four hexadecimal digits after '\\u', "+
|
||||
"but got '%s' instead.", lx.current())
|
||||
return lx.errorf(`expected four hexadecimal digits after '\u', `+
|
||||
"but got %q instead", lx.current())
|
||||
}
|
||||
}
|
||||
return lx.pop()
|
||||
@ -628,8 +723,8 @@ func lexLongUnicodeEscape(lx *lexer) stateFn {
|
||||
for i := 0; i < 8; i++ {
|
||||
r = lx.next()
|
||||
if !isHexadecimal(r) {
|
||||
return lx.errorf("Expected eight hexadecimal digits after '\\U', "+
|
||||
"but got '%s' instead.", lx.current())
|
||||
return lx.errorf(`expected eight hexadecimal digits after '\U', `+
|
||||
"but got %q instead", lx.current())
|
||||
}
|
||||
}
|
||||
return lx.pop()
|
||||
@ -647,9 +742,9 @@ func lexNumberOrDateStart(lx *lexer) stateFn {
|
||||
case 'e', 'E':
|
||||
return lexFloat
|
||||
case '.':
|
||||
return lx.errorf("Floats must start with a digit, not '.'.")
|
||||
return lx.errorf("floats must start with a digit, not '.'")
|
||||
}
|
||||
return lx.errorf("Expected a digit but got %q.", r)
|
||||
return lx.errorf("expected a digit but got %q", r)
|
||||
}
|
||||
|
||||
// lexNumberOrDate consumes either an integer, float or datetime.
|
||||
@ -697,9 +792,9 @@ func lexNumberStart(lx *lexer) stateFn {
|
||||
r := lx.next()
|
||||
if !isDigit(r) {
|
||||
if r == '.' {
|
||||
return lx.errorf("Floats must start with a digit, not '.'.")
|
||||
return lx.errorf("floats must start with a digit, not '.'")
|
||||
}
|
||||
return lx.errorf("Expected a digit but got %q.", r)
|
||||
return lx.errorf("expected a digit but got %q", r)
|
||||
}
|
||||
return lexNumber
|
||||
}
|
||||
@ -745,7 +840,7 @@ func lexBool(lx *lexer) stateFn {
|
||||
var rs []rune
|
||||
for {
|
||||
r := lx.next()
|
||||
if r == eof || isWhitespace(r) || isNL(r) {
|
||||
if !unicode.IsLetter(r) {
|
||||
lx.backup()
|
||||
break
|
||||
}
|
||||
@ -757,7 +852,7 @@ func lexBool(lx *lexer) stateFn {
|
||||
lx.emit(itemBool)
|
||||
return lx.pop()
|
||||
}
|
||||
return lx.errorf("Expected value but found %q instead.", s)
|
||||
return lx.errorf("expected value but found %q instead", s)
|
||||
}
|
||||
|
||||
// lexCommentStart begins the lexing of a comment. It will emit
|
||||
@ -769,7 +864,7 @@ func lexCommentStart(lx *lexer) stateFn {
|
||||
}
|
||||
|
||||
// lexComment lexes an entire comment. It assumes that '#' has been consumed.
|
||||
// It will consume *up to* the first new line character, and pass control
|
||||
// It will consume *up to* the first newline character, and pass control
|
||||
// back to the last state on the stack.
|
||||
func lexComment(lx *lexer) stateFn {
|
||||
r := lx.peek()
|
||||
|
35
vendor/github.com/BurntSushi/toml/parse.go
generated
vendored
35
vendor/github.com/BurntSushi/toml/parse.go
generated
vendored
@ -269,6 +269,41 @@ func (p *parser) value(it item) (interface{}, tomlType) {
|
||||
types = append(types, typ)
|
||||
}
|
||||
return array, p.typeOfArray(types)
|
||||
case itemInlineTableStart:
|
||||
var (
|
||||
hash = make(map[string]interface{})
|
||||
outerContext = p.context
|
||||
outerKey = p.currentKey
|
||||
)
|
||||
|
||||
p.context = append(p.context, p.currentKey)
|
||||
p.currentKey = ""
|
||||
for it := p.next(); it.typ != itemInlineTableEnd; it = p.next() {
|
||||
if it.typ != itemKeyStart {
|
||||
p.bug("Expected key start but instead found %q, around line %d",
|
||||
it.val, p.approxLine)
|
||||
}
|
||||
if it.typ == itemCommentStart {
|
||||
p.expect(itemText)
|
||||
continue
|
||||
}
|
||||
|
||||
// retrieve key
|
||||
k := p.next()
|
||||
p.approxLine = k.line
|
||||
kname := p.keyString(k)
|
||||
|
||||
// retrieve value
|
||||
p.currentKey = kname
|
||||
val, typ := p.value(p.next())
|
||||
// make sure we keep metadata up to date
|
||||
p.setType(kname, typ)
|
||||
p.ordered = append(p.ordered, p.context.add(p.currentKey))
|
||||
hash[kname] = val
|
||||
}
|
||||
p.context = outerContext
|
||||
p.currentKey = outerKey
|
||||
return hash, tomlHash
|
||||
}
|
||||
p.bug("Unexpected value type: %s", it.typ)
|
||||
panic("unreachable")
|
||||
|
12
vendor/github.com/Masterminds/semver/CHANGELOG.md
generated
vendored
12
vendor/github.com/Masterminds/semver/CHANGELOG.md
generated
vendored
@ -1,3 +1,15 @@
|
||||
# 1.3.0 (2017-05-02)
|
||||
|
||||
## Added
|
||||
- #45: Added json (un)marshaling support (thanks @mh-cbon)
|
||||
- Stability marker. See https://masterminds.github.io/stability/
|
||||
|
||||
## Fixed
|
||||
- #51: Fix handling of single digit tilde constraint (thanks @dgodd)
|
||||
|
||||
## Changed
|
||||
- #55: The godoc icon moved from png to svg
|
||||
|
||||
# 1.2.3 (2017-04-03)
|
||||
|
||||
## Fixed
|
||||
|
2
vendor/github.com/Masterminds/semver/README.md
generated
vendored
2
vendor/github.com/Masterminds/semver/README.md
generated
vendored
@ -9,7 +9,7 @@ The `semver` package provides the ability to work with [Semantic Versions](http:
|
||||
|
||||
[![Stability:
|
||||
Active](https://masterminds.github.io/stability/active.svg)](https://masterminds.github.io/stability/active.html)
|
||||
[![Build Status](https://travis-ci.org/Masterminds/semver.svg)](https://travis-ci.org/Masterminds/semver) [![Build status](https://ci.appveyor.com/api/projects/status/jfk66lib7hb985k8/branch/master?svg=true&passingText=windows%20build%20passing&failingText=windows%20build%20failing)](https://ci.appveyor.com/project/mattfarina/semver/branch/master) [![GoDoc](https://godoc.org/github.com/Masterminds/semver?status.png)](https://godoc.org/github.com/Masterminds/semver) [![Go Report Card](https://goreportcard.com/badge/github.com/Masterminds/semver)](https://goreportcard.com/report/github.com/Masterminds/semver)
|
||||
[![Build Status](https://travis-ci.org/Masterminds/semver.svg)](https://travis-ci.org/Masterminds/semver) [![Build status](https://ci.appveyor.com/api/projects/status/jfk66lib7hb985k8/branch/master?svg=true&passingText=windows%20build%20passing&failingText=windows%20build%20failing)](https://ci.appveyor.com/project/mattfarina/semver/branch/master) [![GoDoc](https://godoc.org/github.com/Masterminds/semver?status.svg)](https://godoc.org/github.com/Masterminds/semver) [![Go Report Card](https://goreportcard.com/badge/github.com/Masterminds/semver)](https://goreportcard.com/report/github.com/Masterminds/semver)
|
||||
|
||||
## Parsing Semantic Versions
|
||||
|
||||
|
2
vendor/github.com/Masterminds/semver/constraints.go
generated
vendored
2
vendor/github.com/Masterminds/semver/constraints.go
generated
vendored
@ -175,7 +175,7 @@ func parseConstraint(c string) (*constraint, error) {
|
||||
if isX(m[3]) {
|
||||
ver = "0.0.0"
|
||||
dirty = true
|
||||
} else if isX(strings.TrimPrefix(m[4], ".")) {
|
||||
} else if isX(strings.TrimPrefix(m[4], ".")) || m[4] == "" {
|
||||
minorDirty = true
|
||||
dirty = true
|
||||
ver = fmt.Sprintf("%s.0.0%s", m[3], m[6])
|
||||
|
26
vendor/github.com/Masterminds/semver/version.go
generated
vendored
26
vendor/github.com/Masterminds/semver/version.go
generated
vendored
@ -2,6 +2,7 @@ package semver
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"regexp"
|
||||
@ -291,6 +292,31 @@ func (v *Version) Compare(o *Version) int {
|
||||
return comparePrerelease(ps, po)
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements JSON.Unmarshaler interface.
|
||||
func (v *Version) UnmarshalJSON(b []byte) error {
|
||||
var s string
|
||||
if err := json.Unmarshal(b, &s); err != nil {
|
||||
return err
|
||||
}
|
||||
temp, err := NewVersion(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
v.major = temp.major
|
||||
v.minor = temp.minor
|
||||
v.patch = temp.patch
|
||||
v.pre = temp.pre
|
||||
v.metadata = temp.metadata
|
||||
v.original = temp.original
|
||||
temp = nil
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalJSON implements JSON.Marshaler interface.
|
||||
func (v *Version) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.String())
|
||||
}
|
||||
|
||||
func compareSegment(v, o int64) int {
|
||||
if v < o {
|
||||
return -1
|
||||
|
10
vendor/github.com/Masterminds/sprig/dict.go
generated
vendored
10
vendor/github.com/Masterminds/sprig/dict.go
generated
vendored
@ -1,5 +1,7 @@
|
||||
package sprig
|
||||
|
||||
import "github.com/imdario/mergo"
|
||||
|
||||
func set(d map[string]interface{}, key string, value interface{}) map[string]interface{} {
|
||||
d[key] = value
|
||||
return d
|
||||
@ -72,3 +74,11 @@ func dict(v ...interface{}) map[string]interface{} {
|
||||
}
|
||||
return dict
|
||||
}
|
||||
|
||||
func merge(dst map[string]interface{}, src map[string]interface{}) interface{} {
|
||||
if err := mergo.Merge(&dst, src); err != nil {
|
||||
// Swallow errors inside of a template.
|
||||
return ""
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
6
vendor/github.com/Masterminds/sprig/doc.go
generated
vendored
6
vendor/github.com/Masterminds/sprig/doc.go
generated
vendored
@ -19,7 +19,7 @@ Date Functions
|
||||
- date FORMAT TIME: Format a date, where a date is an integer type or a time.Time type, and
|
||||
format is a time.Format formatting string.
|
||||
- dateModify: Given a date, modify it with a duration: `date_modify "-1.5h" now`. If the duration doesn't
|
||||
parse, it returns the time unaltered. See `time.ParseDuration` for info on duration strings.
|
||||
parse, it returns the time unaltered. See `time.ParseDuration` for info on duration strings.
|
||||
- now: Current time.Time, for feeding into date-related functions.
|
||||
- htmlDate TIME: Format a date for use in the value field of an HTML "date" form element.
|
||||
- dateInZone FORMAT TIME TZ: Like date, but takes three arguments: format, timestamp,
|
||||
@ -68,7 +68,7 @@ String Slice Functions:
|
||||
- split: strings.Split, but as `split SEP STRING`. The results are returned
|
||||
as a map with the indexes set to _N, where N is an integer starting from 0.
|
||||
Use it like this: `{{$v := "foo/bar/baz" | split "/"}}{{$v._0}}` (Prints `foo`)
|
||||
- splitList: strings.Split, but as `split SEP STRING`. The results are returned
|
||||
- splitList: strings.Split, but as `split SEP STRING`. The results are returned
|
||||
as an array.
|
||||
- toStrings: convert a list to a list of strings. 'list 1 2 3 | toStrings' produces '["1" "2" "3"]'
|
||||
- sortAlpha: sort a list lexicographically.
|
||||
@ -114,7 +114,7 @@ File Paths:
|
||||
- base: Return the last element of a path. https://golang.org/pkg/path#Base
|
||||
- dir: Remove the last element of a path. https://golang.org/pkg/path#Dir
|
||||
- clean: Clean a path to the shortest equivalent name. (e.g. remove "foo/.."
|
||||
from "foo/../bar.html") https://golang.org/pkg/path#Clean
|
||||
from "foo/../bar.html") https://golang.org/pkg/path#Clean
|
||||
- ext: https://golang.org/pkg/path#Ext
|
||||
- isAbs: https://golang.org/pkg/path#IsAbs
|
||||
|
||||
|
20
vendor/github.com/Masterminds/sprig/functions.go
generated
vendored
20
vendor/github.com/Masterminds/sprig/functions.go
generated
vendored
@ -1,6 +1,7 @@
|
||||
package sprig
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"html/template"
|
||||
"os"
|
||||
"path"
|
||||
@ -10,6 +11,7 @@ import (
|
||||
"time"
|
||||
|
||||
util "github.com/aokoli/goutils"
|
||||
"github.com/huandu/xstrings"
|
||||
)
|
||||
|
||||
// Produce the function map.
|
||||
@ -122,6 +124,9 @@ var genericMap = map[string]interface{}{
|
||||
"randAscii": randAscii,
|
||||
"randNumeric": randNumeric,
|
||||
"swapcase": util.SwapCase,
|
||||
"shuffle": xstrings.Shuffle,
|
||||
"snakecase": xstrings.ToSnakeCase,
|
||||
"camelcase": xstrings.ToCamelCase,
|
||||
"wrap": func(l int, s string) string { return util.Wrap(s, l) },
|
||||
"wrapWith": func(l int, sep, str string) string { return util.WrapCustom(str, l, sep, true) },
|
||||
// Switch order so that "foobar" | contains "foo"
|
||||
@ -178,6 +183,9 @@ var genericMap = map[string]interface{}{
|
||||
"biggest": max,
|
||||
"max": max,
|
||||
"min": min,
|
||||
"ceil": ceil,
|
||||
"floor": floor,
|
||||
"round": round,
|
||||
|
||||
// string slices. Note that we reverse the order b/c that's better
|
||||
// for template processing.
|
||||
@ -227,6 +235,7 @@ var genericMap = map[string]interface{}{
|
||||
"keys": keys,
|
||||
"pick": pick,
|
||||
"omit": omit,
|
||||
"merge": merge,
|
||||
|
||||
"append": push, "push": push,
|
||||
"prepend": prepend,
|
||||
@ -249,4 +258,15 @@ var genericMap = map[string]interface{}{
|
||||
// SemVer:
|
||||
"semver": semver,
|
||||
"semverCompare": semverCompare,
|
||||
|
||||
// Flow Control:
|
||||
"fail": func(msg string) (string, error) { return "", errors.New(msg) },
|
||||
|
||||
// Regex
|
||||
"regexMatch": regexMatch,
|
||||
"regexFindAll": regexFindAll,
|
||||
"regexFind": regexFind,
|
||||
"regexReplaceAll": regexReplaceAll,
|
||||
"regexReplaceAllLiteral": regexReplaceAllLiteral,
|
||||
"regexSplit": regexSplit,
|
||||
}
|
||||
|
28
vendor/github.com/Masterminds/sprig/glide.lock
generated
vendored
28
vendor/github.com/Masterminds/sprig/glide.lock
generated
vendored
@ -1,8 +1,12 @@
|
||||
hash: d366098dbe0d3a7bc5afdc55b91fb2a75e3443ff976e1a3b87a79e22cfead454
|
||||
updated: 2017-04-07T09:31:43.889475111-06:00
|
||||
hash: b9cc40bfd6dde74a94103b96700df1a9ab29a7fff5650216cf5a05f4fe72fb73
|
||||
updated: 2017-05-02T16:01:04.617727646-06:00
|
||||
imports:
|
||||
- name: github.com/aokoli/goutils
|
||||
version: 9c37978a95bd5c709a15883b6242714ea6709e64
|
||||
- name: github.com/huandu/xstrings
|
||||
version: 3959339b333561bf62a38b424fd41517c2c90f40
|
||||
- name: github.com/imdario/mergo
|
||||
version: 3e95a51e0639b4cf372f2ccf74c86749d747fbdc
|
||||
- name: github.com/Masterminds/goutils
|
||||
version: 45307ec16e3cd47cd841506c081f7afd8237d210
|
||||
- name: github.com/Masterminds/semver
|
||||
@ -10,10 +14,20 @@ imports:
|
||||
- name: github.com/satori/go.uuid
|
||||
version: 879c5887cd475cd7864858769793b2ceb0d44feb
|
||||
- name: github.com/stretchr/testify
|
||||
version: 4d4bfba8f1d1027c4fdbe371823030df51419987
|
||||
- name: golang.org/x/crypto
|
||||
version: 420870623a70591d5e0b187c77c95455a1224ca6
|
||||
version: e3a8ff8ce36581f87a15341206f205b1da467059
|
||||
subpackages:
|
||||
- assert
|
||||
- name: golang.org/x/crypto
|
||||
version: d172538b2cfce0c13cee31e647d0367aa8cd2486
|
||||
subpackages:
|
||||
- scrypt
|
||||
- pbkdf2
|
||||
devImports: []
|
||||
- scrypt
|
||||
testImports:
|
||||
- name: github.com/davecgh/go-spew
|
||||
version: 5215b55f46b2b919f50a1df0eaa5886afe4e3b3d
|
||||
subpackages:
|
||||
- spew
|
||||
- name: github.com/pmezard/go-difflib
|
||||
version: d8ed2627bdf02c080bf22230dbb337003b7aba2d
|
||||
subpackages:
|
||||
- difflib
|
||||
|
3
vendor/github.com/Masterminds/sprig/glide.yaml
generated
vendored
3
vendor/github.com/Masterminds/sprig/glide.yaml
generated
vendored
@ -10,3 +10,6 @@ import:
|
||||
- package: github.com/Masterminds/semver
|
||||
version: v1.2.2
|
||||
- package: github.com/stretchr/testify
|
||||
- package: github.com/imdario/mergo
|
||||
version: ~0.2.2
|
||||
- package: github.com/huandu/xstrings
|
||||
|
30
vendor/github.com/Masterminds/sprig/numeric.go
generated
vendored
30
vendor/github.com/Masterminds/sprig/numeric.go
generated
vendored
@ -127,3 +127,33 @@ func untilStep(start, stop, step int) []int {
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
func floor(a interface{}) float64 {
|
||||
aa := toFloat64(a)
|
||||
return math.Floor(aa)
|
||||
}
|
||||
|
||||
func ceil(a interface{}) float64 {
|
||||
aa := toFloat64(a)
|
||||
return math.Ceil(aa)
|
||||
}
|
||||
|
||||
func round(a interface{}, p int, r_opt ...float64) float64 {
|
||||
roundOn := .5
|
||||
if len(r_opt) > 0 {
|
||||
roundOn = r_opt[0]
|
||||
}
|
||||
val := toFloat64(a)
|
||||
places := toFloat64(p)
|
||||
|
||||
var round float64
|
||||
pow := math.Pow(10, places)
|
||||
digit := pow * val
|
||||
_, div := math.Modf(digit)
|
||||
if div >= roundOn {
|
||||
round = math.Ceil(digit)
|
||||
} else {
|
||||
round = math.Floor(digit)
|
||||
}
|
||||
return round / pow
|
||||
}
|
35
vendor/github.com/Masterminds/sprig/regex.go
generated
vendored
Normal file
35
vendor/github.com/Masterminds/sprig/regex.go
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
package sprig
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
)
|
||||
|
||||
func regexMatch(regex string, s string) bool {
|
||||
match, _ := regexp.MatchString(regex, s)
|
||||
return match
|
||||
}
|
||||
|
||||
func regexFindAll(regex string, s string, n int) []string {
|
||||
r := regexp.MustCompile(regex)
|
||||
return r.FindAllString(s, n)
|
||||
}
|
||||
|
||||
func regexFind(regex string, s string) string {
|
||||
r := regexp.MustCompile(regex)
|
||||
return r.FindString(s)
|
||||
}
|
||||
|
||||
func regexReplaceAll(regex string, s string, repl string) string {
|
||||
r := regexp.MustCompile(regex)
|
||||
return r.ReplaceAllString(s, repl)
|
||||
}
|
||||
|
||||
func regexReplaceAllLiteral(regex string, s string, repl string) string {
|
||||
r := regexp.MustCompile(regex)
|
||||
return r.ReplaceAllLiteralString(s, repl)
|
||||
}
|
||||
|
||||
func regexSplit(regex string, s string, n int) []string {
|
||||
r := regexp.MustCompile(regex)
|
||||
return r.Split(s, n)
|
||||
}
|
8
vendor/github.com/aokoli/goutils/CHANGELOG.md
generated
vendored
Normal file
8
vendor/github.com/aokoli/goutils/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
# 1.0.1 (2017-05-31)
|
||||
|
||||
## Fixed
|
||||
- #21: Fix generation of alphanumeric strings (thanks @dbarranco)
|
||||
|
||||
# 1.0.0 (2014-04-30)
|
||||
|
||||
- Initial release.
|
28
vendor/github.com/aokoli/goutils/README.md
generated
vendored
28
vendor/github.com/aokoli/goutils/README.md
generated
vendored
@ -1,9 +1,10 @@
|
||||
GoUtils
|
||||
===========
|
||||
[![Stability: Maintenance](https://masterminds.github.io/stability/maintenance.svg)](https://masterminds.github.io/stability/maintenance.html)
|
||||
[![GoDoc](https://godoc.org/github.com/Masterminds/goutils?status.png)](https://godoc.org/github.com/Masterminds/goutils)
|
||||
[![GoDoc](https://godoc.org/github.com/Masterminds/goutils?status.png)](https://godoc.org/github.com/Masterminds/goutils) [![Build Status](https://travis-ci.org/Masterminds/goutils.svg?branch=master)](https://travis-ci.org/Masterminds/goutils) [![Build status](https://ci.appveyor.com/api/projects/status/sc2b1ew0m7f0aiju?svg=true)](https://ci.appveyor.com/project/mattfarina/goutils)
|
||||
|
||||
GoUtils provides users with utility functions to manipulate strings in various ways. It is a Go implementation of some
|
||||
|
||||
GoUtils provides users with utility functions to manipulate strings in various ways. It is a Go implementation of some
|
||||
string manipulation libraries of Java Apache Commons. GoUtils includes the following Java Apache Commons classes:
|
||||
* WordUtils
|
||||
* RandomStringUtils
|
||||
@ -13,11 +14,11 @@ string manipulation libraries of Java Apache Commons. GoUtils includes the follo
|
||||
If you have Go set up on your system, from the GOPATH directory within the command line/terminal, enter this:
|
||||
|
||||
go get github.com/Masterminds/goutils
|
||||
|
||||
|
||||
If you do not have Go set up on your system, please follow the [Go installation directions from the documenation](http://golang.org/doc/install), and then follow the instructions above to install GoUtils.
|
||||
|
||||
|
||||
## Documentation
|
||||
## Documentation
|
||||
GoUtils doc is available here: [![GoDoc](https://godoc.org/github.com/Masterminds/goutils?status.png)](https://godoc.org/github.com/Masterminds/goutils)
|
||||
|
||||
|
||||
@ -25,12 +26,12 @@ GoUtils doc is available here: [![GoDoc](https://godoc.org/github.com/Mastermind
|
||||
The code snippets below show examples of how to use GoUtils. Some functions return errors while others do not. The first instance below, which does not return an error, is the `Initials` function (located within the `wordutils.go` file).
|
||||
|
||||
package main
|
||||
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/Masterminds/goutils"
|
||||
)
|
||||
|
||||
|
||||
func main() {
|
||||
|
||||
// EXAMPLE 1: A goutils function which returns no errors
|
||||
@ -40,35 +41,30 @@ The code snippets below show examples of how to use GoUtils. Some functions retu
|
||||
Some functions return errors mainly due to illegal arguements used as parameters. The code example below illustrates how to deal with function that returns an error. In this instance, the function is the `Random` function (located within the `randomstringutils.go` file).
|
||||
|
||||
package main
|
||||
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/Masterminds/goutils"
|
||||
)
|
||||
|
||||
|
||||
func main() {
|
||||
|
||||
// EXAMPLE 2: A goutils function which returns an error
|
||||
rand1, err1 := goutils.Random (-1, 0, 0, true, true)
|
||||
|
||||
if err1 != nil {
|
||||
if err1 != nil {
|
||||
fmt.Println(err1) // Prints out error message because -1 was entered as the first parameter in goutils.Random(...)
|
||||
} else {
|
||||
fmt.Println(rand1)
|
||||
fmt.Println(rand1)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
## License
|
||||
GoUtils is licensed under the Apache License, Version 2.0. Please check the LICENSE.txt file or visit http://www.apache.org/licenses/LICENSE-2.0 for a copy of the license.
|
||||
GoUtils is licensed under the Apache License, Version 2.0. Please check the LICENSE.txt file or visit http://www.apache.org/licenses/LICENSE-2.0 for a copy of the license.
|
||||
|
||||
## Issue Reporting
|
||||
Make suggestions or report issues using the Git issue tracker: https://github.com/Masterminds/goutils/issues
|
||||
|
||||
## Website
|
||||
* [GoUtils webpage](http://Masterminds.github.io/goutils/)
|
||||
|
||||
## Mailing List
|
||||
Contact [okolialex@gmail.com](mailto:okolialex@mail.com) to be added to the mailing list. You will get updates on the
|
||||
status of the project and the potential direction it will be heading.
|
||||
|
||||
|
21
vendor/github.com/aokoli/goutils/appveyor.yml
generated
vendored
Normal file
21
vendor/github.com/aokoli/goutils/appveyor.yml
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
version: build-{build}.{branch}
|
||||
|
||||
clone_folder: C:\gopath\src\github.com\Masterminds\goutils
|
||||
shallow_clone: true
|
||||
|
||||
environment:
|
||||
GOPATH: C:\gopath
|
||||
|
||||
platform:
|
||||
- x64
|
||||
|
||||
build: off
|
||||
|
||||
install:
|
||||
- go version
|
||||
- go env
|
||||
|
||||
test_script:
|
||||
- go test -v
|
||||
|
||||
deploy: off
|
20
vendor/github.com/aokoli/goutils/randomstringutils.go
generated
vendored
20
vendor/github.com/aokoli/goutils/randomstringutils.go
generated
vendored
@ -20,6 +20,7 @@ import (
|
||||
"fmt"
|
||||
"math"
|
||||
"math/rand"
|
||||
"regexp"
|
||||
"time"
|
||||
"unicode"
|
||||
)
|
||||
@ -101,7 +102,24 @@ Returns:
|
||||
error - an error stemming from an invalid parameter within underlying function, RandomSeed(...)
|
||||
*/
|
||||
func RandomAlphaNumeric(count int) (string, error) {
|
||||
return Random(count, 0, 0, true, true)
|
||||
RandomString, err := Random(count, 0, 0, true, true)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("Error: %s", err)
|
||||
}
|
||||
match, err := regexp.MatchString("([0-9]+)", RandomString)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if !match {
|
||||
//Get the position between 0 and the length of the string-1 to insert a random number
|
||||
position := rand.Intn(count)
|
||||
//Insert a random number between [0-9] in the position
|
||||
RandomString = RandomString[:position] + string('0'+rand.Intn(10)) + RandomString[position+1:]
|
||||
return RandomString, err
|
||||
}
|
||||
return RandomString, err
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
23
vendor/github.com/huandu/xstrings/CONTRIBUTING.md
generated
vendored
Normal file
23
vendor/github.com/huandu/xstrings/CONTRIBUTING.md
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
# Contributing #
|
||||
|
||||
Thanks for your contribution in advance. No matter what you will contribute to this project, pull request or bug report or feature discussion, it's always highly appreciated.
|
||||
|
||||
## New API or feature ##
|
||||
|
||||
I want to speak more about how to add new functions to this package.
|
||||
|
||||
Package `xstring` is a collection of useful string functions which should be implemented in Go. It's a bit subject to say which function should be included and which should not. I set up following rules in order to make it clear and as objective as possible.
|
||||
|
||||
* Rule 1: Only string algorithm, which takes string as input, can be included.
|
||||
* Rule 2: If a function has been implemented in package `string`, it must not be included.
|
||||
* Rule 3: If a function is not language neutral, it must not be included.
|
||||
* Rule 4: If a function is a part of standard library in other languages, it can be included.
|
||||
* Rule 5: If a function is quite useful in some famous framework or library, it can be included.
|
||||
|
||||
New function must be discussed in project issues before submitting any code. If a pull request with new functions is sent without any ref issue, it will be rejected.
|
||||
|
||||
## Pull request ##
|
||||
|
||||
Pull request is always welcome. Just make sure you have run `go fmt` and all test cases passed before submit.
|
||||
|
||||
If the pull request is to add a new API or feature, don't forget to update README.md and add new API in function list.
|
22
vendor/github.com/huandu/xstrings/LICENSE
generated
vendored
Normal file
22
vendor/github.com/huandu/xstrings/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Huan Du
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
114
vendor/github.com/huandu/xstrings/README.md
generated
vendored
Normal file
114
vendor/github.com/huandu/xstrings/README.md
generated
vendored
Normal file
@ -0,0 +1,114 @@
|
||||
# xstrings #
|
||||
|
||||
[![Build Status](https://travis-ci.org/huandu/xstrings.png?branch=master)](https://travis-ci.org/huandu/xstrings)
|
||||
[![GoDoc](https://godoc.org/github.com/huandu/xstrings?status.svg)](https://godoc.org/github.com/huandu/xstrings)
|
||||
|
||||
Go package [xstrings](https://godoc.org/github.com/huandu/xstrings) is a collection of string functions, which are widely used in other languages but absent in Go package [strings](http://golang.org/pkg/strings).
|
||||
|
||||
All functions are well tested and carefully tuned for performance.
|
||||
|
||||
## Propose a new function ##
|
||||
|
||||
Please review [contributing guideline](CONTRIBUTING.md) and [create new issue](https://github.com/huandu/xstrings/issues) to state why it should be included.
|
||||
|
||||
## Install ##
|
||||
|
||||
Use `go get` to install this library.
|
||||
|
||||
go get github.com/huandu/xstrings
|
||||
|
||||
## API document ##
|
||||
|
||||
See [GoDoc](https://godoc.org/github.com/huandu/xstrings) for full document.
|
||||
|
||||
## Function list ##
|
||||
|
||||
Go functions have a unique naming style. One, who has experience in other language but new in Go, may have difficulties to find out right string function to use.
|
||||
|
||||
Here is a list of functions in [strings](http://golang.org/pkg/strings) and [xstrings](https://godoc.org/github.com/huandu/xstrings) with enough extra information about how to map these functions to their friends in other languages. Hope this list could be helpful for fresh gophers.
|
||||
|
||||
### Package `xstrings` functions ###
|
||||
|
||||
*Keep this table sorted by Function in ascending order.*
|
||||
|
||||
| Function | Friends | # |
|
||||
| -------- | ------- | --- |
|
||||
| [Center](https://godoc.org/github.com/huandu/xstrings#Center) | `str.center` in Python; `String#center` in Ruby | [#30](https://github.com/huandu/xstrings/issues/30) |
|
||||
| [Count](https://godoc.org/github.com/huandu/xstrings#Count) | `String#count` in Ruby | [#16](https://github.com/huandu/xstrings/issues/16) |
|
||||
| [Delete](https://godoc.org/github.com/huandu/xstrings#Delete) | `String#delete` in Ruby | [#17](https://github.com/huandu/xstrings/issues/17) |
|
||||
| [ExpandTabs](https://godoc.org/github.com/huandu/xstrings#ExpandTabs) | `str.expandtabs` in Python | [#27](https://github.com/huandu/xstrings/issues/27) |
|
||||
| [FirstRuneToLower](https://godoc.org/github.com/huandu/xstrings#FirstRuneToLower) | `lcfirst` in PHP or Perl | [#15](https://github.com/huandu/xstrings/issues/15) |
|
||||
| [FirstRuneToUpper](https://godoc.org/github.com/huandu/xstrings#FirstRuneToUpper) | `String#capitalize` in Ruby; `ucfirst` in PHP or Perl | [#15](https://github.com/huandu/xstrings/issues/15) |
|
||||
| [Insert](https://godoc.org/github.com/huandu/xstrings#Insert) | `String#insert` in Ruby | [#18](https://github.com/huandu/xstrings/issues/18) |
|
||||
| [LastPartition](https://godoc.org/github.com/huandu/xstrings#LastPartition) | `str.rpartition` in Python; `String#rpartition` in Ruby | [#19](https://github.com/huandu/xstrings/issues/19) |
|
||||
| [LeftJustify](https://godoc.org/github.com/huandu/xstrings#LeftJustify) | `str.ljust` in Python; `String#ljust` in Ruby | [#28](https://github.com/huandu/xstrings/issues/28) |
|
||||
| [Len](https://godoc.org/github.com/huandu/xstrings#Len) | `mb_strlen` in PHP | [#23](https://github.com/huandu/xstrings/issues/23) |
|
||||
| [Partition](https://godoc.org/github.com/huandu/xstrings#Partition) | `str.partition` in Python; `String#partition` in Ruby | [#10](https://github.com/huandu/xstrings/issues/10) |
|
||||
| [Reverse](https://godoc.org/github.com/huandu/xstrings#Reverse) | `String#reverse` in Ruby; `strrev` in PHP; `reverse` in Perl | [#7](https://github.com/huandu/xstrings/issues/7) |
|
||||
| [RightJustify](https://godoc.org/github.com/huandu/xstrings#RightJustify) | `str.rjust` in Python; `String#rjust` in Ruby | [#29](https://github.com/huandu/xstrings/issues/29) |
|
||||
| [RuneWidth](https://godoc.org/github.com/huandu/xstrings#RuneWidth) | - | [#27](https://github.com/huandu/xstrings/issues/27) |
|
||||
| [Scrub](https://godoc.org/github.com/huandu/xstrings#Scrub) | `String#scrub` in Ruby | [#20](https://github.com/huandu/xstrings/issues/20) |
|
||||
| [Shuffle](https://godoc.org/github.com/huandu/xstrings#Shuffle) | `str_shuffle` in PHP | [#13](https://github.com/huandu/xstrings/issues/13) |
|
||||
| [ShuffleSource](https://godoc.org/github.com/huandu/xstrings#ShuffleSource) | `str_shuffle` in PHP | [#13](https://github.com/huandu/xstrings/issues/13) |
|
||||
| [Slice](https://godoc.org/github.com/huandu/xstrings#Slice) | `mb_substr` in PHP | [#9](https://github.com/huandu/xstrings/issues/9) |
|
||||
| [Squeeze](https://godoc.org/github.com/huandu/xstrings#Squeeze) | `String#squeeze` in Ruby | [#11](https://github.com/huandu/xstrings/issues/11) |
|
||||
| [Successor](https://godoc.org/github.com/huandu/xstrings#Successor) | `String#succ` or `String#next` in Ruby | [#22](https://github.com/huandu/xstrings/issues/22) |
|
||||
| [SwapCase](https://godoc.org/github.com/huandu/xstrings#SwapCase) | `str.swapcase` in Python; `String#swapcase` in Ruby | [#12](https://github.com/huandu/xstrings/issues/12) |
|
||||
| [ToCamelCase](https://godoc.org/github.com/huandu/xstrings#ToCamelCase) | `String#camelize` in RoR | [#1](https://github.com/huandu/xstrings/issues/1) |
|
||||
| [ToSnakeCase](https://godoc.org/github.com/huandu/xstrings#ToSnakeCase) | `String#underscore` in RoR | [#1](https://github.com/huandu/xstrings/issues/1) |
|
||||
| [Translate](https://godoc.org/github.com/huandu/xstrings#Translate) | `str.translate` in Python; `String#tr` in Ruby; `strtr` in PHP; `tr///` in Perl | [#21](https://github.com/huandu/xstrings/issues/21) |
|
||||
| [Width](https://godoc.org/github.com/huandu/xstrings#Width) | `mb_strwidth` in PHP | [#26](https://github.com/huandu/xstrings/issues/26) |
|
||||
| [WordCount](https://godoc.org/github.com/huandu/xstrings#WordCount) | `str_word_count` in PHP | [#14](https://github.com/huandu/xstrings/issues/14) |
|
||||
| [WordSplit](https://godoc.org/github.com/huandu/xstrings#WordSplit) | - | [#14](https://github.com/huandu/xstrings/issues/14) |
|
||||
|
||||
### Package `strings` functions ###
|
||||
|
||||
*Keep this table sorted by Function in ascending order.*
|
||||
|
||||
| Function | Friends |
|
||||
| -------- | ------- |
|
||||
| [Contains](http://golang.org/pkg/strings/#Contains) | `String#include?` in Ruby |
|
||||
| [ContainsAny](http://golang.org/pkg/strings/#ContainsAny) | - |
|
||||
| [ContainsRune](http://golang.org/pkg/strings/#ContainsRune) | - |
|
||||
| [Count](http://golang.org/pkg/strings/#Count) | `str.count` in Python; `substr_count` in PHP |
|
||||
| [EqualFold](http://golang.org/pkg/strings/#EqualFold) | `stricmp` in PHP; `String#casecmp` in Ruby |
|
||||
| [Fields](http://golang.org/pkg/strings/#Fields) | `str.split` in Python; `split` in Perl; `String#split` in Ruby |
|
||||
| [FieldsFunc](http://golang.org/pkg/strings/#FieldsFunc) | - |
|
||||
| [HasPrefix](http://golang.org/pkg/strings/#HasPrefix) | `str.startswith` in Python; `String#start_with?` in Ruby |
|
||||
| [HasSuffix](http://golang.org/pkg/strings/#HasSuffix) | `str.endswith` in Python; `String#end_with?` in Ruby |
|
||||
| [Index](http://golang.org/pkg/strings/#Index) | `str.index` in Python; `String#index` in Ruby; `strpos` in PHP; `index` in Perl |
|
||||
| [IndexAny](http://golang.org/pkg/strings/#IndexAny) | - |
|
||||
| [IndexByte](http://golang.org/pkg/strings/#IndexByte) | - |
|
||||
| [IndexFunc](http://golang.org/pkg/strings/#IndexFunc) | - |
|
||||
| [IndexRune](http://golang.org/pkg/strings/#IndexRune) | - |
|
||||
| [Join](http://golang.org/pkg/strings/#Join) | `str.join` in Python; `Array#join` in Ruby; `implode` in PHP; `join` in Perl |
|
||||
| [LastIndex](http://golang.org/pkg/strings/#LastIndex) | `str.rindex` in Python; `String#rindex`; `strrpos` in PHP; `rindex` in Perl |
|
||||
| [LastIndexAny](http://golang.org/pkg/strings/#LastIndexAny) | - |
|
||||
| [LastIndexFunc](http://golang.org/pkg/strings/#LastIndexFunc) | - |
|
||||
| [Map](http://golang.org/pkg/strings/#Map) | `String#each_codepoint` in Ruby |
|
||||
| [Repeat](http://golang.org/pkg/strings/#Repeat) | operator `*` in Python and Ruby; `str_repeat` in PHP |
|
||||
| [Replace](http://golang.org/pkg/strings/#Replace) | `str.replace` in Python; `String#sub` in Ruby; `str_replace` in PHP |
|
||||
| [Split](http://golang.org/pkg/strings/#Split) | `str.split` in Python; `String#split` in Ruby; `explode` in PHP; `split` in Perl |
|
||||
| [SplitAfter](http://golang.org/pkg/strings/#SplitAfter) | - |
|
||||
| [SplitAfterN](http://golang.org/pkg/strings/#SplitAfterN) | - |
|
||||
| [SplitN](http://golang.org/pkg/strings/#SplitN) | `str.split` in Python; `String#split` in Ruby; `explode` in PHP; `split` in Perl |
|
||||
| [Title](http://golang.org/pkg/strings/#Title) | `str.title` in Python |
|
||||
| [ToLower](http://golang.org/pkg/strings/#ToLower) | `str.lower` in Python; `String#downcase` in Ruby; `strtolower` in PHP; `lc` in Perl |
|
||||
| [ToLowerSpecial](http://golang.org/pkg/strings/#ToLowerSpecial) | - |
|
||||
| [ToTitle](http://golang.org/pkg/strings/#ToTitle) | - |
|
||||
| [ToTitleSpecial](http://golang.org/pkg/strings/#ToTitleSpecial) | - |
|
||||
| [ToUpper](http://golang.org/pkg/strings/#ToUpper) | `str.upper` in Python; `String#upcase` in Ruby; `strtoupper` in PHP; `uc` in Perl |
|
||||
| [ToUpperSpecial](http://golang.org/pkg/strings/#ToUpperSpecial) | - |
|
||||
| [Trim](http://golang.org/pkg/strings/#Trim) | `str.strip` in Python; `String#strip` in Ruby; `trim` in PHP |
|
||||
| [TrimFunc](http://golang.org/pkg/strings/#TrimFunc) | - |
|
||||
| [TrimLeft](http://golang.org/pkg/strings/#TrimLeft) | `str.lstrip` in Python; `String#lstrip` in Ruby; `ltrim` in PHP |
|
||||
| [TrimLeftFunc](http://golang.org/pkg/strings/#TrimLeftFunc) | - |
|
||||
| [TrimPrefix](http://golang.org/pkg/strings/#TrimPrefix) | - |
|
||||
| [TrimRight](http://golang.org/pkg/strings/#TrimRight) | `str.rstrip` in Python; `String#rstrip` in Ruby; `rtrim` in PHP |
|
||||
| [TrimRightFunc](http://golang.org/pkg/strings/#TrimRightFunc) | - |
|
||||
| [TrimSpace](http://golang.org/pkg/strings/#TrimSpace) | `str.strip` in Python; `String#strip` in Ruby; `trim` in PHP |
|
||||
| [TrimSuffix](http://golang.org/pkg/strings/#TrimSuffix) | `String#chomp` in Ruby; `chomp` in Perl |
|
||||
|
||||
## License ##
|
||||
|
||||
This library is licensed under MIT license. See LICENSE for details.
|
25
vendor/github.com/huandu/xstrings/common.go
generated
vendored
Normal file
25
vendor/github.com/huandu/xstrings/common.go
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
// Copyright 2015 Huan Du. All rights reserved.
|
||||
// Licensed under the MIT license that can be found in the LICENSE file.
|
||||
|
||||
package xstrings
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
)
|
||||
|
||||
const _BUFFER_INIT_GROW_SIZE_MAX = 2048
|
||||
|
||||
// Lazy initialize a buffer.
|
||||
func allocBuffer(orig, cur string) *bytes.Buffer {
|
||||
output := &bytes.Buffer{}
|
||||
maxSize := len(orig) * 4
|
||||
|
||||
// Avoid to reserve too much memory at once.
|
||||
if maxSize > _BUFFER_INIT_GROW_SIZE_MAX {
|
||||
maxSize = _BUFFER_INIT_GROW_SIZE_MAX
|
||||
}
|
||||
|
||||
output.Grow(maxSize)
|
||||
output.WriteString(orig[:len(orig)-len(cur)])
|
||||
return output
|
||||
}
|
357
vendor/github.com/huandu/xstrings/convert.go
generated
vendored
Normal file
357
vendor/github.com/huandu/xstrings/convert.go
generated
vendored
Normal file
@ -0,0 +1,357 @@
|
||||
// Copyright 2015 Huan Du. All rights reserved.
|
||||
// Licensed under the MIT license that can be found in the LICENSE file.
|
||||
|
||||
package xstrings
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"math/rand"
|
||||
"unicode"
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
// ToCamelCase can convert all lower case characters behind underscores
|
||||
// to upper case character.
|
||||
// Underscore character will be removed in result except following cases.
|
||||
// * More than 1 underscore.
|
||||
// "a__b" => "A_B"
|
||||
// * At the beginning of string.
|
||||
// "_a" => "_A"
|
||||
// * At the end of string.
|
||||
// "ab_" => "Ab_"
|
||||
func ToCamelCase(str string) string {
|
||||
if len(str) == 0 {
|
||||
return ""
|
||||
}
|
||||
|
||||
buf := &bytes.Buffer{}
|
||||
var r0, r1 rune
|
||||
var size int
|
||||
|
||||
// leading '_' will appear in output.
|
||||
for len(str) > 0 {
|
||||
r0, size = utf8.DecodeRuneInString(str)
|
||||
str = str[size:]
|
||||
|
||||
if r0 != '_' {
|
||||
break
|
||||
}
|
||||
|
||||
buf.WriteRune(r0)
|
||||
}
|
||||
|
||||
if len(str) == 0 {
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
buf.WriteRune(unicode.ToUpper(r0))
|
||||
r0, size = utf8.DecodeRuneInString(str)
|
||||
str = str[size:]
|
||||
|
||||
for len(str) > 0 {
|
||||
r1 = r0
|
||||
r0, size = utf8.DecodeRuneInString(str)
|
||||
str = str[size:]
|
||||
|
||||
if r1 == '_' && r0 != '_' {
|
||||
r0 = unicode.ToUpper(r0)
|
||||
} else {
|
||||
buf.WriteRune(r1)
|
||||
}
|
||||
}
|
||||
|
||||
buf.WriteRune(r0)
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
// ToSnakeCase can convert all upper case characters in a string to
|
||||
// underscore format.
|
||||
//
|
||||
// Some samples.
|
||||
// "FirstName" => "first_name"
|
||||
// "HTTPServer" => "http_server"
|
||||
// "NoHTTPS" => "no_https"
|
||||
// "GO_PATH" => "go_path"
|
||||
// "GO PATH" => "go_path" // space is converted to underscore.
|
||||
// "GO-PATH" => "go_path" // hyphen is converted to underscore.
|
||||
func ToSnakeCase(str string) string {
|
||||
if len(str) == 0 {
|
||||
return ""
|
||||
}
|
||||
|
||||
buf := &bytes.Buffer{}
|
||||
var prev, r0, r1 rune
|
||||
var size int
|
||||
|
||||
r0 = '_'
|
||||
|
||||
for len(str) > 0 {
|
||||
prev = r0
|
||||
r0, size = utf8.DecodeRuneInString(str)
|
||||
str = str[size:]
|
||||
|
||||
switch {
|
||||
case r0 == utf8.RuneError:
|
||||
buf.WriteByte(byte(str[0]))
|
||||
|
||||
case unicode.IsUpper(r0):
|
||||
if prev != '_' {
|
||||
buf.WriteRune('_')
|
||||
}
|
||||
|
||||
buf.WriteRune(unicode.ToLower(r0))
|
||||
|
||||
if len(str) == 0 {
|
||||
break
|
||||
}
|
||||
|
||||
r0, size = utf8.DecodeRuneInString(str)
|
||||
str = str[size:]
|
||||
|
||||
if !unicode.IsUpper(r0) {
|
||||
buf.WriteRune(r0)
|
||||
break
|
||||
}
|
||||
|
||||
// find next non-upper-case character and insert `_` properly.
|
||||
// it's designed to convert `HTTPServer` to `http_server`.
|
||||
// if there are more than 2 adjacent upper case characters in a word,
|
||||
// treat them as an abbreviation plus a normal word.
|
||||
for len(str) > 0 {
|
||||
r1 = r0
|
||||
r0, size = utf8.DecodeRuneInString(str)
|
||||
str = str[size:]
|
||||
|
||||
if r0 == utf8.RuneError {
|
||||
buf.WriteRune(unicode.ToLower(r1))
|
||||
buf.WriteByte(byte(str[0]))
|
||||
break
|
||||
}
|
||||
|
||||
if !unicode.IsUpper(r0) {
|
||||
if r0 == '_' || r0 == ' ' || r0 == '-' {
|
||||
r0 = '_'
|
||||
|
||||
buf.WriteRune(unicode.ToLower(r1))
|
||||
} else {
|
||||
buf.WriteRune('_')
|
||||
buf.WriteRune(unicode.ToLower(r1))
|
||||
buf.WriteRune(r0)
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
buf.WriteRune(unicode.ToLower(r1))
|
||||
}
|
||||
|
||||
if len(str) == 0 || r0 == '_' {
|
||||
buf.WriteRune(unicode.ToLower(r0))
|
||||
break
|
||||
}
|
||||
|
||||
default:
|
||||
if r0 == ' ' || r0 == '-' {
|
||||
r0 = '_'
|
||||
}
|
||||
|
||||
buf.WriteRune(r0)
|
||||
}
|
||||
}
|
||||
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
// SwapCase will swap characters case from upper to lower or lower to upper.
|
||||
func SwapCase(str string) string {
|
||||
var r rune
|
||||
var size int
|
||||
|
||||
buf := &bytes.Buffer{}
|
||||
|
||||
for len(str) > 0 {
|
||||
r, size = utf8.DecodeRuneInString(str)
|
||||
|
||||
switch {
|
||||
case unicode.IsUpper(r):
|
||||
buf.WriteRune(unicode.ToLower(r))
|
||||
|
||||
case unicode.IsLower(r):
|
||||
buf.WriteRune(unicode.ToUpper(r))
|
||||
|
||||
default:
|
||||
buf.WriteRune(r)
|
||||
}
|
||||
|
||||
str = str[size:]
|
||||
}
|
||||
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
// FirstRuneToUpper converts first rune to upper case if necessary.
|
||||
func FirstRuneToUpper(str string) string {
|
||||
if str == "" {
|
||||
return str
|
||||
}
|
||||
|
||||
r, size := utf8.DecodeRuneInString(str)
|
||||
|
||||
if !unicode.IsLower(r) {
|
||||
return str
|
||||
}
|
||||
|
||||
buf := &bytes.Buffer{}
|
||||
buf.WriteRune(unicode.ToUpper(r))
|
||||
buf.WriteString(str[size:])
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
// FirstRuneToLower converts first rune to lower case if necessary.
|
||||
func FirstRuneToLower(str string) string {
|
||||
if str == "" {
|
||||
return str
|
||||
}
|
||||
|
||||
r, size := utf8.DecodeRuneInString(str)
|
||||
|
||||
if !unicode.IsUpper(r) {
|
||||
return str
|
||||
}
|
||||
|
||||
buf := &bytes.Buffer{}
|
||||
buf.WriteRune(unicode.ToLower(r))
|
||||
buf.WriteString(str[size:])
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
// Shuffle randomizes runes in a string and returns the result.
|
||||
// It uses default random source in `math/rand`.
|
||||
func Shuffle(str string) string {
|
||||
if str == "" {
|
||||
return str
|
||||
}
|
||||
|
||||
runes := []rune(str)
|
||||
index := 0
|
||||
|
||||
for i := len(runes) - 1; i > 0; i-- {
|
||||
index = rand.Intn(i + 1)
|
||||
|
||||
if i != index {
|
||||
runes[i], runes[index] = runes[index], runes[i]
|
||||
}
|
||||
}
|
||||
|
||||
return string(runes)
|
||||
}
|
||||
|
||||
// ShuffleSource randomizes runes in a string with given random source.
|
||||
func ShuffleSource(str string, src rand.Source) string {
|
||||
if str == "" {
|
||||
return str
|
||||
}
|
||||
|
||||
runes := []rune(str)
|
||||
index := 0
|
||||
r := rand.New(src)
|
||||
|
||||
for i := len(runes) - 1; i > 0; i-- {
|
||||
index = r.Intn(i + 1)
|
||||
|
||||
if i != index {
|
||||
runes[i], runes[index] = runes[index], runes[i]
|
||||
}
|
||||
}
|
||||
|
||||
return string(runes)
|
||||
}
|
||||
|
||||
// Successor returns the successor to string.
|
||||
//
|
||||
// If there is one alphanumeric rune is found in string, increase the rune by 1.
|
||||
// If increment generates a "carry", the rune to the left of it is incremented.
|
||||
// This process repeats until there is no carry, adding an additional rune if necessary.
|
||||
//
|
||||
// If there is no alphanumeric rune, the rightmost rune will be increased by 1
|
||||
// regardless whether the result is a valid rune or not.
|
||||
//
|
||||
// Only following characters are alphanumeric.
|
||||
// * a - z
|
||||
// * A - Z
|
||||
// * 0 - 9
|
||||
//
|
||||
// Samples (borrowed from ruby's String#succ document):
|
||||
// "abcd" => "abce"
|
||||
// "THX1138" => "THX1139"
|
||||
// "<<koala>>" => "<<koalb>>"
|
||||
// "1999zzz" => "2000aaa"
|
||||
// "ZZZ9999" => "AAAA0000"
|
||||
// "***" => "**+"
|
||||
func Successor(str string) string {
|
||||
if str == "" {
|
||||
return str
|
||||
}
|
||||
|
||||
var r rune
|
||||
var i int
|
||||
carry := ' '
|
||||
runes := []rune(str)
|
||||
l := len(runes)
|
||||
lastAlphanumeric := l
|
||||
|
||||
for i = l - 1; i >= 0; i-- {
|
||||
r = runes[i]
|
||||
|
||||
if ('a' <= r && r <= 'y') ||
|
||||
('A' <= r && r <= 'Y') ||
|
||||
('0' <= r && r <= '8') {
|
||||
runes[i]++
|
||||
carry = ' '
|
||||
lastAlphanumeric = i
|
||||
break
|
||||
}
|
||||
|
||||
switch r {
|
||||
case 'z':
|
||||
runes[i] = 'a'
|
||||
carry = 'a'
|
||||
lastAlphanumeric = i
|
||||
|
||||
case 'Z':
|
||||
runes[i] = 'A'
|
||||
carry = 'A'
|
||||
lastAlphanumeric = i
|
||||
|
||||
case '9':
|
||||
runes[i] = '0'
|
||||
carry = '0'
|
||||
lastAlphanumeric = i
|
||||
}
|
||||
}
|
||||
|
||||
// Needs to add one character for carry.
|
||||
if i < 0 && carry != ' ' {
|
||||
buf := &bytes.Buffer{}
|
||||
buf.Grow(l + 4) // Reserve enough space for write.
|
||||
|
||||
if lastAlphanumeric != 0 {
|
||||
buf.WriteString(str[:lastAlphanumeric])
|
||||
}
|
||||
|
||||
buf.WriteRune(carry)
|
||||
|
||||
for _, r = range runes[lastAlphanumeric:] {
|
||||
buf.WriteRune(r)
|
||||
}
|
||||
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
// No alphanumeric character. Simply increase last rune's value.
|
||||
if lastAlphanumeric == l {
|
||||
runes[l-1]++
|
||||
}
|
||||
|
||||
return string(runes)
|
||||
}
|
120
vendor/github.com/huandu/xstrings/count.go
generated
vendored
Normal file
120
vendor/github.com/huandu/xstrings/count.go
generated
vendored
Normal file
@ -0,0 +1,120 @@
|
||||
// Copyright 2015 Huan Du. All rights reserved.
|
||||
// Licensed under the MIT license that can be found in the LICENSE file.
|
||||
|
||||
package xstrings
|
||||
|
||||
import (
|
||||
"unicode"
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
// Get str's utf8 rune length.
|
||||
func Len(str string) int {
|
||||
return utf8.RuneCountInString(str)
|
||||
}
|
||||
|
||||
// Count number of words in a string.
|
||||
//
|
||||
// Word is defined as a locale dependent string containing alphabetic characters,
|
||||
// which may also contain but not start with `'` and `-` characters.
|
||||
func WordCount(str string) int {
|
||||
var r rune
|
||||
var size, n int
|
||||
|
||||
inWord := false
|
||||
|
||||
for len(str) > 0 {
|
||||
r, size = utf8.DecodeRuneInString(str)
|
||||
|
||||
switch {
|
||||
case isAlphabet(r):
|
||||
if !inWord {
|
||||
inWord = true
|
||||
n++
|
||||
}
|
||||
|
||||
case inWord && (r == '\'' || r == '-'):
|
||||
// Still in word.
|
||||
|
||||
default:
|
||||
inWord = false
|
||||
}
|
||||
|
||||
str = str[size:]
|
||||
}
|
||||
|
||||
return n
|
||||
}
|
||||
|
||||
const minCJKCharacter = '\u3400'
|
||||
|
||||
// Checks r is a letter but not CJK character.
|
||||
func isAlphabet(r rune) bool {
|
||||
if !unicode.IsLetter(r) {
|
||||
return false
|
||||
}
|
||||
|
||||
switch {
|
||||
// Quick check for non-CJK character.
|
||||
case r < minCJKCharacter:
|
||||
return true
|
||||
|
||||
// Common CJK characters.
|
||||
case r >= '\u4E00' && r <= '\u9FCC':
|
||||
return false
|
||||
|
||||
// Rare CJK characters.
|
||||
case r >= '\u3400' && r <= '\u4D85':
|
||||
return false
|
||||
|
||||
// Rare and historic CJK characters.
|
||||
case r >= '\U00020000' && r <= '\U0002B81D':
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// Width returns string width in monotype font.
|
||||
// Multi-byte characters are usually twice the width of single byte characters.
|
||||
//
|
||||
// Algorithm comes from `mb_strwidth` in PHP.
|
||||
// http://php.net/manual/en/function.mb-strwidth.php
|
||||
func Width(str string) int {
|
||||
var r rune
|
||||
var size, n int
|
||||
|
||||
for len(str) > 0 {
|
||||
r, size = utf8.DecodeRuneInString(str)
|
||||
n += RuneWidth(r)
|
||||
str = str[size:]
|
||||
}
|
||||
|
||||
return n
|
||||
}
|
||||
|
||||
// RuneWidth returns character width in monotype font.
|
||||
// Multi-byte characters are usually twice the width of single byte characters.
|
||||
//
|
||||
// Algorithm comes from `mb_strwidth` in PHP.
|
||||
// http://php.net/manual/en/function.mb-strwidth.php
|
||||
func RuneWidth(r rune) int {
|
||||
switch {
|
||||
case r == utf8.RuneError || r < '\x20':
|
||||
return 0
|
||||
|
||||
case '\x20' <= r && r < '\u2000':
|
||||
return 1
|
||||
|
||||
case '\u2000' <= r && r < '\uFF61':
|
||||
return 2
|
||||
|
||||
case '\uFF61' <= r && r < '\uFFA0':
|
||||
return 1
|
||||
|
||||
case '\uFFA0' <= r:
|
||||
return 2
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
8
vendor/github.com/huandu/xstrings/doc.go
generated
vendored
Normal file
8
vendor/github.com/huandu/xstrings/doc.go
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
// Copyright 2015 Huan Du. All rights reserved.
|
||||
// Licensed under the MIT license that can be found in the LICENSE file.
|
||||
|
||||
// Package `xstrings` is to provide string algorithms which are useful but not included in `strings` package.
|
||||
// See project home page for details. https://github.com/huandu/xstrings
|
||||
//
|
||||
// Package `xstrings` assumes all strings are encoded in utf8.
|
||||
package xstrings
|
170
vendor/github.com/huandu/xstrings/format.go
generated
vendored
Normal file
170
vendor/github.com/huandu/xstrings/format.go
generated
vendored
Normal file
@ -0,0 +1,170 @@
|
||||
// Copyright 2015 Huan Du. All rights reserved.
|
||||
// Licensed under the MIT license that can be found in the LICENSE file.
|
||||
|
||||
package xstrings
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
// ExpandTabs can expand tabs ('\t') rune in str to one or more spaces dpending on
|
||||
// current column and tabSize.
|
||||
// The column number is reset to zero after each newline ('\n') occurring in the str.
|
||||
//
|
||||
// ExpandTabs uses RuneWidth to decide rune's width.
|
||||
// For example, CJK characters will be treated as two characters.
|
||||
//
|
||||
// If tabSize <= 0, ExpandTabs panics with error.
|
||||
//
|
||||
// Samples:
|
||||
// ExpandTabs("a\tbc\tdef\tghij\tk", 4) => "a bc def ghij k"
|
||||
// ExpandTabs("abcdefg\thij\nk\tl", 4) => "abcdefg hij\nk l"
|
||||
// ExpandTabs("z中\t文\tw", 4) => "z中 文 w"
|
||||
func ExpandTabs(str string, tabSize int) string {
|
||||
if tabSize <= 0 {
|
||||
panic("tab size must be positive")
|
||||
}
|
||||
|
||||
var r rune
|
||||
var i, size, column, expand int
|
||||
var output *bytes.Buffer
|
||||
|
||||
orig := str
|
||||
|
||||
for len(str) > 0 {
|
||||
r, size = utf8.DecodeRuneInString(str)
|
||||
|
||||
if r == '\t' {
|
||||
expand = tabSize - column%tabSize
|
||||
|
||||
if output == nil {
|
||||
output = allocBuffer(orig, str)
|
||||
}
|
||||
|
||||
for i = 0; i < expand; i++ {
|
||||
output.WriteByte(byte(' '))
|
||||
}
|
||||
|
||||
column += expand
|
||||
} else {
|
||||
if r == '\n' {
|
||||
column = 0
|
||||
} else {
|
||||
column += RuneWidth(r)
|
||||
}
|
||||
|
||||
if output != nil {
|
||||
output.WriteRune(r)
|
||||
}
|
||||
}
|
||||
|
||||
str = str[size:]
|
||||
}
|
||||
|
||||
if output == nil {
|
||||
return orig
|
||||
}
|
||||
|
||||
return output.String()
|
||||
}
|
||||
|
||||
// LeftJustify returns a string with pad string at right side if str's rune length is smaller than length.
|
||||
// If str's rune length is larger than length, str itself will be returned.
|
||||
//
|
||||
// If pad is an empty string, str will be returned.
|
||||
//
|
||||
// Samples:
|
||||
// LeftJustify("hello", 4, " ") => "hello"
|
||||
// LeftJustify("hello", 10, " ") => "hello "
|
||||
// LeftJustify("hello", 10, "123") => "hello12312"
|
||||
func LeftJustify(str string, length int, pad string) string {
|
||||
l := Len(str)
|
||||
|
||||
if l >= length || pad == "" {
|
||||
return str
|
||||
}
|
||||
|
||||
remains := length - l
|
||||
padLen := Len(pad)
|
||||
|
||||
output := &bytes.Buffer{}
|
||||
output.Grow(len(str) + (remains/padLen+1)*len(pad))
|
||||
output.WriteString(str)
|
||||
writePadString(output, pad, padLen, remains)
|
||||
return output.String()
|
||||
}
|
||||
|
||||
// RightJustify returns a string with pad string at left side if str's rune length is smaller than length.
|
||||
// If str's rune length is larger than length, str itself will be returned.
|
||||
//
|
||||
// If pad is an empty string, str will be returned.
|
||||
//
|
||||
// Samples:
|
||||
// RightJustify("hello", 4, " ") => "hello"
|
||||
// RightJustify("hello", 10, " ") => " hello"
|
||||
// RightJustify("hello", 10, "123") => "12312hello"
|
||||
func RightJustify(str string, length int, pad string) string {
|
||||
l := Len(str)
|
||||
|
||||
if l >= length || pad == "" {
|
||||
return str
|
||||
}
|
||||
|
||||
remains := length - l
|
||||
padLen := Len(pad)
|
||||
|
||||
output := &bytes.Buffer{}
|
||||
output.Grow(len(str) + (remains/padLen+1)*len(pad))
|
||||
writePadString(output, pad, padLen, remains)
|
||||
output.WriteString(str)
|
||||
return output.String()
|
||||
}
|
||||
|
||||
// Center returns a string with pad string at both side if str's rune length is smaller than length.
|
||||
// If str's rune length is larger than length, str itself will be returned.
|
||||
//
|
||||
// If pad is an empty string, str will be returned.
|
||||
//
|
||||
// Samples:
|
||||
// Center("hello", 4, " ") => "hello"
|
||||
// Center("hello", 10, " ") => " hello "
|
||||
// Center("hello", 10, "123") => "12hello123"
|
||||
func Center(str string, length int, pad string) string {
|
||||
l := Len(str)
|
||||
|
||||
if l >= length || pad == "" {
|
||||
return str
|
||||
}
|
||||
|
||||
remains := length - l
|
||||
padLen := Len(pad)
|
||||
|
||||
output := &bytes.Buffer{}
|
||||
output.Grow(len(str) + (remains/padLen+1)*len(pad))
|
||||
writePadString(output, pad, padLen, remains/2)
|
||||
output.WriteString(str)
|
||||
writePadString(output, pad, padLen, (remains+1)/2)
|
||||
return output.String()
|
||||
}
|
||||
|
||||
func writePadString(output *bytes.Buffer, pad string, padLen, remains int) {
|
||||
var r rune
|
||||
var size int
|
||||
|
||||
repeats := remains / padLen
|
||||
|
||||
for i := 0; i < repeats; i++ {
|
||||
output.WriteString(pad)
|
||||
}
|
||||
|
||||
remains = remains % padLen
|
||||
|
||||
if remains != 0 {
|
||||
for i := 0; i < remains; i++ {
|
||||
r, size = utf8.DecodeRuneInString(pad)
|
||||
output.WriteRune(r)
|
||||
pad = pad[size:]
|
||||
}
|
||||
}
|
||||
}
|
217
vendor/github.com/huandu/xstrings/manipulate.go
generated
vendored
Normal file
217
vendor/github.com/huandu/xstrings/manipulate.go
generated
vendored
Normal file
@ -0,0 +1,217 @@
|
||||
// Copyright 2015 Huan Du. All rights reserved.
|
||||
// Licensed under the MIT license that can be found in the LICENSE file.
|
||||
|
||||
package xstrings
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"strings"
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
// Reverse a utf8 encoded string.
|
||||
func Reverse(str string) string {
|
||||
var size int
|
||||
|
||||
tail := len(str)
|
||||
buf := make([]byte, tail)
|
||||
s := buf
|
||||
|
||||
for len(str) > 0 {
|
||||
_, size = utf8.DecodeRuneInString(str)
|
||||
tail -= size
|
||||
s = append(s[:tail], []byte(str[:size])...)
|
||||
str = str[size:]
|
||||
}
|
||||
|
||||
return string(buf)
|
||||
}
|
||||
|
||||
// Slice a string by rune.
|
||||
//
|
||||
// Start must satisfy 0 <= start <= rune length.
|
||||
//
|
||||
// End can be positive, zero or negative.
|
||||
// If end >= 0, start and end must satisfy start <= end <= rune length.
|
||||
// If end < 0, it means slice to the end of string.
|
||||
//
|
||||
// Otherwise, Slice will panic as out of range.
|
||||
func Slice(str string, start, end int) string {
|
||||
var size, startPos, endPos int
|
||||
|
||||
origin := str
|
||||
|
||||
if start < 0 || end > len(str) || (end >= 0 && start > end) {
|
||||
panic("out of range")
|
||||
}
|
||||
|
||||
if end >= 0 {
|
||||
end -= start
|
||||
}
|
||||
|
||||
for start > 0 && len(str) > 0 {
|
||||
_, size = utf8.DecodeRuneInString(str)
|
||||
start--
|
||||
startPos += size
|
||||
str = str[size:]
|
||||
}
|
||||
|
||||
if end < 0 {
|
||||
return origin[startPos:]
|
||||
}
|
||||
|
||||
endPos = startPos
|
||||
|
||||
for end > 0 && len(str) > 0 {
|
||||
_, size = utf8.DecodeRuneInString(str)
|
||||
end--
|
||||
endPos += size
|
||||
str = str[size:]
|
||||
}
|
||||
|
||||
if len(str) == 0 && (start > 0 || end > 0) {
|
||||
panic("out of range")
|
||||
}
|
||||
|
||||
return origin[startPos:endPos]
|
||||
}
|
||||
|
||||
// Partition splits a string by sep into three parts.
|
||||
// The return value is a slice of strings with head, match and tail.
|
||||
//
|
||||
// If str contains sep, for example "hello" and "l", Partition returns
|
||||
// "he", "l", "lo"
|
||||
//
|
||||
// If str doesn't contain sep, for example "hello" and "x", Partition returns
|
||||
// "hello", "", ""
|
||||
func Partition(str, sep string) (head, match, tail string) {
|
||||
index := strings.Index(str, sep)
|
||||
|
||||
if index == -1 {
|
||||
head = str
|
||||
return
|
||||
}
|
||||
|
||||
head = str[:index]
|
||||
match = str[index : index+len(sep)]
|
||||
tail = str[index+len(sep):]
|
||||
return
|
||||
}
|
||||
|
||||
// LastPartition splits a string by last instance of sep into three parts.
|
||||
// The return value is a slice of strings with head, match and tail.
|
||||
//
|
||||
// If str contains sep, for example "hello" and "l", LastPartition returns
|
||||
// "hel", "l", "o"
|
||||
//
|
||||
// If str doesn't contain sep, for example "hello" and "x", LastPartition returns
|
||||
// "", "", "hello"
|
||||
func LastPartition(str, sep string) (head, match, tail string) {
|
||||
index := strings.LastIndex(str, sep)
|
||||
|
||||
if index == -1 {
|
||||
tail = str
|
||||
return
|
||||
}
|
||||
|
||||
head = str[:index]
|
||||
match = str[index : index+len(sep)]
|
||||
tail = str[index+len(sep):]
|
||||
return
|
||||
}
|
||||
|
||||
// Insert src into dst at given rune index.
|
||||
// Index is counted by runes instead of bytes.
|
||||
//
|
||||
// If index is out of range of dst, panic with out of range.
|
||||
func Insert(dst, src string, index int) string {
|
||||
return Slice(dst, 0, index) + src + Slice(dst, index, -1)
|
||||
}
|
||||
|
||||
// Scrubs invalid utf8 bytes with repl string.
|
||||
// Adjacent invalid bytes are replaced only once.
|
||||
func Scrub(str, repl string) string {
|
||||
var buf *bytes.Buffer
|
||||
var r rune
|
||||
var size, pos int
|
||||
var hasError bool
|
||||
|
||||
origin := str
|
||||
|
||||
for len(str) > 0 {
|
||||
r, size = utf8.DecodeRuneInString(str)
|
||||
|
||||
if r == utf8.RuneError {
|
||||
if !hasError {
|
||||
if buf == nil {
|
||||
buf = &bytes.Buffer{}
|
||||
}
|
||||
|
||||
buf.WriteString(origin[:pos])
|
||||
hasError = true
|
||||
}
|
||||
} else if hasError {
|
||||
hasError = false
|
||||
buf.WriteString(repl)
|
||||
|
||||
origin = origin[pos:]
|
||||
pos = 0
|
||||
}
|
||||
|
||||
pos += size
|
||||
str = str[size:]
|
||||
}
|
||||
|
||||
if buf != nil {
|
||||
buf.WriteString(origin)
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
// No invalid byte.
|
||||
return origin
|
||||
}
|
||||
|
||||
// Splits a string into words. Returns a slice of words.
|
||||
// If there is no word in a string, return nil.
|
||||
//
|
||||
// Word is defined as a locale dependent string containing alphabetic characters,
|
||||
// which may also contain but not start with `'` and `-` characters.
|
||||
func WordSplit(str string) []string {
|
||||
var word string
|
||||
var words []string
|
||||
var r rune
|
||||
var size, pos int
|
||||
|
||||
inWord := false
|
||||
|
||||
for len(str) > 0 {
|
||||
r, size = utf8.DecodeRuneInString(str)
|
||||
|
||||
switch {
|
||||
case isAlphabet(r):
|
||||
if !inWord {
|
||||
inWord = true
|
||||
word = str
|
||||
pos = 0
|
||||
}
|
||||
|
||||
case inWord && (r == '\'' || r == '-'):
|
||||
// Still in word.
|
||||
|
||||
default:
|
||||
if inWord {
|
||||
inWord = false
|
||||
words = append(words, word[:pos])
|
||||
}
|
||||
}
|
||||
|
||||
pos += size
|
||||
str = str[size:]
|
||||
}
|
||||
|
||||
if inWord {
|
||||
words = append(words, word[:pos])
|
||||
}
|
||||
|
||||
return words
|
||||
}
|
545
vendor/github.com/huandu/xstrings/translate.go
generated
vendored
Normal file
545
vendor/github.com/huandu/xstrings/translate.go
generated
vendored
Normal file
@ -0,0 +1,545 @@
|
||||
// Copyright 2015 Huan Du. All rights reserved.
|
||||
// Licensed under the MIT license that can be found in the LICENSE file.
|
||||
|
||||
package xstrings
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"unicode"
|
||||
"unicode/utf8"
|
||||
)
|
||||
|
||||
type runeRangeMap struct {
|
||||
FromLo rune // Lower bound of range map.
|
||||
FromHi rune // An inclusive higher bound of range map.
|
||||
ToLo rune
|
||||
ToHi rune
|
||||
}
|
||||
|
||||
type runeDict struct {
|
||||
Dict [unicode.MaxASCII + 1]rune
|
||||
}
|
||||
|
||||
type runeMap map[rune]rune
|
||||
|
||||
// Translator can translate string with pre-compiled from and to patterns.
|
||||
// If a from/to pattern pair needs to be used more than once, it's recommended
|
||||
// to create a Translator and reuse it.
|
||||
type Translator struct {
|
||||
quickDict *runeDict // A quick dictionary to look up rune by index. Only availabe for latin runes.
|
||||
runeMap runeMap // Rune map for translation.
|
||||
ranges []*runeRangeMap // Ranges of runes.
|
||||
mappedRune rune // If mappedRune >= 0, all matched runes are translated to the mappedRune.
|
||||
reverted bool // If to pattern is empty, all matched characters will be deleted.
|
||||
hasPattern bool
|
||||
}
|
||||
|
||||
// NewTranslator creates new Translator through a from/to pattern pair.
|
||||
func NewTranslator(from, to string) *Translator {
|
||||
tr := &Translator{}
|
||||
|
||||
if from == "" {
|
||||
return tr
|
||||
}
|
||||
|
||||
reverted := from[0] == '^'
|
||||
deletion := len(to) == 0
|
||||
|
||||
if reverted {
|
||||
from = from[1:]
|
||||
}
|
||||
|
||||
var fromStart, fromEnd, fromRangeStep rune
|
||||
var toStart, toEnd, toRangeStep rune
|
||||
var fromRangeSize, toRangeSize rune
|
||||
var singleRunes []rune
|
||||
|
||||
// Update the to rune range.
|
||||
updateRange := func() {
|
||||
// No more rune to read in the to rune pattern.
|
||||
if toEnd == utf8.RuneError {
|
||||
return
|
||||
}
|
||||
|
||||
if toRangeStep == 0 {
|
||||
to, toStart, toEnd, toRangeStep = nextRuneRange(to, toEnd)
|
||||
return
|
||||
}
|
||||
|
||||
// Current range is not empty. Consume 1 rune from start.
|
||||
if toStart != toEnd {
|
||||
toStart += toRangeStep
|
||||
return
|
||||
}
|
||||
|
||||
// No more rune. Repeat the last rune.
|
||||
if to == "" {
|
||||
toEnd = utf8.RuneError
|
||||
return
|
||||
}
|
||||
|
||||
// Both start and end are used. Read two more runes from the to pattern.
|
||||
to, toStart, toEnd, toRangeStep = nextRuneRange(to, utf8.RuneError)
|
||||
}
|
||||
|
||||
if deletion {
|
||||
toStart = utf8.RuneError
|
||||
toEnd = utf8.RuneError
|
||||
} else {
|
||||
// If from pattern is reverted, only the last rune in the to pattern will be used.
|
||||
if reverted {
|
||||
var size int
|
||||
|
||||
for len(to) > 0 {
|
||||
toStart, size = utf8.DecodeRuneInString(to)
|
||||
to = to[size:]
|
||||
}
|
||||
|
||||
toEnd = utf8.RuneError
|
||||
} else {
|
||||
to, toStart, toEnd, toRangeStep = nextRuneRange(to, utf8.RuneError)
|
||||
}
|
||||
}
|
||||
|
||||
fromEnd = utf8.RuneError
|
||||
|
||||
for len(from) > 0 {
|
||||
from, fromStart, fromEnd, fromRangeStep = nextRuneRange(from, fromEnd)
|
||||
|
||||
// fromStart is a single character. Just map it with a rune in the to pattern.
|
||||
if fromRangeStep == 0 {
|
||||
singleRunes = tr.addRune(fromStart, toStart, singleRunes)
|
||||
updateRange()
|
||||
continue
|
||||
}
|
||||
|
||||
for toEnd != utf8.RuneError && fromStart != fromEnd {
|
||||
// If mapped rune is a single character instead of a range, simply shift first
|
||||
// rune in the range.
|
||||
if toRangeStep == 0 {
|
||||
singleRunes = tr.addRune(fromStart, toStart, singleRunes)
|
||||
updateRange()
|
||||
fromStart += fromRangeStep
|
||||
continue
|
||||
}
|
||||
|
||||
fromRangeSize = (fromEnd - fromStart) * fromRangeStep
|
||||
toRangeSize = (toEnd - toStart) * toRangeStep
|
||||
|
||||
// Not enough runes in the to pattern. Need to read more.
|
||||
if fromRangeSize > toRangeSize {
|
||||
fromStart, toStart = tr.addRuneRange(fromStart, fromStart+toRangeSize*fromRangeStep, toStart, toEnd, singleRunes)
|
||||
fromStart += fromRangeStep
|
||||
updateRange()
|
||||
|
||||
// Edge case: If fromRangeSize == toRangeSize + 1, the last fromStart value needs be considered
|
||||
// as a single rune.
|
||||
if fromStart == fromEnd {
|
||||
singleRunes = tr.addRune(fromStart, toStart, singleRunes)
|
||||
updateRange()
|
||||
}
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
fromStart, toStart = tr.addRuneRange(fromStart, fromEnd, toStart, toStart+fromRangeSize*toRangeStep, singleRunes)
|
||||
updateRange()
|
||||
break
|
||||
}
|
||||
|
||||
if fromStart == fromEnd {
|
||||
fromEnd = utf8.RuneError
|
||||
continue
|
||||
}
|
||||
|
||||
fromStart, toStart = tr.addRuneRange(fromStart, fromEnd, toStart, toStart, singleRunes)
|
||||
fromEnd = utf8.RuneError
|
||||
}
|
||||
|
||||
if fromEnd != utf8.RuneError {
|
||||
singleRunes = tr.addRune(fromEnd, toStart, singleRunes)
|
||||
}
|
||||
|
||||
tr.reverted = reverted
|
||||
tr.mappedRune = -1
|
||||
tr.hasPattern = true
|
||||
|
||||
// Translate RuneError only if in deletion or reverted mode.
|
||||
if deletion || reverted {
|
||||
tr.mappedRune = toStart
|
||||
}
|
||||
|
||||
return tr
|
||||
}
|
||||
|
||||
func (tr *Translator) addRune(from, to rune, singleRunes []rune) []rune {
|
||||
if from <= unicode.MaxASCII {
|
||||
if tr.quickDict == nil {
|
||||
tr.quickDict = &runeDict{}
|
||||
}
|
||||
|
||||
tr.quickDict.Dict[from] = to
|
||||
} else {
|
||||
if tr.runeMap == nil {
|
||||
tr.runeMap = make(runeMap)
|
||||
}
|
||||
|
||||
tr.runeMap[from] = to
|
||||
}
|
||||
|
||||
singleRunes = append(singleRunes, from)
|
||||
return singleRunes
|
||||
}
|
||||
|
||||
func (tr *Translator) addRuneRange(fromLo, fromHi, toLo, toHi rune, singleRunes []rune) (rune, rune) {
|
||||
var r rune
|
||||
var rrm *runeRangeMap
|
||||
|
||||
if fromLo < fromHi {
|
||||
rrm = &runeRangeMap{
|
||||
FromLo: fromLo,
|
||||
FromHi: fromHi,
|
||||
ToLo: toLo,
|
||||
ToHi: toHi,
|
||||
}
|
||||
} else {
|
||||
rrm = &runeRangeMap{
|
||||
FromLo: fromHi,
|
||||
FromHi: fromLo,
|
||||
ToLo: toHi,
|
||||
ToHi: toLo,
|
||||
}
|
||||
}
|
||||
|
||||
// If there is any single rune conflicts with this rune range, clear single rune record.
|
||||
for _, r = range singleRunes {
|
||||
if rrm.FromLo <= r && r <= rrm.FromHi {
|
||||
if r <= unicode.MaxASCII {
|
||||
tr.quickDict.Dict[r] = 0
|
||||
} else {
|
||||
delete(tr.runeMap, r)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tr.ranges = append(tr.ranges, rrm)
|
||||
return fromHi, toHi
|
||||
}
|
||||
|
||||
func nextRuneRange(str string, last rune) (remaining string, start, end rune, rangeStep rune) {
|
||||
var r rune
|
||||
var size int
|
||||
|
||||
remaining = str
|
||||
escaping := false
|
||||
isRange := false
|
||||
|
||||
for len(remaining) > 0 {
|
||||
r, size = utf8.DecodeRuneInString(remaining)
|
||||
remaining = remaining[size:]
|
||||
|
||||
// Parse special characters.
|
||||
if !escaping {
|
||||
if r == '\\' {
|
||||
escaping = true
|
||||
continue
|
||||
}
|
||||
|
||||
if r == '-' {
|
||||
// Ignore slash at beginning of string.
|
||||
if last == utf8.RuneError {
|
||||
continue
|
||||
}
|
||||
|
||||
start = last
|
||||
isRange = true
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
escaping = false
|
||||
|
||||
if last != utf8.RuneError {
|
||||
// This is a range which start and end are the same.
|
||||
// Considier it as a normal character.
|
||||
if isRange && last == r {
|
||||
isRange = false
|
||||
continue
|
||||
}
|
||||
|
||||
start = last
|
||||
end = r
|
||||
|
||||
if isRange {
|
||||
if start < end {
|
||||
rangeStep = 1
|
||||
} else {
|
||||
rangeStep = -1
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
last = r
|
||||
}
|
||||
|
||||
start = last
|
||||
end = utf8.RuneError
|
||||
return
|
||||
}
|
||||
|
||||
// Translate str with a from/to pattern pair.
|
||||
//
|
||||
// See comment in Translate function for usage and samples.
|
||||
func (tr *Translator) Translate(str string) string {
|
||||
if !tr.hasPattern || str == "" {
|
||||
return str
|
||||
}
|
||||
|
||||
var r rune
|
||||
var size int
|
||||
var needTr bool
|
||||
|
||||
orig := str
|
||||
|
||||
var output *bytes.Buffer
|
||||
|
||||
for len(str) > 0 {
|
||||
r, size = utf8.DecodeRuneInString(str)
|
||||
r, needTr = tr.TranslateRune(r)
|
||||
|
||||
if needTr && output == nil {
|
||||
output = allocBuffer(orig, str)
|
||||
}
|
||||
|
||||
if r != utf8.RuneError && output != nil {
|
||||
output.WriteRune(r)
|
||||
}
|
||||
|
||||
str = str[size:]
|
||||
}
|
||||
|
||||
// No character is translated.
|
||||
if output == nil {
|
||||
return orig
|
||||
}
|
||||
|
||||
return output.String()
|
||||
}
|
||||
|
||||
// TranslateRune return translated rune and true if r matches the from pattern.
|
||||
// If r doesn't match the pattern, original r is returned and translated is false.
|
||||
func (tr *Translator) TranslateRune(r rune) (result rune, translated bool) {
|
||||
switch {
|
||||
case tr.quickDict != nil:
|
||||
if r <= unicode.MaxASCII {
|
||||
result = tr.quickDict.Dict[r]
|
||||
|
||||
if result != 0 {
|
||||
translated = true
|
||||
|
||||
if tr.mappedRune >= 0 {
|
||||
result = tr.mappedRune
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
fallthrough
|
||||
|
||||
case tr.runeMap != nil:
|
||||
var ok bool
|
||||
|
||||
if result, ok = tr.runeMap[r]; ok {
|
||||
translated = true
|
||||
|
||||
if tr.mappedRune >= 0 {
|
||||
result = tr.mappedRune
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
fallthrough
|
||||
|
||||
default:
|
||||
var rrm *runeRangeMap
|
||||
ranges := tr.ranges
|
||||
|
||||
for i := len(ranges) - 1; i >= 0; i-- {
|
||||
rrm = ranges[i]
|
||||
|
||||
if rrm.FromLo <= r && r <= rrm.FromHi {
|
||||
translated = true
|
||||
|
||||
if tr.mappedRune >= 0 {
|
||||
result = tr.mappedRune
|
||||
break
|
||||
}
|
||||
|
||||
if rrm.ToLo < rrm.ToHi {
|
||||
result = rrm.ToLo + r - rrm.FromLo
|
||||
} else if rrm.ToLo > rrm.ToHi {
|
||||
// ToHi can be smaller than ToLo if range is from higher to lower.
|
||||
result = rrm.ToLo - r + rrm.FromLo
|
||||
} else {
|
||||
result = rrm.ToLo
|
||||
}
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if tr.reverted {
|
||||
if !translated {
|
||||
result = tr.mappedRune
|
||||
}
|
||||
|
||||
translated = !translated
|
||||
}
|
||||
|
||||
if !translated {
|
||||
result = r
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// HasPattern returns true if Translator has one pattern at least.
|
||||
func (tr *Translator) HasPattern() bool {
|
||||
return tr.hasPattern
|
||||
}
|
||||
|
||||
// Translate str with the characters defined in from replaced by characters defined in to.
|
||||
//
|
||||
// From and to are patterns representing a set of characters. Pattern is defined as following.
|
||||
//
|
||||
// * Special characters
|
||||
// * '-' means a range of runes, e.g.
|
||||
// * "a-z" means all characters from 'a' to 'z' inclusive;
|
||||
// * "z-a" means all characters from 'z' to 'a' inclusive.
|
||||
// * '^' as first character means a set of all runes excepted listed, e.g.
|
||||
// * "^a-z" means all characters except 'a' to 'z' inclusive.
|
||||
// * '\' escapes special characters.
|
||||
// * Normal character represents itself, e.g. "abc" is a set including 'a', 'b' and 'c'.
|
||||
//
|
||||
// Translate will try to find a 1:1 mapping from from to to.
|
||||
// If to is smaller than from, last rune in to will be used to map "out of range" characters in from.
|
||||
//
|
||||
// Note that '^' only works in the from pattern. It will be considered as a normal character in the to pattern.
|
||||
//
|
||||
// If the to pattern is an empty string, Translate works exactly the same as Delete.
|
||||
//
|
||||
// Samples:
|
||||
// Translate("hello", "aeiou", "12345") => "h2ll4"
|
||||
// Translate("hello", "a-z", "A-Z") => "HELLO"
|
||||
// Translate("hello", "z-a", "a-z") => "svool"
|
||||
// Translate("hello", "aeiou", "*") => "h*ll*"
|
||||
// Translate("hello", "^l", "*") => "**ll*"
|
||||
// Translate("hello ^ world", `\^lo`, "*") => "he*** * w*r*d"
|
||||
func Translate(str, from, to string) string {
|
||||
tr := NewTranslator(from, to)
|
||||
return tr.Translate(str)
|
||||
}
|
||||
|
||||
// Delete runes in str matching the pattern.
|
||||
// Pattern is defined in Translate function.
|
||||
//
|
||||
// Samples:
|
||||
// Delete("hello", "aeiou") => "hll"
|
||||
// Delete("hello", "a-k") => "llo"
|
||||
// Delete("hello", "^a-k") => "he"
|
||||
func Delete(str, pattern string) string {
|
||||
tr := NewTranslator(pattern, "")
|
||||
return tr.Translate(str)
|
||||
}
|
||||
|
||||
// Count how many runes in str match the pattern.
|
||||
// Pattern is defined in Translate function.
|
||||
//
|
||||
// Samples:
|
||||
// Count("hello", "aeiou") => 3
|
||||
// Count("hello", "a-k") => 3
|
||||
// Count("hello", "^a-k") => 2
|
||||
func Count(str, pattern string) int {
|
||||
if pattern == "" || str == "" {
|
||||
return 0
|
||||
}
|
||||
|
||||
var r rune
|
||||
var size int
|
||||
var matched bool
|
||||
|
||||
tr := NewTranslator(pattern, "")
|
||||
cnt := 0
|
||||
|
||||
for len(str) > 0 {
|
||||
r, size = utf8.DecodeRuneInString(str)
|
||||
str = str[size:]
|
||||
|
||||
if _, matched = tr.TranslateRune(r); matched {
|
||||
cnt++
|
||||
}
|
||||
}
|
||||
|
||||
return cnt
|
||||
}
|
||||
|
||||
// Squeeze deletes adjacent repeated runes in str.
|
||||
// If pattern is not empty, only runes matching the pattern will be squeezed.
|
||||
//
|
||||
// Samples:
|
||||
// Squeeze("hello", "") => "helo"
|
||||
// Squeeze("hello", "m-z") => "hello"
|
||||
func Squeeze(str, pattern string) string {
|
||||
var last, r rune
|
||||
var size int
|
||||
var skipSqueeze, matched bool
|
||||
var tr *Translator
|
||||
var output *bytes.Buffer
|
||||
|
||||
orig := str
|
||||
last = -1
|
||||
|
||||
if len(pattern) > 0 {
|
||||
tr = NewTranslator(pattern, "")
|
||||
}
|
||||
|
||||
for len(str) > 0 {
|
||||
r, size = utf8.DecodeRuneInString(str)
|
||||
|
||||
// Need to squeeze the str.
|
||||
if last == r && !skipSqueeze {
|
||||
if tr != nil {
|
||||
if _, matched = tr.TranslateRune(r); !matched {
|
||||
skipSqueeze = true
|
||||
}
|
||||
}
|
||||
|
||||
if output == nil {
|
||||
output = allocBuffer(orig, str)
|
||||
}
|
||||
|
||||
if skipSqueeze {
|
||||
output.WriteRune(r)
|
||||
}
|
||||
} else {
|
||||
if output != nil {
|
||||
output.WriteRune(r)
|
||||
}
|
||||
|
||||
last = r
|
||||
}
|
||||
|
||||
str = str[size:]
|
||||
}
|
||||
|
||||
if output == nil {
|
||||
return orig
|
||||
}
|
||||
|
||||
return output.String()
|
||||
}
|
26
vendor/github.com/imdario/mergo/README.md
generated
vendored
26
vendor/github.com/imdario/mergo/README.md
generated
vendored
@ -65,15 +65,27 @@ If you were using Mergo **before** April 6th 2015, please check your project wor
|
||||
|
||||
You can only merge same-type structs with exported fields initialized as zero value of their type and same-types maps. Mergo won't merge unexported (private) fields but will do recursively any exported one. Also maps will be merged recursively except for structs inside maps (because they are not addressable using Go reflection).
|
||||
|
||||
if err := mergo.Merge(&dst, src); err != nil {
|
||||
// ...
|
||||
}
|
||||
```go
|
||||
if err := mergo.Merge(&dst, src); err != nil {
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
Also, you can merge overwriting values using MergeWithOverwrite.
|
||||
|
||||
```go
|
||||
if err := mergo.MergeWithOverwrite(&dst, src); err != nil {
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
Additionally, you can map a map[string]interface{} to a struct (and otherwise, from struct to map), following the same restrictions as in Merge(). Keys are capitalized to find each corresponding exported field.
|
||||
|
||||
if err := mergo.Map(&dst, srcMap); err != nil {
|
||||
// ...
|
||||
}
|
||||
```go
|
||||
if err := mergo.Map(&dst, srcMap); err != nil {
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
Warning: if you map a struct to map, it won't do it recursively. Don't expect Mergo to map struct members of your struct as map[string]interface{}. They will be just assigned as values.
|
||||
|
||||
@ -97,11 +109,11 @@ type Foo struct {
|
||||
func main() {
|
||||
src := Foo{
|
||||
A: "one",
|
||||
B: 2,
|
||||
}
|
||||
|
||||
dest := Foo{
|
||||
A: "two",
|
||||
B: 2,
|
||||
}
|
||||
|
||||
mergo.Merge(&dest, src)
|
||||
|
19
vendor/github.com/mvdan/sh/interp/builtin.go
generated
vendored
19
vendor/github.com/mvdan/sh/interp/builtin.go
generated
vendored
@ -19,7 +19,7 @@ func isBuiltin(name string) bool {
|
||||
"echo", "printf", "break", "continue", "pwd", "cd",
|
||||
"wait", "builtin", "trap", "type", "source", "command",
|
||||
"pushd", "popd", "umask", "alias", "unalias", "fg", "bg",
|
||||
"getopts", "eval":
|
||||
"getopts", "eval", "test", "[":
|
||||
return true
|
||||
}
|
||||
return false
|
||||
@ -207,6 +207,23 @@ func (r *Runner) builtinCode(pos syntax.Pos, name string, args []string) int {
|
||||
r2.File = file
|
||||
r2.Run()
|
||||
return r2.exit
|
||||
case "[":
|
||||
if len(args) == 0 || args[len(args)-1] != "]" {
|
||||
r.runErr(pos, "[: missing matching ]")
|
||||
break
|
||||
}
|
||||
args = args[:len(args)-1]
|
||||
fallthrough
|
||||
case "test":
|
||||
p := testParser{
|
||||
rem: args,
|
||||
err: func(format string, a ...interface{}) {
|
||||
r.runErr(pos, format, a...)
|
||||
},
|
||||
}
|
||||
p.next()
|
||||
expr := p.classicTest("[", false)
|
||||
return oneIf(r.bashTest(expr) == "")
|
||||
case "trap", "source", "command", "pushd", "popd",
|
||||
"umask", "alias", "unalias", "fg", "bg", "getopts":
|
||||
r.runErr(pos, "unhandled builtin: %s", name)
|
||||
|
21
vendor/github.com/mvdan/sh/interp/interp.go
generated
vendored
21
vendor/github.com/mvdan/sh/interp/interp.go
generated
vendored
@ -563,6 +563,7 @@ func (r *Runner) loopStmtsBroken(stmts []*syntax.Stmt) bool {
|
||||
func (r *Runner) wordParts(wps []syntax.WordPart, quoted bool) []string {
|
||||
var parts []string
|
||||
var curBuf bytes.Buffer
|
||||
allowEmpty := false
|
||||
flush := func() {
|
||||
if curBuf.Len() == 0 {
|
||||
return
|
||||
@ -590,17 +591,18 @@ func (r *Runner) wordParts(wps []syntax.WordPart, quoted bool) []string {
|
||||
}
|
||||
curBuf.WriteString(s)
|
||||
case *syntax.SglQuoted:
|
||||
allowEmpty = true
|
||||
curBuf.WriteString(x.Value)
|
||||
case *syntax.DblQuoted:
|
||||
// TODO: @ between double quotes but not alone
|
||||
allowEmpty = true
|
||||
if len(x.Parts) == 1 {
|
||||
pe, ok := x.Parts[0].(*syntax.ParamExp)
|
||||
if ok && pe.Param.Value == "@" {
|
||||
for i, arg := range r.args {
|
||||
pe, _ := x.Parts[0].(*syntax.ParamExp)
|
||||
if elems := r.quotedElems(pe); elems != nil {
|
||||
for i, elem := range elems {
|
||||
if i > 0 {
|
||||
flush()
|
||||
}
|
||||
curBuf.WriteString(arg)
|
||||
curBuf.WriteString(elem)
|
||||
}
|
||||
continue
|
||||
}
|
||||
@ -617,10 +619,10 @@ func (r *Runner) wordParts(wps []syntax.WordPart, quoted bool) []string {
|
||||
}
|
||||
case *syntax.CmdSubst:
|
||||
r2 := *r
|
||||
var outBuf bytes.Buffer
|
||||
r2.Stdout = &outBuf
|
||||
var buf bytes.Buffer
|
||||
r2.Stdout = &buf
|
||||
r2.stmts(x.Stmts)
|
||||
val := strings.TrimRight(outBuf.String(), "\n")
|
||||
val := strings.TrimRight(buf.String(), "\n")
|
||||
if quoted {
|
||||
curBuf.WriteString(val)
|
||||
} else {
|
||||
@ -633,6 +635,9 @@ func (r *Runner) wordParts(wps []syntax.WordPart, quoted bool) []string {
|
||||
}
|
||||
}
|
||||
flush()
|
||||
if allowEmpty && len(parts) == 0 {
|
||||
parts = append(parts, "")
|
||||
}
|
||||
return parts
|
||||
}
|
||||
|
||||
|
23
vendor/github.com/mvdan/sh/interp/param.go
generated
vendored
23
vendor/github.com/mvdan/sh/interp/param.go
generated
vendored
@ -12,6 +12,29 @@ import (
|
||||
"github.com/mvdan/sh/syntax"
|
||||
)
|
||||
|
||||
func (r *Runner) quotedElems(pe *syntax.ParamExp) []string {
|
||||
if pe == nil {
|
||||
return nil
|
||||
}
|
||||
if pe.Param.Value == "@" {
|
||||
return r.args
|
||||
}
|
||||
w, _ := pe.Index.(*syntax.Word)
|
||||
if w == nil || len(w.Parts) != 1 {
|
||||
return nil
|
||||
}
|
||||
l, _ := w.Parts[0].(*syntax.Lit)
|
||||
if l == nil || l.Value != "@" {
|
||||
return nil
|
||||
}
|
||||
val, _ := r.lookupVar(pe.Param.Value)
|
||||
switch x := val.(type) {
|
||||
case []string:
|
||||
return x
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *Runner) paramExp(pe *syntax.ParamExp) string {
|
||||
name := pe.Param.Value
|
||||
var val varValue
|
||||
|
182
vendor/github.com/mvdan/sh/interp/test_classic.go
generated
vendored
Normal file
182
vendor/github.com/mvdan/sh/interp/test_classic.go
generated
vendored
Normal file
@ -0,0 +1,182 @@
|
||||
// Copyright (c) 2017, Daniel Martí <mvdan@mvdan.cc>
|
||||
// See LICENSE for licensing information
|
||||
|
||||
package interp
|
||||
|
||||
import (
|
||||
"github.com/mvdan/sh/syntax"
|
||||
)
|
||||
|
||||
const illegalTok = 0
|
||||
|
||||
type testParser struct {
|
||||
eof bool
|
||||
val string
|
||||
rem []string
|
||||
|
||||
err func(format string, a ...interface{})
|
||||
}
|
||||
|
||||
func (p *testParser) next() {
|
||||
if p.eof || len(p.rem) == 0 {
|
||||
p.eof = true
|
||||
return
|
||||
}
|
||||
p.val = p.rem[0]
|
||||
p.rem = p.rem[1:]
|
||||
}
|
||||
|
||||
func (p *testParser) followWord(fval string) *syntax.Word {
|
||||
if p.eof {
|
||||
p.err("%s must be followed by a word", fval)
|
||||
}
|
||||
w := &syntax.Word{Parts: []syntax.WordPart{
|
||||
&syntax.Lit{Value: p.val},
|
||||
}}
|
||||
p.next()
|
||||
return w
|
||||
}
|
||||
|
||||
func (p *testParser) classicTest(fval string, pastAndOr bool) syntax.TestExpr {
|
||||
var left syntax.TestExpr
|
||||
if pastAndOr {
|
||||
left = p.testExprBase(fval)
|
||||
} else {
|
||||
left = p.classicTest(fval, true)
|
||||
}
|
||||
if left == nil || p.eof {
|
||||
return left
|
||||
}
|
||||
opStr := p.val
|
||||
op := testBinaryOp(p.val)
|
||||
if op == illegalTok {
|
||||
p.err("not a valid test operator: %s", p.val)
|
||||
}
|
||||
b := &syntax.BinaryTest{
|
||||
Op: op,
|
||||
X: left,
|
||||
}
|
||||
p.next()
|
||||
switch b.Op {
|
||||
case syntax.AndTest, syntax.OrTest:
|
||||
if b.Y = p.classicTest(opStr, false); b.Y == nil {
|
||||
p.err("%s must be followed by an expression", opStr)
|
||||
}
|
||||
default:
|
||||
b.Y = p.followWord(opStr)
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (p *testParser) testExprBase(fval string) syntax.TestExpr {
|
||||
if p.eof {
|
||||
return nil
|
||||
}
|
||||
op := testUnaryOp(p.val)
|
||||
switch op {
|
||||
case syntax.TsNot:
|
||||
u := &syntax.UnaryTest{Op: op}
|
||||
p.next()
|
||||
u.X = p.classicTest(op.String(), false)
|
||||
return u
|
||||
case illegalTok:
|
||||
return p.followWord(fval)
|
||||
default:
|
||||
u := &syntax.UnaryTest{Op: op}
|
||||
p.next()
|
||||
u.X = p.followWord(op.String())
|
||||
return u
|
||||
}
|
||||
}
|
||||
|
||||
// testUnaryOp is an exact copy of syntax's.
|
||||
func testUnaryOp(val string) syntax.UnTestOperator {
|
||||
switch val {
|
||||
case "!":
|
||||
return syntax.TsNot
|
||||
case "-e", "-a":
|
||||
return syntax.TsExists
|
||||
case "-f":
|
||||
return syntax.TsRegFile
|
||||
case "-d":
|
||||
return syntax.TsDirect
|
||||
case "-c":
|
||||
return syntax.TsCharSp
|
||||
case "-b":
|
||||
return syntax.TsBlckSp
|
||||
case "-p":
|
||||
return syntax.TsNmPipe
|
||||
case "-S":
|
||||
return syntax.TsSocket
|
||||
case "-L", "-h":
|
||||
return syntax.TsSmbLink
|
||||
case "-k":
|
||||
return syntax.TsSticky
|
||||
case "-g":
|
||||
return syntax.TsGIDSet
|
||||
case "-u":
|
||||
return syntax.TsUIDSet
|
||||
case "-G":
|
||||
return syntax.TsGrpOwn
|
||||
case "-O":
|
||||
return syntax.TsUsrOwn
|
||||
case "-N":
|
||||
return syntax.TsModif
|
||||
case "-r":
|
||||
return syntax.TsRead
|
||||
case "-w":
|
||||
return syntax.TsWrite
|
||||
case "-x":
|
||||
return syntax.TsExec
|
||||
case "-s":
|
||||
return syntax.TsNoEmpty
|
||||
case "-t":
|
||||
return syntax.TsFdTerm
|
||||
case "-z":
|
||||
return syntax.TsEmpStr
|
||||
case "-n":
|
||||
return syntax.TsNempStr
|
||||
case "-o":
|
||||
return syntax.TsOptSet
|
||||
case "-v":
|
||||
return syntax.TsVarSet
|
||||
case "-R":
|
||||
return syntax.TsRefVar
|
||||
default:
|
||||
return illegalTok
|
||||
}
|
||||
}
|
||||
|
||||
// testBinaryOp is like syntax's, but with -a and -o, and without =~.
|
||||
func testBinaryOp(val string) syntax.BinTestOperator {
|
||||
switch val {
|
||||
case "-a":
|
||||
return syntax.AndTest
|
||||
case "-o":
|
||||
return syntax.OrTest
|
||||
case "==", "=":
|
||||
return syntax.TsMatch
|
||||
case "!=":
|
||||
return syntax.TsNoMatch
|
||||
case "-nt":
|
||||
return syntax.TsNewer
|
||||
case "-ot":
|
||||
return syntax.TsOlder
|
||||
case "-ef":
|
||||
return syntax.TsDevIno
|
||||
case "-eq":
|
||||
return syntax.TsEql
|
||||
case "-ne":
|
||||
return syntax.TsNeq
|
||||
case "-le":
|
||||
return syntax.TsLeq
|
||||
case "-ge":
|
||||
return syntax.TsGeq
|
||||
case "-lt":
|
||||
return syntax.TsLss
|
||||
case "-gt":
|
||||
return syntax.TsGtr
|
||||
default:
|
||||
return illegalTok
|
||||
}
|
||||
}
|
101
vendor/github.com/mvdan/sh/syntax/lexer.go
generated
vendored
101
vendor/github.com/mvdan/sh/syntax/lexer.go
generated
vendored
@ -28,6 +28,15 @@ func paramOps(r rune) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// these start a parameter expansion name
|
||||
func paramNameOp(r rune) bool {
|
||||
switch r {
|
||||
case '}', ':', '+', '=', '%', '[', ']', '/', '^', ',', '@':
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// tokenize these inside arithmetic expansions
|
||||
func arithmOps(r rune) bool {
|
||||
switch r {
|
||||
@ -86,14 +95,6 @@ retry:
|
||||
return p.r
|
||||
}
|
||||
|
||||
func (p *Parser) unrune(r rune, tok token) {
|
||||
if p.r != utf8.RuneSelf {
|
||||
p.npos -= utf8.RuneLen(p.r)
|
||||
p.r = r
|
||||
p.tok = tok
|
||||
}
|
||||
}
|
||||
|
||||
// fill reads more bytes from the input src into readBuf. Any bytes that
|
||||
// had not yet been used at the end of the buffer are slid into the
|
||||
// beginning of the buffer.
|
||||
@ -528,7 +529,7 @@ func (p *Parser) paramToken(r rune) token {
|
||||
p.rune()
|
||||
return leftBrack
|
||||
case '/':
|
||||
if p.rune() == '/' {
|
||||
if p.rune() == '/' && p.quote != paramExpRepl {
|
||||
p.rune()
|
||||
return dblSlash
|
||||
}
|
||||
@ -961,90 +962,90 @@ loop:
|
||||
p.tok, p.val = _LitWord, p.endLit()
|
||||
}
|
||||
|
||||
func testUnaryOp(val string) token {
|
||||
func testUnaryOp(val string) UnTestOperator {
|
||||
switch val {
|
||||
case "!":
|
||||
return exclMark
|
||||
return TsNot
|
||||
case "-e", "-a":
|
||||
return tsExists
|
||||
return TsExists
|
||||
case "-f":
|
||||
return tsRegFile
|
||||
return TsRegFile
|
||||
case "-d":
|
||||
return tsDirect
|
||||
return TsDirect
|
||||
case "-c":
|
||||
return tsCharSp
|
||||
return TsCharSp
|
||||
case "-b":
|
||||
return tsBlckSp
|
||||
return TsBlckSp
|
||||
case "-p":
|
||||
return tsNmPipe
|
||||
return TsNmPipe
|
||||
case "-S":
|
||||
return tsSocket
|
||||
return TsSocket
|
||||
case "-L", "-h":
|
||||
return tsSmbLink
|
||||
return TsSmbLink
|
||||
case "-k":
|
||||
return tsSticky
|
||||
return TsSticky
|
||||
case "-g":
|
||||
return tsGIDSet
|
||||
return TsGIDSet
|
||||
case "-u":
|
||||
return tsUIDSet
|
||||
return TsUIDSet
|
||||
case "-G":
|
||||
return tsGrpOwn
|
||||
return TsGrpOwn
|
||||
case "-O":
|
||||
return tsUsrOwn
|
||||
return TsUsrOwn
|
||||
case "-N":
|
||||
return tsModif
|
||||
return TsModif
|
||||
case "-r":
|
||||
return tsRead
|
||||
return TsRead
|
||||
case "-w":
|
||||
return tsWrite
|
||||
return TsWrite
|
||||
case "-x":
|
||||
return tsExec
|
||||
return TsExec
|
||||
case "-s":
|
||||
return tsNoEmpty
|
||||
return TsNoEmpty
|
||||
case "-t":
|
||||
return tsFdTerm
|
||||
return TsFdTerm
|
||||
case "-z":
|
||||
return tsEmpStr
|
||||
return TsEmpStr
|
||||
case "-n":
|
||||
return tsNempStr
|
||||
return TsNempStr
|
||||
case "-o":
|
||||
return tsOptSet
|
||||
return TsOptSet
|
||||
case "-v":
|
||||
return tsVarSet
|
||||
return TsVarSet
|
||||
case "-R":
|
||||
return tsRefVar
|
||||
return TsRefVar
|
||||
default:
|
||||
return illegalTok
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
func testBinaryOp(val string) token {
|
||||
func testBinaryOp(val string) BinTestOperator {
|
||||
switch val {
|
||||
case "==", "=":
|
||||
return equal
|
||||
return TsMatch
|
||||
case "!=":
|
||||
return nequal
|
||||
return TsNoMatch
|
||||
case "=~":
|
||||
return tsReMatch
|
||||
return TsReMatch
|
||||
case "-nt":
|
||||
return tsNewer
|
||||
return TsNewer
|
||||
case "-ot":
|
||||
return tsOlder
|
||||
return TsOlder
|
||||
case "-ef":
|
||||
return tsDevIno
|
||||
return TsDevIno
|
||||
case "-eq":
|
||||
return tsEql
|
||||
return TsEql
|
||||
case "-ne":
|
||||
return tsNeq
|
||||
return TsNeq
|
||||
case "-le":
|
||||
return tsLeq
|
||||
return TsLeq
|
||||
case "-ge":
|
||||
return tsGeq
|
||||
return TsGeq
|
||||
case "-lt":
|
||||
return tsLss
|
||||
return TsLss
|
||||
case "-gt":
|
||||
return tsGtr
|
||||
return TsGtr
|
||||
default:
|
||||
return illegalTok
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
87
vendor/github.com/mvdan/sh/syntax/nodes.go
generated
vendored
87
vendor/github.com/mvdan/sh/syntax/nodes.go
generated
vendored
@ -111,17 +111,16 @@ func (c *Comment) End() Pos { return c.Hash + Pos(len(c.Text)) }
|
||||
// Stmt represents a statement, otherwise known as a compound command.
|
||||
// It is compromised of a command and other components that may come
|
||||
// before or after it.
|
||||
//
|
||||
// The Coprocess field is particular to MirBSDKorn.
|
||||
type Stmt struct {
|
||||
Cmd Command
|
||||
Position Pos
|
||||
Semicolon Pos
|
||||
Negated bool
|
||||
Background bool
|
||||
Coprocess bool
|
||||
Assigns []*Assign
|
||||
Redirs []*Redirect
|
||||
Negated bool // ! stmt
|
||||
Background bool // stmt &
|
||||
Coprocess bool // mksh's |&
|
||||
|
||||
Assigns []*Assign // a=x b=y stmt
|
||||
Redirs []*Redirect // stmt >a <b
|
||||
}
|
||||
|
||||
func (s *Stmt) Pos() Pos { return s.Position }
|
||||
@ -174,13 +173,13 @@ func (*CoprocClause) commandNode() {}
|
||||
|
||||
// Assign represents an assignment to a variable.
|
||||
type Assign struct {
|
||||
Append bool
|
||||
Naked bool
|
||||
Append bool // +=
|
||||
Naked bool // without '='
|
||||
Name *Lit
|
||||
Index ArithmExpr
|
||||
Key *DblQuoted
|
||||
Value *Word
|
||||
Array *ArrayExpr
|
||||
Index ArithmExpr // [i]
|
||||
Key *DblQuoted // ["k"]
|
||||
Value *Word // =val
|
||||
Array *ArrayExpr // =(arr)
|
||||
}
|
||||
|
||||
func (a *Assign) Pos() Pos { return a.Name.Pos() }
|
||||
@ -193,8 +192,7 @@ func (a *Assign) End() Pos {
|
||||
}
|
||||
if a.Index != nil {
|
||||
return a.Index.End() + 2
|
||||
}
|
||||
if a.Key != nil {
|
||||
} else if a.Key != nil {
|
||||
return a.Key.End() + 2
|
||||
}
|
||||
if a.Naked {
|
||||
@ -205,10 +203,11 @@ func (a *Assign) End() Pos {
|
||||
|
||||
// Redirect represents an input/output redirection.
|
||||
type Redirect struct {
|
||||
OpPos Pos
|
||||
Op RedirOperator
|
||||
N *Lit
|
||||
Word, Hdoc *Word
|
||||
OpPos Pos
|
||||
Op RedirOperator
|
||||
N *Lit // N>
|
||||
Word *Word // >word
|
||||
Hdoc *Word // here-document body
|
||||
}
|
||||
|
||||
func (r *Redirect) Pos() Pos {
|
||||
@ -330,10 +329,10 @@ func (b *BinaryCmd) End() Pos { return b.Y.End() }
|
||||
|
||||
// FuncDecl represents the declaration of a function.
|
||||
type FuncDecl struct {
|
||||
Position Pos
|
||||
BashStyle bool
|
||||
Name *Lit
|
||||
Body *Stmt
|
||||
Position Pos
|
||||
RsrvWord bool // non-posix "function " style
|
||||
Name *Lit
|
||||
Body *Stmt
|
||||
}
|
||||
|
||||
func (f *FuncDecl) Pos() Pos { return f.Position }
|
||||
@ -379,7 +378,7 @@ func (l *Lit) End() Pos { return l.ValueEnd }
|
||||
// SglQuoted represents a string within single quotes.
|
||||
type SglQuoted struct {
|
||||
Position Pos
|
||||
Dollar bool
|
||||
Dollar bool // $''
|
||||
Value string
|
||||
}
|
||||
|
||||
@ -395,7 +394,7 @@ func (q *SglQuoted) End() Pos {
|
||||
// DblQuoted represents a list of nodes within double quotes.
|
||||
type DblQuoted struct {
|
||||
Position Pos
|
||||
Dollar bool
|
||||
Dollar bool // $""
|
||||
Parts []WordPart
|
||||
}
|
||||
|
||||
@ -415,10 +414,8 @@ type CmdSubst struct {
|
||||
Left, Right Pos
|
||||
Stmts []*Stmt
|
||||
|
||||
// MirBSDTempFile is true for mksh's ${ foo;}
|
||||
MirBSDTempFile bool
|
||||
// MirBSDReplyvar is true for mksh's ${|foo;}
|
||||
MirBSDReplyVar bool
|
||||
TempFile bool // mksh's ${ foo;}
|
||||
ReplyVar bool // mksh's ${|foo;}
|
||||
}
|
||||
|
||||
func (c *CmdSubst) Pos() Pos { return c.Left }
|
||||
@ -427,16 +424,16 @@ func (c *CmdSubst) End() Pos { return c.Right + 1 }
|
||||
// ParamExp represents a parameter expansion.
|
||||
type ParamExp struct {
|
||||
Dollar, Rbrace Pos
|
||||
Short bool
|
||||
Indirect bool
|
||||
Length bool
|
||||
Width bool
|
||||
Short bool // $a instead of ${a}
|
||||
Indirect bool // ${!a}
|
||||
Length bool // ${#a}
|
||||
Width bool // ${%a}
|
||||
Param *Lit
|
||||
Index ArithmExpr
|
||||
Key *DblQuoted
|
||||
Slice *Slice
|
||||
Repl *Replace
|
||||
Exp *Expansion
|
||||
Index ArithmExpr // ${a[i]}
|
||||
Key *DblQuoted // ${a["k"]}
|
||||
Slice *Slice // ${a:x:y}
|
||||
Repl *Replace // ${a/x/y}
|
||||
Exp *Expansion // ${a:-b}, ${a#b}, etc
|
||||
}
|
||||
|
||||
func (p *ParamExp) Pos() Pos { return p.Dollar }
|
||||
@ -446,8 +443,7 @@ func (p *ParamExp) End() Pos {
|
||||
}
|
||||
if p.Index != nil {
|
||||
return p.Index.End() + 1
|
||||
}
|
||||
if p.Key != nil {
|
||||
} else if p.Key != nil {
|
||||
return p.Key.End() + 1
|
||||
}
|
||||
return p.Param.End()
|
||||
@ -480,8 +476,8 @@ type Expansion struct {
|
||||
// ArithmExp represents an arithmetic expansion.
|
||||
type ArithmExp struct {
|
||||
Left, Right Pos
|
||||
Bracket bool
|
||||
Unsigned bool
|
||||
Bracket bool // deprecated $[expr] form
|
||||
Unsigned bool // mksh's $((# expr))
|
||||
X ArithmExpr
|
||||
}
|
||||
|
||||
@ -498,7 +494,7 @@ func (a *ArithmExp) End() Pos {
|
||||
// This node will never appear when in PosixConformant mode.
|
||||
type ArithmCmd struct {
|
||||
Left, Right Pos
|
||||
Unsigned bool
|
||||
Unsigned bool // mksh's ((# expr))
|
||||
X ArithmExpr
|
||||
}
|
||||
|
||||
@ -651,7 +647,7 @@ func (p *ParenTest) End() Pos { return p.Rparen + 1 }
|
||||
// This node will never appear when in PosixConformant mode.
|
||||
type DeclClause struct {
|
||||
Position Pos
|
||||
Variant string
|
||||
Variant string // "declare", "local", etc
|
||||
Opts []*Word
|
||||
Assigns []*Assign
|
||||
}
|
||||
@ -684,8 +680,7 @@ type ArrayElem struct {
|
||||
func (a *ArrayElem) Pos() Pos {
|
||||
if a.Index != nil {
|
||||
return a.Index.Pos()
|
||||
}
|
||||
if a.Key != nil {
|
||||
} else if a.Key != nil {
|
||||
return a.Key.Pos()
|
||||
}
|
||||
return a.Value.Pos()
|
||||
|
178
vendor/github.com/mvdan/sh/syntax/parser.go
generated
vendored
178
vendor/github.com/mvdan/sh/syntax/parser.go
generated
vendored
@ -118,7 +118,7 @@ func (p *Parser) getPos() Pos { return Pos(p.offs + p.npos) }
|
||||
|
||||
func (p *Parser) lit(pos Pos, val string) *Lit {
|
||||
if len(p.litBatch) == 0 {
|
||||
p.litBatch = make([]Lit, 64)
|
||||
p.litBatch = make([]Lit, 128)
|
||||
}
|
||||
l := &p.litBatch[0]
|
||||
p.litBatch = p.litBatch[1:]
|
||||
@ -130,7 +130,7 @@ func (p *Parser) lit(pos Pos, val string) *Lit {
|
||||
|
||||
func (p *Parser) word(parts []WordPart) *Word {
|
||||
if len(p.wordBatch) == 0 {
|
||||
p.wordBatch = make([]Word, 32)
|
||||
p.wordBatch = make([]Word, 64)
|
||||
}
|
||||
w := &p.wordBatch[0]
|
||||
p.wordBatch = p.wordBatch[1:]
|
||||
@ -150,7 +150,7 @@ func (p *Parser) wps(wp WordPart) []WordPart {
|
||||
|
||||
func (p *Parser) stmt(pos Pos) *Stmt {
|
||||
if len(p.stmtBatch) == 0 {
|
||||
p.stmtBatch = make([]Stmt, 16)
|
||||
p.stmtBatch = make([]Stmt, 64)
|
||||
}
|
||||
s := &p.stmtBatch[0]
|
||||
p.stmtBatch = p.stmtBatch[1:]
|
||||
@ -160,7 +160,7 @@ func (p *Parser) stmt(pos Pos) *Stmt {
|
||||
|
||||
func (p *Parser) stList() []*Stmt {
|
||||
if len(p.stListBatch) == 0 {
|
||||
p.stListBatch = make([]*Stmt, 128)
|
||||
p.stListBatch = make([]*Stmt, 256)
|
||||
}
|
||||
stmts := p.stListBatch[:0:4]
|
||||
p.stListBatch = p.stListBatch[4:]
|
||||
@ -184,7 +184,7 @@ func (p *Parser) call(w *Word) *CallExpr {
|
||||
return ce
|
||||
}
|
||||
|
||||
type quoteState uint
|
||||
type quoteState uint32
|
||||
|
||||
const (
|
||||
noState quoteState = 1 << iota
|
||||
@ -557,9 +557,9 @@ func (p *Parser) wordPart() WordPart {
|
||||
p.curErr(`"${ stmts;}" is a mksh feature`)
|
||||
}
|
||||
cs := &CmdSubst{
|
||||
Left: p.pos,
|
||||
MirBSDTempFile: p.r != '|',
|
||||
MirBSDReplyVar: p.r == '|',
|
||||
Left: p.pos,
|
||||
TempFile: p.r != '|',
|
||||
ReplyVar: p.r == '|',
|
||||
}
|
||||
old := p.preNested(subCmd)
|
||||
p.rune() // don't tokenize '|'
|
||||
@ -792,6 +792,9 @@ func (p *Parser) arithmExpr(ftok token, fpos Pos, level int, compact, tern bool)
|
||||
case _Lit, _LitWord:
|
||||
p.curErr("not a valid arithmetic operator: %s", p.val)
|
||||
return nil
|
||||
case leftBrack:
|
||||
p.curErr("[ must follow a name")
|
||||
return nil
|
||||
case rightParen, _EOF:
|
||||
default:
|
||||
if p.quote == arithmExpr {
|
||||
@ -845,7 +848,7 @@ func isArithName(left ArithmExpr) bool {
|
||||
}
|
||||
switch x := w.Parts[0].(type) {
|
||||
case *Lit:
|
||||
return validIdent(x.Value)
|
||||
return ValidName(x.Value)
|
||||
case *ParamExp:
|
||||
return x.nakedIndex()
|
||||
default:
|
||||
@ -905,10 +908,6 @@ func (p *Parser) arithmExprBase(compact bool) ArithmExpr {
|
||||
p.postNested(old)
|
||||
p.matched(left, leftBrack, rightBrack)
|
||||
x = p.word(p.wps(pe))
|
||||
case dollar:
|
||||
x = p.word(p.wps(p.shortParamExp()))
|
||||
case dollBrace:
|
||||
x = p.word(p.wps(p.paramExp()))
|
||||
case bckQuote:
|
||||
if p.quote == arithmExprLet {
|
||||
return nil
|
||||
@ -964,15 +963,18 @@ func (p *Parser) paramExp() *ParamExp {
|
||||
pe := &ParamExp{Dollar: p.pos}
|
||||
old := p.quote
|
||||
p.quote = paramExpName
|
||||
p.next()
|
||||
if p.r == '#' {
|
||||
p.tok = hash
|
||||
p.pos = p.getPos()
|
||||
p.rune()
|
||||
} else {
|
||||
p.next()
|
||||
}
|
||||
switch p.tok {
|
||||
case at:
|
||||
p.tok, p.val = _LitWord, "@"
|
||||
case dblHash:
|
||||
p.unrune('#', hash)
|
||||
fallthrough
|
||||
case hash:
|
||||
if p.r != '}' {
|
||||
if paramNameOp(p.r) {
|
||||
pe.Length = true
|
||||
p.next()
|
||||
}
|
||||
@ -980,12 +982,12 @@ func (p *Parser) paramExp() *ParamExp {
|
||||
if p.lang != LangMirBSDKorn {
|
||||
p.posErr(pe.Pos(), `"${%%foo}" is a mksh feature`)
|
||||
}
|
||||
if p.r != '}' {
|
||||
if paramNameOp(p.r) {
|
||||
pe.Width = true
|
||||
p.next()
|
||||
}
|
||||
case exclMark:
|
||||
if p.r != '}' {
|
||||
if paramNameOp(p.r) {
|
||||
pe.Indirect = true
|
||||
p.next()
|
||||
}
|
||||
@ -1006,9 +1008,7 @@ func (p *Parser) paramExp() *ParamExp {
|
||||
p.curErr("%s cannot be followed by a word", op)
|
||||
}
|
||||
default:
|
||||
if !pe.Length {
|
||||
p.posErr(pe.Dollar, "parameter expansion requires a literal")
|
||||
}
|
||||
p.curErr("parameter expansion requires a literal")
|
||||
}
|
||||
if p.tok == rightBrace {
|
||||
pe.Rbrace = p.pos
|
||||
@ -1050,14 +1050,9 @@ func (p *Parser) paramExp() *ParamExp {
|
||||
p.next()
|
||||
pe.Repl.Orig = p.getWord()
|
||||
p.quote = paramExpExp
|
||||
switch p.tok {
|
||||
case dblSlash:
|
||||
p.unrune('/', slash)
|
||||
p.next()
|
||||
case slash:
|
||||
p.next()
|
||||
if p.got(slash) {
|
||||
pe.Repl.With = p.getWord()
|
||||
}
|
||||
pe.Repl.With = p.getWord()
|
||||
case colon:
|
||||
if p.lang == LangPOSIX {
|
||||
p.curErr("slicing is a bash feature")
|
||||
@ -1119,7 +1114,8 @@ func stopToken(tok token) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func validIdent(val string) bool {
|
||||
// ValidName returns whether val is a valid name as per the POSIX spec.
|
||||
func ValidName(val string) bool {
|
||||
for i, c := range val {
|
||||
switch {
|
||||
case 'a' <= c && c <= 'z':
|
||||
@ -1138,7 +1134,7 @@ func (p *Parser) hasValidIdent() bool {
|
||||
if p.val[end-1] == '+' && p.lang != LangPOSIX {
|
||||
end--
|
||||
}
|
||||
if validIdent(p.val[:end]) {
|
||||
if ValidName(p.val[:end]) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@ -1387,57 +1383,51 @@ preLoop:
|
||||
case "esac":
|
||||
p.curErr(`%q can only be used to end a case`, p.val)
|
||||
case "[[":
|
||||
if p.lang == LangPOSIX {
|
||||
break
|
||||
if p.lang != LangPOSIX {
|
||||
s.Cmd = p.testClause()
|
||||
}
|
||||
s.Cmd = p.testClause()
|
||||
case "]]":
|
||||
if p.lang == LangPOSIX {
|
||||
break
|
||||
if p.lang != LangPOSIX {
|
||||
p.curErr(`%s can only be used to close a test`,
|
||||
p.val)
|
||||
}
|
||||
p.curErr(`%s can only be used to close a test`, p.val)
|
||||
case "let":
|
||||
if p.lang == LangPOSIX {
|
||||
break
|
||||
if p.lang != LangPOSIX {
|
||||
s.Cmd = p.letClause()
|
||||
}
|
||||
s.Cmd = p.letClause()
|
||||
case "function":
|
||||
if p.lang == LangPOSIX {
|
||||
break
|
||||
if p.lang != LangPOSIX {
|
||||
s.Cmd = p.bashFuncDecl()
|
||||
}
|
||||
s.Cmd = p.bashFuncDecl()
|
||||
case "declare":
|
||||
if p.lang != LangBash {
|
||||
break
|
||||
if p.lang == LangBash {
|
||||
s.Cmd = p.declClause()
|
||||
}
|
||||
s.Cmd = p.declClause()
|
||||
case "local", "export", "readonly", "typeset", "nameref":
|
||||
if p.lang == LangPOSIX {
|
||||
break
|
||||
if p.lang != LangPOSIX {
|
||||
s.Cmd = p.declClause()
|
||||
}
|
||||
s.Cmd = p.declClause()
|
||||
case "time":
|
||||
if p.lang == LangPOSIX {
|
||||
break
|
||||
if p.lang != LangPOSIX {
|
||||
s.Cmd = p.timeClause()
|
||||
}
|
||||
s.Cmd = p.timeClause()
|
||||
case "coproc":
|
||||
if p.lang != LangBash {
|
||||
break
|
||||
if p.lang == LangBash {
|
||||
s.Cmd = p.coprocClause()
|
||||
}
|
||||
s.Cmd = p.coprocClause()
|
||||
}
|
||||
if s.Cmd == nil {
|
||||
name := p.lit(p.pos, p.val)
|
||||
if p.next(); p.gotSameLine(leftParen) {
|
||||
p.follow(name.ValuePos, "foo(", rightParen)
|
||||
if p.lang == LangPOSIX && !validIdent(name.Value) {
|
||||
p.posErr(name.Pos(), "invalid func name")
|
||||
}
|
||||
s.Cmd = p.funcDecl(name, name.ValuePos)
|
||||
} else {
|
||||
s.Cmd = p.callExpr(s, p.word(p.wps(name)))
|
||||
if s.Cmd != nil {
|
||||
break
|
||||
}
|
||||
name := p.lit(p.pos, p.val)
|
||||
if p.next(); p.gotSameLine(leftParen) {
|
||||
p.follow(name.ValuePos, "foo(", rightParen)
|
||||
if p.lang == LangPOSIX && !ValidName(name.Value) {
|
||||
p.posErr(name.Pos(), "invalid func name")
|
||||
}
|
||||
s.Cmd = p.funcDecl(name, name.ValuePos)
|
||||
} else {
|
||||
s.Cmd = p.callExpr(s, p.word(p.wps(name)))
|
||||
}
|
||||
case bckQuote:
|
||||
if p.quote == subCmdBckquo {
|
||||
@ -1576,25 +1566,16 @@ func (p *Parser) loop(forPos Pos) Loop {
|
||||
if p.tok == dblLeftParen {
|
||||
cl := &CStyleLoop{Lparen: p.pos}
|
||||
old := p.preNested(arithmExprCmd)
|
||||
if p.next(); p.tok == dblSemicolon {
|
||||
p.unrune(';', semicolon)
|
||||
}
|
||||
if p.tok != semicolon {
|
||||
cl.Init = p.arithmExpr(dblLeftParen, cl.Lparen, 0, false, false)
|
||||
}
|
||||
p.next()
|
||||
cl.Init = p.arithmExpr(dblLeftParen, cl.Lparen, 0, false, false)
|
||||
scPos := p.pos
|
||||
if p.tok == dblSemicolon {
|
||||
p.unrune(';', semicolon)
|
||||
}
|
||||
p.follow(p.pos, "expression", semicolon)
|
||||
if p.tok != semicolon {
|
||||
if !p.got(dblSemicolon) {
|
||||
p.follow(p.pos, "expr", semicolon)
|
||||
cl.Cond = p.arithmExpr(semicolon, scPos, 0, false, false)
|
||||
scPos = p.pos
|
||||
p.follow(p.pos, "expr", semicolon)
|
||||
}
|
||||
scPos = p.pos
|
||||
p.follow(p.pos, "expression", semicolon)
|
||||
if p.tok != semicolon {
|
||||
cl.Post = p.arithmExpr(semicolon, scPos, 0, false, false)
|
||||
}
|
||||
cl.Post = p.arithmExpr(semicolon, scPos, 0, false, false)
|
||||
cl.Rparen = p.arithmEnd(dblLeftParen, cl.Lparen, old)
|
||||
p.gotSameLine(semicolon)
|
||||
return cl
|
||||
@ -1677,7 +1658,7 @@ func (p *Parser) testClause() *TestClause {
|
||||
if p.next(); p.tok == _EOF || p.gotRsrv("]]") {
|
||||
p.posErr(tc.Left, "test clause requires at least one expression")
|
||||
}
|
||||
tc.X = p.testExpr(illegalTok, tc.Left, 0)
|
||||
tc.X = p.testExpr(illegalTok, tc.Left, false)
|
||||
tc.Right = p.pos
|
||||
if !p.gotRsrv("]]") {
|
||||
p.matchingErr(tc.Left, "[[", "]]")
|
||||
@ -1685,26 +1666,23 @@ func (p *Parser) testClause() *TestClause {
|
||||
return tc
|
||||
}
|
||||
|
||||
func (p *Parser) testExpr(ftok token, fpos Pos, level int) TestExpr {
|
||||
func (p *Parser) testExpr(ftok token, fpos Pos, pastAndOr bool) TestExpr {
|
||||
var left TestExpr
|
||||
if level > 1 {
|
||||
if pastAndOr {
|
||||
left = p.testExprBase(ftok, fpos)
|
||||
} else {
|
||||
left = p.testExpr(ftok, fpos, level+1)
|
||||
left = p.testExpr(ftok, fpos, true)
|
||||
}
|
||||
if left == nil {
|
||||
return left
|
||||
}
|
||||
var newLevel int
|
||||
switch p.tok {
|
||||
case andAnd, orOr:
|
||||
case _LitWord:
|
||||
if p.val == "]]" {
|
||||
return left
|
||||
}
|
||||
fallthrough
|
||||
case rdrIn, rdrOut:
|
||||
newLevel = 1
|
||||
case _EOF, rightParen:
|
||||
return left
|
||||
case _Lit:
|
||||
@ -1712,11 +1690,8 @@ func (p *Parser) testExpr(ftok token, fpos Pos, level int) TestExpr {
|
||||
default:
|
||||
p.curErr("not a valid test operator: %v", p.tok)
|
||||
}
|
||||
if newLevel < level {
|
||||
return left
|
||||
}
|
||||
if p.tok == _LitWord {
|
||||
if p.tok = testBinaryOp(p.val); p.tok == illegalTok {
|
||||
if p.tok = token(testBinaryOp(p.val)); p.tok == illegalTok {
|
||||
p.curErr("not a valid test operator: %s", p.val)
|
||||
}
|
||||
}
|
||||
@ -1728,7 +1703,7 @@ func (p *Parser) testExpr(ftok token, fpos Pos, level int) TestExpr {
|
||||
switch b.Op {
|
||||
case AndTest, OrTest:
|
||||
p.next()
|
||||
if b.Y = p.testExpr(token(b.Op), b.OpPos, newLevel); b.Y == nil {
|
||||
if b.Y = p.testExpr(token(b.Op), b.OpPos, false); b.Y == nil {
|
||||
p.followErrExp(b.OpPos, b.Op.String())
|
||||
}
|
||||
case TsReMatch:
|
||||
@ -1754,11 +1729,10 @@ func (p *Parser) testExprBase(ftok token, fpos Pos) TestExpr {
|
||||
case _EOF:
|
||||
return nil
|
||||
case _LitWord:
|
||||
op := testUnaryOp(p.val)
|
||||
op := token(testUnaryOp(p.val))
|
||||
switch op {
|
||||
case illegalTok:
|
||||
case tsRefVar, tsModif:
|
||||
// TODO: check with man mksh
|
||||
case tsRefVar, tsModif: // not available in mksh
|
||||
if p.lang == LangBash {
|
||||
p.tok = op
|
||||
}
|
||||
@ -1770,7 +1744,7 @@ func (p *Parser) testExprBase(ftok token, fpos Pos) TestExpr {
|
||||
case exclMark:
|
||||
u := &UnaryTest{OpPos: p.pos, Op: TsNot}
|
||||
p.next()
|
||||
u.X = p.testExpr(token(u.Op), u.OpPos, 0)
|
||||
u.X = p.testExpr(token(u.Op), u.OpPos, false)
|
||||
return u
|
||||
case tsExists, tsRegFile, tsDirect, tsCharSp, tsBlckSp, tsNmPipe,
|
||||
tsSocket, tsSmbLink, tsSticky, tsGIDSet, tsUIDSet, tsGrpOwn,
|
||||
@ -1783,7 +1757,7 @@ func (p *Parser) testExprBase(ftok token, fpos Pos) TestExpr {
|
||||
case leftParen:
|
||||
pe := &ParenTest{Lparen: p.pos}
|
||||
p.next()
|
||||
if pe.X = p.testExpr(leftParen, pe.Lparen, 0); pe.X == nil {
|
||||
if pe.X = p.testExpr(leftParen, pe.Lparen, false); pe.X == nil {
|
||||
p.followErrExp(pe.Lparen, "(")
|
||||
}
|
||||
pe.Rparen = p.matched(pe.Lparen, leftParen, rightParen)
|
||||
@ -1953,9 +1927,9 @@ func (p *Parser) callExpr(s *Stmt, w *Word) *CallExpr {
|
||||
|
||||
func (p *Parser) funcDecl(name *Lit, pos Pos) *FuncDecl {
|
||||
fd := &FuncDecl{
|
||||
Position: pos,
|
||||
BashStyle: pos != name.ValuePos,
|
||||
Name: name,
|
||||
Position: pos,
|
||||
RsrvWord: pos != name.ValuePos,
|
||||
Name: name,
|
||||
}
|
||||
if fd.Body, _ = p.getStmt(false, false); fd.Body == nil {
|
||||
p.followErr(fd.Pos(), "foo()", "a statement")
|
||||
|
10
vendor/github.com/mvdan/sh/syntax/printer.go
generated
vendored
10
vendor/github.com/mvdan/sh/syntax/printer.go
generated
vendored
@ -289,13 +289,13 @@ func (p *Printer) wordPart(wp WordPart) {
|
||||
case *CmdSubst:
|
||||
p.incLines(x.Pos())
|
||||
switch {
|
||||
case x.MirBSDTempFile:
|
||||
case x.TempFile:
|
||||
p.WriteString("${")
|
||||
p.wantSpace = true
|
||||
p.nestedStmts(x.Stmts, x.Right)
|
||||
p.wantSpace = false
|
||||
p.semiRsrv("}", x.Right, true)
|
||||
case x.MirBSDReplyVar:
|
||||
case x.ReplyVar:
|
||||
p.WriteString("${|")
|
||||
p.nestedStmts(x.Stmts, x.Right)
|
||||
p.wantSpace = false
|
||||
@ -380,9 +380,7 @@ func (p *Printer) paramExp(pe *ParamExp) {
|
||||
case pe.Indirect:
|
||||
p.WriteByte('!')
|
||||
}
|
||||
if pe.Param != nil {
|
||||
p.WriteString(pe.Param.Value)
|
||||
}
|
||||
p.WriteString(pe.Param.Value)
|
||||
p.wroteIndex(pe.Index, pe.Key)
|
||||
if pe.Slice != nil {
|
||||
p.WriteByte(':')
|
||||
@ -741,7 +739,7 @@ func (p *Printer) command(cmd Command, redirs []*Redirect) (startRedirs int) {
|
||||
}
|
||||
p.nestedBinary = false
|
||||
case *FuncDecl:
|
||||
if x.BashStyle {
|
||||
if x.RsrvWord {
|
||||
p.WriteString("function ")
|
||||
}
|
||||
p.WriteString(x.Name.Value)
|
||||
|
243
vendor/github.com/mvdan/sh/syntax/simplify.go
generated
vendored
Normal file
243
vendor/github.com/mvdan/sh/syntax/simplify.go
generated
vendored
Normal file
@ -0,0 +1,243 @@
|
||||
// Copyright (c) 2017, Daniel Martí <mvdan@mvdan.cc>
|
||||
// See LICENSE for licensing information
|
||||
|
||||
package syntax
|
||||
|
||||
import "bytes"
|
||||
|
||||
// Simplify simplifies a given program and returns whether any changes
|
||||
// were made.
|
||||
//
|
||||
// This function is EXPERIMENTAL; it may change or disappear at any
|
||||
// point until this notice is removed.
|
||||
func Simplify(f *File) bool {
|
||||
s := simplifier{}
|
||||
Walk(f, s.visit)
|
||||
return s.modified
|
||||
}
|
||||
|
||||
type simplifier struct {
|
||||
modified bool
|
||||
}
|
||||
|
||||
func (s *simplifier) visit(node Node) bool {
|
||||
switch x := node.(type) {
|
||||
case *Assign:
|
||||
if x.Index != nil {
|
||||
x.Index = s.removeParensArithm(x.Index)
|
||||
x.Index = s.inlineSimpleParams(x.Index)
|
||||
}
|
||||
case *ParamExp:
|
||||
if x.Index != nil {
|
||||
x.Index = s.removeParensArithm(x.Index)
|
||||
x.Index = s.inlineSimpleParams(x.Index)
|
||||
}
|
||||
if x.Slice == nil {
|
||||
break
|
||||
}
|
||||
if x.Slice.Offset != nil {
|
||||
x.Slice.Offset = s.removeParensArithm(x.Slice.Offset)
|
||||
x.Slice.Offset = s.inlineSimpleParams(x.Slice.Offset)
|
||||
}
|
||||
if x.Slice.Length != nil {
|
||||
x.Slice.Length = s.removeParensArithm(x.Slice.Length)
|
||||
x.Slice.Length = s.inlineSimpleParams(x.Slice.Length)
|
||||
}
|
||||
case *ArithmExp:
|
||||
x.X = s.removeParensArithm(x.X)
|
||||
x.X = s.inlineSimpleParams(x.X)
|
||||
case *ArithmCmd:
|
||||
x.X = s.removeParensArithm(x.X)
|
||||
x.X = s.inlineSimpleParams(x.X)
|
||||
case *ParenArithm:
|
||||
x.X = s.removeParensArithm(x.X)
|
||||
x.X = s.inlineSimpleParams(x.X)
|
||||
case *BinaryArithm:
|
||||
x.X = s.inlineSimpleParams(x.X)
|
||||
x.Y = s.inlineSimpleParams(x.Y)
|
||||
case *CmdSubst:
|
||||
x.Stmts = s.inlineSubshell(x.Stmts)
|
||||
case *Subshell:
|
||||
x.Stmts = s.inlineSubshell(x.Stmts)
|
||||
case *Word:
|
||||
x.Parts = s.simplifyWord(x.Parts)
|
||||
case *TestClause:
|
||||
x.X = s.removeParensTest(x.X)
|
||||
x.X = s.removeNegateTest(x.X)
|
||||
case *ParenTest:
|
||||
x.X = s.removeParensTest(x.X)
|
||||
x.X = s.removeNegateTest(x.X)
|
||||
case *BinaryTest:
|
||||
x.X = s.unquoteParams(x.X)
|
||||
x.X = s.removeNegateTest(x.X)
|
||||
switch x.Op {
|
||||
case TsMatch, TsNoMatch:
|
||||
// unquoting enables globbing
|
||||
default:
|
||||
x.Y = s.unquoteParams(x.Y)
|
||||
}
|
||||
x.Y = s.removeNegateTest(x.Y)
|
||||
case *UnaryTest:
|
||||
x.X = s.unquoteParams(x.X)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (s *simplifier) simplifyWord(wps []WordPart) []WordPart {
|
||||
parts:
|
||||
for i, wp := range wps {
|
||||
dq, _ := wp.(*DblQuoted)
|
||||
if dq == nil || len(dq.Parts) != 1 {
|
||||
break
|
||||
}
|
||||
lit, _ := dq.Parts[0].(*Lit)
|
||||
if lit == nil {
|
||||
break
|
||||
}
|
||||
var buf bytes.Buffer
|
||||
escaped := false
|
||||
for _, r := range lit.Value {
|
||||
switch r {
|
||||
case '\\':
|
||||
escaped = !escaped
|
||||
if escaped {
|
||||
continue
|
||||
}
|
||||
case '\'':
|
||||
continue parts
|
||||
case '$', '"', '`':
|
||||
escaped = false
|
||||
default:
|
||||
if escaped {
|
||||
continue parts
|
||||
}
|
||||
escaped = false
|
||||
}
|
||||
buf.WriteRune(r)
|
||||
}
|
||||
newVal := buf.String()
|
||||
if newVal == lit.Value {
|
||||
break
|
||||
}
|
||||
s.modified = true
|
||||
wps[i] = &SglQuoted{
|
||||
Position: dq.Position,
|
||||
Dollar: dq.Dollar,
|
||||
Value: newVal,
|
||||
}
|
||||
}
|
||||
return wps
|
||||
}
|
||||
|
||||
func (s *simplifier) removeParensArithm(x ArithmExpr) ArithmExpr {
|
||||
for {
|
||||
par, _ := x.(*ParenArithm)
|
||||
if par == nil {
|
||||
return x
|
||||
}
|
||||
s.modified = true
|
||||
x = par.X
|
||||
}
|
||||
}
|
||||
|
||||
func (s *simplifier) inlineSimpleParams(x ArithmExpr) ArithmExpr {
|
||||
w, _ := x.(*Word)
|
||||
if w == nil || len(w.Parts) != 1 {
|
||||
return x
|
||||
}
|
||||
pe, _ := w.Parts[0].(*ParamExp)
|
||||
if pe == nil || !ValidName(pe.Param.Value) {
|
||||
return x
|
||||
}
|
||||
if pe.Indirect || pe.Length || pe.Width || pe.Key != nil ||
|
||||
pe.Slice != nil || pe.Repl != nil || pe.Exp != nil {
|
||||
return x
|
||||
}
|
||||
if pe.Index != nil {
|
||||
s.modified = true
|
||||
pe.Short = true
|
||||
return w
|
||||
}
|
||||
s.modified = true
|
||||
return &Word{Parts: []WordPart{pe.Param}}
|
||||
}
|
||||
|
||||
func (s *simplifier) inlineSubshell(stmts []*Stmt) []*Stmt {
|
||||
for len(stmts) == 1 {
|
||||
st := stmts[0]
|
||||
if st.Negated || st.Background || st.Coprocess ||
|
||||
len(st.Assigns) > 0 || len(st.Redirs) > 0 {
|
||||
break
|
||||
}
|
||||
sub, _ := st.Cmd.(*Subshell)
|
||||
if sub == nil {
|
||||
break
|
||||
}
|
||||
s.modified = true
|
||||
stmts = sub.Stmts
|
||||
}
|
||||
return stmts
|
||||
}
|
||||
|
||||
func (s *simplifier) unquoteParams(x TestExpr) TestExpr {
|
||||
w, _ := x.(*Word)
|
||||
if w == nil || len(w.Parts) != 1 {
|
||||
return x
|
||||
}
|
||||
dq, _ := w.Parts[0].(*DblQuoted)
|
||||
if dq == nil || len(dq.Parts) != 1 {
|
||||
return x
|
||||
}
|
||||
if _, ok := dq.Parts[0].(*ParamExp); !ok {
|
||||
return x
|
||||
}
|
||||
s.modified = true
|
||||
w.Parts = dq.Parts
|
||||
return w
|
||||
}
|
||||
|
||||
func (s *simplifier) removeParensTest(x TestExpr) TestExpr {
|
||||
for {
|
||||
par, _ := x.(*ParenTest)
|
||||
if par == nil {
|
||||
return x
|
||||
}
|
||||
s.modified = true
|
||||
x = par.X
|
||||
}
|
||||
}
|
||||
|
||||
func (s *simplifier) removeNegateTest(x TestExpr) TestExpr {
|
||||
u, _ := x.(*UnaryTest)
|
||||
if u == nil || u.Op != TsNot {
|
||||
return x
|
||||
}
|
||||
switch y := u.X.(type) {
|
||||
case *UnaryTest:
|
||||
switch y.Op {
|
||||
case TsEmpStr:
|
||||
y.Op = TsNempStr
|
||||
s.modified = true
|
||||
return y
|
||||
case TsNempStr:
|
||||
y.Op = TsEmpStr
|
||||
s.modified = true
|
||||
return y
|
||||
case TsNot:
|
||||
s.modified = true
|
||||
return y.X
|
||||
}
|
||||
case *BinaryTest:
|
||||
switch y.Op {
|
||||
case TsMatch:
|
||||
y.Op = TsNoMatch
|
||||
s.modified = true
|
||||
return y
|
||||
case TsNoMatch:
|
||||
y.Op = TsMatch
|
||||
s.modified = true
|
||||
return y
|
||||
}
|
||||
}
|
||||
return x
|
||||
}
|
13
vendor/github.com/mvdan/sh/syntax/walk.go
generated
vendored
13
vendor/github.com/mvdan/sh/syntax/walk.go
generated
vendored
@ -46,6 +46,11 @@ func Walk(node Node, f func(Node) bool) {
|
||||
if x.Value != nil {
|
||||
Walk(x.Value, f)
|
||||
}
|
||||
if x.Index != nil {
|
||||
Walk(x.Index, f)
|
||||
} else if x.Key != nil {
|
||||
Walk(x.Key, f)
|
||||
}
|
||||
if x.Array != nil {
|
||||
Walk(x.Array, f)
|
||||
}
|
||||
@ -109,11 +114,11 @@ func Walk(node Node, f func(Node) bool) {
|
||||
case *CmdSubst:
|
||||
walkStmts(x.Stmts, f)
|
||||
case *ParamExp:
|
||||
if x.Param != nil {
|
||||
Walk(x.Param, f)
|
||||
}
|
||||
Walk(x.Param, f)
|
||||
if x.Index != nil {
|
||||
Walk(x.Index, f)
|
||||
} else if x.Key != nil {
|
||||
Walk(x.Key, f)
|
||||
}
|
||||
if x.Repl != nil {
|
||||
if x.Repl.Orig != nil {
|
||||
@ -164,6 +169,8 @@ func Walk(node Node, f func(Node) bool) {
|
||||
case *ArrayElem:
|
||||
if x.Index != nil {
|
||||
Walk(x.Index, f)
|
||||
} else if x.Key != nil {
|
||||
Walk(x.Key, f)
|
||||
}
|
||||
Walk(x.Value, f)
|
||||
case *ExtGlob:
|
||||
|
25
vendor/github.com/spf13/pflag/README.md
generated
vendored
25
vendor/github.com/spf13/pflag/README.md
generated
vendored
@ -246,6 +246,25 @@ It is possible to mark a flag as hidden, meaning it will still function as norma
|
||||
flags.MarkHidden("secretFlag")
|
||||
```
|
||||
|
||||
## Disable sorting of flags
|
||||
`pflag` allows you to disable sorting of flags for help and usage message.
|
||||
|
||||
**Example**:
|
||||
```go
|
||||
flags.BoolP("verbose", "v", false, "verbose output")
|
||||
flags.String("coolflag", "yeaah", "it's really cool flag")
|
||||
flags.Int("usefulflag", 777, "sometimes it's very useful")
|
||||
flags.SortFlags = false
|
||||
flags.PrintDefaults()
|
||||
```
|
||||
**Output**:
|
||||
```
|
||||
-v, --verbose verbose output
|
||||
--coolflag string it's really cool flag (default "yeaah")
|
||||
--usefulflag int sometimes it's very useful (default 777)
|
||||
```
|
||||
|
||||
|
||||
## Supporting Go flags when using pflag
|
||||
In order to support flags defined using Go's `flag` package, they must be added to the `pflag` flagset. This is usually necessary
|
||||
to support flags defined by third-party dependencies (e.g. `golang/glog`).
|
||||
@ -270,8 +289,8 @@ func main() {
|
||||
You can see the full reference documentation of the pflag package
|
||||
[at godoc.org][3], or through go's standard documentation system by
|
||||
running `godoc -http=:6060` and browsing to
|
||||
[http://localhost:6060/pkg/github.com/ogier/pflag][2] after
|
||||
[http://localhost:6060/pkg/github.com/spf13/pflag][2] after
|
||||
installation.
|
||||
|
||||
[2]: http://localhost:6060/pkg/github.com/ogier/pflag
|
||||
[3]: http://godoc.org/github.com/ogier/pflag
|
||||
[2]: http://localhost:6060/pkg/github.com/spf13/pflag
|
||||
[3]: http://godoc.org/github.com/spf13/pflag
|
||||
|
4
vendor/github.com/spf13/pflag/count.go
generated
vendored
4
vendor/github.com/spf13/pflag/count.go
generated
vendored
@ -83,7 +83,9 @@ func (f *FlagSet) CountP(name, shorthand string, usage string) *int {
|
||||
return p
|
||||
}
|
||||
|
||||
// Count like Count only the flag is placed on the CommandLine isntead of a given flag set
|
||||
// Count defines a count flag with specified name, default value, and usage string.
|
||||
// The return value is the address of an int variable that stores the value of the flag.
|
||||
// A count flag will add 1 to its value evey time it is found on the command line
|
||||
func Count(name string, usage string) *int {
|
||||
return CommandLine.CountP(name, "", usage)
|
||||
}
|
||||
|
243
vendor/github.com/spf13/pflag/flag.go
generated
vendored
243
vendor/github.com/spf13/pflag/flag.go
generated
vendored
@ -16,9 +16,9 @@ pflag is a drop-in replacement of Go's native flag package. If you import
|
||||
pflag under the name "flag" then all code should continue to function
|
||||
with no changes.
|
||||
|
||||
import flag "github.com/ogier/pflag"
|
||||
import flag "github.com/spf13/pflag"
|
||||
|
||||
There is one exception to this: if you directly instantiate the Flag struct
|
||||
There is one exception to this: if you directly instantiate the Flag struct
|
||||
there is one more field "Shorthand" that you will need to set.
|
||||
Most code never instantiates this struct directly, and instead uses
|
||||
functions such as String(), BoolVar(), and Var(), and is therefore
|
||||
@ -134,14 +134,21 @@ type FlagSet struct {
|
||||
// a custom error handler.
|
||||
Usage func()
|
||||
|
||||
// SortFlags is used to indicate, if user wants to have sorted flags in
|
||||
// help/usage messages.
|
||||
SortFlags bool
|
||||
|
||||
name string
|
||||
parsed bool
|
||||
actual map[NormalizedName]*Flag
|
||||
orderedActual []*Flag
|
||||
sortedActual []*Flag
|
||||
formal map[NormalizedName]*Flag
|
||||
orderedFormal []*Flag
|
||||
sortedFormal []*Flag
|
||||
shorthands map[byte]*Flag
|
||||
args []string // arguments after flags
|
||||
argsLenAtDash int // len(args) when a '--' was located when parsing, or -1 if no --
|
||||
exitOnError bool // does the program exit if there's an error?
|
||||
errorHandling ErrorHandling
|
||||
output io.Writer // nil means stderr; use out() accessor
|
||||
interspersed bool // allow interspersed option/non-option args
|
||||
@ -156,7 +163,7 @@ type Flag struct {
|
||||
Value Value // value as set
|
||||
DefValue string // default value (as text); for usage message
|
||||
Changed bool // If the user set the value (or if left to default)
|
||||
NoOptDefVal string //default value (as text); if the flag is on the command line without any options
|
||||
NoOptDefVal string // default value (as text); if the flag is on the command line without any options
|
||||
Deprecated string // If this flag is deprecated, this string is the new or now thing to use
|
||||
Hidden bool // used by cobra.Command to allow flags to be hidden from help/usage text
|
||||
ShorthandDeprecated string // If the shorthand of this flag is deprecated, this string is the new or now thing to use
|
||||
@ -194,11 +201,13 @@ func sortFlags(flags map[NormalizedName]*Flag) []*Flag {
|
||||
// "--getUrl" which may also be translated to "geturl" and everything will work.
|
||||
func (f *FlagSet) SetNormalizeFunc(n func(f *FlagSet, name string) NormalizedName) {
|
||||
f.normalizeNameFunc = n
|
||||
for k, v := range f.formal {
|
||||
delete(f.formal, k)
|
||||
nname := f.normalizeFlagName(string(k))
|
||||
f.formal[nname] = v
|
||||
f.sortedFormal = f.sortedFormal[:0]
|
||||
for k, v := range f.orderedFormal {
|
||||
delete(f.formal, NormalizedName(v.Name))
|
||||
nname := f.normalizeFlagName(v.Name)
|
||||
v.Name = string(nname)
|
||||
f.formal[nname] = v
|
||||
f.orderedFormal[k] = v
|
||||
}
|
||||
}
|
||||
|
||||
@ -229,10 +238,25 @@ func (f *FlagSet) SetOutput(output io.Writer) {
|
||||
f.output = output
|
||||
}
|
||||
|
||||
// VisitAll visits the flags in lexicographical order, calling fn for each.
|
||||
// VisitAll visits the flags in lexicographical order or
|
||||
// in primordial order if f.SortFlags is false, calling fn for each.
|
||||
// It visits all flags, even those not set.
|
||||
func (f *FlagSet) VisitAll(fn func(*Flag)) {
|
||||
for _, flag := range sortFlags(f.formal) {
|
||||
if len(f.formal) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
var flags []*Flag
|
||||
if f.SortFlags {
|
||||
if len(f.formal) != len(f.sortedFormal) {
|
||||
f.sortedFormal = sortFlags(f.formal)
|
||||
}
|
||||
flags = f.sortedFormal
|
||||
} else {
|
||||
flags = f.orderedFormal
|
||||
}
|
||||
|
||||
for _, flag := range flags {
|
||||
fn(flag)
|
||||
}
|
||||
}
|
||||
@ -253,22 +277,39 @@ func (f *FlagSet) HasAvailableFlags() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// VisitAll visits the command-line flags in lexicographical order, calling
|
||||
// fn for each. It visits all flags, even those not set.
|
||||
// VisitAll visits the command-line flags in lexicographical order or
|
||||
// in primordial order if f.SortFlags is false, calling fn for each.
|
||||
// It visits all flags, even those not set.
|
||||
func VisitAll(fn func(*Flag)) {
|
||||
CommandLine.VisitAll(fn)
|
||||
}
|
||||
|
||||
// Visit visits the flags in lexicographical order, calling fn for each.
|
||||
// Visit visits the flags in lexicographical order or
|
||||
// in primordial order if f.SortFlags is false, calling fn for each.
|
||||
// It visits only those flags that have been set.
|
||||
func (f *FlagSet) Visit(fn func(*Flag)) {
|
||||
for _, flag := range sortFlags(f.actual) {
|
||||
if len(f.actual) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
var flags []*Flag
|
||||
if f.SortFlags {
|
||||
if len(f.actual) != len(f.sortedActual) {
|
||||
f.sortedActual = sortFlags(f.actual)
|
||||
}
|
||||
flags = f.sortedActual
|
||||
} else {
|
||||
flags = f.orderedActual
|
||||
}
|
||||
|
||||
for _, flag := range flags {
|
||||
fn(flag)
|
||||
}
|
||||
}
|
||||
|
||||
// Visit visits the command-line flags in lexicographical order, calling fn
|
||||
// for each. It visits only those flags that have been set.
|
||||
// Visit visits the command-line flags in lexicographical order or
|
||||
// in primordial order if f.SortFlags is false, calling fn for each.
|
||||
// It visits only those flags that have been set.
|
||||
func Visit(fn func(*Flag)) {
|
||||
CommandLine.Visit(fn)
|
||||
}
|
||||
@ -278,6 +319,22 @@ func (f *FlagSet) Lookup(name string) *Flag {
|
||||
return f.lookup(f.normalizeFlagName(name))
|
||||
}
|
||||
|
||||
// ShorthandLookup returns the Flag structure of the short handed flag,
|
||||
// returning nil if none exists.
|
||||
// It panics, if len(name) > 1.
|
||||
func (f *FlagSet) ShorthandLookup(name string) *Flag {
|
||||
if name == "" {
|
||||
return nil
|
||||
}
|
||||
if len(name) > 1 {
|
||||
msg := fmt.Sprintf("can not look up shorthand which is more than one ASCII character: %q", name)
|
||||
fmt.Fprintf(f.out(), msg)
|
||||
panic(msg)
|
||||
}
|
||||
c := name[0]
|
||||
return f.shorthands[c]
|
||||
}
|
||||
|
||||
// lookup returns the Flag structure of the named flag, returning nil if none exists.
|
||||
func (f *FlagSet) lookup(name NormalizedName) *Flag {
|
||||
return f.formal[name]
|
||||
@ -319,7 +376,7 @@ func (f *FlagSet) MarkDeprecated(name string, usageMessage string) error {
|
||||
if flag == nil {
|
||||
return fmt.Errorf("flag %q does not exist", name)
|
||||
}
|
||||
if len(usageMessage) == 0 {
|
||||
if usageMessage == "" {
|
||||
return fmt.Errorf("deprecated message for flag %q must be set", name)
|
||||
}
|
||||
flag.Deprecated = usageMessage
|
||||
@ -334,7 +391,7 @@ func (f *FlagSet) MarkShorthandDeprecated(name string, usageMessage string) erro
|
||||
if flag == nil {
|
||||
return fmt.Errorf("flag %q does not exist", name)
|
||||
}
|
||||
if len(usageMessage) == 0 {
|
||||
if usageMessage == "" {
|
||||
return fmt.Errorf("deprecated message for flag %q must be set", name)
|
||||
}
|
||||
flag.ShorthandDeprecated = usageMessage
|
||||
@ -358,6 +415,12 @@ func Lookup(name string) *Flag {
|
||||
return CommandLine.Lookup(name)
|
||||
}
|
||||
|
||||
// ShorthandLookup returns the Flag structure of the short handed flag,
|
||||
// returning nil if none exists.
|
||||
func ShorthandLookup(name string) *Flag {
|
||||
return CommandLine.ShorthandLookup(name)
|
||||
}
|
||||
|
||||
// Set sets the value of the named flag.
|
||||
func (f *FlagSet) Set(name, value string) error {
|
||||
normalName := f.normalizeFlagName(name)
|
||||
@ -365,17 +428,28 @@ func (f *FlagSet) Set(name, value string) error {
|
||||
if !ok {
|
||||
return fmt.Errorf("no such flag -%v", name)
|
||||
}
|
||||
|
||||
err := flag.Value.Set(value)
|
||||
if err != nil {
|
||||
return err
|
||||
var flagName string
|
||||
if flag.Shorthand != "" && flag.ShorthandDeprecated == "" {
|
||||
flagName = fmt.Sprintf("-%s, --%s", flag.Shorthand, flag.Name)
|
||||
} else {
|
||||
flagName = fmt.Sprintf("--%s", flag.Name)
|
||||
}
|
||||
return fmt.Errorf("invalid argument %q for %q flag: %v", value, flagName, err)
|
||||
}
|
||||
|
||||
if f.actual == nil {
|
||||
f.actual = make(map[NormalizedName]*Flag)
|
||||
}
|
||||
f.actual[normalName] = flag
|
||||
f.orderedActual = append(f.orderedActual, flag)
|
||||
|
||||
flag.Changed = true
|
||||
if len(flag.Deprecated) > 0 {
|
||||
fmt.Fprintf(os.Stderr, "Flag --%s has been deprecated, %s\n", flag.Name, flag.Deprecated)
|
||||
|
||||
if flag.Deprecated != "" {
|
||||
fmt.Fprintf(f.out(), "Flag --%s has been deprecated, %s\n", flag.Name, flag.Deprecated)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@ -557,28 +631,28 @@ func wrap(i, w int, s string) string {
|
||||
// for all flags in the FlagSet. Wrapped to `cols` columns (0 for no
|
||||
// wrapping)
|
||||
func (f *FlagSet) FlagUsagesWrapped(cols int) string {
|
||||
x := new(bytes.Buffer)
|
||||
buf := new(bytes.Buffer)
|
||||
|
||||
lines := make([]string, 0, len(f.formal))
|
||||
|
||||
maxlen := 0
|
||||
f.VisitAll(func(flag *Flag) {
|
||||
if len(flag.Deprecated) > 0 || flag.Hidden {
|
||||
if flag.Deprecated != "" || flag.Hidden {
|
||||
return
|
||||
}
|
||||
|
||||
line := ""
|
||||
if len(flag.Shorthand) > 0 && len(flag.ShorthandDeprecated) == 0 {
|
||||
if flag.Shorthand != "" && flag.ShorthandDeprecated == "" {
|
||||
line = fmt.Sprintf(" -%s, --%s", flag.Shorthand, flag.Name)
|
||||
} else {
|
||||
line = fmt.Sprintf(" --%s", flag.Name)
|
||||
}
|
||||
|
||||
varname, usage := UnquoteUsage(flag)
|
||||
if len(varname) > 0 {
|
||||
if varname != "" {
|
||||
line += " " + varname
|
||||
}
|
||||
if len(flag.NoOptDefVal) > 0 {
|
||||
if flag.NoOptDefVal != "" {
|
||||
switch flag.Value.Type() {
|
||||
case "string":
|
||||
line += fmt.Sprintf("[=\"%s\"]", flag.NoOptDefVal)
|
||||
@ -601,7 +675,7 @@ func (f *FlagSet) FlagUsagesWrapped(cols int) string {
|
||||
line += usage
|
||||
if !flag.defaultIsZeroValue() {
|
||||
if flag.Value.Type() == "string" {
|
||||
line += fmt.Sprintf(" (default \"%s\")", flag.DefValue)
|
||||
line += fmt.Sprintf(" (default %q)", flag.DefValue)
|
||||
} else {
|
||||
line += fmt.Sprintf(" (default %s)", flag.DefValue)
|
||||
}
|
||||
@ -614,10 +688,10 @@ func (f *FlagSet) FlagUsagesWrapped(cols int) string {
|
||||
sidx := strings.Index(line, "\x00")
|
||||
spacing := strings.Repeat(" ", maxlen-sidx)
|
||||
// maxlen + 2 comes from + 1 for the \x00 and + 1 for the (deliberate) off-by-one in maxlen-sidx
|
||||
fmt.Fprintln(x, line[:sidx], spacing, wrap(maxlen+2, cols, line[sidx+1:]))
|
||||
fmt.Fprintln(buf, line[:sidx], spacing, wrap(maxlen+2, cols, line[sidx+1:]))
|
||||
}
|
||||
|
||||
return x.String()
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
// FlagUsages returns a string containing the usage information for all flags in
|
||||
@ -714,11 +788,10 @@ func (f *FlagSet) VarP(value Value, name, shorthand, usage string) {
|
||||
|
||||
// AddFlag will add the flag to the FlagSet
|
||||
func (f *FlagSet) AddFlag(flag *Flag) {
|
||||
// Call normalizeFlagName function only once
|
||||
normalizedFlagName := f.normalizeFlagName(flag.Name)
|
||||
|
||||
_, alreadythere := f.formal[normalizedFlagName]
|
||||
if alreadythere {
|
||||
_, alreadyThere := f.formal[normalizedFlagName]
|
||||
if alreadyThere {
|
||||
msg := fmt.Sprintf("%s flag redefined: %s", f.name, flag.Name)
|
||||
fmt.Fprintln(f.out(), msg)
|
||||
panic(msg) // Happens only if flags are declared with identical names
|
||||
@ -729,28 +802,31 @@ func (f *FlagSet) AddFlag(flag *Flag) {
|
||||
|
||||
flag.Name = string(normalizedFlagName)
|
||||
f.formal[normalizedFlagName] = flag
|
||||
f.orderedFormal = append(f.orderedFormal, flag)
|
||||
|
||||
if len(flag.Shorthand) == 0 {
|
||||
if flag.Shorthand == "" {
|
||||
return
|
||||
}
|
||||
if len(flag.Shorthand) > 1 {
|
||||
fmt.Fprintf(f.out(), "%s shorthand more than ASCII character: %s\n", f.name, flag.Shorthand)
|
||||
panic("shorthand is more than one character")
|
||||
msg := fmt.Sprintf("%q shorthand is more than one ASCII character", flag.Shorthand)
|
||||
fmt.Fprintf(f.out(), msg)
|
||||
panic(msg)
|
||||
}
|
||||
if f.shorthands == nil {
|
||||
f.shorthands = make(map[byte]*Flag)
|
||||
}
|
||||
c := flag.Shorthand[0]
|
||||
old, alreadythere := f.shorthands[c]
|
||||
if alreadythere {
|
||||
fmt.Fprintf(f.out(), "%s shorthand reused: %q for %s already used for %s\n", f.name, c, flag.Name, old.Name)
|
||||
panic("shorthand redefinition")
|
||||
used, alreadyThere := f.shorthands[c]
|
||||
if alreadyThere {
|
||||
msg := fmt.Sprintf("unable to redefine %q shorthand in %q flagset: it's already used for %q flag", c, f.name, used.Name)
|
||||
fmt.Fprintf(f.out(), msg)
|
||||
panic(msg)
|
||||
}
|
||||
f.shorthands[c] = flag
|
||||
}
|
||||
|
||||
// AddFlagSet adds one FlagSet to another. If a flag is already present in f
|
||||
// the flag from newSet will be ignored
|
||||
// the flag from newSet will be ignored.
|
||||
func (f *FlagSet) AddFlagSet(newSet *FlagSet) {
|
||||
if newSet == nil {
|
||||
return
|
||||
@ -798,34 +874,6 @@ func (f *FlagSet) usage() {
|
||||
}
|
||||
}
|
||||
|
||||
func (f *FlagSet) setFlag(flag *Flag, value string, origArg string) error {
|
||||
if err := flag.Value.Set(value); err != nil {
|
||||
return f.failf("invalid argument %q for %s: %v", value, origArg, err)
|
||||
}
|
||||
// mark as visited for Visit()
|
||||
if f.actual == nil {
|
||||
f.actual = make(map[NormalizedName]*Flag)
|
||||
}
|
||||
f.actual[f.normalizeFlagName(flag.Name)] = flag
|
||||
flag.Changed = true
|
||||
if len(flag.Deprecated) > 0 {
|
||||
fmt.Fprintf(os.Stderr, "Flag --%s has been deprecated, %s\n", flag.Name, flag.Deprecated)
|
||||
}
|
||||
if len(flag.ShorthandDeprecated) > 0 && containsShorthand(origArg, flag.Shorthand) {
|
||||
fmt.Fprintf(os.Stderr, "Flag shorthand -%s has been deprecated, %s\n", flag.Shorthand, flag.ShorthandDeprecated)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func containsShorthand(arg, shorthand string) bool {
|
||||
// filter out flags --<flag_name>
|
||||
if strings.HasPrefix(arg, "-") {
|
||||
return false
|
||||
}
|
||||
arg = strings.SplitN(arg, "=", 2)[0]
|
||||
return strings.Contains(arg, shorthand)
|
||||
}
|
||||
|
||||
func (f *FlagSet) parseLongArg(s string, args []string, fn parseFunc) (a []string, err error) {
|
||||
a = args
|
||||
name := s[2:]
|
||||
@ -833,10 +881,11 @@ func (f *FlagSet) parseLongArg(s string, args []string, fn parseFunc) (a []strin
|
||||
err = f.failf("bad flag syntax: %s", s)
|
||||
return
|
||||
}
|
||||
|
||||
split := strings.SplitN(name, "=", 2)
|
||||
name = split[0]
|
||||
flag, alreadythere := f.formal[f.normalizeFlagName(name)]
|
||||
if !alreadythere {
|
||||
flag, exists := f.formal[f.normalizeFlagName(name)]
|
||||
if !exists {
|
||||
if name == "help" { // special case for nice help message.
|
||||
f.usage()
|
||||
return a, ErrHelp
|
||||
@ -844,11 +893,12 @@ func (f *FlagSet) parseLongArg(s string, args []string, fn parseFunc) (a []strin
|
||||
err = f.failf("unknown flag: --%s", name)
|
||||
return
|
||||
}
|
||||
|
||||
var value string
|
||||
if len(split) == 2 {
|
||||
// '--flag=arg'
|
||||
value = split[1]
|
||||
} else if len(flag.NoOptDefVal) > 0 {
|
||||
} else if flag.NoOptDefVal != "" {
|
||||
// '--flag' (arg was optional)
|
||||
value = flag.NoOptDefVal
|
||||
} else if len(a) > 0 {
|
||||
@ -860,7 +910,8 @@ func (f *FlagSet) parseLongArg(s string, args []string, fn parseFunc) (a []strin
|
||||
err = f.failf("flag needs an argument: %s", s)
|
||||
return
|
||||
}
|
||||
err = fn(flag, value, s)
|
||||
|
||||
err = fn(flag, value)
|
||||
return
|
||||
}
|
||||
|
||||
@ -868,38 +919,49 @@ func (f *FlagSet) parseSingleShortArg(shorthands string, args []string, fn parse
|
||||
if strings.HasPrefix(shorthands, "test.") {
|
||||
return
|
||||
}
|
||||
|
||||
outArgs = args
|
||||
outShorts = shorthands[1:]
|
||||
c := shorthands[0]
|
||||
|
||||
flag, alreadythere := f.shorthands[c]
|
||||
if !alreadythere {
|
||||
flag, exists := f.shorthands[c]
|
||||
if !exists {
|
||||
if c == 'h' { // special case for nice help message.
|
||||
f.usage()
|
||||
err = ErrHelp
|
||||
return
|
||||
}
|
||||
//TODO continue on error
|
||||
err = f.failf("unknown shorthand flag: %q in -%s", c, shorthands)
|
||||
return
|
||||
}
|
||||
|
||||
var value string
|
||||
if len(shorthands) > 2 && shorthands[1] == '=' {
|
||||
// '-f=arg'
|
||||
value = shorthands[2:]
|
||||
outShorts = ""
|
||||
} else if len(flag.NoOptDefVal) > 0 {
|
||||
} else if flag.NoOptDefVal != "" {
|
||||
// '-f' (arg was optional)
|
||||
value = flag.NoOptDefVal
|
||||
} else if len(shorthands) > 1 {
|
||||
// '-farg'
|
||||
value = shorthands[1:]
|
||||
outShorts = ""
|
||||
} else if len(args) > 0 {
|
||||
// '-f arg'
|
||||
value = args[0]
|
||||
outArgs = args[1:]
|
||||
} else {
|
||||
// '-f' (arg was required)
|
||||
err = f.failf("flag needs an argument: %q in -%s", c, shorthands)
|
||||
return
|
||||
}
|
||||
err = fn(flag, value, shorthands)
|
||||
|
||||
if flag.ShorthandDeprecated != "" {
|
||||
fmt.Fprintf(f.out(), "Flag shorthand -%s has been deprecated, %s\n", flag.Shorthand, flag.ShorthandDeprecated)
|
||||
}
|
||||
|
||||
err = fn(flag, value)
|
||||
return
|
||||
}
|
||||
|
||||
@ -907,6 +969,7 @@ func (f *FlagSet) parseShortArg(s string, args []string, fn parseFunc) (a []stri
|
||||
a = args
|
||||
shorthands := s[1:]
|
||||
|
||||
// "shorthands" can be a series of shorthand letters of flags (e.g. "-vvv").
|
||||
for len(shorthands) > 0 {
|
||||
shorthands, a, err = f.parseSingleShortArg(shorthands, args, fn)
|
||||
if err != nil {
|
||||
@ -954,13 +1017,18 @@ func (f *FlagSet) parseArgs(args []string, fn parseFunc) (err error) {
|
||||
// The return value will be ErrHelp if -help was set but not defined.
|
||||
func (f *FlagSet) Parse(arguments []string) error {
|
||||
f.parsed = true
|
||||
f.args = make([]string, 0, len(arguments))
|
||||
|
||||
assign := func(flag *Flag, value, origArg string) error {
|
||||
return f.setFlag(flag, value, origArg)
|
||||
if len(arguments) < 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
err := f.parseArgs(arguments, assign)
|
||||
f.args = make([]string, 0, len(arguments))
|
||||
|
||||
set := func(flag *Flag, value string) error {
|
||||
return f.Set(flag.Name, value)
|
||||
}
|
||||
|
||||
err := f.parseArgs(arguments, set)
|
||||
if err != nil {
|
||||
switch f.errorHandling {
|
||||
case ContinueOnError:
|
||||
@ -974,7 +1042,7 @@ func (f *FlagSet) Parse(arguments []string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
type parseFunc func(flag *Flag, value, origArg string) error
|
||||
type parseFunc func(flag *Flag, value string) error
|
||||
|
||||
// ParseAll parses flag definitions from the argument list, which should not
|
||||
// include the command name. The arguments for fn are flag and value. Must be
|
||||
@ -985,11 +1053,7 @@ func (f *FlagSet) ParseAll(arguments []string, fn func(flag *Flag, value string)
|
||||
f.parsed = true
|
||||
f.args = make([]string, 0, len(arguments))
|
||||
|
||||
assign := func(flag *Flag, value, origArg string) error {
|
||||
return fn(flag, value)
|
||||
}
|
||||
|
||||
err := f.parseArgs(arguments, assign)
|
||||
err := f.parseArgs(arguments, fn)
|
||||
if err != nil {
|
||||
switch f.errorHandling {
|
||||
case ContinueOnError:
|
||||
@ -1036,14 +1100,15 @@ func Parsed() bool {
|
||||
// CommandLine is the default set of command-line flags, parsed from os.Args.
|
||||
var CommandLine = NewFlagSet(os.Args[0], ExitOnError)
|
||||
|
||||
// NewFlagSet returns a new, empty flag set with the specified name and
|
||||
// error handling property.
|
||||
// NewFlagSet returns a new, empty flag set with the specified name,
|
||||
// error handling property and SortFlags set to true.
|
||||
func NewFlagSet(name string, errorHandling ErrorHandling) *FlagSet {
|
||||
f := &FlagSet{
|
||||
name: name,
|
||||
errorHandling: errorHandling,
|
||||
argsLenAtDash: -1,
|
||||
interspersed: true,
|
||||
SortFlags: true,
|
||||
}
|
||||
return f
|
||||
}
|
||||
|
173
vendor/golang.org/x/sys/unix/README.md
generated
vendored
Normal file
173
vendor/golang.org/x/sys/unix/README.md
generated
vendored
Normal file
@ -0,0 +1,173 @@
|
||||
# Building `sys/unix`
|
||||
|
||||
The sys/unix package provides access to the raw system call interface of the
|
||||
underlying operating system. See: https://godoc.org/golang.org/x/sys/unix
|
||||
|
||||
Porting Go to a new architecture/OS combination or adding syscalls, types, or
|
||||
constants to an existing architecture/OS pair requires some manual effort;
|
||||
however, there are tools that automate much of the process.
|
||||
|
||||
## Build Systems
|
||||
|
||||
There are currently two ways we generate the necessary files. We are currently
|
||||
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"`)
|
||||
|
||||
The old build system generates the Go files based on the C header files
|
||||
present on your system. This means that files
|
||||
for a given GOOS/GOARCH pair must be generated on a system with that OS and
|
||||
architecture. This also means that the generated code can differ from system
|
||||
to system, based on differences in the header files.
|
||||
|
||||
To avoid this, if you are using the old build system, only generate the Go
|
||||
files on an installation with unmodified header files. It is also important to
|
||||
keep track of which version of the OS the files were generated from (ex.
|
||||
Darwin 14 vs Darwin 15). This makes it easier to track the progress of changes
|
||||
and have each OS upgrade correspond to a single change.
|
||||
|
||||
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
|
||||
|
||||
### New Build System (currently for `GOOS == "Linux" && GOARCH != "sparc64"`)
|
||||
|
||||
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
|
||||
that on any platform that supports Docker, all the files using the new build
|
||||
system can be generated at once, and generated files will not change based on
|
||||
what the person running the scripts has installed on their computer.
|
||||
|
||||
The OS specific files for the new build system are located in the `${GOOS}`
|
||||
directory, and the build is coordinated by the `${GOOS}/mkall.go` program. When
|
||||
the kernel or system library updates, modify the Dockerfile at
|
||||
`${GOOS}/Dockerfile` to checkout the new release of the source.
|
||||
|
||||
To build all the files under the new build system, you must be on an amd64/Linux
|
||||
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
|
||||
|
||||
## 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.
|
||||
They must be called from within the docker container.
|
||||
|
||||
### asm files
|
||||
|
||||
The hand-written assembly file at `asm_${GOOS}_${GOARCH}.s` implements system
|
||||
call dispatch. There are three entry points:
|
||||
```
|
||||
func Syscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr)
|
||||
func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr)
|
||||
func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr)
|
||||
```
|
||||
The first and second are the standard ones; they differ only in how many
|
||||
arguments can be passed to the kernel. The third is for low-level use by the
|
||||
ForkExec wrapper. Unlike the first two, it does not call into the scheduler to
|
||||
let it know that a system call is running.
|
||||
|
||||
When porting Go to an new architecture/OS, this file must be implemented for
|
||||
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
|
||||
syscall number declarations and parses them to produce the corresponding list of
|
||||
Go numeric constants. See `zsysnum_${GOOS}_${GOARCH}.go` for the generated
|
||||
constants.
|
||||
|
||||
Adding new syscall numbers is mostly done by running the build on a sufficiently
|
||||
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
|
||||
|
||||
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
|
||||
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.
|
||||
|
||||
Adding a new syscall often just requires adding a new `//sys` function prototype
|
||||
with the desired arguments and a capitalized name so it is exported. However, if
|
||||
you want the interface to the syscall to be different, often one will make an
|
||||
unexported `//sys` prototype, an then write a custom wrapper in
|
||||
`syscall_${GOOS}.go`.
|
||||
|
||||
### types files
|
||||
|
||||
For each OS, there is a hand-written Go file at `${GOOS}/types.go` (or
|
||||
`types_${GOOS}.go` on the old system). This file includes standard C headers and
|
||||
creates Go type aliases to the corresponding C types. The file is then fed
|
||||
through godef to get the Go compatible definitions. Finally, the generated code
|
||||
is fed though mkpost.go to format the code correctly and remove any hidden or
|
||||
private identifiers. This cleaned-up code is written to
|
||||
`ztypes_${GOOS}_${GOARCH}.go`.
|
||||
|
||||
The hardest part about preparing this file is figuring out which headers to
|
||||
include and which symbols need to be `#define`d to get the actual data
|
||||
structures that pass through to the kernel system calls. Some C libraries
|
||||
preset alternate versions for binary compatibility and translate them on the
|
||||
way in and out of system calls, but there is almost always a `#define` that can
|
||||
get the real ones.
|
||||
See `types_darwin.go` and `linux/types.go` for examples.
|
||||
|
||||
To add a new type, add in the necessary include statement at the top of the
|
||||
file (if it is not already there) and add in a type alias line. Note that if
|
||||
your type is significantly different on different architectures, you may need
|
||||
some `#if/#elif` macros in your include statements.
|
||||
|
||||
### mkerrors.sh
|
||||
|
||||
This script is used to generate the system's various constants. This doesn't
|
||||
just include the error numbers and error strings, but also the signal numbers
|
||||
an a wide variety of miscellaneous constants. The constants come from the list
|
||||
of include files in the `includes_${uname}` variable. A regex then picks out
|
||||
the desired `#define` statements, and generates the corresponding Go constants.
|
||||
The error numbers and strings are generated from `#include <errno.h>`, and the
|
||||
signal numbers and strings are generated from `#include <signal.h>`. All of
|
||||
these constants are written to `zerrors_${GOOS}_${GOARCH}.go` via a C program,
|
||||
`_errors.c`, which prints out all the constants.
|
||||
|
||||
To add a constant, add the header that includes it to the appropriate variable.
|
||||
Then, edit the regex (if necessary) to match the desired constant. Avoid making
|
||||
the regex too broad to avoid matching unintended constants.
|
||||
|
||||
|
||||
## Generated files
|
||||
|
||||
### `zerror_${GOOS}_${GOARCH}.go`
|
||||
|
||||
A file containing all of the system's generated error numbers, error strings,
|
||||
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).
|
||||
|
||||
### `zsysnum_${GOOS}_${GOARCH}.go`
|
||||
|
||||
A list of numeric constants for all the syscall number of the specific GOOS
|
||||
and GOARCH. Generated by mksysnum (see above).
|
||||
|
||||
### `ztypes_${GOOS}_${GOARCH}.go`
|
||||
|
||||
A file containing Go types for passing into (or returning from) syscalls.
|
||||
Generated by godefs and the types file (see above).
|
4
vendor/golang.org/x/sys/unix/asm_solaris_amd64.s
generated
vendored
4
vendor/golang.org/x/sys/unix/asm_solaris_amd64.s
generated
vendored
@ -10,8 +10,8 @@
|
||||
// System calls for amd64, Solaris are implemented in runtime/syscall_solaris.go
|
||||
//
|
||||
|
||||
TEXT ·sysvicall6(SB),NOSPLIT,$0-64
|
||||
TEXT ·sysvicall6(SB),NOSPLIT,$0-88
|
||||
JMP syscall·sysvicall6(SB)
|
||||
|
||||
TEXT ·rawSysvicall6(SB),NOSPLIT,$0-64
|
||||
TEXT ·rawSysvicall6(SB),NOSPLIT,$0-88
|
||||
JMP syscall·rawSysvicall6(SB)
|
||||
|
2
vendor/golang.org/x/sys/unix/endian_big.go
generated
vendored
2
vendor/golang.org/x/sys/unix/endian_big.go
generated
vendored
@ -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 ppc64 s390x mips64
|
||||
// +build ppc64 s390x mips mips64
|
||||
|
||||
package unix
|
||||
|
||||
|
2
vendor/golang.org/x/sys/unix/endian_little.go
generated
vendored
2
vendor/golang.org/x/sys/unix/endian_little.go
generated
vendored
@ -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 386 amd64 amd64p32 arm arm64 ppc64le mips64le
|
||||
// +build 386 amd64 amd64p32 arm arm64 ppc64le mipsle mips64le
|
||||
|
||||
package unix
|
||||
|
||||
|
143
vendor/golang.org/x/sys/unix/mkall.sh
generated
vendored
143
vendor/golang.org/x/sys/unix/mkall.sh
generated
vendored
@ -3,75 +3,9 @@
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file.
|
||||
|
||||
# The unix package provides access to the raw system call
|
||||
# interface of the underlying operating system. Porting Go to
|
||||
# a new architecture/operating system combination requires
|
||||
# some manual effort, though there are tools that automate
|
||||
# much of the process. The auto-generated files have names
|
||||
# beginning with z.
|
||||
#
|
||||
# This script runs or (given -n) prints suggested commands to generate z files
|
||||
# for the current system. Running those commands is not automatic.
|
||||
# This script is documentation more than anything else.
|
||||
#
|
||||
# * asm_${GOOS}_${GOARCH}.s
|
||||
#
|
||||
# This hand-written assembly file implements system call dispatch.
|
||||
# There are three entry points:
|
||||
#
|
||||
# func Syscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr);
|
||||
# func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr);
|
||||
# func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr);
|
||||
#
|
||||
# The first and second are the standard ones; they differ only in
|
||||
# how many arguments can be passed to the kernel.
|
||||
# The third is for low-level use by the ForkExec wrapper;
|
||||
# unlike the first two, it does not call into the scheduler to
|
||||
# let it know that a system call is running.
|
||||
#
|
||||
# * syscall_${GOOS}.go
|
||||
#
|
||||
# This hand-written Go file implements system calls that need
|
||||
# special handling and lists "//sys" comments giving prototypes
|
||||
# for ones that can be auto-generated. Mksyscall reads those
|
||||
# comments to generate the stubs.
|
||||
#
|
||||
# * syscall_${GOOS}_${GOARCH}.go
|
||||
#
|
||||
# Same as syscall_${GOOS}.go except that it contains code specific
|
||||
# to ${GOOS} on one particular architecture.
|
||||
#
|
||||
# * types_${GOOS}.c
|
||||
#
|
||||
# This hand-written C file includes standard C headers and then
|
||||
# creates typedef or enum names beginning with a dollar sign
|
||||
# (use of $ in variable names is a gcc extension). The hardest
|
||||
# part about preparing this file is figuring out which headers to
|
||||
# include and which symbols need to be #defined to get the
|
||||
# actual data structures that pass through to the kernel system calls.
|
||||
# Some C libraries present alternate versions for binary compatibility
|
||||
# and translate them on the way in and out of system calls, but
|
||||
# there is almost always a #define that can get the real ones.
|
||||
# See types_darwin.c and types_linux.c for examples.
|
||||
#
|
||||
# * zerror_${GOOS}_${GOARCH}.go
|
||||
#
|
||||
# This machine-generated file defines the system's error numbers,
|
||||
# error strings, and signal numbers. The generator is "mkerrors.sh".
|
||||
# Usually no arguments are needed, but mkerrors.sh will pass its
|
||||
# arguments on to godefs.
|
||||
#
|
||||
# * zsyscall_${GOOS}_${GOARCH}.go
|
||||
#
|
||||
# Generated by mksyscall.pl; see syscall_${GOOS}.go above.
|
||||
#
|
||||
# * zsysnum_${GOOS}_${GOARCH}.go
|
||||
#
|
||||
# Generated by mksysnum_${GOOS}.
|
||||
#
|
||||
# * ztypes_${GOOS}_${GOARCH}.go
|
||||
#
|
||||
# Generated by godefs; see types_${GOOS}.c above.
|
||||
# This script runs or (given -n) prints suggested commands to generate files for
|
||||
# the Architecture/OS specified by the GOARCH and GOOS environment variables.
|
||||
# See README.md for more information about how the build system works.
|
||||
|
||||
GOOSARCH="${GOOS}_${GOARCH}"
|
||||
|
||||
@ -84,6 +18,7 @@ zsysctl="zsysctl_$GOOSARCH.go"
|
||||
mksysnum=
|
||||
mktypes=
|
||||
run="sh"
|
||||
cmd=""
|
||||
|
||||
case "$1" in
|
||||
-syscalls)
|
||||
@ -98,6 +33,7 @@ case "$1" in
|
||||
;;
|
||||
-n)
|
||||
run="cat"
|
||||
cmd="echo"
|
||||
shift
|
||||
esac
|
||||
|
||||
@ -109,6 +45,14 @@ case "$#" in
|
||||
exit 2
|
||||
esac
|
||||
|
||||
if [[ "$GOOS" = "linux" ]] && [[ "$GOARCH" != "sparc64" ]]; then
|
||||
# Use then new 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
|
||||
exit
|
||||
fi
|
||||
|
||||
GOOSARCH_in=syscall_$GOOSARCH.go
|
||||
case "$GOOSARCH" in
|
||||
_* | *_ | _)
|
||||
@ -167,64 +111,6 @@ freebsd_arm)
|
||||
# API consistent across over platforms.
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
|
||||
;;
|
||||
linux_386)
|
||||
mkerrors="$mkerrors -m32"
|
||||
mksyscall="./mksyscall.pl -l32"
|
||||
mksysnum="./mksysnum_linux.pl /usr/include/asm/unistd_32.h"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
linux_amd64)
|
||||
unistd_h=$(ls -1 /usr/include/asm/unistd_64.h /usr/include/x86_64-linux-gnu/asm/unistd_64.h 2>/dev/null | head -1)
|
||||
if [ "$unistd_h" = "" ]; then
|
||||
echo >&2 cannot find unistd_64.h
|
||||
exit 1
|
||||
fi
|
||||
mkerrors="$mkerrors -m64"
|
||||
mksysnum="./mksysnum_linux.pl $unistd_h"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
linux_arm)
|
||||
mkerrors="$mkerrors"
|
||||
mksyscall="./mksyscall.pl -l32 -arm"
|
||||
mksysnum="curl -s 'http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/plain/arch/arm/include/uapi/asm/unistd.h' | ./mksysnum_linux.pl -"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
linux_arm64)
|
||||
unistd_h=$(ls -1 /usr/include/asm/unistd.h /usr/include/asm-generic/unistd.h 2>/dev/null | head -1)
|
||||
if [ "$unistd_h" = "" ]; then
|
||||
echo >&2 cannot find unistd_64.h
|
||||
exit 1
|
||||
fi
|
||||
mksysnum="./mksysnum_linux.pl $unistd_h"
|
||||
# Let the type of C char be signed for making the bare syscall
|
||||
# API consistent across over platforms.
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
|
||||
;;
|
||||
linux_ppc64)
|
||||
GOOSARCH_in=syscall_linux_ppc64x.go
|
||||
unistd_h=/usr/include/asm/unistd.h
|
||||
mkerrors="$mkerrors -m64"
|
||||
mksysnum="./mksysnum_linux.pl $unistd_h"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
linux_ppc64le)
|
||||
GOOSARCH_in=syscall_linux_ppc64x.go
|
||||
unistd_h=/usr/include/powerpc64le-linux-gnu/asm/unistd.h
|
||||
mkerrors="$mkerrors -m64"
|
||||
mksysnum="./mksysnum_linux.pl $unistd_h"
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
|
||||
;;
|
||||
linux_s390x)
|
||||
GOOSARCH_in=syscall_linux_s390x.go
|
||||
unistd_h=/usr/include/asm/unistd.h
|
||||
mkerrors="$mkerrors -m64"
|
||||
mksysnum="./mksysnum_linux.pl $unistd_h"
|
||||
# Let the type of C char be signed to make the bare sys
|
||||
# API more consistent between platforms.
|
||||
# This is a deliberate departure from the way the syscall
|
||||
# package generates its version of the types file.
|
||||
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
|
||||
@ -288,7 +174,6 @@ 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 "echo // +build $GOARCH,$GOOS > ztypes_$GOOSARCH.go";
|
||||
echo "$mktypes types_$GOOS.go | go run mkpost.go >>ztypes_$GOOSARCH.go";
|
||||
echo "$mktypes types_$GOOS.go | go run mkpost.go > ztypes_$GOOSARCH.go";
|
||||
fi
|
||||
) | $run
|
||||
|
55
vendor/golang.org/x/sys/unix/mkerrors.sh
generated
vendored
55
vendor/golang.org/x/sys/unix/mkerrors.sh
generated
vendored
@ -16,6 +16,15 @@ if test -z "$GOARCH" -o -z "$GOOS"; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check that we are using the new build system if we should
|
||||
if [[ "$GOOS" -eq "linux" ]] && [[ "$GOARCH" != "sparc64" ]]; then
|
||||
if [[ "$GOLANG_SYS_BUILD" -ne "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
|
||||
fi
|
||||
|
||||
CC=${CC:-cc}
|
||||
|
||||
if [[ "$GOOS" -eq "solaris" ]]; then
|
||||
@ -102,6 +111,36 @@ includes_Linux='
|
||||
#endif
|
||||
#define _GNU_SOURCE
|
||||
|
||||
// <sys/ioctl.h> is broken on powerpc64, as it fails to include definitions of
|
||||
// these structures. We just include them copied from <bits/termios.h>.
|
||||
#if defined(__powerpc__)
|
||||
struct sgttyb {
|
||||
char sg_ispeed;
|
||||
char sg_ospeed;
|
||||
char sg_erase;
|
||||
char sg_kill;
|
||||
short sg_flags;
|
||||
};
|
||||
|
||||
struct tchars {
|
||||
char t_intrc;
|
||||
char t_quitc;
|
||||
char t_startc;
|
||||
char t_stopc;
|
||||
char t_eofc;
|
||||
char t_brkc;
|
||||
};
|
||||
|
||||
struct ltchars {
|
||||
char t_suspc;
|
||||
char t_dsuspc;
|
||||
char t_rprntc;
|
||||
char t_flushc;
|
||||
char t_werasc;
|
||||
char t_lnextc;
|
||||
};
|
||||
#endif
|
||||
|
||||
#include <bits/sockaddr.h>
|
||||
#include <sys/epoll.h>
|
||||
#include <sys/inotify.h>
|
||||
@ -122,6 +161,8 @@ includes_Linux='
|
||||
#include <linux/if_addr.h>
|
||||
#include <linux/falloc.h>
|
||||
#include <linux/filter.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/keyctl.h>
|
||||
#include <linux/netlink.h>
|
||||
#include <linux/random.h>
|
||||
#include <linux/reboot.h>
|
||||
@ -157,6 +198,11 @@ includes_Linux='
|
||||
// but it is already in bluetooth_linux.go
|
||||
#undef SOL_BLUETOOTH
|
||||
#endif
|
||||
|
||||
// Certain constants are missing from the fs/crypto UAPI
|
||||
#define FS_KEY_DESC_PREFIX "fscrypt:"
|
||||
#define FS_KEY_DESC_PREFIX_SIZE 8
|
||||
#define FS_MAX_KEY_SIZE 64
|
||||
'
|
||||
|
||||
includes_NetBSD='
|
||||
@ -351,12 +397,15 @@ ccflags="$@"
|
||||
$2 ~ /^CLOCK_/ ||
|
||||
$2 ~ /^CAN_/ ||
|
||||
$2 ~ /^ALG_/ ||
|
||||
$2 ~ /^FS_(POLICY_FLAGS|KEY_DESC|ENCRYPTION_MODE|[A-Z0-9_]+_KEY_SIZE|IOC_(GET|SET)_ENCRYPTION)/ ||
|
||||
$2 ~ /^GRND_/ ||
|
||||
$2 ~ /^KEY_(SPEC|REQKEY_DEFL)_/ ||
|
||||
$2 ~ /^KEYCTL_/ ||
|
||||
$2 ~ /^SPLICE_/ ||
|
||||
$2 ~ /^(VM|VMADDR)_/ ||
|
||||
$2 !~ "WMESGLEN" &&
|
||||
$2 ~ /^W[A-Z0-9]+$/ ||
|
||||
$2 ~ /^BLK/ {printf("\t%s = C.%s\n", $2, $2)}
|
||||
$2 ~ /^BLK[A-Z]*(GET$|SET$|BUF$|PART$|SIZE)/ {printf("\t%s = C.%s\n", $2, $2)}
|
||||
$2 ~ /^__WCOREFLAG$/ {next}
|
||||
$2 ~ /^__W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", substr($2,3), $2)}
|
||||
|
||||
@ -391,7 +440,7 @@ echo '#include <signal.h>' | $CC -x c - -E -dM $ccflags |
|
||||
sort >_signal.grep
|
||||
|
||||
echo '// mkerrors.sh' "$@"
|
||||
echo '// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT'
|
||||
echo '// Code generated by the command above; see README.md. DO NOT EDIT.'
|
||||
echo
|
||||
echo "// +build ${GOARCH},${GOOS}"
|
||||
echo
|
||||
@ -453,7 +502,7 @@ intcmp(const void *a, const void *b)
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
int i, j, e;
|
||||
int i, e;
|
||||
char buf[1024], *p;
|
||||
|
||||
printf("\n\n// Error table\n");
|
||||
|
76
vendor/golang.org/x/sys/unix/mkpost.go
generated
vendored
76
vendor/golang.org/x/sys/unix/mkpost.go
generated
vendored
@ -8,10 +8,11 @@
|
||||
// modify the generated types. It is used to clean up
|
||||
// the sys API in an architecture specific manner.
|
||||
//
|
||||
// mkpost is run after cgo -godefs by mkall.sh.
|
||||
// mkpost is run after cgo -godefs; see README.md.
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"go/format"
|
||||
"io/ioutil"
|
||||
@ -21,42 +22,67 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Get the OS and architecture (using GOARCH_TARGET if it exists)
|
||||
goos := os.Getenv("GOOS")
|
||||
goarch := os.Getenv("GOARCH_TARGET")
|
||||
if goarch == "" {
|
||||
goarch = os.Getenv("GOARCH")
|
||||
}
|
||||
// Check that we are using the new build system if we should be.
|
||||
if goos == "linux" && goarch != "sparc64" {
|
||||
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("See README.md\n")
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
b, err := ioutil.ReadAll(os.Stdin)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
s := string(b)
|
||||
|
||||
goarch := os.Getenv("GOARCH")
|
||||
goos := os.Getenv("GOOS")
|
||||
// If we have empty Ptrace structs, we should delete them. Only s390x emits
|
||||
// nonempty Ptrace structs.
|
||||
ptraceRexexp := regexp.MustCompile(`type Ptrace((Psw|Fpregs|Per) struct {\s*})`)
|
||||
b = ptraceRexexp.ReplaceAll(b, nil)
|
||||
|
||||
// Replace the control_regs union with a blank identifier for now.
|
||||
controlRegsRegex := regexp.MustCompile(`(Control_regs)\s+\[0\]uint64`)
|
||||
b = controlRegsRegex.ReplaceAll(b, []byte("_ [0]uint64"))
|
||||
|
||||
// Remove fields that are added by glibc
|
||||
// Note that this is unstable as the identifers are private.
|
||||
removeFieldsRegex := regexp.MustCompile(`X__glibc\S*`)
|
||||
b = removeFieldsRegex.ReplaceAll(b, []byte("_"))
|
||||
|
||||
// We refuse to export private fields on s390x
|
||||
if goarch == "s390x" && goos == "linux" {
|
||||
// Export the types of PtraceRegs fields.
|
||||
re := regexp.MustCompile("ptrace(Psw|Fpregs|Per)")
|
||||
s = re.ReplaceAllString(s, "Ptrace$1")
|
||||
// Remove cgo padding fields
|
||||
removeFieldsRegex := regexp.MustCompile(`Pad_cgo_\d+`)
|
||||
b = removeFieldsRegex.ReplaceAll(b, []byte("_"))
|
||||
|
||||
// Replace padding fields inserted by cgo with blank identifiers.
|
||||
re = regexp.MustCompile("Pad_cgo[A-Za-z0-9_]*")
|
||||
s = re.ReplaceAllString(s, "_")
|
||||
|
||||
// Replace other unwanted fields with blank identifiers.
|
||||
re = regexp.MustCompile("X_[A-Za-z0-9_]*")
|
||||
s = re.ReplaceAllString(s, "_")
|
||||
|
||||
// Replace the control_regs union with a blank identifier for now.
|
||||
re = regexp.MustCompile("(Control_regs)\\s+\\[0\\]uint64")
|
||||
s = re.ReplaceAllString(s, "_ [0]uint64")
|
||||
// Remove padding, hidden, or unused fields
|
||||
removeFieldsRegex = regexp.MustCompile(`X_\S+`)
|
||||
b = removeFieldsRegex.ReplaceAll(b, []byte("_"))
|
||||
}
|
||||
|
||||
// Remove the first line of warning from cgo
|
||||
b = b[bytes.IndexByte(b, '\n')+1:]
|
||||
// Modify the command in the header to include:
|
||||
// mkpost, our own warning, and a build tag.
|
||||
replacement := fmt.Sprintf(`$1 | go run mkpost.go
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build %s,%s`, goarch, goos)
|
||||
cgoCommandRegex := regexp.MustCompile(`(cgo -godefs .*)`)
|
||||
b = cgoCommandRegex.ReplaceAll(b, []byte(replacement))
|
||||
|
||||
// gofmt
|
||||
b, err = format.Source([]byte(s))
|
||||
b, err = format.Source(b)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
// Append this command to the header to show where the new file
|
||||
// came from.
|
||||
re := regexp.MustCompile("(cgo -godefs [a-zA-Z0-9_]+\\.go.*)")
|
||||
b = re.ReplaceAll(b, []byte("$1 | go run mkpost.go"))
|
||||
|
||||
fmt.Printf("%s", b)
|
||||
os.Stdout.Write(b)
|
||||
}
|
||||
|
12
vendor/golang.org/x/sys/unix/mksyscall.pl
generated
vendored
12
vendor/golang.org/x/sys/unix/mksyscall.pl
generated
vendored
@ -69,6 +69,16 @@ if($ARGV[0] =~ /^-/) {
|
||||
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*//;
|
||||
@ -300,7 +310,7 @@ if($errors) {
|
||||
|
||||
print <<EOF;
|
||||
// $cmdline
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build $tags
|
||||
|
||||
|
2
vendor/golang.org/x/sys/unix/mksyscall_solaris.pl
generated
vendored
2
vendor/golang.org/x/sys/unix/mksyscall_solaris.pl
generated
vendored
@ -258,7 +258,7 @@ if($errors) {
|
||||
|
||||
print <<EOF;
|
||||
// $cmdline
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build $tags
|
||||
|
||||
|
2
vendor/golang.org/x/sys/unix/mksysnum_darwin.pl
generated
vendored
2
vendor/golang.org/x/sys/unix/mksysnum_darwin.pl
generated
vendored
@ -16,7 +16,7 @@ my $command = "mksysnum_darwin.pl " . join(' ', @ARGV);
|
||||
|
||||
print <<EOF;
|
||||
// $command
|
||||
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
|
||||
|
||||
|
2
vendor/golang.org/x/sys/unix/mksysnum_dragonfly.pl
generated
vendored
2
vendor/golang.org/x/sys/unix/mksysnum_dragonfly.pl
generated
vendored
@ -17,7 +17,7 @@ my $command = "mksysnum_dragonfly.pl " . join(' ', @ARGV);
|
||||
|
||||
print <<EOF;
|
||||
// $command
|
||||
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
|
||||
|
||||
|
2
vendor/golang.org/x/sys/unix/mksysnum_freebsd.pl
generated
vendored
2
vendor/golang.org/x/sys/unix/mksysnum_freebsd.pl
generated
vendored
@ -17,7 +17,7 @@ my $command = "mksysnum_freebsd.pl " . join(' ', @ARGV);
|
||||
|
||||
print <<EOF;
|
||||
// $command
|
||||
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
|
||||
|
||||
|
78
vendor/golang.org/x/sys/unix/mksysnum_linux.pl
generated
vendored
78
vendor/golang.org/x/sys/unix/mksysnum_linux.pl
generated
vendored
@ -1,78 +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.
|
||||
|
||||
use strict;
|
||||
|
||||
if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") {
|
||||
print STDERR "GOARCH or GOOS not defined in environment\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $command = "mksysnum_linux.pl ". join(' ', @ARGV);
|
||||
|
||||
print <<EOF;
|
||||
// $command
|
||||
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
|
||||
|
||||
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
|
||||
|
||||
package unix
|
||||
|
||||
const(
|
||||
EOF
|
||||
|
||||
my $offset = 0;
|
||||
|
||||
sub fmt {
|
||||
my ($name, $num) = @_;
|
||||
if($num > 999){
|
||||
# ignore deprecated syscalls that are no longer implemented
|
||||
# https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/uapi/asm-generic/unistd.h?id=refs/heads/master#n716
|
||||
return;
|
||||
}
|
||||
$name =~ y/a-z/A-Z/;
|
||||
$num = $num + $offset;
|
||||
print " SYS_$name = $num;\n";
|
||||
}
|
||||
|
||||
my $prev;
|
||||
open(GCC, "gcc -E -dD @ARGV |") || die "can't run gcc";
|
||||
while(<GCC>){
|
||||
if(/^#define __NR_Linux\s+([0-9]+)/){
|
||||
# mips/mips64: extract offset
|
||||
$offset = $1;
|
||||
}
|
||||
elsif(/^#define __NR(\w*)_SYSCALL_BASE\s+([0-9]+)/){
|
||||
# arm: extract offset
|
||||
$offset = $1;
|
||||
}
|
||||
elsif(/^#define __NR_syscalls\s+/) {
|
||||
# ignore redefinitions of __NR_syscalls
|
||||
}
|
||||
elsif(/^#define __NR_(\w*)Linux_syscalls\s+/) {
|
||||
# mips/mips64: ignore definitions about the number of syscalls
|
||||
}
|
||||
elsif(/^#define __NR_(\w+)\s+([0-9]+)/){
|
||||
$prev = $2;
|
||||
fmt($1, $2);
|
||||
}
|
||||
elsif(/^#define __NR3264_(\w+)\s+([0-9]+)/){
|
||||
$prev = $2;
|
||||
fmt($1, $2);
|
||||
}
|
||||
elsif(/^#define __NR_(\w+)\s+\(\w+\+\s*([0-9]+)\)/){
|
||||
fmt($1, $prev+$2)
|
||||
}
|
||||
elsif(/^#define __NR_(\w+)\s+\(__NR_Linux \+ ([0-9]+)/){
|
||||
fmt($1, $2);
|
||||
}
|
||||
elsif(/^#define __NR_(\w+)\s+\(__NR_SYSCALL_BASE \+ ([0-9]+)/){
|
||||
fmt($1, $2);
|
||||
}
|
||||
}
|
||||
|
||||
print <<EOF;
|
||||
)
|
||||
EOF
|
2
vendor/golang.org/x/sys/unix/mksysnum_netbsd.pl
generated
vendored
2
vendor/golang.org/x/sys/unix/mksysnum_netbsd.pl
generated
vendored
@ -17,7 +17,7 @@ my $command = "mksysnum_netbsd.pl " . join(' ', @ARGV);
|
||||
|
||||
print <<EOF;
|
||||
// $command
|
||||
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
|
||||
|
||||
|
2
vendor/golang.org/x/sys/unix/mksysnum_openbsd.pl
generated
vendored
2
vendor/golang.org/x/sys/unix/mksysnum_openbsd.pl
generated
vendored
@ -17,7 +17,7 @@ my $command = "mksysnum_openbsd.pl " . join(' ', @ARGV);
|
||||
|
||||
print <<EOF;
|
||||
// $command
|
||||
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build $ENV{'GOARCH'},$ENV{'GOOS'}
|
||||
|
||||
|
9
vendor/golang.org/x/sys/unix/sockcmsg_unix.go
generated
vendored
9
vendor/golang.org/x/sys/unix/sockcmsg_unix.go
generated
vendored
@ -1,4 +1,4 @@
|
||||
// Copyright 2011 The Go Authors. All rights reserved.
|
||||
// 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.
|
||||
|
||||
@ -13,9 +13,10 @@ import "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 and DragonFly BSD kernels
|
||||
// still require 32-bit aligned access to network subsystem.
|
||||
if darwin64Bit || dragonfly64Bit {
|
||||
// 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
|
||||
}
|
||||
return (salen + salign - 1) & ^(salign - 1)
|
||||
|
33
vendor/golang.org/x/sys/unix/syscall_dragonfly.go
generated
vendored
33
vendor/golang.org/x/sys/unix/syscall_dragonfly.go
generated
vendored
@ -1,8 +1,8 @@
|
||||
// Copyright 2009,2010 The Go Authors. All rights reserved.
|
||||
// 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.
|
||||
|
||||
// FreeBSD system calls.
|
||||
// DragonFly BSD system calls.
|
||||
// This file is compiled as ordinary Go code,
|
||||
// but it is also input to mksyscall,
|
||||
// which parses the //sys lines and generates system call stubs.
|
||||
@ -34,7 +34,7 @@ func nametomib(name string) (mib []_C_int, err error) {
|
||||
|
||||
// NOTE(rsc): It seems strange to set the buffer to have
|
||||
// size CTL_MAXNAME+2 but use only CTL_MAXNAME
|
||||
// as the size. I don't know why the +2 is here, but the
|
||||
// as the size. I don't know why the +2 is here, but the
|
||||
// kernel uses +2 for its own implementation of this function.
|
||||
// I am scared that if we don't include the +2 here, the kernel
|
||||
// will silently write 2 words farther than we specify
|
||||
@ -57,7 +57,7 @@ func nametomib(name string) (mib []_C_int, err error) {
|
||||
}
|
||||
|
||||
func direntIno(buf []byte) (uint64, bool) {
|
||||
return readInt(buf, unsafe.Offsetof(Dirent{}.Ino), unsafe.Sizeof(Dirent{}.Ino))
|
||||
return readInt(buf, unsafe.Offsetof(Dirent{}.Fileno), unsafe.Sizeof(Dirent{}.Fileno))
|
||||
}
|
||||
|
||||
func direntReclen(buf []byte) (uint64, bool) {
|
||||
@ -65,7 +65,7 @@ func direntReclen(buf []byte) (uint64, bool) {
|
||||
if !ok {
|
||||
return 0, false
|
||||
}
|
||||
return (16 + namlen + 1 + 7) & ^7, true
|
||||
return (16 + namlen + 1 + 7) &^ 7, true
|
||||
}
|
||||
|
||||
func direntNamlen(buf []byte) (uint64, bool) {
|
||||
@ -92,6 +92,24 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) {
|
||||
return extpwrite(fd, p, 0, offset)
|
||||
}
|
||||
|
||||
func Accept4(fd, flags int) (nfd int, sa Sockaddr, err error) {
|
||||
var rsa RawSockaddrAny
|
||||
var len _Socklen = SizeofSockaddrAny
|
||||
nfd, err = accept4(fd, &rsa, &len, flags)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if len > SizeofSockaddrAny {
|
||||
panic("RawSockaddrAny too small")
|
||||
}
|
||||
sa, err = anyToSockaddr(&rsa)
|
||||
if err != nil {
|
||||
Close(nfd)
|
||||
nfd = 0
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
var bufsize uintptr
|
||||
@ -199,6 +217,7 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
|
||||
//sys munmap(addr uintptr, length uintptr) (err error)
|
||||
//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ
|
||||
//sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE
|
||||
//sys accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error)
|
||||
|
||||
/*
|
||||
* Unimplemented
|
||||
@ -234,6 +253,8 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
|
||||
// Kdebug_trace
|
||||
// Sigreturn
|
||||
// Mmap
|
||||
// Mlock
|
||||
// Munlock
|
||||
// Atsocket
|
||||
// Kqueue_from_portset_np
|
||||
// Kqueue_portset
|
||||
@ -326,6 +347,8 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
|
||||
// Lio_listio
|
||||
// __pthread_cond_wait
|
||||
// Iopolicysys
|
||||
// Mlockall
|
||||
// Munlockall
|
||||
// __pthread_kill
|
||||
// __pthread_sigmask
|
||||
// __sigwait
|
||||
|
148
vendor/golang.org/x/sys/unix/syscall_linux.go
generated
vendored
148
vendor/golang.org/x/sys/unix/syscall_linux.go
generated
vendored
@ -36,6 +36,25 @@ func Creat(path string, mode uint32) (fd int, err error) {
|
||||
return Open(path, O_CREAT|O_WRONLY|O_TRUNC, mode)
|
||||
}
|
||||
|
||||
//sys ioctl(fd int, req uint, arg uintptr) (err error)
|
||||
|
||||
// ioctl itself should not be exposed directly, but additional get/set
|
||||
// functions for specific types are permissible.
|
||||
|
||||
// IoctlSetInt performs an ioctl operation which sets an integer value
|
||||
// on fd, using the specified request number.
|
||||
func IoctlSetInt(fd int, req uint, value int) (err error) {
|
||||
return ioctl(fd, req, uintptr(value))
|
||||
}
|
||||
|
||||
// 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) {
|
||||
var value int
|
||||
err := ioctl(fd, req, 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) {
|
||||
@ -744,10 +763,124 @@ func GetsockoptUcred(fd, level, opt int) (*Ucred, error) {
|
||||
return &value, err
|
||||
}
|
||||
|
||||
func GetsockoptTCPInfo(fd, level, opt int) (*TCPInfo, error) {
|
||||
var value TCPInfo
|
||||
vallen := _Socklen(SizeofTCPInfo)
|
||||
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))
|
||||
}
|
||||
|
||||
// Keyctl Commands (http://man7.org/linux/man-pages/man2/keyctl.2.html)
|
||||
|
||||
// KeyctlInt calls keyctl commands in which each argument is an int.
|
||||
// These commands are KEYCTL_REVOKE, KEYCTL_CHOWN, KEYCTL_CLEAR, KEYCTL_LINK,
|
||||
// KEYCTL_UNLINK, KEYCTL_NEGATE, KEYCTL_SET_REQKEY_KEYRING, KEYCTL_SET_TIMEOUT,
|
||||
// KEYCTL_ASSUME_AUTHORITY, KEYCTL_SESSION_TO_PARENT, KEYCTL_REJECT,
|
||||
// KEYCTL_INVALIDATE, and KEYCTL_GET_PERSISTENT.
|
||||
//sys KeyctlInt(cmd int, arg2 int, arg3 int, arg4 int, arg5 int) (ret int, err error) = SYS_KEYCTL
|
||||
|
||||
// KeyctlBuffer calls keyctl commands in which the third and fourth
|
||||
// arguments are a buffer and its length, respectively.
|
||||
// These commands are KEYCTL_UPDATE, KEYCTL_READ, and KEYCTL_INSTANTIATE.
|
||||
//sys KeyctlBuffer(cmd int, arg2 int, buf []byte, arg5 int) (ret int, err error) = SYS_KEYCTL
|
||||
|
||||
// KeyctlString calls keyctl commands which return a string.
|
||||
// These commands are KEYCTL_DESCRIBE and KEYCTL_GET_SECURITY.
|
||||
func KeyctlString(cmd int, id int) (string, error) {
|
||||
// We must loop as the string data may change in between the syscalls.
|
||||
// We could allocate a large buffer here to reduce the chance that the
|
||||
// syscall needs to be called twice; however, this is unnecessary as
|
||||
// the performance loss is negligible.
|
||||
var buffer []byte
|
||||
for {
|
||||
// Try to fill the buffer with data
|
||||
length, err := KeyctlBuffer(cmd, id, buffer, 0)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
// Check if the data was written
|
||||
if length <= len(buffer) {
|
||||
// Exclude the null terminator
|
||||
return string(buffer[:length-1]), nil
|
||||
}
|
||||
|
||||
// Make a bigger buffer if needed
|
||||
buffer = make([]byte, length)
|
||||
}
|
||||
}
|
||||
|
||||
// Keyctl commands with special signatures.
|
||||
|
||||
// KeyctlGetKeyringID implements the KEYCTL_GET_KEYRING_ID command.
|
||||
// See the full documentation at:
|
||||
// http://man7.org/linux/man-pages/man3/keyctl_get_keyring_ID.3.html
|
||||
func KeyctlGetKeyringID(id int, create bool) (ringid int, err error) {
|
||||
createInt := 0
|
||||
if create {
|
||||
createInt = 1
|
||||
}
|
||||
return KeyctlInt(KEYCTL_GET_KEYRING_ID, id, createInt, 0, 0)
|
||||
}
|
||||
|
||||
// KeyctlSetperm implements the KEYCTL_SETPERM command. The perm value is the
|
||||
// key handle permission mask as described in the "keyctl setperm" section of
|
||||
// http://man7.org/linux/man-pages/man1/keyctl.1.html.
|
||||
// See the full documentation at:
|
||||
// http://man7.org/linux/man-pages/man3/keyctl_setperm.3.html
|
||||
func KeyctlSetperm(id int, perm uint32) error {
|
||||
_, err := KeyctlInt(KEYCTL_SETPERM, id, int(perm), 0, 0)
|
||||
return err
|
||||
}
|
||||
|
||||
//sys keyctlJoin(cmd int, arg2 string) (ret int, err error) = SYS_KEYCTL
|
||||
|
||||
// KeyctlJoinSessionKeyring implements the KEYCTL_JOIN_SESSION_KEYRING command.
|
||||
// See the full documentation at:
|
||||
// http://man7.org/linux/man-pages/man3/keyctl_join_session_keyring.3.html
|
||||
func KeyctlJoinSessionKeyring(name string) (ringid int, err error) {
|
||||
return keyctlJoin(KEYCTL_JOIN_SESSION_KEYRING, name)
|
||||
}
|
||||
|
||||
//sys keyctlSearch(cmd int, arg2 int, arg3 string, arg4 string, arg5 int) (ret int, err error) = SYS_KEYCTL
|
||||
|
||||
// KeyctlSearch implements the KEYCTL_SEARCH command.
|
||||
// See the full documentation at:
|
||||
// http://man7.org/linux/man-pages/man3/keyctl_search.3.html
|
||||
func KeyctlSearch(ringid int, keyType, description string, destRingid int) (id int, err error) {
|
||||
return keyctlSearch(KEYCTL_SEARCH, ringid, keyType, description, destRingid)
|
||||
}
|
||||
|
||||
//sys keyctlIOV(cmd int, arg2 int, payload []Iovec, arg5 int) (err error) = SYS_KEYCTL
|
||||
|
||||
// KeyctlInstantiateIOV implements the KEYCTL_INSTANTIATE_IOV command. This
|
||||
// command is similar to KEYCTL_INSTANTIATE, except that the payload is a slice
|
||||
// of Iovec (each of which represents a buffer) instead of a single buffer.
|
||||
// See the full documentation at:
|
||||
// http://man7.org/linux/man-pages/man3/keyctl_instantiate_iov.3.html
|
||||
func KeyctlInstantiateIOV(id int, payload []Iovec, ringid int) error {
|
||||
return keyctlIOV(KEYCTL_INSTANTIATE_IOV, id, payload, ringid)
|
||||
}
|
||||
|
||||
//sys keyctlDH(cmd int, arg2 *KeyctlDHParams, buf []byte) (ret int, err error) = SYS_KEYCTL
|
||||
|
||||
// KeyctlDHCompute implements the KEYCTL_DH_COMPUTE command. This command
|
||||
// computes a Diffie-Hellman shared secret based on the provide params. The
|
||||
// secret is written to the provided buffer and the returned size is the number
|
||||
// of bytes written (returning an error if there is insufficient space in the
|
||||
// buffer). If a nil buffer is passed in, this function returns the minimum
|
||||
// buffer length needed to store the appropriate data. Note that this differs
|
||||
// from KEYCTL_READ's behavior which always returns the requested payload size.
|
||||
// See the full documentation at:
|
||||
// http://man7.org/linux/man-pages/man3/keyctl_dh_compute.3.html
|
||||
func KeyctlDHCompute(params *KeyctlDHParams, buffer []byte) (size int, err error) {
|
||||
return keyctlDH(KEYCTL_DH_COMPUTE, params, buffer)
|
||||
}
|
||||
|
||||
func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) {
|
||||
var msg Msghdr
|
||||
var rsa RawSockaddrAny
|
||||
@ -1026,11 +1159,13 @@ func Mount(source string, target string, fstype string, flags uintptr, data stri
|
||||
* Direct access
|
||||
*/
|
||||
//sys Acct(path string) (err error)
|
||||
//sys AddKey(keyType string, description string, payload []byte, ringid int) (id int, err error)
|
||||
//sys Adjtimex(buf *Timex) (state int, err error)
|
||||
//sys Chdir(path string) (err error)
|
||||
//sys Chroot(path string) (err error)
|
||||
//sys ClockGettime(clockid int32, time *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 Dup(oldfd int) (fd int, err error)
|
||||
//sys Dup3(oldfd int, newfd int, flags int) (err error)
|
||||
//sysnb EpollCreate(size int) (fd int, err error)
|
||||
@ -1068,7 +1203,11 @@ func Getpgrp() (pid int) {
|
||||
//sysnb InotifyRmWatch(fd int, watchdesc uint32) (success int, err error)
|
||||
//sysnb Kill(pid int, sig syscall.Signal) (err error)
|
||||
//sys Klogctl(typ int, buf []byte) (n int, err error) = SYS_SYSLOG
|
||||
//sys Lgetxattr(path string, attr string, dest []byte) (sz int, err error)
|
||||
//sys Listxattr(path string, dest []byte) (sz int, err error)
|
||||
//sys Llistxattr(path string, dest []byte) (sz int, err error)
|
||||
//sys Lremovexattr(path string, attr string) (err error)
|
||||
//sys Lsetxattr(path string, attr string, data []byte, flags int) (err error)
|
||||
//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
|
||||
//sys Mknodat(dirfd int, path string, mode uint32, dev int) (err error)
|
||||
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
|
||||
@ -1078,6 +1217,7 @@ func Getpgrp() (pid int) {
|
||||
//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 RequestKey(keyType string, description string, callback string, destRingid int) (id int, err error)
|
||||
//sys Setdomainname(p []byte) (err error)
|
||||
//sys Sethostname(p []byte) (err error)
|
||||
//sysnb Setpgid(pid int, pgid int) (err error)
|
||||
@ -1161,7 +1301,6 @@ func Vmsplice(fd int, iovs []Iovec, flags int) (int, error) {
|
||||
/*
|
||||
* Unimplemented
|
||||
*/
|
||||
// AddKey
|
||||
// AfsSyscall
|
||||
// Alarm
|
||||
// ArchPrctl
|
||||
@ -1196,16 +1335,10 @@ func Vmsplice(fd int, iovs []Iovec, flags int) (int, error) {
|
||||
// IoGetevents
|
||||
// IoSetup
|
||||
// IoSubmit
|
||||
// Ioctl
|
||||
// IoprioGet
|
||||
// IoprioSet
|
||||
// KexecLoad
|
||||
// Keyctl
|
||||
// Lgetxattr
|
||||
// Llistxattr
|
||||
// LookupDcookie
|
||||
// Lremovexattr
|
||||
// Lsetxattr
|
||||
// Mbind
|
||||
// MigratePages
|
||||
// Mincore
|
||||
@ -1236,7 +1369,6 @@ func Vmsplice(fd int, iovs []Iovec, flags int) (int, error) {
|
||||
// Readahead
|
||||
// Readv
|
||||
// RemapFilePages
|
||||
// RequestKey
|
||||
// RestartSyscall
|
||||
// RtSigaction
|
||||
// RtSigpending
|
||||
|
5
vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go
generated
vendored
5
vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go
generated
vendored
@ -7,6 +7,7 @@
|
||||
|
||||
package unix
|
||||
|
||||
//sys Dup2(oldfd int, newfd int) (err error)
|
||||
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
|
||||
//sys Fchown(fd int, uid int, gid int) (err error)
|
||||
//sys Fstatfs(fd int, buf *Statfs_t) (err error)
|
||||
@ -182,9 +183,9 @@ func fillStat_t(s *Stat_t, st *stat_t) {
|
||||
s.Blocks = st.Blocks
|
||||
}
|
||||
|
||||
func (r *PtraceRegs) PC() uint64 { return r.Regs[64] }
|
||||
func (r *PtraceRegs) PC() uint64 { return r.Epc }
|
||||
|
||||
func (r *PtraceRegs) SetPC(pc uint64) { r.Regs[64] = pc }
|
||||
func (r *PtraceRegs) SetPC(pc uint64) { r.Epc = pc }
|
||||
|
||||
func (iov *Iovec) SetLen(length int) {
|
||||
iov.Len = uint64(length)
|
||||
|
4
vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go
generated
vendored
4
vendor/golang.org/x/sys/unix/syscall_linux_mipsx.go
generated
vendored
@ -211,9 +211,9 @@ func Setrlimit(resource int, rlim *Rlimit) (err error) {
|
||||
return setrlimit(resource, &rl)
|
||||
}
|
||||
|
||||
func (r *PtraceRegs) PC() uint64 { return uint64(r.Regs[64]) }
|
||||
func (r *PtraceRegs) PC() uint64 { return r.Epc }
|
||||
|
||||
func (r *PtraceRegs) SetPC(pc uint64) { r.Regs[64] = uint32(pc) }
|
||||
func (r *PtraceRegs) SetPC(pc uint64) { r.Epc = pc }
|
||||
|
||||
func (iov *Iovec) SetLen(length int) {
|
||||
iov.Len = uint32(length)
|
||||
|
42
vendor/golang.org/x/sys/unix/syscall_solaris.go
generated
vendored
42
vendor/golang.org/x/sys/unix/syscall_solaris.go
generated
vendored
@ -422,7 +422,7 @@ func Accept(fd int) (nfd int, sa Sockaddr, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) = libsocket.recvmsg
|
||||
//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error) = libsocket.__xnet_recvmsg
|
||||
|
||||
func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) {
|
||||
var msg Msghdr
|
||||
@ -441,7 +441,7 @@ func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from
|
||||
iov.Base = &dummy
|
||||
iov.SetLen(1)
|
||||
}
|
||||
msg.Accrights = (*int8)(unsafe.Pointer(&oob[0]))
|
||||
msg.Accrightslen = int32(len(oob))
|
||||
}
|
||||
msg.Iov = &iov
|
||||
msg.Iovlen = 1
|
||||
@ -461,7 +461,7 @@ func Sendmsg(fd int, p, oob []byte, to Sockaddr, flags int) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) = libsocket.sendmsg
|
||||
//sys sendmsg(s int, msg *Msghdr, flags int) (n int, err error) = libsocket.__xnet_sendmsg
|
||||
|
||||
func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error) {
|
||||
var ptr unsafe.Pointer
|
||||
@ -487,7 +487,7 @@ func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error)
|
||||
iov.Base = &dummy
|
||||
iov.SetLen(1)
|
||||
}
|
||||
msg.Accrights = (*int8)(unsafe.Pointer(&oob[0]))
|
||||
msg.Accrightslen = int32(len(oob))
|
||||
}
|
||||
msg.Iov = &iov
|
||||
msg.Iovlen = 1
|
||||
@ -519,43 +519,43 @@ func Acct(path string) (err error) {
|
||||
* Expose the ioctl function
|
||||
*/
|
||||
|
||||
//sys ioctl(fd int, req int, arg uintptr) (err error)
|
||||
//sys ioctl(fd int, req uint, arg uintptr) (err error)
|
||||
|
||||
func IoctlSetInt(fd int, req int, value int) (err error) {
|
||||
func IoctlSetInt(fd int, req uint, value int) (err error) {
|
||||
return ioctl(fd, req, uintptr(value))
|
||||
}
|
||||
|
||||
func IoctlSetWinsize(fd int, req int, value *Winsize) (err error) {
|
||||
func IoctlSetWinsize(fd int, req uint, value *Winsize) (err error) {
|
||||
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
||||
}
|
||||
|
||||
func IoctlSetTermios(fd int, req int, value *Termios) (err error) {
|
||||
func IoctlSetTermios(fd int, req uint, value *Termios) (err error) {
|
||||
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
||||
}
|
||||
|
||||
func IoctlSetTermio(fd int, req int, value *Termio) (err error) {
|
||||
func IoctlSetTermio(fd int, req uint, value *Termio) (err error) {
|
||||
return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
|
||||
}
|
||||
|
||||
func IoctlGetInt(fd int, req int) (int, error) {
|
||||
func IoctlGetInt(fd int, req uint) (int, error) {
|
||||
var value int
|
||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
|
||||
return value, err
|
||||
}
|
||||
|
||||
func IoctlGetWinsize(fd int, req int) (*Winsize, error) {
|
||||
func IoctlGetWinsize(fd int, req uint) (*Winsize, error) {
|
||||
var value Winsize
|
||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
|
||||
return &value, err
|
||||
}
|
||||
|
||||
func IoctlGetTermios(fd int, req int) (*Termios, error) {
|
||||
func IoctlGetTermios(fd int, req uint) (*Termios, error) {
|
||||
var value Termios
|
||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
|
||||
return &value, err
|
||||
}
|
||||
|
||||
func IoctlGetTermio(fd int, req int) (*Termio, error) {
|
||||
func IoctlGetTermio(fd int, req uint) (*Termio, error) {
|
||||
var value Termio
|
||||
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
|
||||
return &value, err
|
||||
@ -583,6 +583,7 @@ func IoctlGetTermio(fd int, req int) (*Termio, error) {
|
||||
//sys Fdatasync(fd int) (err error)
|
||||
//sys Fpathconf(fd int, name int) (val int, err error)
|
||||
//sys Fstat(fd int, stat *Stat_t) (err error)
|
||||
//sys Fstatvfs(fd int, vfsstat *Statvfs_t) (err error)
|
||||
//sys Getdents(fd int, buf []byte, basep *uintptr) (n int, err error)
|
||||
//sysnb Getgid() (gid int)
|
||||
//sysnb Getpid() (pid int)
|
||||
@ -599,7 +600,7 @@ func IoctlGetTermio(fd int, req int) (*Termio, error) {
|
||||
//sys Kill(pid int, signum syscall.Signal) (err error)
|
||||
//sys Lchown(path string, uid int, gid int) (err error)
|
||||
//sys Link(path string, link string) (err error)
|
||||
//sys Listen(s int, backlog int) (err error) = libsocket.listen
|
||||
//sys Listen(s int, backlog int) (err error) = libsocket.__xnet_llisten
|
||||
//sys Lstat(path string, stat *Stat_t) (err error)
|
||||
//sys Madvise(b []byte, advice int) (err error)
|
||||
//sys Mkdir(path string, mode uint32) (err error)
|
||||
@ -639,6 +640,7 @@ func IoctlGetTermio(fd int, req int) (*Termio, error) {
|
||||
//sysnb Setuid(uid int) (err error)
|
||||
//sys Shutdown(s int, how int) (err error) = libsocket.shutdown
|
||||
//sys Stat(path string, stat *Stat_t) (err error)
|
||||
//sys Statvfs(path string, vfsstat *Statvfs_t) (err error)
|
||||
//sys Symlink(path string, link string) (err error)
|
||||
//sys Sync() (err error)
|
||||
//sysnb Times(tms *Tms) (ticks uintptr, err error)
|
||||
@ -652,15 +654,15 @@ func IoctlGetTermio(fd int, req int) (*Termio, error) {
|
||||
//sys Unlinkat(dirfd int, path string, flags int) (err error)
|
||||
//sys Ustat(dev int, ubuf *Ustat_t) (err error)
|
||||
//sys Utime(path string, buf *Utimbuf) (err error)
|
||||
//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) = libsocket.bind
|
||||
//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) = libsocket.connect
|
||||
//sys bind(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) = libsocket.__xnet_bind
|
||||
//sys connect(s int, addr unsafe.Pointer, addrlen _Socklen) (err error) = libsocket.__xnet_connect
|
||||
//sys mmap(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error)
|
||||
//sys munmap(addr uintptr, length uintptr) (err error)
|
||||
//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) = libsocket.sendto
|
||||
//sys socket(domain int, typ int, proto int) (fd int, err error) = libsocket.socket
|
||||
//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) = libsocket.socketpair
|
||||
//sys sendto(s int, buf []byte, flags int, to unsafe.Pointer, addrlen _Socklen) (err error) = libsocket.__xnet_sendto
|
||||
//sys socket(domain int, typ int, proto int) (fd int, err error) = libsocket.__xnet_socket
|
||||
//sysnb socketpair(domain int, typ int, proto int, fd *[2]int32) (err error) = libsocket.__xnet_socketpair
|
||||
//sys write(fd int, p []byte) (n int, err error)
|
||||
//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) = libsocket.getsockopt
|
||||
//sys getsockopt(s int, level int, name int, val unsafe.Pointer, vallen *_Socklen) (err error) = libsocket.__xnet_getsockopt
|
||||
//sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (err error) = libsocket.getpeername
|
||||
//sys setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) (err error) = libsocket.setsockopt
|
||||
//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, err error) = libsocket.recvfrom
|
||||
|
1
vendor/golang.org/x/sys/unix/syscall_unix.go
generated
vendored
1
vendor/golang.org/x/sys/unix/syscall_unix.go
generated
vendored
@ -23,6 +23,7 @@ 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
|
||||
|
2
vendor/golang.org/x/sys/unix/types_darwin.go
generated
vendored
2
vendor/golang.org/x/sys/unix/types_darwin.go
generated
vendored
@ -5,7 +5,7 @@
|
||||
// +build ignore
|
||||
|
||||
/*
|
||||
Input to cgo -godefs. See also mkerrors.sh and mkall.sh
|
||||
Input to cgo -godefs. See README.md
|
||||
*/
|
||||
|
||||
// +godefs map struct_in_addr [4]byte /* in_addr */
|
||||
|
2
vendor/golang.org/x/sys/unix/types_dragonfly.go
generated
vendored
2
vendor/golang.org/x/sys/unix/types_dragonfly.go
generated
vendored
@ -5,7 +5,7 @@
|
||||
// +build ignore
|
||||
|
||||
/*
|
||||
Input to cgo -godefs. See also mkerrors.sh and mkall.sh
|
||||
Input to cgo -godefs. See README.md
|
||||
*/
|
||||
|
||||
// +godefs map struct_in_addr [4]byte /* in_addr */
|
||||
|
2
vendor/golang.org/x/sys/unix/types_freebsd.go
generated
vendored
2
vendor/golang.org/x/sys/unix/types_freebsd.go
generated
vendored
@ -5,7 +5,7 @@
|
||||
// +build ignore
|
||||
|
||||
/*
|
||||
Input to cgo -godefs. See also mkerrors.sh and mkall.sh
|
||||
Input to cgo -godefs. See README.md
|
||||
*/
|
||||
|
||||
// +godefs map struct_in_addr [4]byte /* in_addr */
|
||||
|
469
vendor/golang.org/x/sys/unix/types_linux.go
generated
vendored
469
vendor/golang.org/x/sys/unix/types_linux.go
generated
vendored
@ -1,469 +0,0 @@
|
||||
// Copyright 2009 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build ignore
|
||||
|
||||
/*
|
||||
Input to cgo -godefs. See also mkerrors.sh and mkall.sh
|
||||
*/
|
||||
|
||||
// +godefs map struct_in_addr [4]byte /* in_addr */
|
||||
// +godefs map struct_in6_addr [16]byte /* in6_addr */
|
||||
|
||||
package unix
|
||||
|
||||
/*
|
||||
#define _LARGEFILE_SOURCE
|
||||
#define _LARGEFILE64_SOURCE
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <dirent.h>
|
||||
#include <fcntl.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <netpacket/packet.h>
|
||||
#include <poll.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/epoll.h>
|
||||
#include <sys/inotify.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/ptrace.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/signal.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/statfs.h>
|
||||
#include <sys/sysinfo.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/times.h>
|
||||
#include <sys/timex.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/un.h>
|
||||
#include <sys/user.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <sys/wait.h>
|
||||
#include <linux/filter.h>
|
||||
#include <linux/netlink.h>
|
||||
#include <linux/rtnetlink.h>
|
||||
#include <linux/icmpv6.h>
|
||||
#include <asm/termbits.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <ustat.h>
|
||||
#include <utime.h>
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#include <bluetooth/hci.h>
|
||||
#include <linux/can.h>
|
||||
#include <linux/if_alg.h>
|
||||
#include <linux/vm_sockets.h>
|
||||
|
||||
#ifdef TCSETS2
|
||||
// On systems that have "struct termios2" use this as type Termios.
|
||||
typedef struct termios2 termios_t;
|
||||
#else
|
||||
typedef struct termios termios_t;
|
||||
#endif
|
||||
|
||||
enum {
|
||||
sizeofPtr = sizeof(void*),
|
||||
};
|
||||
|
||||
union sockaddr_all {
|
||||
struct sockaddr s1; // this one gets used for fields
|
||||
struct sockaddr_in s2; // these pad it out
|
||||
struct sockaddr_in6 s3;
|
||||
struct sockaddr_un s4;
|
||||
struct sockaddr_ll s5;
|
||||
struct sockaddr_nl s6;
|
||||
};
|
||||
|
||||
struct sockaddr_any {
|
||||
struct sockaddr addr;
|
||||
char pad[sizeof(union sockaddr_all) - sizeof(struct sockaddr)];
|
||||
};
|
||||
|
||||
// copied from /usr/include/linux/un.h
|
||||
struct my_sockaddr_un {
|
||||
sa_family_t sun_family;
|
||||
#if defined(__ARM_EABI__) || defined(__powerpc64__)
|
||||
// on ARM char is by default unsigned
|
||||
signed char sun_path[108];
|
||||
#else
|
||||
char sun_path[108];
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef __ARM_EABI__
|
||||
typedef struct user_regs PtraceRegs;
|
||||
#elif defined(__aarch64__)
|
||||
typedef struct user_pt_regs PtraceRegs;
|
||||
#elif defined(__powerpc64__)
|
||||
typedef struct pt_regs PtraceRegs;
|
||||
#elif defined(__mips__)
|
||||
typedef struct user PtraceRegs;
|
||||
#elif defined(__s390x__)
|
||||
typedef struct _user_regs_struct PtraceRegs;
|
||||
#elif defined(__sparc__)
|
||||
#include <asm/ptrace.h>
|
||||
typedef struct pt_regs PtraceRegs;
|
||||
#else
|
||||
typedef struct user_regs_struct PtraceRegs;
|
||||
#endif
|
||||
|
||||
#if defined(__s390x__)
|
||||
typedef struct _user_psw_struct ptracePsw;
|
||||
typedef struct _user_fpregs_struct ptraceFpregs;
|
||||
typedef struct _user_per_struct ptracePer;
|
||||
#else
|
||||
typedef struct {} ptracePsw;
|
||||
typedef struct {} ptraceFpregs;
|
||||
typedef struct {} ptracePer;
|
||||
#endif
|
||||
|
||||
// The real epoll_event is a union, and godefs doesn't handle it well.
|
||||
struct my_epoll_event {
|
||||
uint32_t events;
|
||||
#if defined(__ARM_EABI__) || defined(__aarch64__) || (defined(__mips__) && _MIPS_SIM == _ABIO32)
|
||||
// padding is not specified in linux/eventpoll.h but added to conform to the
|
||||
// alignment requirements of EABI
|
||||
int32_t padFd;
|
||||
#elif defined(__powerpc64__) || defined(__s390x__) || defined(__sparc__)
|
||||
int32_t _padFd;
|
||||
#endif
|
||||
int32_t fd;
|
||||
int32_t pad;
|
||||
};
|
||||
|
||||
*/
|
||||
import "C"
|
||||
|
||||
// Machine characteristics; for internal use.
|
||||
|
||||
const (
|
||||
sizeofPtr = C.sizeofPtr
|
||||
sizeofShort = C.sizeof_short
|
||||
sizeofInt = C.sizeof_int
|
||||
sizeofLong = C.sizeof_long
|
||||
sizeofLongLong = C.sizeof_longlong
|
||||
PathMax = C.PATH_MAX
|
||||
)
|
||||
|
||||
// Basic types
|
||||
|
||||
type (
|
||||
_C_short C.short
|
||||
_C_int C.int
|
||||
_C_long C.long
|
||||
_C_long_long C.longlong
|
||||
)
|
||||
|
||||
// Time
|
||||
|
||||
type Timespec C.struct_timespec
|
||||
|
||||
type Timeval C.struct_timeval
|
||||
|
||||
type Timex C.struct_timex
|
||||
|
||||
type Time_t C.time_t
|
||||
|
||||
type Tms C.struct_tms
|
||||
|
||||
type Utimbuf C.struct_utimbuf
|
||||
|
||||
// Processes
|
||||
|
||||
type Rusage C.struct_rusage
|
||||
|
||||
type Rlimit C.struct_rlimit
|
||||
|
||||
type _Gid_t C.gid_t
|
||||
|
||||
// Files
|
||||
|
||||
type Stat_t C.struct_stat
|
||||
|
||||
type Statfs_t C.struct_statfs
|
||||
|
||||
type Dirent C.struct_dirent
|
||||
|
||||
type Fsid C.fsid_t
|
||||
|
||||
type Flock_t C.struct_flock
|
||||
|
||||
// Advice to Fadvise
|
||||
|
||||
const (
|
||||
FADV_NORMAL = C.POSIX_FADV_NORMAL
|
||||
FADV_RANDOM = C.POSIX_FADV_RANDOM
|
||||
FADV_SEQUENTIAL = C.POSIX_FADV_SEQUENTIAL
|
||||
FADV_WILLNEED = C.POSIX_FADV_WILLNEED
|
||||
FADV_DONTNEED = C.POSIX_FADV_DONTNEED
|
||||
FADV_NOREUSE = C.POSIX_FADV_NOREUSE
|
||||
)
|
||||
|
||||
// Sockets
|
||||
|
||||
type RawSockaddrInet4 C.struct_sockaddr_in
|
||||
|
||||
type RawSockaddrInet6 C.struct_sockaddr_in6
|
||||
|
||||
type RawSockaddrUnix C.struct_my_sockaddr_un
|
||||
|
||||
type RawSockaddrLinklayer C.struct_sockaddr_ll
|
||||
|
||||
type RawSockaddrNetlink C.struct_sockaddr_nl
|
||||
|
||||
type RawSockaddrHCI C.struct_sockaddr_hci
|
||||
|
||||
type RawSockaddrCAN C.struct_sockaddr_can
|
||||
|
||||
type RawSockaddrALG C.struct_sockaddr_alg
|
||||
|
||||
type RawSockaddrVM C.struct_sockaddr_vm
|
||||
|
||||
type RawSockaddr C.struct_sockaddr
|
||||
|
||||
type RawSockaddrAny C.struct_sockaddr_any
|
||||
|
||||
type _Socklen C.socklen_t
|
||||
|
||||
type Linger C.struct_linger
|
||||
|
||||
type Iovec C.struct_iovec
|
||||
|
||||
type IPMreq C.struct_ip_mreq
|
||||
|
||||
type IPMreqn C.struct_ip_mreqn
|
||||
|
||||
type IPv6Mreq C.struct_ipv6_mreq
|
||||
|
||||
type Msghdr C.struct_msghdr
|
||||
|
||||
type Cmsghdr C.struct_cmsghdr
|
||||
|
||||
type Inet4Pktinfo C.struct_in_pktinfo
|
||||
|
||||
type Inet6Pktinfo C.struct_in6_pktinfo
|
||||
|
||||
type IPv6MTUInfo C.struct_ip6_mtuinfo
|
||||
|
||||
type ICMPv6Filter C.struct_icmp6_filter
|
||||
|
||||
type Ucred C.struct_ucred
|
||||
|
||||
type TCPInfo C.struct_tcp_info
|
||||
|
||||
const (
|
||||
SizeofSockaddrInet4 = C.sizeof_struct_sockaddr_in
|
||||
SizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6
|
||||
SizeofSockaddrAny = C.sizeof_struct_sockaddr_any
|
||||
SizeofSockaddrUnix = C.sizeof_struct_sockaddr_un
|
||||
SizeofSockaddrLinklayer = C.sizeof_struct_sockaddr_ll
|
||||
SizeofSockaddrNetlink = C.sizeof_struct_sockaddr_nl
|
||||
SizeofSockaddrHCI = C.sizeof_struct_sockaddr_hci
|
||||
SizeofSockaddrCAN = C.sizeof_struct_sockaddr_can
|
||||
SizeofSockaddrALG = C.sizeof_struct_sockaddr_alg
|
||||
SizeofSockaddrVM = C.sizeof_struct_sockaddr_vm
|
||||
SizeofLinger = C.sizeof_struct_linger
|
||||
SizeofIPMreq = C.sizeof_struct_ip_mreq
|
||||
SizeofIPMreqn = C.sizeof_struct_ip_mreqn
|
||||
SizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq
|
||||
SizeofMsghdr = C.sizeof_struct_msghdr
|
||||
SizeofCmsghdr = C.sizeof_struct_cmsghdr
|
||||
SizeofInet4Pktinfo = C.sizeof_struct_in_pktinfo
|
||||
SizeofInet6Pktinfo = C.sizeof_struct_in6_pktinfo
|
||||
SizeofIPv6MTUInfo = C.sizeof_struct_ip6_mtuinfo
|
||||
SizeofICMPv6Filter = C.sizeof_struct_icmp6_filter
|
||||
SizeofUcred = C.sizeof_struct_ucred
|
||||
SizeofTCPInfo = C.sizeof_struct_tcp_info
|
||||
)
|
||||
|
||||
// Netlink routing and interface messages
|
||||
|
||||
const (
|
||||
IFA_UNSPEC = C.IFA_UNSPEC
|
||||
IFA_ADDRESS = C.IFA_ADDRESS
|
||||
IFA_LOCAL = C.IFA_LOCAL
|
||||
IFA_LABEL = C.IFA_LABEL
|
||||
IFA_BROADCAST = C.IFA_BROADCAST
|
||||
IFA_ANYCAST = C.IFA_ANYCAST
|
||||
IFA_CACHEINFO = C.IFA_CACHEINFO
|
||||
IFA_MULTICAST = C.IFA_MULTICAST
|
||||
IFLA_UNSPEC = C.IFLA_UNSPEC
|
||||
IFLA_ADDRESS = C.IFLA_ADDRESS
|
||||
IFLA_BROADCAST = C.IFLA_BROADCAST
|
||||
IFLA_IFNAME = C.IFLA_IFNAME
|
||||
IFLA_MTU = C.IFLA_MTU
|
||||
IFLA_LINK = C.IFLA_LINK
|
||||
IFLA_QDISC = C.IFLA_QDISC
|
||||
IFLA_STATS = C.IFLA_STATS
|
||||
IFLA_COST = C.IFLA_COST
|
||||
IFLA_PRIORITY = C.IFLA_PRIORITY
|
||||
IFLA_MASTER = C.IFLA_MASTER
|
||||
IFLA_WIRELESS = C.IFLA_WIRELESS
|
||||
IFLA_PROTINFO = C.IFLA_PROTINFO
|
||||
IFLA_TXQLEN = C.IFLA_TXQLEN
|
||||
IFLA_MAP = C.IFLA_MAP
|
||||
IFLA_WEIGHT = C.IFLA_WEIGHT
|
||||
IFLA_OPERSTATE = C.IFLA_OPERSTATE
|
||||
IFLA_LINKMODE = C.IFLA_LINKMODE
|
||||
IFLA_LINKINFO = C.IFLA_LINKINFO
|
||||
IFLA_NET_NS_PID = C.IFLA_NET_NS_PID
|
||||
IFLA_IFALIAS = C.IFLA_IFALIAS
|
||||
IFLA_MAX = C.IFLA_MAX
|
||||
RT_SCOPE_UNIVERSE = C.RT_SCOPE_UNIVERSE
|
||||
RT_SCOPE_SITE = C.RT_SCOPE_SITE
|
||||
RT_SCOPE_LINK = C.RT_SCOPE_LINK
|
||||
RT_SCOPE_HOST = C.RT_SCOPE_HOST
|
||||
RT_SCOPE_NOWHERE = C.RT_SCOPE_NOWHERE
|
||||
RT_TABLE_UNSPEC = C.RT_TABLE_UNSPEC
|
||||
RT_TABLE_COMPAT = C.RT_TABLE_COMPAT
|
||||
RT_TABLE_DEFAULT = C.RT_TABLE_DEFAULT
|
||||
RT_TABLE_MAIN = C.RT_TABLE_MAIN
|
||||
RT_TABLE_LOCAL = C.RT_TABLE_LOCAL
|
||||
RT_TABLE_MAX = C.RT_TABLE_MAX
|
||||
RTA_UNSPEC = C.RTA_UNSPEC
|
||||
RTA_DST = C.RTA_DST
|
||||
RTA_SRC = C.RTA_SRC
|
||||
RTA_IIF = C.RTA_IIF
|
||||
RTA_OIF = C.RTA_OIF
|
||||
RTA_GATEWAY = C.RTA_GATEWAY
|
||||
RTA_PRIORITY = C.RTA_PRIORITY
|
||||
RTA_PREFSRC = C.RTA_PREFSRC
|
||||
RTA_METRICS = C.RTA_METRICS
|
||||
RTA_MULTIPATH = C.RTA_MULTIPATH
|
||||
RTA_FLOW = C.RTA_FLOW
|
||||
RTA_CACHEINFO = C.RTA_CACHEINFO
|
||||
RTA_TABLE = C.RTA_TABLE
|
||||
RTN_UNSPEC = C.RTN_UNSPEC
|
||||
RTN_UNICAST = C.RTN_UNICAST
|
||||
RTN_LOCAL = C.RTN_LOCAL
|
||||
RTN_BROADCAST = C.RTN_BROADCAST
|
||||
RTN_ANYCAST = C.RTN_ANYCAST
|
||||
RTN_MULTICAST = C.RTN_MULTICAST
|
||||
RTN_BLACKHOLE = C.RTN_BLACKHOLE
|
||||
RTN_UNREACHABLE = C.RTN_UNREACHABLE
|
||||
RTN_PROHIBIT = C.RTN_PROHIBIT
|
||||
RTN_THROW = C.RTN_THROW
|
||||
RTN_NAT = C.RTN_NAT
|
||||
RTN_XRESOLVE = C.RTN_XRESOLVE
|
||||
RTNLGRP_NONE = C.RTNLGRP_NONE
|
||||
RTNLGRP_LINK = C.RTNLGRP_LINK
|
||||
RTNLGRP_NOTIFY = C.RTNLGRP_NOTIFY
|
||||
RTNLGRP_NEIGH = C.RTNLGRP_NEIGH
|
||||
RTNLGRP_TC = C.RTNLGRP_TC
|
||||
RTNLGRP_IPV4_IFADDR = C.RTNLGRP_IPV4_IFADDR
|
||||
RTNLGRP_IPV4_MROUTE = C.RTNLGRP_IPV4_MROUTE
|
||||
RTNLGRP_IPV4_ROUTE = C.RTNLGRP_IPV4_ROUTE
|
||||
RTNLGRP_IPV4_RULE = C.RTNLGRP_IPV4_RULE
|
||||
RTNLGRP_IPV6_IFADDR = C.RTNLGRP_IPV6_IFADDR
|
||||
RTNLGRP_IPV6_MROUTE = C.RTNLGRP_IPV6_MROUTE
|
||||
RTNLGRP_IPV6_ROUTE = C.RTNLGRP_IPV6_ROUTE
|
||||
RTNLGRP_IPV6_IFINFO = C.RTNLGRP_IPV6_IFINFO
|
||||
RTNLGRP_IPV6_PREFIX = C.RTNLGRP_IPV6_PREFIX
|
||||
RTNLGRP_IPV6_RULE = C.RTNLGRP_IPV6_RULE
|
||||
RTNLGRP_ND_USEROPT = C.RTNLGRP_ND_USEROPT
|
||||
SizeofNlMsghdr = C.sizeof_struct_nlmsghdr
|
||||
SizeofNlMsgerr = C.sizeof_struct_nlmsgerr
|
||||
SizeofRtGenmsg = C.sizeof_struct_rtgenmsg
|
||||
SizeofNlAttr = C.sizeof_struct_nlattr
|
||||
SizeofRtAttr = C.sizeof_struct_rtattr
|
||||
SizeofIfInfomsg = C.sizeof_struct_ifinfomsg
|
||||
SizeofIfAddrmsg = C.sizeof_struct_ifaddrmsg
|
||||
SizeofRtMsg = C.sizeof_struct_rtmsg
|
||||
SizeofRtNexthop = C.sizeof_struct_rtnexthop
|
||||
)
|
||||
|
||||
type NlMsghdr C.struct_nlmsghdr
|
||||
|
||||
type NlMsgerr C.struct_nlmsgerr
|
||||
|
||||
type RtGenmsg C.struct_rtgenmsg
|
||||
|
||||
type NlAttr C.struct_nlattr
|
||||
|
||||
type RtAttr C.struct_rtattr
|
||||
|
||||
type IfInfomsg C.struct_ifinfomsg
|
||||
|
||||
type IfAddrmsg C.struct_ifaddrmsg
|
||||
|
||||
type RtMsg C.struct_rtmsg
|
||||
|
||||
type RtNexthop C.struct_rtnexthop
|
||||
|
||||
// Linux socket filter
|
||||
|
||||
const (
|
||||
SizeofSockFilter = C.sizeof_struct_sock_filter
|
||||
SizeofSockFprog = C.sizeof_struct_sock_fprog
|
||||
)
|
||||
|
||||
type SockFilter C.struct_sock_filter
|
||||
|
||||
type SockFprog C.struct_sock_fprog
|
||||
|
||||
// Inotify
|
||||
|
||||
type InotifyEvent C.struct_inotify_event
|
||||
|
||||
const SizeofInotifyEvent = C.sizeof_struct_inotify_event
|
||||
|
||||
// Ptrace
|
||||
|
||||
// Register structures
|
||||
type PtraceRegs C.PtraceRegs
|
||||
|
||||
// Structures contained in PtraceRegs on s390x (exported by mkpost.go)
|
||||
type ptracePsw C.ptracePsw
|
||||
|
||||
type ptraceFpregs C.ptraceFpregs
|
||||
|
||||
type ptracePer C.ptracePer
|
||||
|
||||
// Misc
|
||||
|
||||
type FdSet C.fd_set
|
||||
|
||||
type Sysinfo_t C.struct_sysinfo
|
||||
|
||||
type Utsname C.struct_utsname
|
||||
|
||||
type Ustat_t C.struct_ustat
|
||||
|
||||
type EpollEvent C.struct_my_epoll_event
|
||||
|
||||
const (
|
||||
AT_FDCWD = C.AT_FDCWD
|
||||
AT_REMOVEDIR = C.AT_REMOVEDIR
|
||||
AT_SYMLINK_FOLLOW = C.AT_SYMLINK_FOLLOW
|
||||
AT_SYMLINK_NOFOLLOW = C.AT_SYMLINK_NOFOLLOW
|
||||
)
|
||||
|
||||
type PollFd C.struct_pollfd
|
||||
|
||||
const (
|
||||
POLLIN = C.POLLIN
|
||||
POLLPRI = C.POLLPRI
|
||||
POLLOUT = C.POLLOUT
|
||||
POLLRDHUP = C.POLLRDHUP
|
||||
POLLERR = C.POLLERR
|
||||
POLLHUP = C.POLLHUP
|
||||
POLLNVAL = C.POLLNVAL
|
||||
)
|
||||
|
||||
type Sigset_t C.sigset_t
|
||||
|
||||
// sysconf information
|
||||
|
||||
const _SC_PAGESIZE = C._SC_PAGESIZE
|
||||
|
||||
// Terminal handling
|
||||
|
||||
type Termios C.termios_t
|
2
vendor/golang.org/x/sys/unix/types_netbsd.go
generated
vendored
2
vendor/golang.org/x/sys/unix/types_netbsd.go
generated
vendored
@ -5,7 +5,7 @@
|
||||
// +build ignore
|
||||
|
||||
/*
|
||||
Input to cgo -godefs. See also mkerrors.sh and mkall.sh
|
||||
Input to cgo -godefs. See README.md
|
||||
*/
|
||||
|
||||
// +godefs map struct_in_addr [4]byte /* in_addr */
|
||||
|
2
vendor/golang.org/x/sys/unix/types_openbsd.go
generated
vendored
2
vendor/golang.org/x/sys/unix/types_openbsd.go
generated
vendored
@ -5,7 +5,7 @@
|
||||
// +build ignore
|
||||
|
||||
/*
|
||||
Input to cgo -godefs. See also mkerrors.sh and mkall.sh
|
||||
Input to cgo -godefs. See README.md
|
||||
*/
|
||||
|
||||
// +godefs map struct_in_addr [4]byte /* in_addr */
|
||||
|
9
vendor/golang.org/x/sys/unix/types_solaris.go
generated
vendored
9
vendor/golang.org/x/sys/unix/types_solaris.go
generated
vendored
@ -5,7 +5,7 @@
|
||||
// +build ignore
|
||||
|
||||
/*
|
||||
Input to cgo -godefs. See also mkerrors.sh and mkall.sh
|
||||
Input to cgo -godefs. See README.md
|
||||
*/
|
||||
|
||||
// +godefs map struct_in_addr [4]byte /* in_addr */
|
||||
@ -37,6 +37,7 @@ package unix
|
||||
#include <sys/signal.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/statvfs.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/times.h>
|
||||
#include <sys/types.h>
|
||||
@ -139,6 +140,12 @@ type Flock_t C.struct_flock
|
||||
|
||||
type Dirent C.struct_dirent
|
||||
|
||||
// Filesystems
|
||||
|
||||
type _Fsblkcnt_t C.fsblkcnt_t
|
||||
|
||||
type Statvfs_t C.struct_statvfs
|
||||
|
||||
// Sockets
|
||||
|
||||
type RawSockaddrInet4 C.struct_sockaddr_in
|
||||
|
56
vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go
generated
vendored
56
vendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go
generated
vendored
@ -1,5 +1,5 @@
|
||||
// mkerrors.sh -m64
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build amd64,dragonfly
|
||||
|
||||
@ -37,8 +37,8 @@ const (
|
||||
AF_MAX = 0x24
|
||||
AF_MPLS = 0x22
|
||||
AF_NATM = 0x1d
|
||||
AF_NETBIOS = 0x6
|
||||
AF_NETGRAPH = 0x20
|
||||
AF_NS = 0x6
|
||||
AF_OSI = 0x7
|
||||
AF_PUP = 0x4
|
||||
AF_ROUTE = 0x11
|
||||
@ -46,6 +46,7 @@ const (
|
||||
AF_SNA = 0xb
|
||||
AF_UNIX = 0x1
|
||||
AF_UNSPEC = 0x0
|
||||
ALTWERASE = 0x200
|
||||
B0 = 0x0
|
||||
B110 = 0x6e
|
||||
B115200 = 0x1c200
|
||||
@ -141,7 +142,22 @@ const (
|
||||
BRKINT = 0x2
|
||||
CFLUSH = 0xf
|
||||
CLOCAL = 0x8000
|
||||
CLOCK_MONOTONIC = 0x4
|
||||
CLOCK_MONOTONIC_FAST = 0xc
|
||||
CLOCK_MONOTONIC_PRECISE = 0xb
|
||||
CLOCK_PROCESS_CPUTIME_ID = 0xf
|
||||
CLOCK_PROF = 0x2
|
||||
CLOCK_REALTIME = 0x0
|
||||
CLOCK_REALTIME_FAST = 0xa
|
||||
CLOCK_REALTIME_PRECISE = 0x9
|
||||
CLOCK_SECOND = 0xd
|
||||
CLOCK_THREAD_CPUTIME_ID = 0xe
|
||||
CLOCK_UPTIME = 0x5
|
||||
CLOCK_UPTIME_FAST = 0x8
|
||||
CLOCK_UPTIME_PRECISE = 0x7
|
||||
CLOCK_VIRTUAL = 0x1
|
||||
CREAD = 0x800
|
||||
CRTSCTS = 0x30000
|
||||
CS5 = 0x0
|
||||
CS6 = 0x100
|
||||
CS7 = 0x200
|
||||
@ -286,24 +302,28 @@ const (
|
||||
ECHOPRT = 0x20
|
||||
EVFILT_AIO = -0x3
|
||||
EVFILT_EXCEPT = -0x8
|
||||
EVFILT_FS = -0xa
|
||||
EVFILT_MARKER = 0xf
|
||||
EVFILT_PROC = -0x5
|
||||
EVFILT_READ = -0x1
|
||||
EVFILT_SIGNAL = -0x6
|
||||
EVFILT_SYSCOUNT = 0x8
|
||||
EVFILT_SYSCOUNT = 0xa
|
||||
EVFILT_TIMER = -0x7
|
||||
EVFILT_USER = -0x9
|
||||
EVFILT_VNODE = -0x4
|
||||
EVFILT_WRITE = -0x2
|
||||
EV_ADD = 0x1
|
||||
EV_CLEAR = 0x20
|
||||
EV_DELETE = 0x2
|
||||
EV_DISABLE = 0x8
|
||||
EV_DISPATCH = 0x80
|
||||
EV_ENABLE = 0x4
|
||||
EV_EOF = 0x8000
|
||||
EV_ERROR = 0x4000
|
||||
EV_FLAG1 = 0x2000
|
||||
EV_NODATA = 0x1000
|
||||
EV_ONESHOT = 0x10
|
||||
EV_RECEIPT = 0x40
|
||||
EV_SYSFLAGS = 0xf000
|
||||
EXTA = 0x4b00
|
||||
EXTB = 0x9600
|
||||
@ -679,7 +699,6 @@ const (
|
||||
IPPROTO_SATEXPAK = 0x40
|
||||
IPPROTO_SATMON = 0x45
|
||||
IPPROTO_SCCSP = 0x60
|
||||
IPPROTO_SCTP = 0x84
|
||||
IPPROTO_SDRP = 0x2a
|
||||
IPPROTO_SEP = 0x21
|
||||
IPPROTO_SKIP = 0x39
|
||||
@ -730,6 +749,7 @@ const (
|
||||
IPV6_LEAVE_GROUP = 0xd
|
||||
IPV6_MAXHLIM = 0xff
|
||||
IPV6_MAXPACKET = 0xffff
|
||||
IPV6_MINHLIM = 0x28
|
||||
IPV6_MMTU = 0x500
|
||||
IPV6_MSFILTER = 0x4a
|
||||
IPV6_MULTICAST_HOPS = 0xa
|
||||
@ -778,6 +798,7 @@ const (
|
||||
IP_FW_FLUSH = 0x34
|
||||
IP_FW_GET = 0x36
|
||||
IP_FW_RESETLOG = 0x37
|
||||
IP_FW_X = 0x31
|
||||
IP_FW_ZERO = 0x35
|
||||
IP_HDRINCL = 0x2
|
||||
IP_IPSEC_POLICY = 0x15
|
||||
@ -833,6 +854,7 @@ const (
|
||||
MADV_SETMAP = 0xb
|
||||
MADV_WILLNEED = 0x3
|
||||
MAP_ANON = 0x1000
|
||||
MAP_ANONYMOUS = 0x1000
|
||||
MAP_COPY = 0x2
|
||||
MAP_FILE = 0x0
|
||||
MAP_FIXED = 0x10
|
||||
@ -851,6 +873,7 @@ const (
|
||||
MAP_VPAGETABLE = 0x2000
|
||||
MCL_CURRENT = 0x1
|
||||
MCL_FUTURE = 0x2
|
||||
MSG_CMSG_CLOEXEC = 0x1000
|
||||
MSG_CTRUNC = 0x20
|
||||
MSG_DONTROUTE = 0x4
|
||||
MSG_DONTWAIT = 0x80
|
||||
@ -860,11 +883,11 @@ const (
|
||||
MSG_FMASK = 0xffff0000
|
||||
MSG_FNONBLOCKING = 0x20000
|
||||
MSG_NOSIGNAL = 0x400
|
||||
MSG_NOTIFICATION = 0x200
|
||||
MSG_OOB = 0x1
|
||||
MSG_PEEK = 0x2
|
||||
MSG_SYNC = 0x800
|
||||
MSG_TRUNC = 0x10
|
||||
MSG_UNUSED09 = 0x200
|
||||
MSG_WAITALL = 0x40
|
||||
MS_ASYNC = 0x1
|
||||
MS_INVALIDATE = 0x2
|
||||
@ -875,12 +898,19 @@ const (
|
||||
NET_RT_IFLIST = 0x3
|
||||
NET_RT_MAXID = 0x4
|
||||
NOFLSH = 0x80000000
|
||||
NOKERNINFO = 0x2000000
|
||||
NOTE_ATTRIB = 0x8
|
||||
NOTE_CHILD = 0x4
|
||||
NOTE_DELETE = 0x1
|
||||
NOTE_EXEC = 0x20000000
|
||||
NOTE_EXIT = 0x80000000
|
||||
NOTE_EXTEND = 0x4
|
||||
NOTE_FFAND = 0x40000000
|
||||
NOTE_FFCOPY = 0xc0000000
|
||||
NOTE_FFCTRLMASK = 0xc0000000
|
||||
NOTE_FFLAGSMASK = 0xffffff
|
||||
NOTE_FFNOP = 0x0
|
||||
NOTE_FFOR = 0x80000000
|
||||
NOTE_FORK = 0x40000000
|
||||
NOTE_LINK = 0x10
|
||||
NOTE_LOWAT = 0x1
|
||||
@ -891,6 +921,7 @@ const (
|
||||
NOTE_REVOKE = 0x40
|
||||
NOTE_TRACK = 0x1
|
||||
NOTE_TRACKERR = 0x2
|
||||
NOTE_TRIGGER = 0x1000000
|
||||
NOTE_WRITE = 0x2
|
||||
OCRNL = 0x10
|
||||
ONLCR = 0x2
|
||||
@ -898,6 +929,7 @@ const (
|
||||
ONOCR = 0x20
|
||||
ONOEOT = 0x8
|
||||
OPOST = 0x1
|
||||
OXTABS = 0x4
|
||||
O_ACCMODE = 0x3
|
||||
O_APPEND = 0x8
|
||||
O_ASYNC = 0x40
|
||||
@ -910,14 +942,11 @@ const (
|
||||
O_FAPPEND = 0x100000
|
||||
O_FASYNCWRITE = 0x800000
|
||||
O_FBLOCKING = 0x40000
|
||||
O_FBUFFERED = 0x2000000
|
||||
O_FMASK = 0x7fc0000
|
||||
O_FMASK = 0xfc0000
|
||||
O_FNONBLOCKING = 0x80000
|
||||
O_FOFFSET = 0x200000
|
||||
O_FSYNC = 0x80
|
||||
O_FSYNCWRITE = 0x400000
|
||||
O_FUNBUFFERED = 0x1000000
|
||||
O_MAPONREAD = 0x4000000
|
||||
O_NDELAY = 0x4
|
||||
O_NOCTTY = 0x8000
|
||||
O_NOFOLLOW = 0x100
|
||||
@ -1096,8 +1125,10 @@ const (
|
||||
SIOCSLIFPHYADDR = 0x8118694a
|
||||
SIOCSLOWAT = 0x80047302
|
||||
SIOCSPGRP = 0x80047308
|
||||
SOCK_CLOEXEC = 0x10000000
|
||||
SOCK_DGRAM = 0x2
|
||||
SOCK_MAXADDRLEN = 0xff
|
||||
SOCK_NONBLOCK = 0x20000000
|
||||
SOCK_RAW = 0x3
|
||||
SOCK_RDM = 0x4
|
||||
SOCK_SEQPACKET = 0x5
|
||||
@ -1107,6 +1138,7 @@ const (
|
||||
SO_ACCEPTCONN = 0x2
|
||||
SO_ACCEPTFILTER = 0x1000
|
||||
SO_BROADCAST = 0x20
|
||||
SO_CPUHINT = 0x1030
|
||||
SO_DEBUG = 0x1
|
||||
SO_DONTROUTE = 0x10
|
||||
SO_ERROR = 0x1007
|
||||
@ -1127,8 +1159,12 @@ const (
|
||||
SO_TYPE = 0x1008
|
||||
SO_USELOOPBACK = 0x40
|
||||
TCIFLUSH = 0x1
|
||||
TCIOFF = 0x3
|
||||
TCIOFLUSH = 0x3
|
||||
TCION = 0x4
|
||||
TCOFLUSH = 0x2
|
||||
TCOOFF = 0x1
|
||||
TCOON = 0x2
|
||||
TCP_FASTKEEP = 0x80
|
||||
TCP_KEEPCNT = 0x400
|
||||
TCP_KEEPIDLE = 0x100
|
||||
@ -1227,6 +1263,8 @@ const (
|
||||
VKILL = 0x5
|
||||
VLNEXT = 0xe
|
||||
VMIN = 0x10
|
||||
VM_BCACHE_SIZE_MAX = 0x0
|
||||
VM_SWZONE_SIZE_MAX = 0x4000000000
|
||||
VQUIT = 0x9
|
||||
VREPRINT = 0x6
|
||||
VSTART = 0xc
|
||||
|
3303
vendor/golang.org/x/sys/unix/zerrors_linux_386.go
generated
vendored
3303
vendor/golang.org/x/sys/unix/zerrors_linux_386.go
generated
vendored
File diff suppressed because it is too large
Load Diff
3312
vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go
generated
vendored
3312
vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go
generated
vendored
File diff suppressed because it is too large
Load Diff
3236
vendor/golang.org/x/sys/unix/zerrors_linux_arm.go
generated
vendored
3236
vendor/golang.org/x/sys/unix/zerrors_linux_arm.go
generated
vendored
File diff suppressed because it is too large
Load Diff
3369
vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go
generated
vendored
3369
vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go
generated
vendored
File diff suppressed because it is too large
Load Diff
3286
vendor/golang.org/x/sys/unix/zerrors_linux_mips.go
generated
vendored
3286
vendor/golang.org/x/sys/unix/zerrors_linux_mips.go
generated
vendored
File diff suppressed because it is too large
Load Diff
3378
vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go
generated
vendored
3378
vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go
generated
vendored
File diff suppressed because it is too large
Load Diff
3378
vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go
generated
vendored
3378
vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go
generated
vendored
File diff suppressed because it is too large
Load Diff
3479
vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go
generated
vendored
3479
vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go
generated
vendored
File diff suppressed because it is too large
Load Diff
3513
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go
generated
vendored
3513
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go
generated
vendored
File diff suppressed because it is too large
Load Diff
3509
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go
generated
vendored
3509
vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go
generated
vendored
File diff suppressed because it is too large
Load Diff
3567
vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go
generated
vendored
3567
vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go
generated
vendored
File diff suppressed because it is too large
Load Diff
49
vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go
generated
vendored
49
vendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go
generated
vendored
@ -1,5 +1,5 @@
|
||||
// mkerrors.sh -m64
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build amd64,solaris
|
||||
|
||||
@ -159,7 +159,12 @@ const (
|
||||
BPF_W = 0x0
|
||||
BPF_X = 0x8
|
||||
BRKINT = 0x2
|
||||
BS0 = 0x0
|
||||
BS1 = 0x2000
|
||||
BSDLY = 0x2000
|
||||
CBAUD = 0xf
|
||||
CFLUSH = 0xf
|
||||
CIBAUD = 0xf0000
|
||||
CLOCAL = 0x800
|
||||
CLOCK_HIGHRES = 0x4
|
||||
CLOCK_LEVEL = 0xa
|
||||
@ -169,7 +174,13 @@ const (
|
||||
CLOCK_REALTIME = 0x3
|
||||
CLOCK_THREAD_CPUTIME_ID = 0x2
|
||||
CLOCK_VIRTUAL = 0x1
|
||||
CR0 = 0x0
|
||||
CR1 = 0x200
|
||||
CR2 = 0x400
|
||||
CR3 = 0x600
|
||||
CRDLY = 0x600
|
||||
CREAD = 0x80
|
||||
CRTSCTS = 0x80000000
|
||||
CS5 = 0x0
|
||||
CS6 = 0x10
|
||||
CS7 = 0x20
|
||||
@ -276,6 +287,9 @@ const (
|
||||
FD_CLOEXEC = 0x1
|
||||
FD_NFDBITS = 0x40
|
||||
FD_SETSIZE = 0x10000
|
||||
FF0 = 0x0
|
||||
FF1 = 0x8000
|
||||
FFDLY = 0x8000
|
||||
FLUSHALL = 0x1
|
||||
FLUSHDATA = 0x0
|
||||
FLUSHO = 0x2000
|
||||
@ -290,6 +304,10 @@ const (
|
||||
F_DUP2FD_CLOEXEC = 0x24
|
||||
F_DUPFD = 0x0
|
||||
F_DUPFD_CLOEXEC = 0x25
|
||||
F_FLOCK = 0x35
|
||||
F_FLOCK64 = 0x35
|
||||
F_FLOCKW = 0x36
|
||||
F_FLOCKW64 = 0x36
|
||||
F_FREESP = 0xb
|
||||
F_FREESP64 = 0xb
|
||||
F_GETFD = 0x1
|
||||
@ -304,6 +322,12 @@ const (
|
||||
F_MDACC = 0x20
|
||||
F_NODNY = 0x0
|
||||
F_NPRIV = 0x10
|
||||
F_OFD_GETLK = 0x2f
|
||||
F_OFD_GETLK64 = 0x2f
|
||||
F_OFD_SETLK = 0x30
|
||||
F_OFD_SETLK64 = 0x30
|
||||
F_OFD_SETLKW = 0x31
|
||||
F_OFD_SETLKW64 = 0x31
|
||||
F_PRIV = 0xf
|
||||
F_QUOTACTL = 0x11
|
||||
F_RDACC = 0x1
|
||||
@ -332,6 +356,7 @@ const (
|
||||
F_WRDNY = 0x2
|
||||
F_WRLCK = 0x2
|
||||
HUPCL = 0x400
|
||||
IBSHIFT = 0x10
|
||||
ICANON = 0x2
|
||||
ICRNL = 0x100
|
||||
IEXTEN = 0x8000
|
||||
@ -589,15 +614,21 @@ const (
|
||||
IP_UNSPEC_SRC = 0x42
|
||||
ISIG = 0x1
|
||||
ISTRIP = 0x20
|
||||
IUCLC = 0x200
|
||||
IXANY = 0x800
|
||||
IXOFF = 0x1000
|
||||
IXON = 0x400
|
||||
LOCK_EX = 0x2
|
||||
LOCK_NB = 0x4
|
||||
LOCK_SH = 0x1
|
||||
LOCK_UN = 0x8
|
||||
MADV_ACCESS_DEFAULT = 0x6
|
||||
MADV_ACCESS_LWP = 0x7
|
||||
MADV_ACCESS_MANY = 0x8
|
||||
MADV_DONTNEED = 0x4
|
||||
MADV_FREE = 0x5
|
||||
MADV_NORMAL = 0x0
|
||||
MADV_PURGE = 0x9
|
||||
MADV_RANDOM = 0x1
|
||||
MADV_SEQUENTIAL = 0x2
|
||||
MADV_WILLNEED = 0x3
|
||||
@ -605,6 +636,7 @@ const (
|
||||
MAP_ALIGN = 0x200
|
||||
MAP_ANON = 0x100
|
||||
MAP_ANONYMOUS = 0x100
|
||||
MAP_FILE = 0x0
|
||||
MAP_FIXED = 0x10
|
||||
MAP_INITDATA = 0x800
|
||||
MAP_NORESERVE = 0x40
|
||||
@ -632,10 +664,14 @@ const (
|
||||
MS_OLDSYNC = 0x0
|
||||
MS_SYNC = 0x4
|
||||
M_FLUSH = 0x86
|
||||
NL0 = 0x0
|
||||
NL1 = 0x100
|
||||
NLDLY = 0x100
|
||||
NOFLSH = 0x80
|
||||
OCRNL = 0x8
|
||||
OFDEL = 0x80
|
||||
OFILL = 0x40
|
||||
OLCUC = 0x2
|
||||
ONLCR = 0x4
|
||||
ONLRET = 0x20
|
||||
ONOCR = 0x10
|
||||
@ -955,12 +991,21 @@ const (
|
||||
SO_USELOOPBACK = 0x40
|
||||
SO_VRRP = 0x1017
|
||||
SO_WROFF = 0x2
|
||||
TAB0 = 0x0
|
||||
TAB1 = 0x800
|
||||
TAB2 = 0x1000
|
||||
TAB3 = 0x1800
|
||||
TABDLY = 0x1800
|
||||
TCFLSH = 0x5407
|
||||
TCGETA = 0x5401
|
||||
TCGETS = 0x540d
|
||||
TCIFLUSH = 0x0
|
||||
TCIOFF = 0x2
|
||||
TCIOFLUSH = 0x2
|
||||
TCION = 0x3
|
||||
TCOFLUSH = 0x1
|
||||
TCOOFF = 0x0
|
||||
TCOON = 0x1
|
||||
TCP_ABORT_THRESHOLD = 0x11
|
||||
TCP_ANONPRIVBIND = 0x20
|
||||
TCP_CONN_ABORT_THRESHOLD = 0x13
|
||||
@ -1089,6 +1134,8 @@ const (
|
||||
WSTOPPED = 0x4
|
||||
WTRAPPED = 0x2
|
||||
WUNTRACED = 0x4
|
||||
XCASE = 0x4
|
||||
XTABS = 0x1800
|
||||
)
|
||||
|
||||
// Errors
|
||||
|
13
vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go
generated
vendored
13
vendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go
generated
vendored
@ -1,5 +1,5 @@
|
||||
// mksyscall.pl -dragonfly -tags dragonfly,amd64 syscall_bsd.go syscall_dragonfly.go syscall_dragonfly_amd64.go
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build dragonfly,amd64
|
||||
|
||||
@ -1380,3 +1380,14 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error) {
|
||||
r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0)
|
||||
nfd = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
269
vendor/golang.org/x/sys/unix/zsyscall_linux_386.go
generated
vendored
269
vendor/golang.org/x/sys/unix/zsyscall_linux_386.go
generated
vendored
@ -1,5 +1,5 @@
|
||||
// mksyscall.pl -l32 -tags linux,386 syscall_linux.go syscall_linux_386.go
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build linux,386
|
||||
|
||||
@ -14,6 +14,16 @@ var _ syscall.Errno
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func ioctl(fd int, req uint, arg uintptr) (err error) {
|
||||
_, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(oldpath)
|
||||
@ -186,6 +196,104 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func KeyctlInt(cmd int, arg2 int, arg3 int, arg4 int, arg5 int) (ret int, err error) {
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(arg3), uintptr(arg4), uintptr(arg5), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func KeyctlBuffer(cmd int, arg2 int, buf []byte, arg5 int) (ret int, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(buf) > 0 {
|
||||
_p0 = unsafe.Pointer(&buf[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(_p0), uintptr(len(buf)), uintptr(arg5), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlJoin(cmd int, arg2 string) (ret int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(arg2)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := Syscall(SYS_KEYCTL, uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlSearch(cmd int, arg2 int, arg3 string, arg4 string, arg5 int) (ret int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(arg3)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(arg4)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(arg5), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlIOV(cmd int, arg2 int, payload []Iovec, arg5 int) (err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(payload) > 0 {
|
||||
_p0 = unsafe.Pointer(&payload[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
_, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(_p0), uintptr(len(payload)), uintptr(arg5), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlDH(cmd int, arg2 *KeyctlDHParams, buf []byte) (ret int, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(buf) > 0 {
|
||||
_p0 = unsafe.Pointer(&buf[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(unsafe.Pointer(arg2)), uintptr(_p0), uintptr(len(buf)), 0, 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
|
||||
_, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
|
||||
if e1 != 0 {
|
||||
@ -251,6 +359,33 @@ func Acct(path string) (err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func AddKey(keyType string, description string, payload []byte, ringid int) (id int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(keyType)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(description)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 unsafe.Pointer
|
||||
if len(payload) > 0 {
|
||||
_p2 = unsafe.Pointer(&payload[0])
|
||||
} else {
|
||||
_p2 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_ADD_KEY, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(payload)), uintptr(ringid), 0)
|
||||
id = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Adjtimex(buf *Timex) (state int, err error) {
|
||||
r0, _, e1 := Syscall(SYS_ADJTIMEX, uintptr(unsafe.Pointer(buf)), 0, 0)
|
||||
state = int(r0)
|
||||
@ -312,6 +447,17 @@ func Close(fd int) (err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) {
|
||||
r0, _, e1 := Syscall6(SYS_COPY_FILE_RANGE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags))
|
||||
n = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Dup(oldfd int) (fd int, err error) {
|
||||
r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 0, 0)
|
||||
fd = int(r0)
|
||||
@ -681,6 +827,33 @@ func Klogctl(typ int, buf []byte) (n int, err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Lgetxattr(path string, attr string, dest []byte) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 unsafe.Pointer
|
||||
if len(dest) > 0 {
|
||||
_p2 = unsafe.Pointer(&dest[0])
|
||||
} else {
|
||||
_p2 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_LGETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0)
|
||||
sz = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Listxattr(path string, dest []byte) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
@ -703,6 +876,74 @@ func Listxattr(path string, dest []byte) (sz int, err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Llistxattr(path string, dest []byte) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 unsafe.Pointer
|
||||
if len(dest) > 0 {
|
||||
_p1 = unsafe.Pointer(&dest[0])
|
||||
} else {
|
||||
_p1 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall(SYS_LLISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)))
|
||||
sz = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Lremovexattr(path string, attr string) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_, _, e1 := Syscall(SYS_LREMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Lsetxattr(path string, attr string, data []byte, flags int) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 unsafe.Pointer
|
||||
if len(data) > 0 {
|
||||
_p2 = unsafe.Pointer(&data[0])
|
||||
} else {
|
||||
_p2 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
_, _, e1 := Syscall6(SYS_LSETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Mkdirat(dirfd int, path string, mode uint32) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
@ -840,6 +1081,32 @@ func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err e
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func RequestKey(keyType string, description string, callback string, destRingid int) (id int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(keyType)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(description)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 *byte
|
||||
_p2, err = BytePtrFromString(callback)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_REQUEST_KEY, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(destRingid), 0, 0)
|
||||
id = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Setdomainname(p []byte) (err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(p) > 0 {
|
||||
|
269
vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go
generated
vendored
269
vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go
generated
vendored
@ -1,5 +1,5 @@
|
||||
// mksyscall.pl -tags linux,amd64 syscall_linux.go syscall_linux_amd64.go
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build linux,amd64
|
||||
|
||||
@ -14,6 +14,16 @@ var _ syscall.Errno
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func ioctl(fd int, req uint, arg uintptr) (err error) {
|
||||
_, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(oldpath)
|
||||
@ -186,6 +196,104 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func KeyctlInt(cmd int, arg2 int, arg3 int, arg4 int, arg5 int) (ret int, err error) {
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(arg3), uintptr(arg4), uintptr(arg5), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func KeyctlBuffer(cmd int, arg2 int, buf []byte, arg5 int) (ret int, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(buf) > 0 {
|
||||
_p0 = unsafe.Pointer(&buf[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(_p0), uintptr(len(buf)), uintptr(arg5), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlJoin(cmd int, arg2 string) (ret int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(arg2)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := Syscall(SYS_KEYCTL, uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlSearch(cmd int, arg2 int, arg3 string, arg4 string, arg5 int) (ret int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(arg3)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(arg4)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(arg5), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlIOV(cmd int, arg2 int, payload []Iovec, arg5 int) (err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(payload) > 0 {
|
||||
_p0 = unsafe.Pointer(&payload[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
_, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(_p0), uintptr(len(payload)), uintptr(arg5), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlDH(cmd int, arg2 *KeyctlDHParams, buf []byte) (ret int, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(buf) > 0 {
|
||||
_p0 = unsafe.Pointer(&buf[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(unsafe.Pointer(arg2)), uintptr(_p0), uintptr(len(buf)), 0, 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
|
||||
_, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
|
||||
if e1 != 0 {
|
||||
@ -251,6 +359,33 @@ func Acct(path string) (err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func AddKey(keyType string, description string, payload []byte, ringid int) (id int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(keyType)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(description)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 unsafe.Pointer
|
||||
if len(payload) > 0 {
|
||||
_p2 = unsafe.Pointer(&payload[0])
|
||||
} else {
|
||||
_p2 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_ADD_KEY, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(payload)), uintptr(ringid), 0)
|
||||
id = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Adjtimex(buf *Timex) (state int, err error) {
|
||||
r0, _, e1 := Syscall(SYS_ADJTIMEX, uintptr(unsafe.Pointer(buf)), 0, 0)
|
||||
state = int(r0)
|
||||
@ -312,6 +447,17 @@ func Close(fd int) (err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) {
|
||||
r0, _, e1 := Syscall6(SYS_COPY_FILE_RANGE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags))
|
||||
n = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Dup(oldfd int) (fd int, err error) {
|
||||
r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 0, 0)
|
||||
fd = int(r0)
|
||||
@ -681,6 +827,33 @@ func Klogctl(typ int, buf []byte) (n int, err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Lgetxattr(path string, attr string, dest []byte) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 unsafe.Pointer
|
||||
if len(dest) > 0 {
|
||||
_p2 = unsafe.Pointer(&dest[0])
|
||||
} else {
|
||||
_p2 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_LGETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0)
|
||||
sz = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Listxattr(path string, dest []byte) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
@ -703,6 +876,74 @@ func Listxattr(path string, dest []byte) (sz int, err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Llistxattr(path string, dest []byte) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 unsafe.Pointer
|
||||
if len(dest) > 0 {
|
||||
_p1 = unsafe.Pointer(&dest[0])
|
||||
} else {
|
||||
_p1 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall(SYS_LLISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)))
|
||||
sz = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Lremovexattr(path string, attr string) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_, _, e1 := Syscall(SYS_LREMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Lsetxattr(path string, attr string, data []byte, flags int) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 unsafe.Pointer
|
||||
if len(data) > 0 {
|
||||
_p2 = unsafe.Pointer(&data[0])
|
||||
} else {
|
||||
_p2 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
_, _, e1 := Syscall6(SYS_LSETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Mkdirat(dirfd int, path string, mode uint32) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
@ -840,6 +1081,32 @@ func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err e
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func RequestKey(keyType string, description string, callback string, destRingid int) (id int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(keyType)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(description)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 *byte
|
||||
_p2, err = BytePtrFromString(callback)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_REQUEST_KEY, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(destRingid), 0, 0)
|
||||
id = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Setdomainname(p []byte) (err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(p) > 0 {
|
||||
|
269
vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go
generated
vendored
269
vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go
generated
vendored
@ -1,5 +1,5 @@
|
||||
// mksyscall.pl -l32 -arm -tags linux,arm syscall_linux.go syscall_linux_arm.go
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build linux,arm
|
||||
|
||||
@ -14,6 +14,16 @@ var _ syscall.Errno
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func ioctl(fd int, req uint, arg uintptr) (err error) {
|
||||
_, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(oldpath)
|
||||
@ -186,6 +196,104 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func KeyctlInt(cmd int, arg2 int, arg3 int, arg4 int, arg5 int) (ret int, err error) {
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(arg3), uintptr(arg4), uintptr(arg5), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func KeyctlBuffer(cmd int, arg2 int, buf []byte, arg5 int) (ret int, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(buf) > 0 {
|
||||
_p0 = unsafe.Pointer(&buf[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(_p0), uintptr(len(buf)), uintptr(arg5), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlJoin(cmd int, arg2 string) (ret int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(arg2)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := Syscall(SYS_KEYCTL, uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlSearch(cmd int, arg2 int, arg3 string, arg4 string, arg5 int) (ret int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(arg3)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(arg4)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(arg5), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlIOV(cmd int, arg2 int, payload []Iovec, arg5 int) (err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(payload) > 0 {
|
||||
_p0 = unsafe.Pointer(&payload[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
_, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(_p0), uintptr(len(payload)), uintptr(arg5), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlDH(cmd int, arg2 *KeyctlDHParams, buf []byte) (ret int, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(buf) > 0 {
|
||||
_p0 = unsafe.Pointer(&buf[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(unsafe.Pointer(arg2)), uintptr(_p0), uintptr(len(buf)), 0, 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
|
||||
_, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
|
||||
if e1 != 0 {
|
||||
@ -251,6 +359,33 @@ func Acct(path string) (err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func AddKey(keyType string, description string, payload []byte, ringid int) (id int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(keyType)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(description)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 unsafe.Pointer
|
||||
if len(payload) > 0 {
|
||||
_p2 = unsafe.Pointer(&payload[0])
|
||||
} else {
|
||||
_p2 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_ADD_KEY, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(payload)), uintptr(ringid), 0)
|
||||
id = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Adjtimex(buf *Timex) (state int, err error) {
|
||||
r0, _, e1 := Syscall(SYS_ADJTIMEX, uintptr(unsafe.Pointer(buf)), 0, 0)
|
||||
state = int(r0)
|
||||
@ -312,6 +447,17 @@ func Close(fd int) (err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) {
|
||||
r0, _, e1 := Syscall6(SYS_COPY_FILE_RANGE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags))
|
||||
n = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Dup(oldfd int) (fd int, err error) {
|
||||
r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 0, 0)
|
||||
fd = int(r0)
|
||||
@ -681,6 +827,33 @@ func Klogctl(typ int, buf []byte) (n int, err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Lgetxattr(path string, attr string, dest []byte) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 unsafe.Pointer
|
||||
if len(dest) > 0 {
|
||||
_p2 = unsafe.Pointer(&dest[0])
|
||||
} else {
|
||||
_p2 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_LGETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0)
|
||||
sz = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Listxattr(path string, dest []byte) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
@ -703,6 +876,74 @@ func Listxattr(path string, dest []byte) (sz int, err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Llistxattr(path string, dest []byte) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 unsafe.Pointer
|
||||
if len(dest) > 0 {
|
||||
_p1 = unsafe.Pointer(&dest[0])
|
||||
} else {
|
||||
_p1 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall(SYS_LLISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)))
|
||||
sz = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Lremovexattr(path string, attr string) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_, _, e1 := Syscall(SYS_LREMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Lsetxattr(path string, attr string, data []byte, flags int) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 unsafe.Pointer
|
||||
if len(data) > 0 {
|
||||
_p2 = unsafe.Pointer(&data[0])
|
||||
} else {
|
||||
_p2 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
_, _, e1 := Syscall6(SYS_LSETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Mkdirat(dirfd int, path string, mode uint32) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
@ -840,6 +1081,32 @@ func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err e
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func RequestKey(keyType string, description string, callback string, destRingid int) (id int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(keyType)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(description)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 *byte
|
||||
_p2, err = BytePtrFromString(callback)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_REQUEST_KEY, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(destRingid), 0, 0)
|
||||
id = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Setdomainname(p []byte) (err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(p) > 0 {
|
||||
|
269
vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go
generated
vendored
269
vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go
generated
vendored
@ -1,5 +1,5 @@
|
||||
// mksyscall.pl -tags linux,arm64 syscall_linux.go syscall_linux_arm64.go
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build linux,arm64
|
||||
|
||||
@ -14,6 +14,16 @@ var _ syscall.Errno
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func ioctl(fd int, req uint, arg uintptr) (err error) {
|
||||
_, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(oldpath)
|
||||
@ -186,6 +196,104 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func KeyctlInt(cmd int, arg2 int, arg3 int, arg4 int, arg5 int) (ret int, err error) {
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(arg3), uintptr(arg4), uintptr(arg5), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func KeyctlBuffer(cmd int, arg2 int, buf []byte, arg5 int) (ret int, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(buf) > 0 {
|
||||
_p0 = unsafe.Pointer(&buf[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(_p0), uintptr(len(buf)), uintptr(arg5), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlJoin(cmd int, arg2 string) (ret int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(arg2)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := Syscall(SYS_KEYCTL, uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlSearch(cmd int, arg2 int, arg3 string, arg4 string, arg5 int) (ret int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(arg3)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(arg4)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(arg5), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlIOV(cmd int, arg2 int, payload []Iovec, arg5 int) (err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(payload) > 0 {
|
||||
_p0 = unsafe.Pointer(&payload[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
_, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(_p0), uintptr(len(payload)), uintptr(arg5), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlDH(cmd int, arg2 *KeyctlDHParams, buf []byte) (ret int, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(buf) > 0 {
|
||||
_p0 = unsafe.Pointer(&buf[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(unsafe.Pointer(arg2)), uintptr(_p0), uintptr(len(buf)), 0, 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
|
||||
_, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
|
||||
if e1 != 0 {
|
||||
@ -251,6 +359,33 @@ func Acct(path string) (err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func AddKey(keyType string, description string, payload []byte, ringid int) (id int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(keyType)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(description)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 unsafe.Pointer
|
||||
if len(payload) > 0 {
|
||||
_p2 = unsafe.Pointer(&payload[0])
|
||||
} else {
|
||||
_p2 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_ADD_KEY, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(payload)), uintptr(ringid), 0)
|
||||
id = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Adjtimex(buf *Timex) (state int, err error) {
|
||||
r0, _, e1 := Syscall(SYS_ADJTIMEX, uintptr(unsafe.Pointer(buf)), 0, 0)
|
||||
state = int(r0)
|
||||
@ -312,6 +447,17 @@ func Close(fd int) (err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) {
|
||||
r0, _, e1 := Syscall6(SYS_COPY_FILE_RANGE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags))
|
||||
n = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Dup(oldfd int) (fd int, err error) {
|
||||
r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 0, 0)
|
||||
fd = int(r0)
|
||||
@ -681,6 +827,33 @@ func Klogctl(typ int, buf []byte) (n int, err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Lgetxattr(path string, attr string, dest []byte) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 unsafe.Pointer
|
||||
if len(dest) > 0 {
|
||||
_p2 = unsafe.Pointer(&dest[0])
|
||||
} else {
|
||||
_p2 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_LGETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0)
|
||||
sz = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Listxattr(path string, dest []byte) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
@ -703,6 +876,74 @@ func Listxattr(path string, dest []byte) (sz int, err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Llistxattr(path string, dest []byte) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 unsafe.Pointer
|
||||
if len(dest) > 0 {
|
||||
_p1 = unsafe.Pointer(&dest[0])
|
||||
} else {
|
||||
_p1 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall(SYS_LLISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)))
|
||||
sz = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Lremovexattr(path string, attr string) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_, _, e1 := Syscall(SYS_LREMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Lsetxattr(path string, attr string, data []byte, flags int) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 unsafe.Pointer
|
||||
if len(data) > 0 {
|
||||
_p2 = unsafe.Pointer(&data[0])
|
||||
} else {
|
||||
_p2 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
_, _, e1 := Syscall6(SYS_LSETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Mkdirat(dirfd int, path string, mode uint32) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
@ -840,6 +1081,32 @@ func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err e
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func RequestKey(keyType string, description string, callback string, destRingid int) (id int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(keyType)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(description)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 *byte
|
||||
_p2, err = BytePtrFromString(callback)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_REQUEST_KEY, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(destRingid), 0, 0)
|
||||
id = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Setdomainname(p []byte) (err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(p) > 0 {
|
||||
|
269
vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go
generated
vendored
269
vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go
generated
vendored
@ -1,5 +1,5 @@
|
||||
// mksyscall.pl -b32 -arm -tags linux,mips syscall_linux.go syscall_linux_mipsx.go
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build linux,mips
|
||||
|
||||
@ -14,6 +14,16 @@ var _ syscall.Errno
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func ioctl(fd int, req uint, arg uintptr) (err error) {
|
||||
_, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(oldpath)
|
||||
@ -186,6 +196,104 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func KeyctlInt(cmd int, arg2 int, arg3 int, arg4 int, arg5 int) (ret int, err error) {
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(arg3), uintptr(arg4), uintptr(arg5), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func KeyctlBuffer(cmd int, arg2 int, buf []byte, arg5 int) (ret int, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(buf) > 0 {
|
||||
_p0 = unsafe.Pointer(&buf[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(_p0), uintptr(len(buf)), uintptr(arg5), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlJoin(cmd int, arg2 string) (ret int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(arg2)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := Syscall(SYS_KEYCTL, uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlSearch(cmd int, arg2 int, arg3 string, arg4 string, arg5 int) (ret int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(arg3)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(arg4)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(arg5), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlIOV(cmd int, arg2 int, payload []Iovec, arg5 int) (err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(payload) > 0 {
|
||||
_p0 = unsafe.Pointer(&payload[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
_, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(_p0), uintptr(len(payload)), uintptr(arg5), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlDH(cmd int, arg2 *KeyctlDHParams, buf []byte) (ret int, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(buf) > 0 {
|
||||
_p0 = unsafe.Pointer(&buf[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(unsafe.Pointer(arg2)), uintptr(_p0), uintptr(len(buf)), 0, 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
|
||||
_, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
|
||||
if e1 != 0 {
|
||||
@ -251,6 +359,33 @@ func Acct(path string) (err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func AddKey(keyType string, description string, payload []byte, ringid int) (id int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(keyType)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(description)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 unsafe.Pointer
|
||||
if len(payload) > 0 {
|
||||
_p2 = unsafe.Pointer(&payload[0])
|
||||
} else {
|
||||
_p2 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_ADD_KEY, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(payload)), uintptr(ringid), 0)
|
||||
id = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Adjtimex(buf *Timex) (state int, err error) {
|
||||
r0, _, e1 := Syscall(SYS_ADJTIMEX, uintptr(unsafe.Pointer(buf)), 0, 0)
|
||||
state = int(r0)
|
||||
@ -312,6 +447,17 @@ func Close(fd int) (err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) {
|
||||
r0, _, e1 := Syscall6(SYS_COPY_FILE_RANGE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags))
|
||||
n = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Dup(oldfd int) (fd int, err error) {
|
||||
r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 0, 0)
|
||||
fd = int(r0)
|
||||
@ -681,6 +827,33 @@ func Klogctl(typ int, buf []byte) (n int, err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Lgetxattr(path string, attr string, dest []byte) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 unsafe.Pointer
|
||||
if len(dest) > 0 {
|
||||
_p2 = unsafe.Pointer(&dest[0])
|
||||
} else {
|
||||
_p2 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_LGETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0)
|
||||
sz = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Listxattr(path string, dest []byte) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
@ -703,6 +876,74 @@ func Listxattr(path string, dest []byte) (sz int, err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Llistxattr(path string, dest []byte) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 unsafe.Pointer
|
||||
if len(dest) > 0 {
|
||||
_p1 = unsafe.Pointer(&dest[0])
|
||||
} else {
|
||||
_p1 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall(SYS_LLISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)))
|
||||
sz = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Lremovexattr(path string, attr string) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_, _, e1 := Syscall(SYS_LREMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Lsetxattr(path string, attr string, data []byte, flags int) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 unsafe.Pointer
|
||||
if len(data) > 0 {
|
||||
_p2 = unsafe.Pointer(&data[0])
|
||||
} else {
|
||||
_p2 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
_, _, e1 := Syscall6(SYS_LSETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Mkdirat(dirfd int, path string, mode uint32) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
@ -840,6 +1081,32 @@ func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err e
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func RequestKey(keyType string, description string, callback string, destRingid int) (id int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(keyType)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(description)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 *byte
|
||||
_p2, err = BytePtrFromString(callback)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_REQUEST_KEY, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(destRingid), 0, 0)
|
||||
id = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Setdomainname(p []byte) (err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(p) > 0 {
|
||||
|
279
vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go
generated
vendored
279
vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go
generated
vendored
@ -1,5 +1,5 @@
|
||||
// mksyscall.pl -tags linux,mips64 syscall_linux.go syscall_linux_mips64x.go
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build linux,mips64
|
||||
|
||||
@ -14,6 +14,16 @@ var _ syscall.Errno
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func ioctl(fd int, req uint, arg uintptr) (err error) {
|
||||
_, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(oldpath)
|
||||
@ -186,6 +196,104 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func KeyctlInt(cmd int, arg2 int, arg3 int, arg4 int, arg5 int) (ret int, err error) {
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(arg3), uintptr(arg4), uintptr(arg5), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func KeyctlBuffer(cmd int, arg2 int, buf []byte, arg5 int) (ret int, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(buf) > 0 {
|
||||
_p0 = unsafe.Pointer(&buf[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(_p0), uintptr(len(buf)), uintptr(arg5), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlJoin(cmd int, arg2 string) (ret int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(arg2)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := Syscall(SYS_KEYCTL, uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlSearch(cmd int, arg2 int, arg3 string, arg4 string, arg5 int) (ret int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(arg3)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(arg4)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(arg5), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlIOV(cmd int, arg2 int, payload []Iovec, arg5 int) (err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(payload) > 0 {
|
||||
_p0 = unsafe.Pointer(&payload[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
_, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(_p0), uintptr(len(payload)), uintptr(arg5), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlDH(cmd int, arg2 *KeyctlDHParams, buf []byte) (ret int, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(buf) > 0 {
|
||||
_p0 = unsafe.Pointer(&buf[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(unsafe.Pointer(arg2)), uintptr(_p0), uintptr(len(buf)), 0, 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
|
||||
_, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
|
||||
if e1 != 0 {
|
||||
@ -251,6 +359,33 @@ func Acct(path string) (err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func AddKey(keyType string, description string, payload []byte, ringid int) (id int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(keyType)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(description)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 unsafe.Pointer
|
||||
if len(payload) > 0 {
|
||||
_p2 = unsafe.Pointer(&payload[0])
|
||||
} else {
|
||||
_p2 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_ADD_KEY, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(payload)), uintptr(ringid), 0)
|
||||
id = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Adjtimex(buf *Timex) (state int, err error) {
|
||||
r0, _, e1 := Syscall(SYS_ADJTIMEX, uintptr(unsafe.Pointer(buf)), 0, 0)
|
||||
state = int(r0)
|
||||
@ -312,6 +447,17 @@ func Close(fd int) (err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) {
|
||||
r0, _, e1 := Syscall6(SYS_COPY_FILE_RANGE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags))
|
||||
n = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Dup(oldfd int) (fd int, err error) {
|
||||
r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 0, 0)
|
||||
fd = int(r0)
|
||||
@ -681,6 +827,33 @@ func Klogctl(typ int, buf []byte) (n int, err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Lgetxattr(path string, attr string, dest []byte) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 unsafe.Pointer
|
||||
if len(dest) > 0 {
|
||||
_p2 = unsafe.Pointer(&dest[0])
|
||||
} else {
|
||||
_p2 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_LGETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0)
|
||||
sz = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Listxattr(path string, dest []byte) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
@ -703,6 +876,74 @@ func Listxattr(path string, dest []byte) (sz int, err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Llistxattr(path string, dest []byte) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 unsafe.Pointer
|
||||
if len(dest) > 0 {
|
||||
_p1 = unsafe.Pointer(&dest[0])
|
||||
} else {
|
||||
_p1 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall(SYS_LLISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)))
|
||||
sz = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Lremovexattr(path string, attr string) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_, _, e1 := Syscall(SYS_LREMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Lsetxattr(path string, attr string, data []byte, flags int) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 unsafe.Pointer
|
||||
if len(data) > 0 {
|
||||
_p2 = unsafe.Pointer(&data[0])
|
||||
} else {
|
||||
_p2 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
_, _, e1 := Syscall6(SYS_LSETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Mkdirat(dirfd int, path string, mode uint32) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
@ -840,6 +1081,32 @@ func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err e
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func RequestKey(keyType string, description string, callback string, destRingid int) (id int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(keyType)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(description)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 *byte
|
||||
_p2, err = BytePtrFromString(callback)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_REQUEST_KEY, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(destRingid), 0, 0)
|
||||
id = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Setdomainname(p []byte) (err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(p) > 0 {
|
||||
@ -1194,6 +1461,16 @@ func Munlockall() (err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Dup2(oldfd int, newfd int) (err error) {
|
||||
_, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(events) > 0 {
|
||||
|
279
vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go
generated
vendored
279
vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go
generated
vendored
@ -1,5 +1,5 @@
|
||||
// mksyscall.pl -tags linux,mips64le syscall_linux.go syscall_linux_mips64x.go
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build linux,mips64le
|
||||
|
||||
@ -14,6 +14,16 @@ var _ syscall.Errno
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func ioctl(fd int, req uint, arg uintptr) (err error) {
|
||||
_, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(oldpath)
|
||||
@ -186,6 +196,104 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func KeyctlInt(cmd int, arg2 int, arg3 int, arg4 int, arg5 int) (ret int, err error) {
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(arg3), uintptr(arg4), uintptr(arg5), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func KeyctlBuffer(cmd int, arg2 int, buf []byte, arg5 int) (ret int, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(buf) > 0 {
|
||||
_p0 = unsafe.Pointer(&buf[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(_p0), uintptr(len(buf)), uintptr(arg5), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlJoin(cmd int, arg2 string) (ret int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(arg2)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := Syscall(SYS_KEYCTL, uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlSearch(cmd int, arg2 int, arg3 string, arg4 string, arg5 int) (ret int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(arg3)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(arg4)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(arg5), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlIOV(cmd int, arg2 int, payload []Iovec, arg5 int) (err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(payload) > 0 {
|
||||
_p0 = unsafe.Pointer(&payload[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
_, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(_p0), uintptr(len(payload)), uintptr(arg5), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlDH(cmd int, arg2 *KeyctlDHParams, buf []byte) (ret int, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(buf) > 0 {
|
||||
_p0 = unsafe.Pointer(&buf[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(unsafe.Pointer(arg2)), uintptr(_p0), uintptr(len(buf)), 0, 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
|
||||
_, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
|
||||
if e1 != 0 {
|
||||
@ -251,6 +359,33 @@ func Acct(path string) (err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func AddKey(keyType string, description string, payload []byte, ringid int) (id int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(keyType)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(description)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 unsafe.Pointer
|
||||
if len(payload) > 0 {
|
||||
_p2 = unsafe.Pointer(&payload[0])
|
||||
} else {
|
||||
_p2 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_ADD_KEY, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(payload)), uintptr(ringid), 0)
|
||||
id = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Adjtimex(buf *Timex) (state int, err error) {
|
||||
r0, _, e1 := Syscall(SYS_ADJTIMEX, uintptr(unsafe.Pointer(buf)), 0, 0)
|
||||
state = int(r0)
|
||||
@ -312,6 +447,17 @@ func Close(fd int) (err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) {
|
||||
r0, _, e1 := Syscall6(SYS_COPY_FILE_RANGE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags))
|
||||
n = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Dup(oldfd int) (fd int, err error) {
|
||||
r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 0, 0)
|
||||
fd = int(r0)
|
||||
@ -681,6 +827,33 @@ func Klogctl(typ int, buf []byte) (n int, err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Lgetxattr(path string, attr string, dest []byte) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 unsafe.Pointer
|
||||
if len(dest) > 0 {
|
||||
_p2 = unsafe.Pointer(&dest[0])
|
||||
} else {
|
||||
_p2 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_LGETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0)
|
||||
sz = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Listxattr(path string, dest []byte) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
@ -703,6 +876,74 @@ func Listxattr(path string, dest []byte) (sz int, err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Llistxattr(path string, dest []byte) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 unsafe.Pointer
|
||||
if len(dest) > 0 {
|
||||
_p1 = unsafe.Pointer(&dest[0])
|
||||
} else {
|
||||
_p1 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall(SYS_LLISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)))
|
||||
sz = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Lremovexattr(path string, attr string) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_, _, e1 := Syscall(SYS_LREMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Lsetxattr(path string, attr string, data []byte, flags int) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 unsafe.Pointer
|
||||
if len(data) > 0 {
|
||||
_p2 = unsafe.Pointer(&data[0])
|
||||
} else {
|
||||
_p2 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
_, _, e1 := Syscall6(SYS_LSETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Mkdirat(dirfd int, path string, mode uint32) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
@ -840,6 +1081,32 @@ func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err e
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func RequestKey(keyType string, description string, callback string, destRingid int) (id int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(keyType)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(description)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 *byte
|
||||
_p2, err = BytePtrFromString(callback)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_REQUEST_KEY, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(destRingid), 0, 0)
|
||||
id = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Setdomainname(p []byte) (err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(p) > 0 {
|
||||
@ -1194,6 +1461,16 @@ func Munlockall() (err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Dup2(oldfd int, newfd int) (err error) {
|
||||
_, _, e1 := Syscall(SYS_DUP2, uintptr(oldfd), uintptr(newfd), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(events) > 0 {
|
||||
|
269
vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go
generated
vendored
269
vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go
generated
vendored
@ -1,5 +1,5 @@
|
||||
// mksyscall.pl -l32 -arm -tags linux,mipsle syscall_linux.go syscall_linux_mipsx.go
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build linux,mipsle
|
||||
|
||||
@ -14,6 +14,16 @@ var _ syscall.Errno
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func ioctl(fd int, req uint, arg uintptr) (err error) {
|
||||
_, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(oldpath)
|
||||
@ -186,6 +196,104 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func KeyctlInt(cmd int, arg2 int, arg3 int, arg4 int, arg5 int) (ret int, err error) {
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(arg3), uintptr(arg4), uintptr(arg5), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func KeyctlBuffer(cmd int, arg2 int, buf []byte, arg5 int) (ret int, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(buf) > 0 {
|
||||
_p0 = unsafe.Pointer(&buf[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(_p0), uintptr(len(buf)), uintptr(arg5), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlJoin(cmd int, arg2 string) (ret int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(arg2)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := Syscall(SYS_KEYCTL, uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlSearch(cmd int, arg2 int, arg3 string, arg4 string, arg5 int) (ret int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(arg3)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(arg4)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(arg5), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlIOV(cmd int, arg2 int, payload []Iovec, arg5 int) (err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(payload) > 0 {
|
||||
_p0 = unsafe.Pointer(&payload[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
_, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(_p0), uintptr(len(payload)), uintptr(arg5), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlDH(cmd int, arg2 *KeyctlDHParams, buf []byte) (ret int, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(buf) > 0 {
|
||||
_p0 = unsafe.Pointer(&buf[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(unsafe.Pointer(arg2)), uintptr(_p0), uintptr(len(buf)), 0, 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
|
||||
_, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
|
||||
if e1 != 0 {
|
||||
@ -251,6 +359,33 @@ func Acct(path string) (err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func AddKey(keyType string, description string, payload []byte, ringid int) (id int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(keyType)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(description)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 unsafe.Pointer
|
||||
if len(payload) > 0 {
|
||||
_p2 = unsafe.Pointer(&payload[0])
|
||||
} else {
|
||||
_p2 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_ADD_KEY, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(payload)), uintptr(ringid), 0)
|
||||
id = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Adjtimex(buf *Timex) (state int, err error) {
|
||||
r0, _, e1 := Syscall(SYS_ADJTIMEX, uintptr(unsafe.Pointer(buf)), 0, 0)
|
||||
state = int(r0)
|
||||
@ -312,6 +447,17 @@ func Close(fd int) (err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) {
|
||||
r0, _, e1 := Syscall6(SYS_COPY_FILE_RANGE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags))
|
||||
n = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Dup(oldfd int) (fd int, err error) {
|
||||
r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 0, 0)
|
||||
fd = int(r0)
|
||||
@ -681,6 +827,33 @@ func Klogctl(typ int, buf []byte) (n int, err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Lgetxattr(path string, attr string, dest []byte) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 unsafe.Pointer
|
||||
if len(dest) > 0 {
|
||||
_p2 = unsafe.Pointer(&dest[0])
|
||||
} else {
|
||||
_p2 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_LGETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0)
|
||||
sz = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Listxattr(path string, dest []byte) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
@ -703,6 +876,74 @@ func Listxattr(path string, dest []byte) (sz int, err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Llistxattr(path string, dest []byte) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 unsafe.Pointer
|
||||
if len(dest) > 0 {
|
||||
_p1 = unsafe.Pointer(&dest[0])
|
||||
} else {
|
||||
_p1 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall(SYS_LLISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)))
|
||||
sz = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Lremovexattr(path string, attr string) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_, _, e1 := Syscall(SYS_LREMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Lsetxattr(path string, attr string, data []byte, flags int) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 unsafe.Pointer
|
||||
if len(data) > 0 {
|
||||
_p2 = unsafe.Pointer(&data[0])
|
||||
} else {
|
||||
_p2 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
_, _, e1 := Syscall6(SYS_LSETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Mkdirat(dirfd int, path string, mode uint32) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
@ -840,6 +1081,32 @@ func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err e
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func RequestKey(keyType string, description string, callback string, destRingid int) (id int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(keyType)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(description)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 *byte
|
||||
_p2, err = BytePtrFromString(callback)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_REQUEST_KEY, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(destRingid), 0, 0)
|
||||
id = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Setdomainname(p []byte) (err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(p) > 0 {
|
||||
|
269
vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go
generated
vendored
269
vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go
generated
vendored
@ -1,5 +1,5 @@
|
||||
// mksyscall.pl -tags linux,ppc64 syscall_linux.go syscall_linux_ppc64x.go
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build linux,ppc64
|
||||
|
||||
@ -14,6 +14,16 @@ var _ syscall.Errno
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func ioctl(fd int, req uint, arg uintptr) (err error) {
|
||||
_, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(oldpath)
|
||||
@ -186,6 +196,104 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func KeyctlInt(cmd int, arg2 int, arg3 int, arg4 int, arg5 int) (ret int, err error) {
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(arg3), uintptr(arg4), uintptr(arg5), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func KeyctlBuffer(cmd int, arg2 int, buf []byte, arg5 int) (ret int, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(buf) > 0 {
|
||||
_p0 = unsafe.Pointer(&buf[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(_p0), uintptr(len(buf)), uintptr(arg5), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlJoin(cmd int, arg2 string) (ret int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(arg2)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := Syscall(SYS_KEYCTL, uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlSearch(cmd int, arg2 int, arg3 string, arg4 string, arg5 int) (ret int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(arg3)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(arg4)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(arg5), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlIOV(cmd int, arg2 int, payload []Iovec, arg5 int) (err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(payload) > 0 {
|
||||
_p0 = unsafe.Pointer(&payload[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
_, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(_p0), uintptr(len(payload)), uintptr(arg5), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlDH(cmd int, arg2 *KeyctlDHParams, buf []byte) (ret int, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(buf) > 0 {
|
||||
_p0 = unsafe.Pointer(&buf[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(unsafe.Pointer(arg2)), uintptr(_p0), uintptr(len(buf)), 0, 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
|
||||
_, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
|
||||
if e1 != 0 {
|
||||
@ -251,6 +359,33 @@ func Acct(path string) (err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func AddKey(keyType string, description string, payload []byte, ringid int) (id int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(keyType)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(description)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 unsafe.Pointer
|
||||
if len(payload) > 0 {
|
||||
_p2 = unsafe.Pointer(&payload[0])
|
||||
} else {
|
||||
_p2 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_ADD_KEY, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(payload)), uintptr(ringid), 0)
|
||||
id = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Adjtimex(buf *Timex) (state int, err error) {
|
||||
r0, _, e1 := Syscall(SYS_ADJTIMEX, uintptr(unsafe.Pointer(buf)), 0, 0)
|
||||
state = int(r0)
|
||||
@ -312,6 +447,17 @@ func Close(fd int) (err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) {
|
||||
r0, _, e1 := Syscall6(SYS_COPY_FILE_RANGE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags))
|
||||
n = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Dup(oldfd int) (fd int, err error) {
|
||||
r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 0, 0)
|
||||
fd = int(r0)
|
||||
@ -681,6 +827,33 @@ func Klogctl(typ int, buf []byte) (n int, err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Lgetxattr(path string, attr string, dest []byte) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 unsafe.Pointer
|
||||
if len(dest) > 0 {
|
||||
_p2 = unsafe.Pointer(&dest[0])
|
||||
} else {
|
||||
_p2 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_LGETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0)
|
||||
sz = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Listxattr(path string, dest []byte) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
@ -703,6 +876,74 @@ func Listxattr(path string, dest []byte) (sz int, err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Llistxattr(path string, dest []byte) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 unsafe.Pointer
|
||||
if len(dest) > 0 {
|
||||
_p1 = unsafe.Pointer(&dest[0])
|
||||
} else {
|
||||
_p1 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall(SYS_LLISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)))
|
||||
sz = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Lremovexattr(path string, attr string) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_, _, e1 := Syscall(SYS_LREMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Lsetxattr(path string, attr string, data []byte, flags int) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 unsafe.Pointer
|
||||
if len(data) > 0 {
|
||||
_p2 = unsafe.Pointer(&data[0])
|
||||
} else {
|
||||
_p2 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
_, _, e1 := Syscall6(SYS_LSETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Mkdirat(dirfd int, path string, mode uint32) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
@ -840,6 +1081,32 @@ func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err e
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func RequestKey(keyType string, description string, callback string, destRingid int) (id int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(keyType)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(description)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 *byte
|
||||
_p2, err = BytePtrFromString(callback)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_REQUEST_KEY, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(destRingid), 0, 0)
|
||||
id = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Setdomainname(p []byte) (err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(p) > 0 {
|
||||
|
269
vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go
generated
vendored
269
vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go
generated
vendored
@ -1,5 +1,5 @@
|
||||
// mksyscall.pl -tags linux,ppc64le syscall_linux.go syscall_linux_ppc64x.go
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build linux,ppc64le
|
||||
|
||||
@ -14,6 +14,16 @@ var _ syscall.Errno
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func ioctl(fd int, req uint, arg uintptr) (err error) {
|
||||
_, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(oldpath)
|
||||
@ -186,6 +196,104 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func KeyctlInt(cmd int, arg2 int, arg3 int, arg4 int, arg5 int) (ret int, err error) {
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(arg3), uintptr(arg4), uintptr(arg5), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func KeyctlBuffer(cmd int, arg2 int, buf []byte, arg5 int) (ret int, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(buf) > 0 {
|
||||
_p0 = unsafe.Pointer(&buf[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(_p0), uintptr(len(buf)), uintptr(arg5), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlJoin(cmd int, arg2 string) (ret int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(arg2)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := Syscall(SYS_KEYCTL, uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlSearch(cmd int, arg2 int, arg3 string, arg4 string, arg5 int) (ret int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(arg3)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(arg4)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(arg5), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlIOV(cmd int, arg2 int, payload []Iovec, arg5 int) (err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(payload) > 0 {
|
||||
_p0 = unsafe.Pointer(&payload[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
_, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(_p0), uintptr(len(payload)), uintptr(arg5), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlDH(cmd int, arg2 *KeyctlDHParams, buf []byte) (ret int, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(buf) > 0 {
|
||||
_p0 = unsafe.Pointer(&buf[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(unsafe.Pointer(arg2)), uintptr(_p0), uintptr(len(buf)), 0, 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
|
||||
_, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
|
||||
if e1 != 0 {
|
||||
@ -251,6 +359,33 @@ func Acct(path string) (err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func AddKey(keyType string, description string, payload []byte, ringid int) (id int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(keyType)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(description)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 unsafe.Pointer
|
||||
if len(payload) > 0 {
|
||||
_p2 = unsafe.Pointer(&payload[0])
|
||||
} else {
|
||||
_p2 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_ADD_KEY, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(payload)), uintptr(ringid), 0)
|
||||
id = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Adjtimex(buf *Timex) (state int, err error) {
|
||||
r0, _, e1 := Syscall(SYS_ADJTIMEX, uintptr(unsafe.Pointer(buf)), 0, 0)
|
||||
state = int(r0)
|
||||
@ -312,6 +447,17 @@ func Close(fd int) (err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) {
|
||||
r0, _, e1 := Syscall6(SYS_COPY_FILE_RANGE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags))
|
||||
n = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Dup(oldfd int) (fd int, err error) {
|
||||
r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 0, 0)
|
||||
fd = int(r0)
|
||||
@ -681,6 +827,33 @@ func Klogctl(typ int, buf []byte) (n int, err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Lgetxattr(path string, attr string, dest []byte) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 unsafe.Pointer
|
||||
if len(dest) > 0 {
|
||||
_p2 = unsafe.Pointer(&dest[0])
|
||||
} else {
|
||||
_p2 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_LGETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0)
|
||||
sz = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Listxattr(path string, dest []byte) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
@ -703,6 +876,74 @@ func Listxattr(path string, dest []byte) (sz int, err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Llistxattr(path string, dest []byte) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 unsafe.Pointer
|
||||
if len(dest) > 0 {
|
||||
_p1 = unsafe.Pointer(&dest[0])
|
||||
} else {
|
||||
_p1 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall(SYS_LLISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)))
|
||||
sz = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Lremovexattr(path string, attr string) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_, _, e1 := Syscall(SYS_LREMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Lsetxattr(path string, attr string, data []byte, flags int) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 unsafe.Pointer
|
||||
if len(data) > 0 {
|
||||
_p2 = unsafe.Pointer(&data[0])
|
||||
} else {
|
||||
_p2 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
_, _, e1 := Syscall6(SYS_LSETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Mkdirat(dirfd int, path string, mode uint32) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
@ -840,6 +1081,32 @@ func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err e
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func RequestKey(keyType string, description string, callback string, destRingid int) (id int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(keyType)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(description)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 *byte
|
||||
_p2, err = BytePtrFromString(callback)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_REQUEST_KEY, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(destRingid), 0, 0)
|
||||
id = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Setdomainname(p []byte) (err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(p) > 0 {
|
||||
|
269
vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go
generated
vendored
269
vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go
generated
vendored
@ -1,5 +1,5 @@
|
||||
// mksyscall.pl -tags linux,s390x syscall_linux.go syscall_linux_s390x.go
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build linux,s390x
|
||||
|
||||
@ -14,6 +14,16 @@ var _ syscall.Errno
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func ioctl(fd int, req uint, arg uintptr) (err error) {
|
||||
_, _, e1 := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), uintptr(arg))
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Linkat(olddirfd int, oldpath string, newdirfd int, newpath string, flags int) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(oldpath)
|
||||
@ -186,6 +196,104 @@ func wait4(pid int, wstatus *_C_int, options int, rusage *Rusage) (wpid int, err
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func KeyctlInt(cmd int, arg2 int, arg3 int, arg4 int, arg5 int) (ret int, err error) {
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(arg3), uintptr(arg4), uintptr(arg5), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func KeyctlBuffer(cmd int, arg2 int, buf []byte, arg5 int) (ret int, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(buf) > 0 {
|
||||
_p0 = unsafe.Pointer(&buf[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(_p0), uintptr(len(buf)), uintptr(arg5), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlJoin(cmd int, arg2 string) (ret int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(arg2)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := Syscall(SYS_KEYCTL, uintptr(cmd), uintptr(unsafe.Pointer(_p0)), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlSearch(cmd int, arg2 int, arg3 string, arg4 string, arg5 int) (ret int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(arg3)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(arg4)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(arg5), 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlIOV(cmd int, arg2 int, payload []Iovec, arg5 int) (err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(payload) > 0 {
|
||||
_p0 = unsafe.Pointer(&payload[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
_, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(arg2), uintptr(_p0), uintptr(len(payload)), uintptr(arg5), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func keyctlDH(cmd int, arg2 *KeyctlDHParams, buf []byte) (ret int, err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(buf) > 0 {
|
||||
_p0 = unsafe.Pointer(&buf[0])
|
||||
} else {
|
||||
_p0 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_KEYCTL, uintptr(cmd), uintptr(unsafe.Pointer(arg2)), uintptr(_p0), uintptr(len(buf)), 0, 0)
|
||||
ret = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func ptrace(request int, pid int, addr uintptr, data uintptr) (err error) {
|
||||
_, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0)
|
||||
if e1 != 0 {
|
||||
@ -251,6 +359,33 @@ func Acct(path string) (err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func AddKey(keyType string, description string, payload []byte, ringid int) (id int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(keyType)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(description)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 unsafe.Pointer
|
||||
if len(payload) > 0 {
|
||||
_p2 = unsafe.Pointer(&payload[0])
|
||||
} else {
|
||||
_p2 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_ADD_KEY, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(payload)), uintptr(ringid), 0)
|
||||
id = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Adjtimex(buf *Timex) (state int, err error) {
|
||||
r0, _, e1 := Syscall(SYS_ADJTIMEX, uintptr(unsafe.Pointer(buf)), 0, 0)
|
||||
state = int(r0)
|
||||
@ -312,6 +447,17 @@ func Close(fd int) (err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) {
|
||||
r0, _, e1 := Syscall6(SYS_COPY_FILE_RANGE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags))
|
||||
n = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Dup(oldfd int) (fd int, err error) {
|
||||
r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 0, 0)
|
||||
fd = int(r0)
|
||||
@ -681,6 +827,33 @@ func Klogctl(typ int, buf []byte) (n int, err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Lgetxattr(path string, attr string, dest []byte) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 unsafe.Pointer
|
||||
if len(dest) > 0 {
|
||||
_p2 = unsafe.Pointer(&dest[0])
|
||||
} else {
|
||||
_p2 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_LGETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0)
|
||||
sz = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Listxattr(path string, dest []byte) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
@ -703,6 +876,74 @@ func Listxattr(path string, dest []byte) (sz int, err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Llistxattr(path string, dest []byte) (sz int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 unsafe.Pointer
|
||||
if len(dest) > 0 {
|
||||
_p1 = unsafe.Pointer(&dest[0])
|
||||
} else {
|
||||
_p1 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
r0, _, e1 := Syscall(SYS_LLISTXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(_p1), uintptr(len(dest)))
|
||||
sz = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Lremovexattr(path string, attr string) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
_, _, e1 := Syscall(SYS_LREMOVEXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Lsetxattr(path string, attr string, data []byte, flags int) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(attr)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 unsafe.Pointer
|
||||
if len(data) > 0 {
|
||||
_p2 = unsafe.Pointer(&data[0])
|
||||
} else {
|
||||
_p2 = unsafe.Pointer(&_zero)
|
||||
}
|
||||
_, _, e1 := Syscall6(SYS_LSETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(data)), uintptr(flags), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Mkdirat(dirfd int, path string, mode uint32) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
@ -840,6 +1081,32 @@ func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err e
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func RequestKey(keyType string, description string, callback string, destRingid int) (id int, err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(keyType)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p1 *byte
|
||||
_p1, err = BytePtrFromString(description)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
var _p2 *byte
|
||||
_p2, err = BytePtrFromString(callback)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
r0, _, e1 := Syscall6(SYS_REQUEST_KEY, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(unsafe.Pointer(_p2)), uintptr(destRingid), 0, 0)
|
||||
id = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Setdomainname(p []byte) (err error) {
|
||||
var _p0 unsafe.Pointer
|
||||
if len(p) > 0 {
|
||||
|
13
vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go
generated
vendored
13
vendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go
generated
vendored
@ -1,5 +1,5 @@
|
||||
// mksyscall.pl -tags linux,sparc64 syscall_linux.go syscall_linux_sparc64.go
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||
|
||||
// +build linux,sparc64
|
||||
|
||||
@ -312,6 +312,17 @@ func Close(fd int) (err error) {
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) {
|
||||
r0, _, e1 := Syscall6(SYS_COPY_FILE_RANGE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags))
|
||||
n = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Dup(oldfd int) (fd int, err error) {
|
||||
r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), 0, 0)
|
||||
fd = int(r0)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user