From 2b2011dafa8ccd2be080ab8bbffed795b9ba3caa Mon Sep 17 00:00:00 2001 From: Lantao Liu Date: Thu, 4 Jan 2018 21:49:10 +0000 Subject: [PATCH 1/2] Add script to sync vendors with containerd Signed-off-by: Lantao Liu --- hack/update-vendor.sh | 49 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/hack/update-vendor.sh b/hack/update-vendor.sh index 833e989a9..604fa1e8a 100755 --- a/hack/update-vendor.sh +++ b/hack/update-vendor.sh @@ -21,9 +21,6 @@ set -o pipefail source $(dirname "${BASH_SOURCE[0]}")/utils.sh cd ${ROOT} -echo "Sort vendor.conf..." -sort vendor.conf -o vendor.conf - echo "Compare vendor with hack/versions..." need_update=false declare -A map=() @@ -51,4 +48,50 @@ if [ ${need_update} = true ]; then exit 1 fi +# hack/versions should be correct now. +echo "Compare vendor with containerd vendors..." +source hack/versions +if [ -z "${CONTAINERD_REPO}" ]; then + CONTAINERD_REPO=containerd/containerd +else + CONTAINERD_REPO=${CONTAINERD_REPO#*/} +fi +containerd_vendor=$(mktemp /tmp/containerd-vendor.conf.XXXX) +curl -s https://raw.githubusercontent.com/${CONTAINERD_REPO}/${CONTAINERD_VERSION}/vendor.conf > ${containerd_vendor} +# Create a temporary vendor file to update. +tmp_vendor=$(mktemp /tmp/vendor.conf.XXXX) +while read vendor; do + repo=$(echo ${vendor} | awk '{print $1}') + commit=$(echo ${vendor} | awk '{print $2}') + alias=$(echo ${vendor} | awk '{print $3}') + vendor_in_containerd=$(grep ${repo} ${containerd_vendor} || true) + if [ -z "${vendor_in_containerd}" ]; then + echo ${vendor} >> ${tmp_vendor} + continue + fi + commit_in_containerd=$(echo ${vendor_in_containerd} | awk '{print $2}') + alias_in_containerd=$(echo ${vendor_in_containerd} | awk '{print $3}') + if [[ "${commit}" != "${commit_in_containerd}" || "${alias}" != "${alias_in_containerd}" ]]; then + echo ${vendor_in_containerd} >> ${tmp_vendor} + else + echo ${vendor} >> ${tmp_vendor} + fi +done < vendor.conf +# Update vendors if temporary vendor.conf is different from the original one. +if ! diff vendor.conf ${tmp_vendor} > /dev/null; then + if [ $# -gt 0 ] && [ ${1} = "-only-verify" ]; then + echo "Need to update vendor.conf." + diff vendor.conf ${tmp_vendor} + rm ${tmp_vendor} + exit 1 + else + echo "Updating vendor.conf." + mv ${tmp_vendor} vendor.conf + fi +fi +rm ${containerd_vendor} + +echo "Sort vendor.conf..." +sort vendor.conf -o vendor.conf + echo "Please commit the change made by this file..." From 141f57065cdb5053428f380d98c4271a494afbb0 Mon Sep 17 00:00:00 2001 From: Lantao Liu Date: Thu, 4 Jan 2018 21:49:38 +0000 Subject: [PATCH 2/2] Update vendors out of sync Signed-off-by: Lantao Liu --- vendor.conf | 8 +- vendor/github.com/BurntSushi/toml/COPYING | 27 +- vendor/github.com/BurntSushi/toml/README.md | 18 +- vendor/github.com/BurntSushi/toml/doc.go | 2 +- vendor/github.com/BurntSushi/toml/encode.go | 2 +- vendor/github.com/BurntSushi/toml/lex.go | 263 +++++-------- vendor/github.com/BurntSushi/toml/parse.go | 35 -- vendor/github.com/docker/go-units/duration.go | 8 +- vendor/github.com/docker/go-units/size.go | 24 +- vendor/github.com/godbus/dbus/README.markdown | 3 - vendor/github.com/godbus/dbus/conn.go | 162 +++----- vendor/github.com/godbus/dbus/conn_darwin.go | 20 +- vendor/github.com/godbus/dbus/conn_other.go | 23 +- vendor/github.com/godbus/dbus/dbus.go | 311 ++++------------ .../github.com/godbus/dbus/default_handler.go | 283 -------------- vendor/github.com/godbus/dbus/doc.go | 6 - vendor/github.com/godbus/dbus/encoder.go | 6 +- vendor/github.com/godbus/dbus/export.go | 348 +++++++++--------- vendor/github.com/godbus/dbus/message.go | 9 +- vendor/github.com/godbus/dbus/object.go | 14 +- .../godbus/dbus/server_interfaces.go | 89 ----- vendor/github.com/godbus/dbus/sig.go | 8 +- .../godbus/dbus/transport_generic.go | 17 +- .../github.com/godbus/dbus/transport_tcp.go | 43 --- .../github.com/godbus/dbus/transport_unix.go | 6 +- .../godbus/dbus/transport_unixcred_freebsd.go | 91 ----- .../godbus/dbus/transport_unixcred_openbsd.go | 14 - vendor/github.com/godbus/dbus/variant.go | 7 +- vendor/golang.org/x/sys/unix/syscall_linux.go | 1 - .../x/sys/unix/syscall_linux_arm64.go | 7 +- .../x/sys/unix/syscall_linux_mips64x.go | 7 +- .../x/sys/unix/zerrors_freebsd_386.go | 43 --- .../x/sys/unix/zerrors_freebsd_amd64.go | 43 --- .../x/sys/unix/zerrors_freebsd_arm.go | 43 --- .../x/sys/unix/zsyscall_linux_386.go | 11 - .../x/sys/unix/zsyscall_linux_amd64.go | 11 - .../x/sys/unix/zsyscall_linux_arm.go | 11 - .../x/sys/unix/zsyscall_linux_arm64.go | 22 +- .../x/sys/unix/zsyscall_linux_mips.go | 11 - .../x/sys/unix/zsyscall_linux_mips64.go | 22 +- .../x/sys/unix/zsyscall_linux_mips64le.go | 22 +- .../x/sys/unix/zsyscall_linux_mipsle.go | 11 - .../x/sys/unix/zsyscall_linux_ppc64.go | 11 - .../x/sys/unix/zsyscall_linux_ppc64le.go | 11 - .../x/sys/unix/zsyscall_linux_s390x.go | 11 - ...sctl_openbsd_386.go => zsysctl_openbsd.go} | 0 .../x/sys/unix/zsysctl_openbsd_amd64.go | 270 -------------- .../x/sys/unix/zsysctl_openbsd_arm.go | 270 -------------- .../x/sys/windows/syscall_windows.go | 15 - 49 files changed, 471 insertions(+), 2229 deletions(-) delete mode 100644 vendor/github.com/godbus/dbus/default_handler.go delete mode 100644 vendor/github.com/godbus/dbus/server_interfaces.go delete mode 100644 vendor/github.com/godbus/dbus/transport_tcp.go delete mode 100644 vendor/github.com/godbus/dbus/transport_unixcred_freebsd.go delete mode 100644 vendor/github.com/godbus/dbus/transport_unixcred_openbsd.go rename vendor/golang.org/x/sys/unix/{zsysctl_openbsd_386.go => zsysctl_openbsd.go} (100%) delete mode 100644 vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go delete mode 100644 vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go diff --git a/vendor.conf b/vendor.conf index 62a4e70ed..791b3f46f 100644 --- a/vendor.conf +++ b/vendor.conf @@ -1,5 +1,5 @@ github.com/blang/semver v3.1.0 -github.com/BurntSushi/toml a368813c5e648fee92e5f6c30e3944ff9d5e8895 +github.com/BurntSushi/toml v0.2.0-21-g9906417 github.com/containerd/cgroups 29da22c6171a4316169f9205ab6c49f59b5b852f github.com/containerd/containerd 6c7abf7c76c1973d4fb4b0bad51691de84869a51 github.com/containerd/continuity cf279e6ac893682272b4479d4c67fd3abf878b4e @@ -13,12 +13,12 @@ github.com/davecgh/go-spew v1.1.0 github.com/docker/distribution b38e5838b7b2f2ad48e06ec4b500011976080621 github.com/docker/docker 86f080cff0914e9694068ed78d503701667c4c00 github.com/docker/go-events 9461782956ad83b30282bf90e31fa6a70c255ba9 -github.com/docker/go-units 0dadbb0345b35ec7ef35e228dabb8de89a65bf52 +github.com/docker/go-units v0.3.1 github.com/docker/spdystream 449fdfce4d962303d702fec724ef0ad181c92528 github.com/emicklei/go-restful ff4f55a206334ef123e4f79bbf348980da81ca46 github.com/fsnotify/fsnotify 7d7316ed6e1ed2de075aab8dfc76de5d158d66e1 github.com/ghodss/yaml 73d445a93680fa1a78ae23a5839bad48f32ba1ee -github.com/godbus/dbus 97646858c46433e4afb3432ad28c12e968efa298 +github.com/godbus/dbus c7fdd8b5cd55e87b4e1f4e372cdb1db61dd6c66f github.com/gogo/protobuf v0.5 github.com/golang/glog 44145f04b68cf362d9c4df2182967c2275eaefed github.com/golang/protobuf 1643683e1b54a9e88ad26d98f81400c8c9d9f4f9 @@ -57,7 +57,7 @@ github.com/syndtr/gocapability e7cb7fa329f456b3855136a2642b197bad7366ba github.com/tchap/go-patricia 5ad6cdb7538b0097d5598c7e57f0a24072adf7dc golang.org/x/net 7dcfb8076726a3fdd9353b6b8a1f1b6be6811bd6 golang.org/x/sync 450f422ab23cf9881c94e2db30cac0eb1b7cf80c -golang.org/x/sys 8dbc5d05d6edcc104950cc299a1ce6641235bc86 +golang.org/x/sys 314a259e304ff91bd6985da2a7149bbf91237993 https://github.com/golang/sys golang.org/x/text 19e51611da83d6be54ddafce4a4af510cb3e9ea4 google.golang.org/genproto d80a6e20e776b0b17a324d0ba1ab50a39c8e8944 google.golang.org/grpc v1.7.2 diff --git a/vendor/github.com/BurntSushi/toml/COPYING b/vendor/github.com/BurntSushi/toml/COPYING index 01b574320..5a8e33254 100644 --- a/vendor/github.com/BurntSushi/toml/COPYING +++ b/vendor/github.com/BurntSushi/toml/COPYING @@ -1,21 +1,14 @@ -The MIT License (MIT) + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 -Copyright (c) 2013 TOML authors + Copyright (C) 2004 Sam Hocevar -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: + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. You just DO WHAT THE FUCK YOU WANT TO. -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. diff --git a/vendor/github.com/BurntSushi/toml/README.md b/vendor/github.com/BurntSushi/toml/README.md index 7c1b37ecc..5a5df6370 100644 --- a/vendor/github.com/BurntSushi/toml/README.md +++ b/vendor/github.com/BurntSushi/toml/README.md @@ -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/toml-lang/toml +Spec: https://github.com/mojombo/toml Compatible with TOML version -[v0.4.0](https://github.com/toml-lang/toml/blob/master/versions/en/toml-v0.4.0.md) +[v0.2.0](https://github.com/toml-lang/toml/blob/master/versions/en/toml-v0.2.0.md) -Documentation: https://godoc.org/github.com/BurntSushi/toml +Documentation: http://godoc.org/github.com/BurntSushi/toml Installation: @@ -26,7 +26,8 @@ go get github.com/BurntSushi/toml/cmd/tomlv tomlv some-toml-file.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) +[![Build status](https://api.travis-ci.org/BurntSushi/toml.png)](https://travis-ci.org/BurntSushi/toml) + ### Testing @@ -86,7 +87,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 @@ -119,7 +120,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 @@ -216,3 +217,4 @@ 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}`. + diff --git a/vendor/github.com/BurntSushi/toml/doc.go b/vendor/github.com/BurntSushi/toml/doc.go index b371f396e..fe2680004 100644 --- a/vendor/github.com/BurntSushi/toml/doc.go +++ b/vendor/github.com/BurntSushi/toml/doc.go @@ -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/toml-lang/toml +The specification implemented: https://github.com/mojombo/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 diff --git a/vendor/github.com/BurntSushi/toml/encode.go b/vendor/github.com/BurntSushi/toml/encode.go index d905c21a2..0f2558b2e 100644 --- a/vendor/github.com/BurntSushi/toml/encode.go +++ b/vendor/github.com/BurntSushi/toml/encode.go @@ -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 newline between top-level tables. + // Output an extra new line between top-level tables. // (The newline isn't written if nothing else has been written though.) enc.newline() } diff --git a/vendor/github.com/BurntSushi/toml/lex.go b/vendor/github.com/BurntSushi/toml/lex.go index e0a742a88..104ebda21 100644 --- a/vendor/github.com/BurntSushi/toml/lex.go +++ b/vendor/github.com/BurntSushi/toml/lex.go @@ -30,28 +30,24 @@ const ( itemArrayTableEnd itemKeyStart itemCommentStart - itemInlineTableStart - itemInlineTableEnd ) const ( - eof = 0 - comma = ',' - tableStart = '[' - tableEnd = ']' - arrayTableStart = '[' - arrayTableEnd = ']' - tableSep = '.' - keySep = '=' - arrayStart = '[' - arrayEnd = ']' - commentStart = '#' - stringStart = '"' - stringEnd = '"' - rawStringStart = '\'' - rawStringEnd = '\'' - inlineTableStart = '{' - inlineTableEnd = '}' + eof = 0 + tableStart = '[' + tableEnd = ']' + arrayTableStart = '[' + arrayTableEnd = ']' + tableSep = '.' + keySep = '=' + arrayStart = '[' + arrayEnd = ']' + arrayValTerm = ',' + commentStart = '#' + stringStart = '"' + stringEnd = '"' + rawStringStart = '\'' + rawStringEnd = '\'' ) type stateFn func(lx *lexer) stateFn @@ -60,18 +56,11 @@ 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 @@ -99,7 +88,7 @@ func (lx *lexer) nextItem() item { func lex(input string) *lexer { lx := &lexer{ - input: input, + input: input + "\n", state: lexTop, line: 1, items: make(chan item, 10), @@ -114,7 +103,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] @@ -136,25 +125,16 @@ 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.atEOF = true + lx.width = 0 return eof } if lx.input[lx.pos] == '\n' { lx.line++ } - 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 + r, lx.width = utf8.DecodeRuneInString(lx.input[lx.pos:]) + lx.pos += lx.width return r } @@ -163,20 +143,9 @@ func (lx *lexer) ignore() { lx.start = lx.pos } -// backup steps back one rune. Can be called only twice between calls to next. +// backup steps back one rune. Can be called only once per call of next. func (lx *lexer) backup() { - 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 + lx.pos -= lx.width if lx.pos < len(lx.input) && lx.input[lx.pos] == '\n' { lx.line-- } @@ -213,7 +182,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 (newlines, tabs, etc.). +// character (new lines, tabs, etc.). func (lx *lexer) errorf(format string, values ...interface{}) stateFn { lx.items <- item{ itemError, @@ -229,6 +198,7 @@ func lexTop(lx *lexer) stateFn { if isWhitespace(r) || isNL(r) { return lexSkip(lx, lexTop) } + switch r { case commentStart: lx.push(lexTop) @@ -237,7 +207,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 @@ -252,12 +222,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 newline. If it sees EOF, it will quit the lexer successfully. +// upon a new line. 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 newline for us. + // a comment will read to a new line for us. lx.push(lexTop) return lexCommentStart case isWhitespace(r): @@ -266,11 +236,11 @@ func lexTopEnd(lx *lexer) stateFn { lx.ignore() return lexTop case r == eof: - lx.emit(itemEOF) - return nil + lx.ignore() + return lexTop } - return lx.errorf("expected a top-level item to end with a newline, "+ - "comment, or EOF, but got %q instead", r) + return lx.errorf("Expected a top-level item to end with a new line, "+ + "comment or EOF, but got %q instead.", r) } // lexTable lexes the beginning of a table. Namely, it makes sure that @@ -297,8 +267,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 @@ -308,11 +278,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) @@ -347,8 +317,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) } } @@ -358,7 +328,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) @@ -389,7 +359,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) } } @@ -402,7 +372,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) } } @@ -411,8 +381,9 @@ 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 newlines. - // In array syntax, the array states are responsible for ignoring newlines. + // We allow whitespace to precede a value, but NOT new lines. + // In array syntax, the array states are responsible for ignoring new + // lines. r := lx.next() switch { case isWhitespace(r): @@ -426,10 +397,6 @@ 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) { @@ -453,7 +420,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 @@ -463,11 +430,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 newlines are ignored. +// have already been consumed. All whitespace and new lines are ignored. func lexArrayValue(lx *lexer) stateFn { r := lx.next() switch { @@ -476,11 +443,10 @@ func lexArrayValue(lx *lexer) stateFn { case r == commentStart: lx.push(lexArrayValue) return lexCommentStart - case r == comma: - return lx.errorf("unexpected comma") + case r == arrayValTerm: + return lx.errorf("Unexpected array value terminator %q.", + arrayValTerm) 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 } @@ -489,9 +455,8 @@ func lexArrayValue(lx *lexer) stateFn { return lexValue } -// 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 ']'. +// lexArrayValueEnd consumes the cruft between values of an array. Namely, +// it ignores whitespace and expects either a ',' or a ']'. func lexArrayValueEnd(lx *lexer) stateFn { r := lx.next() switch { @@ -500,88 +465,31 @@ func lexArrayValueEnd(lx *lexer) stateFn { case r == commentStart: lx.push(lexArrayValueEnd) return lexCommentStart - case r == comma: + case r == arrayValTerm: lx.ignore() return lexArrayValue // move on to the next value case r == arrayEnd: return lexArrayEnd } - return lx.errorf( - "expected a comma or array terminator %q, but got %q instead", - arrayEnd, r, - ) + return lx.errorf("Expected an array value terminator %q or an array "+ + "terminator %q, but got %q instead.", arrayValTerm, 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 newlines") + return lx.errorf("Strings cannot contain new lines.") case r == '\\': lx.push(lexString) return lexStringEscape @@ -598,12 +506,11 @@ 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 { - switch lx.next() { - case eof: - return lx.errorf("unexpected EOF") - case '\\': + r := lx.next() + switch { + case r == '\\': return lexMultilineStringEscape - case stringEnd: + case r == stringEnd: if lx.accept(stringEnd) { if lx.accept(stringEnd) { lx.backup() @@ -627,10 +534,8 @@ 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 newlines") + return lx.errorf("Strings cannot contain new lines.") case r == rawStringEnd: lx.backup() lx.emit(itemRawString) @@ -642,13 +547,12 @@ 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 { - switch lx.next() { - case eof: - return lx.errorf("unexpected EOF") - case rawStringEnd: + r := lx.next() + switch { + case r == rawStringEnd: if lx.accept(rawStringEnd) { if lx.accept(rawStringEnd) { lx.backup() @@ -701,9 +605,10 @@ 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 { @@ -711,8 +616,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 %q instead", lx.current()) + return lx.errorf("Expected four hexadecimal digits after '\\u', "+ + "but got '%s' instead.", lx.current()) } } return lx.pop() @@ -723,8 +628,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 %q instead", lx.current()) + return lx.errorf("Expected eight hexadecimal digits after '\\U', "+ + "but got '%s' instead.", lx.current()) } } return lx.pop() @@ -742,9 +647,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. @@ -775,7 +680,7 @@ func lexDatetime(lx *lexer) stateFn { return lexDatetime } switch r { - case '-', 'T', ':', '.', 'Z', '+': + case '-', 'T', ':', '.', 'Z': return lexDatetime } @@ -792,9 +697,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 } @@ -840,7 +745,7 @@ func lexBool(lx *lexer) stateFn { var rs []rune for { r := lx.next() - if !unicode.IsLetter(r) { + if r == eof || isWhitespace(r) || isNL(r) { lx.backup() break } @@ -852,7 +757,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 @@ -864,7 +769,7 @@ func lexCommentStart(lx *lexer) stateFn { } // lexComment lexes an entire comment. It assumes that '#' has been consumed. -// It will consume *up to* the first newline character, and pass control +// It will consume *up to* the first new line character, and pass control // back to the last state on the stack. func lexComment(lx *lexer) stateFn { r := lx.peek() diff --git a/vendor/github.com/BurntSushi/toml/parse.go b/vendor/github.com/BurntSushi/toml/parse.go index 50869ef92..a5625555c 100644 --- a/vendor/github.com/BurntSushi/toml/parse.go +++ b/vendor/github.com/BurntSushi/toml/parse.go @@ -269,41 +269,6 @@ 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") diff --git a/vendor/github.com/docker/go-units/duration.go b/vendor/github.com/docker/go-units/duration.go index ba02af26d..c219a8a96 100644 --- a/vendor/github.com/docker/go-units/duration.go +++ b/vendor/github.com/docker/go-units/duration.go @@ -12,21 +12,19 @@ import ( func HumanDuration(d time.Duration) string { if seconds := int(d.Seconds()); seconds < 1 { return "Less than a second" - } else if seconds == 1 { - return "1 second" } else if seconds < 60 { return fmt.Sprintf("%d seconds", seconds) } else if minutes := int(d.Minutes()); minutes == 1 { return "About a minute" - } else if minutes < 46 { + } else if minutes < 60 { return fmt.Sprintf("%d minutes", minutes) - } else if hours := int(d.Hours() + 0.5); hours == 1 { + } else if hours := int(d.Hours()); hours == 1 { return "About an hour" } else if hours < 48 { return fmt.Sprintf("%d hours", hours) } else if hours < 24*7*2 { return fmt.Sprintf("%d days", hours/24) - } else if hours < 24*30*2 { + } else if hours < 24*30*3 { return fmt.Sprintf("%d weeks", hours/24/7) } else if hours < 24*365*2 { return fmt.Sprintf("%d months", hours/24/30) diff --git a/vendor/github.com/docker/go-units/size.go b/vendor/github.com/docker/go-units/size.go index 44616c271..f5b82ea24 100644 --- a/vendor/github.com/docker/go-units/size.go +++ b/vendor/github.com/docker/go-units/size.go @@ -37,40 +37,28 @@ var ( var decimapAbbrs = []string{"B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"} var binaryAbbrs = []string{"B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"} -func getSizeAndUnit(size float64, base float64, _map []string) (float64, string) { +// CustomSize returns a human-readable approximation of a size +// using custom format. +func CustomSize(format string, size float64, base float64, _map []string) string { i := 0 unitsLimit := len(_map) - 1 for size >= base && i < unitsLimit { size = size / base i++ } - return size, _map[i] -} - -// CustomSize returns a human-readable approximation of a size -// using custom format. -func CustomSize(format string, size float64, base float64, _map []string) string { - size, unit := getSizeAndUnit(size, base, _map) - return fmt.Sprintf(format, size, unit) -} - -// HumanSizeWithPrecision allows the size to be in any precision, -// instead of 4 digit precision used in units.HumanSize. -func HumanSizeWithPrecision(size float64, precision int) string { - size, unit := getSizeAndUnit(size, 1000.0, decimapAbbrs) - return fmt.Sprintf("%.*g%s", precision, size, unit) + return fmt.Sprintf(format, size, _map[i]) } // HumanSize returns a human-readable approximation of a size // capped at 4 valid numbers (eg. "2.746 MB", "796 KB"). func HumanSize(size float64) string { - return HumanSizeWithPrecision(size, 4) + return CustomSize("%.4g %s", size, 1000.0, decimapAbbrs) } // BytesSize returns a human-readable size in bytes, kibibytes, // mebibytes, gibibytes, or tebibytes (eg. "44kiB", "17MiB"). func BytesSize(size float64) string { - return CustomSize("%.4g%s", size, 1024.0, binaryAbbrs) + return CustomSize("%.4g %s", size, 1024.0, binaryAbbrs) } // FromHumanSize returns an integer from a human-readable specification of a diff --git a/vendor/github.com/godbus/dbus/README.markdown b/vendor/github.com/godbus/dbus/README.markdown index d37f4e2ed..0a6e7e5bf 100644 --- a/vendor/github.com/godbus/dbus/README.markdown +++ b/vendor/github.com/godbus/dbus/README.markdown @@ -1,5 +1,3 @@ -[![Build Status](https://travis-ci.org/godbus/dbus.svg?branch=master)](https://travis-ci.org/godbus/dbus) - dbus ---- @@ -31,7 +29,6 @@ gives a short overview over the basic usage. #### Projects using godbus - [notify](https://github.com/esiqveland/notify) provides desktop notifications over dbus into a library. -- [go-bluetooth](https://github.com/muka/go-bluetooth) provides a bluetooth client over bluez dbus API. Please note that the API is considered unstable for now and may change without further notice. diff --git a/vendor/github.com/godbus/dbus/conn.go b/vendor/github.com/godbus/dbus/conn.go index d3ece8220..a4f539401 100644 --- a/vendor/github.com/godbus/dbus/conn.go +++ b/vendor/github.com/godbus/dbus/conn.go @@ -9,12 +9,13 @@ import ( "sync" ) +const defaultSystemBusAddress = "unix:path=/var/run/dbus/system_bus_socket" + var ( systemBus *Conn systemBusLck sync.Mutex sessionBus *Conn sessionBusLck sync.Mutex - sessionEnvLck sync.Mutex ) // ErrClosed is the error returned by calls on a closed connection. @@ -45,13 +46,15 @@ type Conn struct { calls map[uint32]*Call callsLck sync.RWMutex - handler Handler + handlers map[ObjectPath]map[string]exportWithMapping + handlersLck sync.RWMutex out chan *Message closed bool outLck sync.RWMutex - signalHandler SignalHandler + signals []chan<- *Signal + signalsLck sync.Mutex eavesdropped chan<- *Message eavesdroppedLck sync.Mutex @@ -86,33 +89,14 @@ func SessionBus() (conn *Conn, err error) { return } -func getSessionBusAddress() (string, error) { - sessionEnvLck.Lock() - defer sessionEnvLck.Unlock() - address := os.Getenv("DBUS_SESSION_BUS_ADDRESS") - if address != "" && address != "autolaunch:" { - return address, nil - } - return getSessionBusPlatformAddress() -} - // SessionBusPrivate returns a new private connection to the session bus. func SessionBusPrivate() (*Conn, error) { - address, err := getSessionBusAddress() - if err != nil { - return nil, err + address := os.Getenv("DBUS_SESSION_BUS_ADDRESS") + if address != "" && address != "autolaunch:" { + return Dial(address) } - return Dial(address) -} - -// SessionBusPrivate returns a new private connection to the session bus. -func SessionBusPrivateHandler(handler Handler, signalHandler SignalHandler) (*Conn, error) { - address, err := getSessionBusAddress() - if err != nil { - return nil, err - } - return DialHandler(address, handler, signalHandler) + return sessionBusPlatform() } // SystemBus returns a shared connection to the system bus, connecting to it if @@ -146,12 +130,11 @@ func SystemBus() (conn *Conn, err error) { // SystemBusPrivate returns a new private connection to the system bus. func SystemBusPrivate() (*Conn, error) { - return Dial(getSystemBusPlatformAddress()) -} - -// SystemBusPrivateHandler returns a new private connection to the system bus, using the provided handlers. -func SystemBusPrivateHandler(handler Handler, signalHandler SignalHandler) (*Conn, error) { - return DialHandler(getSystemBusPlatformAddress(), handler, signalHandler) + address := os.Getenv("DBUS_SYSTEM_BUS_ADDRESS") + if address != "" { + return Dial(address) + } + return Dial(defaultSystemBusAddress) } // Dial establishes a new private connection to the message bus specified by address. @@ -160,36 +143,21 @@ func Dial(address string) (*Conn, error) { if err != nil { return nil, err } - return newConn(tr, newDefaultHandler(), newDefaultSignalHandler()) -} - -// DialHandler establishes a new private connection to the message bus specified by address, using the supplied handlers. -func DialHandler(address string, handler Handler, signalHandler SignalHandler) (*Conn, error) { - tr, err := getTransport(address) - if err != nil { - return nil, err - } - return newConn(tr, handler, signalHandler) + return newConn(tr) } // NewConn creates a new private *Conn from an already established connection. func NewConn(conn io.ReadWriteCloser) (*Conn, error) { - return NewConnHandler(conn, newDefaultHandler(), newDefaultSignalHandler()) -} - -// NewConnHandler creates a new private *Conn from an already established connection, using the supplied handlers. -func NewConnHandler(conn io.ReadWriteCloser, handler Handler, signalHandler SignalHandler) (*Conn, error) { - return newConn(genericTransport{conn}, handler, signalHandler) + return newConn(genericTransport{conn}) } // newConn creates a new *Conn from a transport. -func newConn(tr transport, handler Handler, signalHandler SignalHandler) (*Conn, error) { +func newConn(tr transport) (*Conn, error) { conn := new(Conn) conn.transport = tr conn.calls = make(map[uint32]*Call) conn.out = make(chan *Message, 10) - conn.handler = handler - conn.signalHandler = signalHandler + conn.handlers = make(map[ObjectPath]map[string]exportWithMapping) conn.nextSerial = 1 conn.serialUsed = map[uint32]bool{0: true} conn.busObj = conn.Object("org.freedesktop.DBus", "/org/freedesktop/DBus") @@ -217,21 +185,16 @@ func (conn *Conn) Close() error { close(conn.out) conn.closed = true conn.outLck.Unlock() - - if term, ok := conn.signalHandler.(Terminator); ok { - term.Terminate() + conn.signalsLck.Lock() + for _, ch := range conn.signals { + close(ch) } - - if term, ok := conn.handler.(Terminator); ok { - term.Terminate() - } - + conn.signalsLck.Unlock() conn.eavesdroppedLck.Lock() if conn.eavesdropped != nil { close(conn.eavesdropped) } conn.eavesdroppedLck.Unlock() - return conn.transport.Close() } @@ -368,7 +331,17 @@ func (conn *Conn) inWorker() { conn.namesLck.Unlock() } } - go conn.handleSignal(msg) + signal := &Signal{ + Sender: sender, + Path: msg.Headers[FieldPath].value.(ObjectPath), + Name: iface + "." + member, + Body: msg.Body, + } + conn.signalsLck.Lock() + for _, ch := range conn.signals { + ch <- signal + } + conn.signalsLck.Unlock() case TypeMethodCall: go conn.handleCall(msg) } @@ -389,21 +362,6 @@ func (conn *Conn) inWorker() { } } -func (conn *Conn) handleSignal(msg *Message) { - iface := msg.Headers[FieldInterface].value.(string) - member := msg.Headers[FieldMember].value.(string) - // as per http://dbus.freedesktop.org/doc/dbus-specification.html , - // sender is optional for signals. - sender, _ := msg.Headers[FieldSender].value.(string) - signal := &Signal{ - Sender: sender, - Path: msg.Headers[FieldPath].value.(ObjectPath), - Name: iface + "." + member, - Body: msg.Body, - } - conn.signalHandler.DeliverSignal(iface, member, signal) -} - // Names returns the list of all names that are currently owned by this // connection. The slice is always at least one element long, the first element // being the unique name of the connection. @@ -494,19 +452,7 @@ func (conn *Conn) Send(msg *Message, ch chan *Call) *Call { // sendError creates an error message corresponding to the parameters and sends // it to conn.out. -func (conn *Conn) sendError(err error, dest string, serial uint32) { - var e *Error - switch em := err.(type) { - case Error: - e = &em - case *Error: - e = em - case DBusError: - name, body := em.DBusError() - e = NewError(name, body) - default: - e = MakeFailedError(err) - } +func (conn *Conn) sendError(e Error, dest string, serial uint32) { msg := new(Message) msg.Type = TypeError msg.serial = conn.getSerial() @@ -549,30 +495,21 @@ func (conn *Conn) sendReply(dest string, serial uint32, values ...interface{}) { conn.outLck.RUnlock() } -func (conn *Conn) defaultSignalAction(fn func(h *defaultSignalHandler, ch chan<- *Signal), ch chan<- *Signal) { - if !isDefaultSignalHandler(conn.signalHandler) { - return - } - handler := conn.signalHandler.(*defaultSignalHandler) - fn(handler, ch) -} - // Signal registers the given channel to be passed all received signal messages. // The caller has to make sure that ch is sufficiently buffered; if a message // arrives when a write to c is not possible, it is discarded. // -// Multiple of these channels can be registered at the same time. +// Multiple of these channels can be registered at the same time. Passing a +// channel that already is registered will remove it from the list of the +// registered channels. // // These channels are "overwritten" by Eavesdrop; i.e., if there currently is a // channel for eavesdropped messages, this channel receives all signals, and // none of the channels passed to Signal will receive any signals. func (conn *Conn) Signal(ch chan<- *Signal) { - conn.defaultSignalAction((*defaultSignalHandler).addSignal, ch) -} - -// RemoveSignal removes the given channel from the list of the registered channels. -func (conn *Conn) RemoveSignal(ch chan<- *Signal) { - conn.defaultSignalAction((*defaultSignalHandler).removeSignal, ch) + conn.signalsLck.Lock() + conn.signals = append(conn.signals, ch) + conn.signalsLck.Unlock() } // SupportsUnixFDs returns whether the underlying transport supports passing of @@ -673,11 +610,16 @@ func dereferenceAll(vs []interface{}) []interface{} { // getKey gets a key from a the list of keys. Returns "" on error / not found... func getKey(s, key string) string { - for _, keyEqualsValue := range strings.Split(s, ",") { - keyValue := strings.SplitN(keyEqualsValue, "=", 2) - if len(keyValue) == 2 && keyValue[0] == key { - return keyValue[1] - } + i := strings.Index(s, key) + if i == -1 { + return "" } - return "" + if i+len(key)+1 >= len(s) || s[i+len(key)] != '=' { + return "" + } + j := strings.Index(s, ",") + if j == -1 { + j = len(s) + } + return s[i+len(key)+1 : j] } diff --git a/vendor/github.com/godbus/dbus/conn_darwin.go b/vendor/github.com/godbus/dbus/conn_darwin.go index c015f80ce..b67bb1b81 100644 --- a/vendor/github.com/godbus/dbus/conn_darwin.go +++ b/vendor/github.com/godbus/dbus/conn_darwin.go @@ -2,32 +2,20 @@ package dbus import ( "errors" - "fmt" - "os" "os/exec" ) -const defaultSystemBusAddress = "unix:path=/opt/local/var/run/dbus/system_bus_socket" - -func getSessionBusPlatformAddress() (string, error) { +func sessionBusPlatform() (*Conn, error) { cmd := exec.Command("launchctl", "getenv", "DBUS_LAUNCHD_SESSION_BUS_SOCKET") b, err := cmd.CombinedOutput() if err != nil { - return "", err + return nil, err } if len(b) == 0 { - return "", errors.New("dbus: couldn't determine address of session bus") + return nil, errors.New("dbus: couldn't determine address of session bus") } - return "unix:path=" + string(b[:len(b)-1]), nil -} - -func getSystemBusPlatformAddress() string { - address := os.Getenv("DBUS_LAUNCHD_SESSION_BUS_SOCKET") - if address != "" { - return fmt.Sprintf("unix:path=%s", address) - } - return defaultSystemBusAddress + return Dial("unix:path=" + string(b[:len(b)-1])) } diff --git a/vendor/github.com/godbus/dbus/conn_other.go b/vendor/github.com/godbus/dbus/conn_other.go index 254c9f2ef..f74b8758d 100644 --- a/vendor/github.com/godbus/dbus/conn_other.go +++ b/vendor/github.com/godbus/dbus/conn_other.go @@ -5,38 +5,23 @@ package dbus import ( "bytes" "errors" - "fmt" - "os" "os/exec" ) -const defaultSystemBusAddress = "unix:path=/var/run/dbus/system_bus_socket" - -func getSessionBusPlatformAddress() (string, error) { +func sessionBusPlatform() (*Conn, error) { cmd := exec.Command("dbus-launch") b, err := cmd.CombinedOutput() if err != nil { - return "", err + return nil, err } i := bytes.IndexByte(b, '=') j := bytes.IndexByte(b, '\n') if i == -1 || j == -1 { - return "", errors.New("dbus: couldn't determine address of session bus") + return nil, errors.New("dbus: couldn't determine address of session bus") } - env, addr := string(b[0:i]), string(b[i+1:j]) - os.Setenv(env, addr) - - return addr, nil -} - -func getSystemBusPlatformAddress() string { - address := os.Getenv("DBUS_SYSTEM_BUS_ADDRESS") - if address != "" { - return fmt.Sprintf("unix:path=%s", address) - } - return defaultSystemBusAddress + return Dial(string(b[i+1 : j])) } diff --git a/vendor/github.com/godbus/dbus/dbus.go b/vendor/github.com/godbus/dbus/dbus.go index c6d0d3ce0..2ce68735c 100644 --- a/vendor/github.com/godbus/dbus/dbus.go +++ b/vendor/github.com/godbus/dbus/dbus.go @@ -2,7 +2,6 @@ package dbus import ( "errors" - "fmt" "reflect" "strings" ) @@ -13,8 +12,6 @@ var ( uint8Type = reflect.TypeOf(uint8(0)) int16Type = reflect.TypeOf(int16(0)) uint16Type = reflect.TypeOf(uint16(0)) - intType = reflect.TypeOf(int(0)) - uintType = reflect.TypeOf(uint(0)) int32Type = reflect.TypeOf(int32(0)) uint32Type = reflect.TypeOf(uint32(0)) int64Type = reflect.TypeOf(int64(0)) @@ -25,7 +22,6 @@ var ( objectPathType = reflect.TypeOf(ObjectPath("")) variantType = reflect.TypeOf(Variant{Signature{""}, nil}) interfacesType = reflect.TypeOf([]interface{}{}) - interfaceType = reflect.TypeOf((*interface{})(nil)).Elem() unixFDType = reflect.TypeOf(UnixFD(0)) unixFDIndexType = reflect.TypeOf(UnixFDIndex(0)) ) @@ -50,251 +46,86 @@ func Store(src []interface{}, dest ...interface{}) error { } for i := range src { - if err := storeInterfaces(src[i], dest[i]); err != nil { + if err := store(src[i], dest[i]); err != nil { return err } } return nil } -func storeInterfaces(src, dest interface{}) error { - return store(reflect.ValueOf(dest), reflect.ValueOf(src)) -} - -func store(dest, src reflect.Value) error { - if dest.Kind() == reflect.Ptr { - return store(dest.Elem(), src) - } - switch src.Kind() { - case reflect.Slice: - return storeSlice(dest, src) - case reflect.Map: - return storeMap(dest, src) - default: - return storeBase(dest, src) - } -} - -func storeBase(dest, src reflect.Value) error { - return setDest(dest, src) -} - -func setDest(dest, src reflect.Value) error { - if !isVariant(src.Type()) && isVariant(dest.Type()) { - //special conversion for dbus.Variant - dest.Set(reflect.ValueOf(MakeVariant(src.Interface()))) +func store(src, dest interface{}) error { + if reflect.TypeOf(dest).Elem() == reflect.TypeOf(src) { + reflect.ValueOf(dest).Elem().Set(reflect.ValueOf(src)) + return nil + } else if hasStruct(dest) { + rv := reflect.ValueOf(dest).Elem() + switch rv.Kind() { + case reflect.Struct: + vs, ok := src.([]interface{}) + if !ok { + return errors.New("dbus.Store: type mismatch") + } + t := rv.Type() + ndest := make([]interface{}, 0, rv.NumField()) + for i := 0; i < rv.NumField(); i++ { + field := t.Field(i) + if field.PkgPath == "" && field.Tag.Get("dbus") != "-" { + ndest = append(ndest, rv.Field(i).Addr().Interface()) + } + } + if len(vs) != len(ndest) { + return errors.New("dbus.Store: type mismatch") + } + err := Store(vs, ndest...) + if err != nil { + return errors.New("dbus.Store: type mismatch") + } + case reflect.Slice: + sv := reflect.ValueOf(src) + if sv.Kind() != reflect.Slice { + return errors.New("dbus.Store: type mismatch") + } + rv.Set(reflect.MakeSlice(rv.Type(), sv.Len(), sv.Len())) + for i := 0; i < sv.Len(); i++ { + if err := store(sv.Index(i).Interface(), rv.Index(i).Addr().Interface()); err != nil { + return err + } + } + case reflect.Map: + sv := reflect.ValueOf(src) + if sv.Kind() != reflect.Map { + return errors.New("dbus.Store: type mismatch") + } + keys := sv.MapKeys() + rv.Set(reflect.MakeMap(sv.Type())) + for _, key := range keys { + v := reflect.New(sv.Type().Elem()) + if err := store(v, sv.MapIndex(key).Interface()); err != nil { + return err + } + rv.SetMapIndex(key, v.Elem()) + } + default: + return errors.New("dbus.Store: type mismatch") + } return nil - } - if isVariant(src.Type()) && !isVariant(dest.Type()) { - src = getVariantValue(src) - } - if !src.Type().ConvertibleTo(dest.Type()) { - return fmt.Errorf( - "dbus.Store: type mismatch: cannot convert %s to %s", - src.Type(), dest.Type()) - } - dest.Set(src.Convert(dest.Type())) - return nil -} - -func kindsAreCompatible(dest, src reflect.Type) bool { - switch { - case isVariant(dest): - return true - case dest.Kind() == reflect.Interface: - return true - default: - return dest.Kind() == src.Kind() - } -} - -func isConvertibleTo(dest, src reflect.Type) bool { - switch { - case isVariant(dest): - return true - case dest.Kind() == reflect.Interface: - return true - case dest.Kind() == reflect.Slice: - return src.Kind() == reflect.Slice && - isConvertibleTo(dest.Elem(), src.Elem()) - case dest.Kind() == reflect.Struct: - return src == interfacesType - default: - return src.ConvertibleTo(dest) - } -} - -func storeMap(dest, src reflect.Value) error { - switch { - case !kindsAreCompatible(dest.Type(), src.Type()): - return fmt.Errorf( - "dbus.Store: type mismatch: "+ - "map: cannot store a value of %s into %s", - src.Type(), dest.Type()) - case isVariant(dest.Type()): - return storeMapIntoVariant(dest, src) - case dest.Kind() == reflect.Interface: - return storeMapIntoInterface(dest, src) - case isConvertibleTo(dest.Type().Key(), src.Type().Key()) && - isConvertibleTo(dest.Type().Elem(), src.Type().Elem()): - return storeMapIntoMap(dest, src) - default: - return fmt.Errorf( - "dbus.Store: type mismatch: "+ - "map: cannot convert a value of %s into %s", - src.Type(), dest.Type()) - } -} - -func storeMapIntoVariant(dest, src reflect.Value) error { - dv := reflect.MakeMap(src.Type()) - err := store(dv, src) - if err != nil { - return err - } - return storeBase(dest, dv) -} - -func storeMapIntoInterface(dest, src reflect.Value) error { - var dv reflect.Value - if isVariant(src.Type().Elem()) { - //Convert variants to interface{} recursively when converting - //to interface{} - dv = reflect.MakeMap( - reflect.MapOf(src.Type().Key(), interfaceType)) } else { - dv = reflect.MakeMap(src.Type()) - } - err := store(dv, src) - if err != nil { - return err - } - return storeBase(dest, dv) -} - -func storeMapIntoMap(dest, src reflect.Value) error { - if dest.IsNil() { - dest.Set(reflect.MakeMap(dest.Type())) - } - keys := src.MapKeys() - for _, key := range keys { - dkey := key.Convert(dest.Type().Key()) - dval := reflect.New(dest.Type().Elem()).Elem() - err := store(dval, getVariantValue(src.MapIndex(key))) - if err != nil { - return err - } - dest.SetMapIndex(dkey, dval) - } - return nil -} - -func storeSlice(dest, src reflect.Value) error { - switch { - case src.Type() == interfacesType && dest.Kind() == reflect.Struct: - //The decoder always decodes structs as slices of interface{} - return storeStruct(dest, src) - case !kindsAreCompatible(dest.Type(), src.Type()): - return fmt.Errorf( - "dbus.Store: type mismatch: "+ - "slice: cannot store a value of %s into %s", - src.Type(), dest.Type()) - case isVariant(dest.Type()): - return storeSliceIntoVariant(dest, src) - case dest.Kind() == reflect.Interface: - return storeSliceIntoInterface(dest, src) - case isConvertibleTo(dest.Type().Elem(), src.Type().Elem()): - return storeSliceIntoSlice(dest, src) - default: - return fmt.Errorf( - "dbus.Store: type mismatch: "+ - "slice: cannot convert a value of %s into %s", - src.Type(), dest.Type()) + return errors.New("dbus.Store: type mismatch") } } -func storeStruct(dest, src reflect.Value) error { - if isVariant(dest.Type()) { - return storeBase(dest, src) - } - dval := make([]interface{}, 0, dest.NumField()) - dtype := dest.Type() - for i := 0; i < dest.NumField(); i++ { - field := dest.Field(i) - ftype := dtype.Field(i) - if ftype.PkgPath != "" { - continue - } - if ftype.Tag.Get("dbus") == "-" { - continue - } - dval = append(dval, field.Addr().Interface()) - } - if src.Len() != len(dval) { - return fmt.Errorf( - "dbus.Store: type mismatch: "+ - "destination struct does not have "+ - "enough fields need: %d have: %d", - src.Len(), len(dval)) - } - return Store(src.Interface().([]interface{}), dval...) -} - -func storeSliceIntoVariant(dest, src reflect.Value) error { - dv := reflect.MakeSlice(src.Type(), src.Len(), src.Cap()) - err := store(dv, src) - if err != nil { - return err - } - return storeBase(dest, dv) -} - -func storeSliceIntoInterface(dest, src reflect.Value) error { - var dv reflect.Value - if isVariant(src.Type().Elem()) { - //Convert variants to interface{} recursively when converting - //to interface{} - dv = reflect.MakeSlice(reflect.SliceOf(interfaceType), - src.Len(), src.Cap()) - } else { - dv = reflect.MakeSlice(src.Type(), src.Len(), src.Cap()) - } - err := store(dv, src) - if err != nil { - return err - } - return storeBase(dest, dv) -} - -func storeSliceIntoSlice(dest, src reflect.Value) error { - if dest.IsNil() || dest.Len() < src.Len() { - dest.Set(reflect.MakeSlice(dest.Type(), src.Len(), src.Cap())) - } - if dest.Len() != src.Len() { - return fmt.Errorf( - "dbus.Store: type mismatch: "+ - "slices are different lengths "+ - "need: %d have: %d", - src.Len(), dest.Len()) - } - for i := 0; i < src.Len(); i++ { - err := store(dest.Index(i), getVariantValue(src.Index(i))) - if err != nil { - return err +func hasStruct(v interface{}) bool { + t := reflect.TypeOf(v) + for { + switch t.Kind() { + case reflect.Struct: + return true + case reflect.Slice, reflect.Ptr, reflect.Map: + t = t.Elem() + default: + return false } } - return nil -} - -func getVariantValue(in reflect.Value) reflect.Value { - if isVariant(in.Type()) { - return reflect.ValueOf(in.Interface().(Variant).Value()) - } - return in -} - -func isVariant(t reflect.Type) bool { - return t == variantType } // An ObjectPath is an object path as defined by the D-Bus spec. @@ -346,15 +177,15 @@ func alignment(t reflect.Type) int { return 4 case signatureType: return 1 - case interfacesType: - return 4 + case interfacesType: // sometimes used for structs + return 8 } switch t.Kind() { case reflect.Uint8: return 1 case reflect.Uint16, reflect.Int16: return 2 - case reflect.Uint, reflect.Int, reflect.Uint32, reflect.Int32, reflect.String, reflect.Array, reflect.Slice, reflect.Map: + case reflect.Uint32, reflect.Int32, reflect.String, reflect.Array, reflect.Slice, reflect.Map: return 4 case reflect.Uint64, reflect.Int64, reflect.Float64, reflect.Struct: return 8 @@ -369,7 +200,7 @@ func isKeyType(t reflect.Type) bool { switch t.Kind() { case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Float64, - reflect.String, reflect.Uint, reflect.Int: + reflect.String: return true } diff --git a/vendor/github.com/godbus/dbus/default_handler.go b/vendor/github.com/godbus/dbus/default_handler.go deleted file mode 100644 index d32b553bc..000000000 --- a/vendor/github.com/godbus/dbus/default_handler.go +++ /dev/null @@ -1,283 +0,0 @@ -package dbus - -import ( - "bytes" - "reflect" - "strings" - "sync" -) - -func newIntrospectIntf(h *defaultHandler) *exportedIntf { - methods := make(map[string]Method) - methods["Introspect"] = exportedMethod{ - reflect.ValueOf(func(msg Message) (string, *Error) { - path := msg.Headers[FieldPath].value.(ObjectPath) - return h.introspectPath(path), nil - }), - } - return newExportedIntf(methods, true) -} - -func newDefaultHandler() *defaultHandler { - h := &defaultHandler{ - objects: make(map[ObjectPath]*exportedObj), - defaultIntf: make(map[string]*exportedIntf), - } - h.defaultIntf["org.freedesktop.DBus.Introspectable"] = newIntrospectIntf(h) - return h -} - -type defaultHandler struct { - sync.RWMutex - objects map[ObjectPath]*exportedObj - defaultIntf map[string]*exportedIntf -} - -func (h *defaultHandler) PathExists(path ObjectPath) bool { - _, ok := h.objects[path] - return ok -} - -func (h *defaultHandler) introspectPath(path ObjectPath) string { - subpath := make(map[string]struct{}) - var xml bytes.Buffer - xml.WriteString("") - for obj, _ := range h.objects { - p := string(path) - if p != "/" { - p += "/" - } - if strings.HasPrefix(string(obj), p) { - node_name := strings.Split(string(obj[len(p):]), "/")[0] - subpath[node_name] = struct{}{} - } - } - for s, _ := range subpath { - xml.WriteString("\n\t") - } - xml.WriteString("\n") - return xml.String() -} - -func (h *defaultHandler) LookupObject(path ObjectPath) (ServerObject, bool) { - h.RLock() - defer h.RUnlock() - object, ok := h.objects[path] - if ok { - return object, ok - } - - // If an object wasn't found for this exact path, - // look for a matching subtree registration - subtreeObject := newExportedObject() - path = path[:strings.LastIndex(string(path), "/")] - for len(path) > 0 { - object, ok = h.objects[path] - if ok { - for name, iface := range object.interfaces { - // Only include this handler if it registered for the subtree - if iface.isFallbackInterface() { - subtreeObject.interfaces[name] = iface - } - } - break - } - - path = path[:strings.LastIndex(string(path), "/")] - } - - for name, intf := range h.defaultIntf { - if _, exists := subtreeObject.interfaces[name]; exists { - continue - } - subtreeObject.interfaces[name] = intf - } - - return subtreeObject, true -} - -func (h *defaultHandler) AddObject(path ObjectPath, object *exportedObj) { - h.Lock() - h.objects[path] = object - h.Unlock() -} - -func (h *defaultHandler) DeleteObject(path ObjectPath) { - h.Lock() - delete(h.objects, path) - h.Unlock() -} - -type exportedMethod struct { - reflect.Value -} - -func (m exportedMethod) Call(args ...interface{}) ([]interface{}, error) { - t := m.Type() - - params := make([]reflect.Value, len(args)) - for i := 0; i < len(args); i++ { - params[i] = reflect.ValueOf(args[i]).Elem() - } - - ret := m.Value.Call(params) - - err := ret[t.NumOut()-1].Interface().(*Error) - ret = ret[:t.NumOut()-1] - out := make([]interface{}, len(ret)) - for i, val := range ret { - out[i] = val.Interface() - } - if err == nil { - //concrete type to interface nil is a special case - return out, nil - } - return out, err -} - -func (m exportedMethod) NumArguments() int { - return m.Value.Type().NumIn() -} - -func (m exportedMethod) ArgumentValue(i int) interface{} { - return reflect.Zero(m.Type().In(i)).Interface() -} - -func (m exportedMethod) NumReturns() int { - return m.Value.Type().NumOut() -} - -func (m exportedMethod) ReturnValue(i int) interface{} { - return reflect.Zero(m.Type().Out(i)).Interface() -} - -func newExportedObject() *exportedObj { - return &exportedObj{ - interfaces: make(map[string]*exportedIntf), - } -} - -type exportedObj struct { - interfaces map[string]*exportedIntf -} - -func (obj *exportedObj) LookupInterface(name string) (Interface, bool) { - if name == "" { - return obj, true - } - intf, exists := obj.interfaces[name] - return intf, exists -} - -func (obj *exportedObj) AddInterface(name string, iface *exportedIntf) { - obj.interfaces[name] = iface -} - -func (obj *exportedObj) DeleteInterface(name string) { - delete(obj.interfaces, name) -} - -func (obj *exportedObj) LookupMethod(name string) (Method, bool) { - for _, intf := range obj.interfaces { - method, exists := intf.LookupMethod(name) - if exists { - return method, exists - } - } - return nil, false -} - -func (obj *exportedObj) isFallbackInterface() bool { - return false -} - -func newExportedIntf(methods map[string]Method, includeSubtree bool) *exportedIntf { - return &exportedIntf{ - methods: methods, - includeSubtree: includeSubtree, - } -} - -type exportedIntf struct { - methods map[string]Method - - // Whether or not this export is for the entire subtree - includeSubtree bool -} - -func (obj *exportedIntf) LookupMethod(name string) (Method, bool) { - out, exists := obj.methods[name] - return out, exists -} - -func (obj *exportedIntf) isFallbackInterface() bool { - return obj.includeSubtree -} - -func newDefaultSignalHandler() *defaultSignalHandler { - return &defaultSignalHandler{} -} - -func isDefaultSignalHandler(handler SignalHandler) bool { - _, ok := handler.(*defaultSignalHandler) - return ok -} - -type defaultSignalHandler struct { - sync.RWMutex - closed bool - signals []chan<- *Signal -} - -func (sh *defaultSignalHandler) DeliverSignal(intf, name string, signal *Signal) { - sh.RLock() - defer sh.RUnlock() - if sh.closed { - return - } - for _, ch := range sh.signals { - ch <- signal - } -} - -func (sh *defaultSignalHandler) Init() error { - sh.Lock() - sh.signals = make([]chan<- *Signal, 0) - sh.Unlock() - return nil -} - -func (sh *defaultSignalHandler) Terminate() { - sh.Lock() - sh.closed = true - for _, ch := range sh.signals { - close(ch) - } - sh.signals = nil - sh.Unlock() -} - -func (sh *defaultSignalHandler) addSignal(ch chan<- *Signal) { - sh.Lock() - defer sh.Unlock() - if sh.closed { - return - } - sh.signals = append(sh.signals, ch) - -} - -func (sh *defaultSignalHandler) removeSignal(ch chan<- *Signal) { - sh.Lock() - defer sh.Unlock() - if sh.closed { - return - } - for i := len(sh.signals) - 1; i >= 0; i-- { - if ch == sh.signals[i] { - copy(sh.signals[i:], sh.signals[i+1:]) - sh.signals[len(sh.signals)-1] = nil - sh.signals = sh.signals[:len(sh.signals)-1] - } - } -} diff --git a/vendor/github.com/godbus/dbus/doc.go b/vendor/github.com/godbus/dbus/doc.go index 895036a8c..deff554a3 100644 --- a/vendor/github.com/godbus/dbus/doc.go +++ b/vendor/github.com/godbus/dbus/doc.go @@ -19,8 +19,6 @@ respective D-Bus equivalents: bool | BOOLEAN int16 | INT16 uint16 | UINT16 - int | INT32 - uint | UINT32 int32 | INT32 uint32 | UINT32 int64 | INT64 @@ -30,7 +28,6 @@ respective D-Bus equivalents: ObjectPath | OBJECT_PATH Signature | SIGNATURE Variant | VARIANT - interface{} | VARIANT UnixFDIndex | UNIX_FD Slices and arrays encode as ARRAYs of their element type. @@ -44,9 +41,6 @@ be skipped. Pointers encode as the value they're pointed to. -Types convertible to one of the base types above will be mapped as the -base type. - Trying to encode any other type or a slice, map or struct containing an unsupported type will result in an InvalidTypeError. diff --git a/vendor/github.com/godbus/dbus/encoder.go b/vendor/github.com/godbus/dbus/encoder.go index 8bb717761..9f0a9e89e 100644 --- a/vendor/github.com/godbus/dbus/encoder.go +++ b/vendor/github.com/godbus/dbus/encoder.go @@ -96,10 +96,10 @@ func (enc *encoder) encode(v reflect.Value, depth int) { case reflect.Uint16: enc.binwrite(uint16(v.Uint())) enc.pos += 2 - case reflect.Int, reflect.Int32: + case reflect.Int32: enc.binwrite(int32(v.Int())) enc.pos += 4 - case reflect.Uint, reflect.Uint32: + case reflect.Uint32: enc.binwrite(uint32(v.Uint())) enc.pos += 4 case reflect.Int64: @@ -202,8 +202,6 @@ func (enc *encoder) encode(v reflect.Value, depth int) { panic(err) } enc.pos += length - case reflect.Interface: - enc.encode(reflect.ValueOf(MakeVariant(v.Interface())), depth) default: panic(InvalidTypeError{v.Type()}) } diff --git a/vendor/github.com/godbus/dbus/export.go b/vendor/github.com/godbus/dbus/export.go index aae970881..c6440a741 100644 --- a/vendor/github.com/godbus/dbus/export.go +++ b/vendor/github.com/godbus/dbus/export.go @@ -8,73 +8,167 @@ import ( ) var ( - ErrMsgInvalidArg = Error{ + errmsgInvalidArg = Error{ "org.freedesktop.DBus.Error.InvalidArgs", []interface{}{"Invalid type / number of args"}, } - ErrMsgNoObject = Error{ + errmsgNoObject = Error{ "org.freedesktop.DBus.Error.NoSuchObject", []interface{}{"No such object"}, } - ErrMsgUnknownMethod = Error{ + errmsgUnknownMethod = Error{ "org.freedesktop.DBus.Error.UnknownMethod", []interface{}{"Unknown / invalid method"}, } - ErrMsgUnknownInterface = Error{ - "org.freedesktop.DBus.Error.UnknownInterface", - []interface{}{"Object does not implement the interface"}, - } ) -func MakeFailedError(err error) *Error { - return &Error{ - "org.freedesktop.DBus.Error.Failed", - []interface{}{err.Error()}, - } +// exportWithMapping represents an exported struct along with a method name +// mapping to allow for exporting lower-case methods, etc. +type exportWithMapping struct { + export interface{} + + // Method name mapping; key -> struct method, value -> dbus method. + mapping map[string]string + + // Whether or not this export is for the entire subtree + includeSubtree bool } // Sender is a type which can be used in exported methods to receive the message // sender. type Sender string -func computeMethodName(name string, mapping map[string]string) string { - newname, ok := mapping[name] - if ok { - name = newname +func exportedMethod(export exportWithMapping, name string) reflect.Value { + if export.export == nil { + return reflect.Value{} } - return name -} -func getMethods(in interface{}, mapping map[string]string) map[string]reflect.Value { - if in == nil { - return nil - } - methods := make(map[string]reflect.Value) - val := reflect.ValueOf(in) - typ := val.Type() - for i := 0; i < typ.NumMethod(); i++ { - methtype := typ.Method(i) - method := val.Method(i) - t := method.Type() - // only track valid methods must return *Error as last arg - // and must be exported - if t.NumOut() == 0 || - t.Out(t.NumOut()-1) != reflect.TypeOf(&ErrMsgInvalidArg) || - methtype.PkgPath != "" { - continue + // If a mapping was included in the export, check the map to see if we + // should be looking for a different method in the export. + if export.mapping != nil { + for key, value := range export.mapping { + if value == name { + name = key + break + } + + // Catch the case where a method is aliased but the client is calling + // the original, e.g. the "Foo" method was exported mapped to + // "foo," and dbus client called the original "Foo." + if key == name { + return reflect.Value{} + } } - // map names while building table - methods[computeMethodName(methtype.Name, mapping)] = method } - return methods + + value := reflect.ValueOf(export.export) + m := value.MethodByName(name) + + // Catch the case of attempting to call an unexported method + method, ok := value.Type().MethodByName(name) + + if !m.IsValid() || !ok || method.PkgPath != "" { + return reflect.Value{} + } + t := m.Type() + if t.NumOut() == 0 || + t.Out(t.NumOut()-1) != reflect.TypeOf(&errmsgInvalidArg) { + + return reflect.Value{} + } + return m } -func standardMethodArgumentDecode(m Method, sender string, msg *Message, body []interface{}) ([]interface{}, error) { - pointers := make([]interface{}, m.NumArguments()) - decode := make([]interface{}, 0, len(body)) +// searchHandlers will look through all registered handlers looking for one +// to handle the given path. If a verbatim one isn't found, it will check for +// a subtree registration for the path as well. +func (conn *Conn) searchHandlers(path ObjectPath) (map[string]exportWithMapping, bool) { + conn.handlersLck.RLock() + defer conn.handlersLck.RUnlock() - for i := 0; i < m.NumArguments(); i++ { - tp := reflect.TypeOf(m.ArgumentValue(i)) + handlers, ok := conn.handlers[path] + if ok { + return handlers, ok + } + + // If handlers weren't found for this exact path, look for a matching subtree + // registration + handlers = make(map[string]exportWithMapping) + path = path[:strings.LastIndex(string(path), "/")] + for len(path) > 0 { + var subtreeHandlers map[string]exportWithMapping + subtreeHandlers, ok = conn.handlers[path] + if ok { + for iface, handler := range subtreeHandlers { + // Only include this handler if it registered for the subtree + if handler.includeSubtree { + handlers[iface] = handler + } + } + + break + } + + path = path[:strings.LastIndex(string(path), "/")] + } + + return handlers, ok +} + +// handleCall handles the given method call (i.e. looks if it's one of the +// pre-implemented ones and searches for a corresponding handler if not). +func (conn *Conn) handleCall(msg *Message) { + name := msg.Headers[FieldMember].value.(string) + path := msg.Headers[FieldPath].value.(ObjectPath) + ifaceName, hasIface := msg.Headers[FieldInterface].value.(string) + sender, hasSender := msg.Headers[FieldSender].value.(string) + serial := msg.serial + if ifaceName == "org.freedesktop.DBus.Peer" { + switch name { + case "Ping": + conn.sendReply(sender, serial) + case "GetMachineId": + conn.sendReply(sender, serial, conn.uuid) + default: + conn.sendError(errmsgUnknownMethod, sender, serial) + } + return + } + if len(name) == 0 { + conn.sendError(errmsgUnknownMethod, sender, serial) + } + + // Find the exported handler (if any) for this path + handlers, ok := conn.searchHandlers(path) + if !ok { + conn.sendError(errmsgNoObject, sender, serial) + return + } + + var m reflect.Value + if hasIface { + iface := handlers[ifaceName] + m = exportedMethod(iface, name) + } else { + for _, v := range handlers { + m = exportedMethod(v, name) + if m.IsValid() { + break + } + } + } + + if !m.IsValid() { + conn.sendError(errmsgUnknownMethod, sender, serial) + return + } + + t := m.Type() + vs := msg.Body + pointers := make([]interface{}, t.NumIn()) + decode := make([]interface{}, 0, len(vs)) + for i := 0; i < t.NumIn(); i++ { + tp := t.In(i) val := reflect.New(tp) pointers[i] = val.Interface() if tp == reflect.TypeOf((*Sender)(nil)).Elem() { @@ -86,73 +180,26 @@ func standardMethodArgumentDecode(m Method, sender string, msg *Message, body [] } } - if len(decode) != len(body) { - return nil, ErrMsgInvalidArg - } - - if err := Store(body, decode...); err != nil { - return nil, ErrMsgInvalidArg - } - - return pointers, nil -} - -func (conn *Conn) decodeArguments(m Method, sender string, msg *Message) ([]interface{}, error) { - if decoder, ok := m.(ArgumentDecoder); ok { - return decoder.DecodeArguments(conn, sender, msg, msg.Body) - } - return standardMethodArgumentDecode(m, sender, msg, msg.Body) -} - -// handleCall handles the given method call (i.e. looks if it's one of the -// pre-implemented ones and searches for a corresponding handler if not). -func (conn *Conn) handleCall(msg *Message) { - name := msg.Headers[FieldMember].value.(string) - path := msg.Headers[FieldPath].value.(ObjectPath) - ifaceName, _ := msg.Headers[FieldInterface].value.(string) - sender, hasSender := msg.Headers[FieldSender].value.(string) - serial := msg.serial - if ifaceName == "org.freedesktop.DBus.Peer" { - switch name { - case "Ping": - conn.sendReply(sender, serial) - case "GetMachineId": - conn.sendReply(sender, serial, conn.uuid) - default: - conn.sendError(ErrMsgUnknownMethod, sender, serial) - } - return - } - if len(name) == 0 { - conn.sendError(ErrMsgUnknownMethod, sender, serial) - } - - object, ok := conn.handler.LookupObject(path) - if !ok { - conn.sendError(ErrMsgNoObject, sender, serial) + if len(decode) != len(vs) { + conn.sendError(errmsgInvalidArg, sender, serial) return } - iface, exists := object.LookupInterface(ifaceName) - if !exists { - conn.sendError(ErrMsgUnknownInterface, sender, serial) + if err := Store(vs, decode...); err != nil { + conn.sendError(errmsgInvalidArg, sender, serial) return } - m, exists := iface.LookupMethod(name) - if !exists { - conn.sendError(ErrMsgUnknownMethod, sender, serial) - return - } - args, err := conn.decodeArguments(m, sender, msg) - if err != nil { - conn.sendError(err, sender, serial) - return + // Extract parameters + params := make([]reflect.Value, len(pointers)) + for i := 0; i < len(pointers); i++ { + params[i] = reflect.ValueOf(pointers[i]).Elem() } - ret, err := m.Call(args...) - if err != nil { - conn.sendError(err, sender, serial) + // Call method + ret := m.Call(params) + if em := ret[t.NumOut()-1].Interface().(*Error); em != nil { + conn.sendError(*em, sender, serial) return } @@ -165,11 +212,13 @@ func (conn *Conn) handleCall(msg *Message) { reply.Headers[FieldDestination] = msg.Headers[FieldSender] } reply.Headers[FieldReplySerial] = MakeVariant(msg.serial) - reply.Body = make([]interface{}, len(ret)) - for i := 0; i < len(ret); i++ { - reply.Body[i] = ret[i] + reply.Body = make([]interface{}, len(ret)-1) + for i := 0; i < len(ret)-1; i++ { + reply.Body[i] = ret[i].Interface() + } + if len(ret) != 1 { + reply.Headers[FieldSignature] = MakeVariant(SignatureOf(reply.Body...)) } - reply.Headers[FieldSignature] = MakeVariant(SignatureOf(reply.Body...)) conn.outLck.RLock() if !conn.closed { conn.out <- reply @@ -254,7 +303,7 @@ func (conn *Conn) Export(v interface{}, path ObjectPath, iface string) error { // The keys in the map are the real method names (exported on the struct), and // the values are the method names to be exported on DBus. func (conn *Conn) ExportWithMap(v interface{}, mapping map[string]string, path ObjectPath, iface string) error { - return conn.export(getMethods(v, mapping), path, iface, false) + return conn.exportWithMap(v, mapping, path, iface, false) } // ExportSubtree works exactly like Export but registers the given value for @@ -277,89 +326,38 @@ func (conn *Conn) ExportSubtree(v interface{}, path ObjectPath, iface string) er // The keys in the map are the real method names (exported on the struct), and // the values are the method names to be exported on DBus. func (conn *Conn) ExportSubtreeWithMap(v interface{}, mapping map[string]string, path ObjectPath, iface string) error { - return conn.export(getMethods(v, mapping), path, iface, true) -} - -// ExportMethodTable like Export registers the given methods as an object -// on the message bus. Unlike Export the it uses a method table to define -// the object instead of a native go object. -// -// The method table is a map from method name to function closure -// representing the method. This allows an object exported on the bus to not -// necessarily be a native go object. It can be useful for generating exposed -// methods on the fly. -// -// Any non-function objects in the method table are ignored. -func (conn *Conn) ExportMethodTable(methods map[string]interface{}, path ObjectPath, iface string) error { - return conn.exportMethodTable(methods, path, iface, false) -} - -// Like ExportSubtree, but with the same caveats as ExportMethodTable. -func (conn *Conn) ExportSubtreeMethodTable(methods map[string]interface{}, path ObjectPath, iface string) error { - return conn.exportMethodTable(methods, path, iface, true) -} - -func (conn *Conn) exportMethodTable(methods map[string]interface{}, path ObjectPath, iface string, includeSubtree bool) error { - out := make(map[string]reflect.Value) - for name, method := range methods { - rval := reflect.ValueOf(method) - if rval.Kind() != reflect.Func { - continue - } - t := rval.Type() - // only track valid methods must return *Error as last arg - if t.NumOut() == 0 || - t.Out(t.NumOut()-1) != reflect.TypeOf(&ErrMsgInvalidArg) { - continue - } - out[name] = rval - } - return conn.export(out, path, iface, includeSubtree) -} - -func (conn *Conn) unexport(h *defaultHandler, path ObjectPath, iface string) error { - if h.PathExists(path) { - obj := h.objects[path] - obj.DeleteInterface(iface) - if len(obj.interfaces) == 0 { - h.DeleteObject(path) - } - } - return nil + return conn.exportWithMap(v, mapping, path, iface, true) } // exportWithMap is the worker function for all exports/registrations. -func (conn *Conn) export(methods map[string]reflect.Value, path ObjectPath, iface string, includeSubtree bool) error { - h, ok := conn.handler.(*defaultHandler) - if !ok { - return fmt.Errorf( - `dbus: export only allowed on the default hander handler have %T"`, - conn.handler) - } - +func (conn *Conn) exportWithMap(v interface{}, mapping map[string]string, path ObjectPath, iface string, includeSubtree bool) error { if !path.IsValid() { return fmt.Errorf(`dbus: Invalid path name: "%s"`, path) } + conn.handlersLck.Lock() + defer conn.handlersLck.Unlock() + // Remove a previous export if the interface is nil - if methods == nil { - return conn.unexport(h, path, iface) + if v == nil { + if _, ok := conn.handlers[path]; ok { + delete(conn.handlers[path], iface) + if len(conn.handlers[path]) == 0 { + delete(conn.handlers, path) + } + } + + return nil } // If this is the first handler for this path, make a new map to hold all // handlers for this path. - if !h.PathExists(path) { - h.AddObject(path, newExportedObject()) - } - - exportedMethods := make(map[string]Method) - for name, method := range methods { - exportedMethods[name] = exportedMethod{method} + if _, ok := conn.handlers[path]; !ok { + conn.handlers[path] = make(map[string]exportWithMapping) } // Finally, save this handler - obj := h.objects[path] - obj.AddInterface(iface, newExportedIntf(exportedMethods, includeSubtree)) + conn.handlers[path][iface] = exportWithMapping{export: v, mapping: mapping, includeSubtree: includeSubtree} return nil } diff --git a/vendor/github.com/godbus/dbus/message.go b/vendor/github.com/godbus/dbus/message.go index 6a925367e..075d6e38b 100644 --- a/vendor/github.com/godbus/dbus/message.go +++ b/vendor/github.com/godbus/dbus/message.go @@ -22,13 +22,6 @@ const ( // FlagNoAutoStart signals that the message bus should not automatically // start an application when handling this message. FlagNoAutoStart - // FlagAllowInteractiveAuthorization may be set on a method call - // message to inform the receiving side that the caller is prepared - // to wait for interactive authorization, which might take a - // considerable time to complete. For instance, if this flag is set, - // it would be appropriate to query the user for passwords or - // confirmation via Polkit or a similar framework. - FlagAllowInteractiveAuthorization ) // Type represents the possible types of a D-Bus message. @@ -255,7 +248,7 @@ func (msg *Message) EncodeTo(out io.Writer, order binary.ByteOrder) error { // IsValid checks whether msg is a valid message and returns an // InvalidMessageError if it is not. func (msg *Message) IsValid() error { - if msg.Flags & ^(FlagNoAutoStart|FlagNoReplyExpected|FlagAllowInteractiveAuthorization) != 0 { + if msg.Flags & ^(FlagNoAutoStart|FlagNoReplyExpected) != 0 { return InvalidMessageError("invalid flags") } if msg.Type == 0 || msg.Type >= typeMax { diff --git a/vendor/github.com/godbus/dbus/object.go b/vendor/github.com/godbus/dbus/object.go index 333672535..7ef45da4c 100644 --- a/vendor/github.com/godbus/dbus/object.go +++ b/vendor/github.com/godbus/dbus/object.go @@ -27,16 +27,6 @@ func (o *Object) Call(method string, flags Flags, args ...interface{}) *Call { return <-o.Go(method, flags, make(chan *Call, 1), args...).Done } -// AddMatchSignal subscribes BusObject to signals from specified interface and -// method (member). -func (o *Object) AddMatchSignal(iface, member string) *Call { - return o.Call( - "org.freedesktop.DBus.AddMatch", - 0, - "type='signal',interface='"+iface+"',member='"+member+"'", - ) -} - // Go calls a method with the given arguments asynchronously. It returns a // Call structure representing this method call. The passed channel will // return the same value once the call is done. If ch is nil, a new channel @@ -125,12 +115,12 @@ func (o *Object) GetProperty(p string) (Variant, error) { return result, nil } -// Destination returns the destination that calls on (o *Object) are sent to. +// Destination returns the destination that calls on o are sent to. func (o *Object) Destination() string { return o.dest } -// Path returns the path that calls on (o *Object") are sent to. +// Path returns the path that calls on o are sent to. func (o *Object) Path() ObjectPath { return o.path } diff --git a/vendor/github.com/godbus/dbus/server_interfaces.go b/vendor/github.com/godbus/dbus/server_interfaces.go deleted file mode 100644 index 091948aef..000000000 --- a/vendor/github.com/godbus/dbus/server_interfaces.go +++ /dev/null @@ -1,89 +0,0 @@ -package dbus - -// Terminator allows a handler to implement a shutdown mechanism that -// is called when the connection terminates. -type Terminator interface { - Terminate() -} - -// Handler is the representation of a D-Bus Application. -// -// The Handler must have a way to lookup objects given -// an ObjectPath. The returned object must implement the -// ServerObject interface. -type Handler interface { - LookupObject(path ObjectPath) (ServerObject, bool) -} - -// ServerObject is the representation of an D-Bus Object. -// -// Objects are registered at a path for a given Handler. -// The Objects implement D-Bus interfaces. The semantics -// of Interface lookup is up to the implementation of -// the ServerObject. The ServerObject implementation may -// choose to implement empty string as a valid interface -// represeting all methods or not per the D-Bus specification. -type ServerObject interface { - LookupInterface(name string) (Interface, bool) -} - -// An Interface is the representation of a D-Bus Interface. -// -// Interfaces are a grouping of methods implemented by the Objects. -// Interfaces are responsible for routing method calls. -type Interface interface { - LookupMethod(name string) (Method, bool) -} - -// A Method represents the exposed methods on D-Bus. -type Method interface { - // Call requires that all arguments are decoded before being passed to it. - Call(args ...interface{}) ([]interface{}, error) - NumArguments() int - NumReturns() int - // ArgumentValue returns a representative value for the argument at position - // it should be of the proper type. reflect.Zero would be a good mechanism - // to use for this Value. - ArgumentValue(position int) interface{} - // ReturnValue returns a representative value for the return at position - // it should be of the proper type. reflect.Zero would be a good mechanism - // to use for this Value. - ReturnValue(position int) interface{} -} - -// An Argument Decoder can decode arguments using the non-standard mechanism -// -// If a method implements this interface then the non-standard -// decoder will be used. -// -// Method arguments must be decoded from the message. -// The mechanism for doing this will vary based on the -// implementation of the method. A normal approach is provided -// as part of this library, but may be replaced with -// any other decoding scheme. -type ArgumentDecoder interface { - // To decode the arguments of a method the sender and message are - // provided incase the semantics of the implementer provides access - // to these as part of the method invocation. - DecodeArguments(conn *Conn, sender string, msg *Message, args []interface{}) ([]interface{}, error) -} - -// A SignalHandler is responsible for delivering a signal. -// -// Signal delivery may be changed from the default channel -// based approach by Handlers implementing the SignalHandler -// interface. -type SignalHandler interface { - DeliverSignal(iface, name string, signal *Signal) -} - -// A DBusError is used to convert a generic object to a D-Bus error. -// -// Any custom error mechanism may implement this interface to provide -// a custom encoding of the error on D-Bus. By default if a normal -// error is returned, it will be encoded as the generic -// "org.freedesktop.DBus.Error.Failed" error. By implementing this -// interface as well a custom encoding may be provided. -type DBusError interface { - DBusError() (string, []interface{}) -} diff --git a/vendor/github.com/godbus/dbus/sig.go b/vendor/github.com/godbus/dbus/sig.go index c1b809202..f45b53ce1 100644 --- a/vendor/github.com/godbus/dbus/sig.go +++ b/vendor/github.com/godbus/dbus/sig.go @@ -57,12 +57,12 @@ func getSignature(t reflect.Type) string { return "n" case reflect.Uint16: return "q" - case reflect.Int, reflect.Int32: + case reflect.Int32: if t == unixFDType { return "h" } return "i" - case reflect.Uint, reflect.Uint32: + case reflect.Uint32: if t == unixFDIndexType { return "h" } @@ -101,8 +101,6 @@ func getSignature(t reflect.Type) string { panic(InvalidTypeError{t}) } return "a{" + getSignature(t.Key()) + getSignature(t.Elem()) + "}" - case reflect.Interface: - return "v" } panic(InvalidTypeError{t}) } @@ -164,7 +162,7 @@ func (e SignatureError) Error() string { return fmt.Sprintf("dbus: invalid signature: %q (%s)", e.Sig, e.Reason) } -// Try to read a single type from this string. If it was successful, err is nil +// Try to read a single type from this string. If it was successfull, err is nil // and rem is the remaining unparsed part. Otherwise, err is a non-nil // SignatureError and rem is "". depth is the current recursion depth which may // not be greater than 64 and should be given as 0 on the first call. diff --git a/vendor/github.com/godbus/dbus/transport_generic.go b/vendor/github.com/godbus/dbus/transport_generic.go index 3fad859a6..46f8f49d6 100644 --- a/vendor/github.com/godbus/dbus/transport_generic.go +++ b/vendor/github.com/godbus/dbus/transport_generic.go @@ -4,23 +4,8 @@ import ( "encoding/binary" "errors" "io" - "unsafe" ) -var nativeEndian binary.ByteOrder - -func detectEndianness() binary.ByteOrder { - var x uint32 = 0x01020304 - if *(*byte)(unsafe.Pointer(&x)) == 0x01 { - return binary.BigEndian - } - return binary.LittleEndian -} - -func init() { - nativeEndian = detectEndianness() -} - type genericTransport struct { io.ReadWriteCloser } @@ -46,5 +31,5 @@ func (t genericTransport) SendMessage(msg *Message) error { return errors.New("dbus: unix fd passing not enabled") } } - return msg.EncodeTo(t, nativeEndian) + return msg.EncodeTo(t, binary.LittleEndian) } diff --git a/vendor/github.com/godbus/dbus/transport_tcp.go b/vendor/github.com/godbus/dbus/transport_tcp.go deleted file mode 100644 index dd1c8e59c..000000000 --- a/vendor/github.com/godbus/dbus/transport_tcp.go +++ /dev/null @@ -1,43 +0,0 @@ -//+build !windows - -package dbus - -import ( - "errors" - "net" -) - -func init() { - transports["tcp"] = newTcpTransport -} - -func tcpFamily(keys string) (string, error) { - switch getKey(keys, "family") { - case "": - return "tcp", nil - case "ipv4": - return "tcp4", nil - case "ipv6": - return "tcp6", nil - default: - return "", errors.New("dbus: invalid tcp family (must be ipv4 or ipv6)") - } -} - -func newTcpTransport(keys string) (transport, error) { - host := getKey(keys, "host") - port := getKey(keys, "port") - if host == "" || port == "" { - return nil, errors.New("dbus: unsupported address (must set host and port)") - } - - protocol, err := tcpFamily(keys) - if err != nil { - return nil, err - } - socket, err := net.Dial(protocol, net.JoinHostPort(host, port)) - if err != nil { - return nil, err - } - return NewConn(socket) -} diff --git a/vendor/github.com/godbus/dbus/transport_unix.go b/vendor/github.com/godbus/dbus/transport_unix.go index e56d5ca90..3fafeabb1 100644 --- a/vendor/github.com/godbus/dbus/transport_unix.go +++ b/vendor/github.com/godbus/dbus/transport_unix.go @@ -1,4 +1,4 @@ -//+build !windows,!solaris +//+build !windows package dbus @@ -175,7 +175,7 @@ func (t *unixTransport) SendMessage(msg *Message) error { msg.Headers[FieldUnixFDs] = MakeVariant(uint32(len(fds))) oob := syscall.UnixRights(fds...) buf := new(bytes.Buffer) - msg.EncodeTo(buf, nativeEndian) + msg.EncodeTo(buf, binary.LittleEndian) n, oobn, err := t.UnixConn.WriteMsgUnix(buf.Bytes(), oob, nil) if err != nil { return err @@ -184,7 +184,7 @@ func (t *unixTransport) SendMessage(msg *Message) error { return io.ErrShortWrite } } else { - if err := msg.EncodeTo(t, nativeEndian); err != nil { + if err := msg.EncodeTo(t, binary.LittleEndian); err != nil { return nil } } diff --git a/vendor/github.com/godbus/dbus/transport_unixcred_freebsd.go b/vendor/github.com/godbus/dbus/transport_unixcred_freebsd.go deleted file mode 100644 index 0fc5b9273..000000000 --- a/vendor/github.com/godbus/dbus/transport_unixcred_freebsd.go +++ /dev/null @@ -1,91 +0,0 @@ -// The UnixCredentials system call is currently only implemented on Linux -// http://golang.org/src/pkg/syscall/sockcmsg_linux.go -// https://golang.org/s/go1.4-syscall -// http://code.google.com/p/go/source/browse/unix/sockcmsg_linux.go?repo=sys - -// Local implementation of the UnixCredentials system call for FreeBSD - -package dbus - -/* -const int sizeofPtr = sizeof(void*); -#define _WANT_UCRED -#include -*/ -import "C" - -import ( - "io" - "os" - "syscall" - "unsafe" -) - -// http://golang.org/src/pkg/syscall/ztypes_linux_amd64.go -// https://golang.org/src/syscall/ztypes_freebsd_amd64.go -type Ucred struct { - Pid int32 - Uid uint32 - Gid uint32 -} - -// http://golang.org/src/pkg/syscall/types_linux.go -// https://golang.org/src/syscall/types_freebsd.go -// https://github.com/freebsd/freebsd/blob/master/sys/sys/ucred.h -const ( - SizeofUcred = C.sizeof_struct_ucred -) - -// http://golang.org/src/pkg/syscall/sockcmsg_unix.go -func cmsgAlignOf(salen int) int { - salign := C.sizeofPtr - - return (salen + salign - 1) & ^(salign - 1) -} - -// http://golang.org/src/pkg/syscall/sockcmsg_unix.go -func cmsgData(h *syscall.Cmsghdr) unsafe.Pointer { - return unsafe.Pointer(uintptr(unsafe.Pointer(h)) + uintptr(cmsgAlignOf(syscall.SizeofCmsghdr))) -} - -// http://golang.org/src/pkg/syscall/sockcmsg_linux.go -// UnixCredentials encodes credentials into a socket control message -// for sending to another process. This can be used for -// authentication. -func UnixCredentials(ucred *Ucred) []byte { - b := make([]byte, syscall.CmsgSpace(SizeofUcred)) - h := (*syscall.Cmsghdr)(unsafe.Pointer(&b[0])) - h.Level = syscall.SOL_SOCKET - h.Type = syscall.SCM_CREDS - h.SetLen(syscall.CmsgLen(SizeofUcred)) - *((*Ucred)(cmsgData(h))) = *ucred - return b -} - -// http://golang.org/src/pkg/syscall/sockcmsg_linux.go -// ParseUnixCredentials decodes a socket control message that contains -// credentials in a Ucred structure. To receive such a message, the -// SO_PASSCRED option must be enabled on the socket. -func ParseUnixCredentials(m *syscall.SocketControlMessage) (*Ucred, error) { - if m.Header.Level != syscall.SOL_SOCKET { - return nil, syscall.EINVAL - } - if m.Header.Type != syscall.SCM_CREDS { - return nil, syscall.EINVAL - } - ucred := *(*Ucred)(unsafe.Pointer(&m.Data[0])) - return &ucred, nil -} - -func (t *unixTransport) SendNullByte() error { - ucred := &Ucred{Pid: int32(os.Getpid()), Uid: uint32(os.Getuid()), Gid: uint32(os.Getgid())} - b := UnixCredentials(ucred) - _, oobn, err := t.UnixConn.WriteMsgUnix([]byte{0}, b, nil) - if err != nil { - return err - } - if oobn != len(b) { - return io.ErrShortWrite - } - return nil -} diff --git a/vendor/github.com/godbus/dbus/transport_unixcred_openbsd.go b/vendor/github.com/godbus/dbus/transport_unixcred_openbsd.go deleted file mode 100644 index af7bafdf9..000000000 --- a/vendor/github.com/godbus/dbus/transport_unixcred_openbsd.go +++ /dev/null @@ -1,14 +0,0 @@ -package dbus - -import "io" - -func (t *unixTransport) SendNullByte() error { - n, _, err := t.UnixConn.WriteMsgUnix([]byte{0}, nil, nil) - if err != nil { - return err - } - if n != 1 { - return io.ErrShortWrite - } - return nil -} diff --git a/vendor/github.com/godbus/dbus/variant.go b/vendor/github.com/godbus/dbus/variant.go index 0ca123b01..b7b13ae90 100644 --- a/vendor/github.com/godbus/dbus/variant.go +++ b/vendor/github.com/godbus/dbus/variant.go @@ -17,12 +17,7 @@ type Variant struct { // MakeVariant converts the given value to a Variant. It panics if v cannot be // represented as a D-Bus type. func MakeVariant(v interface{}) Variant { - return MakeVariantWithSignature(v, SignatureOf(v)) -} - -// MakeVariantWithSignature converts the given value to a Variant. -func MakeVariantWithSignature(v interface{}, s Signature) Variant { - return Variant{s, v} + return Variant{SignatureOf(v), v} } // ParseVariant parses the given string as a variant as described at diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go index 4520328ab..1b7d59d89 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux.go @@ -1262,7 +1262,6 @@ func Getpgrp() (pid int) { //sys PivotRoot(newroot string, putold string) (err error) = SYS_PIVOT_ROOT //sysnb prlimit(pid int, resource int, newlimit *Rlimit, old *Rlimit) (err error) = SYS_PRLIMIT64 //sys Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (err error) -//sys Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) = SYS_PSELECT6 //sys read(fd int, p []byte) (n int, err error) //sys Removexattr(path string, attr string) (err error) //sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go b/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go index e16a0d141..68cc975db 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_arm64.go @@ -21,12 +21,7 @@ package unix //sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 //sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK - -func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { - ts := Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000} - return Pselect(nfd, r, w, e, &ts, nil) -} - +//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS_PSELECT6 //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) //sys Setfsgid(gid int) (err error) //sys Setfsuid(uid int) (err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go b/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go index 92e620ea5..977df441b 100644 --- a/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go +++ b/vendor/golang.org/x/sys/unix/syscall_linux_mips64x.go @@ -23,12 +23,7 @@ package unix //sys Pread(fd int, p []byte, offset int64) (n int, err error) = SYS_PREAD64 //sys Pwrite(fd int, p []byte, offset int64) (n int, err error) = SYS_PWRITE64 //sys Seek(fd int, offset int64, whence int) (off int64, err error) = SYS_LSEEK - -func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { - ts := Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000} - return Pselect(nfd, r, w, e, &ts, nil) -} - +//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) = SYS_PSELECT6 //sys sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) //sys Setfsgid(gid int) (err error) //sys Setfsuid(uid int) (err error) diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go index adf5eef0f..1d3eec44d 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go +++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_386.go @@ -981,49 +981,6 @@ const ( MAP_STACK = 0x400 MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 - MNT_ACLS = 0x8000000 - MNT_ASYNC = 0x40 - MNT_AUTOMOUNTED = 0x200000000 - MNT_BYFSID = 0x8000000 - MNT_CMDFLAGS = 0xd0f0000 - MNT_DEFEXPORTED = 0x200 - MNT_DELEXPORT = 0x20000 - MNT_EXKERB = 0x800 - MNT_EXPORTANON = 0x400 - MNT_EXPORTED = 0x100 - MNT_EXPUBLIC = 0x20000000 - MNT_EXRDONLY = 0x80 - MNT_FORCE = 0x80000 - MNT_GJOURNAL = 0x2000000 - MNT_IGNORE = 0x800000 - MNT_LAZY = 0x3 - MNT_LOCAL = 0x1000 - MNT_MULTILABEL = 0x4000000 - MNT_NFS4ACLS = 0x10 - MNT_NOATIME = 0x10000000 - MNT_NOCLUSTERR = 0x40000000 - MNT_NOCLUSTERW = 0x80000000 - MNT_NOEXEC = 0x4 - MNT_NONBUSY = 0x4000000 - MNT_NOSUID = 0x8 - MNT_NOSYMFOLLOW = 0x400000 - MNT_NOWAIT = 0x2 - MNT_QUOTA = 0x2000 - MNT_RDONLY = 0x1 - MNT_RELOAD = 0x40000 - MNT_ROOTFS = 0x4000 - MNT_SNAPSHOT = 0x1000000 - MNT_SOFTDEP = 0x200000 - MNT_SUIDDIR = 0x100000 - MNT_SUJ = 0x100000000 - MNT_SUSPEND = 0x4 - MNT_SYNCHRONOUS = 0x2 - MNT_UNION = 0x20 - MNT_UPDATE = 0x10000 - MNT_UPDATEMASK = 0x2d8d0807e - MNT_USER = 0x8000 - MNT_VISFLAGMASK = 0x3fef0ffff - MNT_WAIT = 0x1 MSG_CMSG_CLOEXEC = 0x40000 MSG_COMPAT = 0x8000 MSG_CTRUNC = 0x20 diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go index 360caff4f..ac094f9cf 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go +++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go @@ -982,49 +982,6 @@ const ( MAP_STACK = 0x400 MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 - MNT_ACLS = 0x8000000 - MNT_ASYNC = 0x40 - MNT_AUTOMOUNTED = 0x200000000 - MNT_BYFSID = 0x8000000 - MNT_CMDFLAGS = 0xd0f0000 - MNT_DEFEXPORTED = 0x200 - MNT_DELEXPORT = 0x20000 - MNT_EXKERB = 0x800 - MNT_EXPORTANON = 0x400 - MNT_EXPORTED = 0x100 - MNT_EXPUBLIC = 0x20000000 - MNT_EXRDONLY = 0x80 - MNT_FORCE = 0x80000 - MNT_GJOURNAL = 0x2000000 - MNT_IGNORE = 0x800000 - MNT_LAZY = 0x3 - MNT_LOCAL = 0x1000 - MNT_MULTILABEL = 0x4000000 - MNT_NFS4ACLS = 0x10 - MNT_NOATIME = 0x10000000 - MNT_NOCLUSTERR = 0x40000000 - MNT_NOCLUSTERW = 0x80000000 - MNT_NOEXEC = 0x4 - MNT_NONBUSY = 0x4000000 - MNT_NOSUID = 0x8 - MNT_NOSYMFOLLOW = 0x400000 - MNT_NOWAIT = 0x2 - MNT_QUOTA = 0x2000 - MNT_RDONLY = 0x1 - MNT_RELOAD = 0x40000 - MNT_ROOTFS = 0x4000 - MNT_SNAPSHOT = 0x1000000 - MNT_SOFTDEP = 0x200000 - MNT_SUIDDIR = 0x100000 - MNT_SUJ = 0x100000000 - MNT_SUSPEND = 0x4 - MNT_SYNCHRONOUS = 0x2 - MNT_UNION = 0x20 - MNT_UPDATE = 0x10000 - MNT_UPDATEMASK = 0x2d8d0807e - MNT_USER = 0x8000 - MNT_VISFLAGMASK = 0x3fef0ffff - MNT_WAIT = 0x1 MSG_CMSG_CLOEXEC = 0x40000 MSG_COMPAT = 0x8000 MSG_CTRUNC = 0x20 diff --git a/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go b/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go index 87deda950..c5c6f13e5 100644 --- a/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go +++ b/vendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go @@ -989,49 +989,6 @@ const ( MAP_STACK = 0x400 MCL_CURRENT = 0x1 MCL_FUTURE = 0x2 - MNT_ACLS = 0x8000000 - MNT_ASYNC = 0x40 - MNT_AUTOMOUNTED = 0x200000000 - MNT_BYFSID = 0x8000000 - MNT_CMDFLAGS = 0xd0f0000 - MNT_DEFEXPORTED = 0x200 - MNT_DELEXPORT = 0x20000 - MNT_EXKERB = 0x800 - MNT_EXPORTANON = 0x400 - MNT_EXPORTED = 0x100 - MNT_EXPUBLIC = 0x20000000 - MNT_EXRDONLY = 0x80 - MNT_FORCE = 0x80000 - MNT_GJOURNAL = 0x2000000 - MNT_IGNORE = 0x800000 - MNT_LAZY = 0x3 - MNT_LOCAL = 0x1000 - MNT_MULTILABEL = 0x4000000 - MNT_NFS4ACLS = 0x10 - MNT_NOATIME = 0x10000000 - MNT_NOCLUSTERR = 0x40000000 - MNT_NOCLUSTERW = 0x80000000 - MNT_NOEXEC = 0x4 - MNT_NONBUSY = 0x4000000 - MNT_NOSUID = 0x8 - MNT_NOSYMFOLLOW = 0x400000 - MNT_NOWAIT = 0x2 - MNT_QUOTA = 0x2000 - MNT_RDONLY = 0x1 - MNT_RELOAD = 0x40000 - MNT_ROOTFS = 0x4000 - MNT_SNAPSHOT = 0x1000000 - MNT_SOFTDEP = 0x200000 - MNT_SUIDDIR = 0x100000 - MNT_SUJ = 0x100000000 - MNT_SUSPEND = 0x4 - MNT_SYNCHRONOUS = 0x2 - MNT_UNION = 0x20 - MNT_UPDATE = 0x10000 - MNT_UPDATEMASK = 0x2d8d0807e - MNT_USER = 0x8000 - MNT_VISFLAGMASK = 0x3fef0ffff - MNT_WAIT = 0x1 MSG_CMSG_CLOEXEC = 0x40000 MSG_COMPAT = 0x8000 MSG_CTRUNC = 0x20 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go index 85a2907e5..000a46833 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_386.go @@ -1035,17 +1035,6 @@ func Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) ( // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { - r0, _, e1 := Syscall6(SYS_PSELECT6, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func read(fd int, p []byte) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go index 8e2be97d3..712dffde4 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go @@ -1035,17 +1035,6 @@ func Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) ( // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { - r0, _, e1 := Syscall6(SYS_PSELECT6, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func read(fd int, p []byte) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go index 5ff0637fd..338796d90 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm.go @@ -1035,17 +1035,6 @@ func Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) ( // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { - r0, _, e1 := Syscall6(SYS_PSELECT6, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func read(fd int, p []byte) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go index 40760110f..fc3006d97 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go @@ -1035,17 +1035,6 @@ func Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) ( // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { - r0, _, e1 := Syscall6(SYS_PSELECT6, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func read(fd int, p []byte) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { @@ -1678,6 +1667,17 @@ func Seek(fd int, offset int64, whence int) (off int64, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { + r0, _, e1 := Syscall6(SYS_PSELECT6, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { r0, _, e1 := Syscall6(SYS_SENDFILE, uintptr(outfd), uintptr(infd), uintptr(unsafe.Pointer(offset)), uintptr(count), 0, 0) written = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go index 984e56173..4b0ef2076 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips.go @@ -1035,17 +1035,6 @@ func Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) ( // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { - r0, _, e1 := Syscall6(SYS_PSELECT6, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func read(fd int, p []byte) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go index f98194e24..31eb98c7d 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go @@ -1035,17 +1035,6 @@ func Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) ( // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { - r0, _, e1 := Syscall6(SYS_PSELECT6, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func read(fd int, p []byte) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { @@ -1688,6 +1677,17 @@ func Seek(fd int, offset int64, whence int) (off int64, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { + r0, _, e1 := Syscall6(SYS_PSELECT6, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { r0, _, e1 := Syscall6(SYS_SENDFILE, uintptr(outfd), uintptr(infd), uintptr(unsafe.Pointer(offset)), uintptr(count), 0, 0) written = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go index f30267019..875ffa33f 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go @@ -1035,17 +1035,6 @@ func Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) ( // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { - r0, _, e1 := Syscall6(SYS_PSELECT6, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func read(fd int, p []byte) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { @@ -1688,6 +1677,17 @@ func Seek(fd int, offset int64, whence int) (off int64, err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { + r0, _, e1 := Syscall6(SYS_PSELECT6, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) + n = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { r0, _, e1 := Syscall6(SYS_SENDFILE, uintptr(outfd), uintptr(infd), uintptr(unsafe.Pointer(offset)), uintptr(count), 0, 0) written = int(r0) diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go index f18c5e4a7..6863e81aa 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go @@ -1035,17 +1035,6 @@ func Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) ( // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { - r0, _, e1 := Syscall6(SYS_PSELECT6, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func read(fd int, p []byte) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go index bc268243c..2a32c6b41 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go @@ -1035,17 +1035,6 @@ func Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) ( // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { - r0, _, e1 := Syscall6(SYS_PSELECT6, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func read(fd int, p []byte) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go index 8d874cbcd..8172d3558 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go @@ -1035,17 +1035,6 @@ func Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) ( // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { - r0, _, e1 := Syscall6(SYS_PSELECT6, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func read(fd int, p []byte) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go b/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go index 169321273..49021966f 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go @@ -1035,17 +1035,6 @@ func Prctl(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) ( // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func Pselect(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timespec, sigmask *Sigset_t) (n int, err error) { - r0, _, e1 := Syscall6(SYS_PSELECT6, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), uintptr(unsafe.Pointer(sigmask))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - func read(fd int, p []byte) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd.go similarity index 100% rename from vendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go rename to vendor/golang.org/x/sys/unix/zsysctl_openbsd.go diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go deleted file mode 100644 index 83bb935b9..000000000 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go +++ /dev/null @@ -1,270 +0,0 @@ -// mksysctl_openbsd.pl -// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT - -package unix - -type mibentry struct { - ctlname string - ctloid []_C_int -} - -var sysctlMib = []mibentry{ - {"ddb.console", []_C_int{9, 6}}, - {"ddb.log", []_C_int{9, 7}}, - {"ddb.max_line", []_C_int{9, 3}}, - {"ddb.max_width", []_C_int{9, 2}}, - {"ddb.panic", []_C_int{9, 5}}, - {"ddb.radix", []_C_int{9, 1}}, - {"ddb.tab_stop_width", []_C_int{9, 4}}, - {"ddb.trigger", []_C_int{9, 8}}, - {"fs.posix.setuid", []_C_int{3, 1, 1}}, - {"hw.allowpowerdown", []_C_int{6, 22}}, - {"hw.byteorder", []_C_int{6, 4}}, - {"hw.cpuspeed", []_C_int{6, 12}}, - {"hw.diskcount", []_C_int{6, 10}}, - {"hw.disknames", []_C_int{6, 8}}, - {"hw.diskstats", []_C_int{6, 9}}, - {"hw.machine", []_C_int{6, 1}}, - {"hw.model", []_C_int{6, 2}}, - {"hw.ncpu", []_C_int{6, 3}}, - {"hw.ncpufound", []_C_int{6, 21}}, - {"hw.pagesize", []_C_int{6, 7}}, - {"hw.physmem", []_C_int{6, 19}}, - {"hw.product", []_C_int{6, 15}}, - {"hw.serialno", []_C_int{6, 17}}, - {"hw.setperf", []_C_int{6, 13}}, - {"hw.usermem", []_C_int{6, 20}}, - {"hw.uuid", []_C_int{6, 18}}, - {"hw.vendor", []_C_int{6, 14}}, - {"hw.version", []_C_int{6, 16}}, - {"kern.arandom", []_C_int{1, 37}}, - {"kern.argmax", []_C_int{1, 8}}, - {"kern.boottime", []_C_int{1, 21}}, - {"kern.bufcachepercent", []_C_int{1, 72}}, - {"kern.ccpu", []_C_int{1, 45}}, - {"kern.clockrate", []_C_int{1, 12}}, - {"kern.consdev", []_C_int{1, 75}}, - {"kern.cp_time", []_C_int{1, 40}}, - {"kern.cp_time2", []_C_int{1, 71}}, - {"kern.cryptodevallowsoft", []_C_int{1, 53}}, - {"kern.domainname", []_C_int{1, 22}}, - {"kern.file", []_C_int{1, 73}}, - {"kern.forkstat", []_C_int{1, 42}}, - {"kern.fscale", []_C_int{1, 46}}, - {"kern.fsync", []_C_int{1, 33}}, - {"kern.hostid", []_C_int{1, 11}}, - {"kern.hostname", []_C_int{1, 10}}, - {"kern.intrcnt.nintrcnt", []_C_int{1, 63, 1}}, - {"kern.job_control", []_C_int{1, 19}}, - {"kern.malloc.buckets", []_C_int{1, 39, 1}}, - {"kern.malloc.kmemnames", []_C_int{1, 39, 3}}, - {"kern.maxclusters", []_C_int{1, 67}}, - {"kern.maxfiles", []_C_int{1, 7}}, - {"kern.maxlocksperuid", []_C_int{1, 70}}, - {"kern.maxpartitions", []_C_int{1, 23}}, - {"kern.maxproc", []_C_int{1, 6}}, - {"kern.maxthread", []_C_int{1, 25}}, - {"kern.maxvnodes", []_C_int{1, 5}}, - {"kern.mbstat", []_C_int{1, 59}}, - {"kern.msgbuf", []_C_int{1, 48}}, - {"kern.msgbufsize", []_C_int{1, 38}}, - {"kern.nchstats", []_C_int{1, 41}}, - {"kern.netlivelocks", []_C_int{1, 76}}, - {"kern.nfiles", []_C_int{1, 56}}, - {"kern.ngroups", []_C_int{1, 18}}, - {"kern.nosuidcoredump", []_C_int{1, 32}}, - {"kern.nprocs", []_C_int{1, 47}}, - {"kern.nselcoll", []_C_int{1, 43}}, - {"kern.nthreads", []_C_int{1, 26}}, - {"kern.numvnodes", []_C_int{1, 58}}, - {"kern.osrelease", []_C_int{1, 2}}, - {"kern.osrevision", []_C_int{1, 3}}, - {"kern.ostype", []_C_int{1, 1}}, - {"kern.osversion", []_C_int{1, 27}}, - {"kern.pool_debug", []_C_int{1, 77}}, - {"kern.posix1version", []_C_int{1, 17}}, - {"kern.proc", []_C_int{1, 66}}, - {"kern.random", []_C_int{1, 31}}, - {"kern.rawpartition", []_C_int{1, 24}}, - {"kern.saved_ids", []_C_int{1, 20}}, - {"kern.securelevel", []_C_int{1, 9}}, - {"kern.seminfo", []_C_int{1, 61}}, - {"kern.shminfo", []_C_int{1, 62}}, - {"kern.somaxconn", []_C_int{1, 28}}, - {"kern.sominconn", []_C_int{1, 29}}, - {"kern.splassert", []_C_int{1, 54}}, - {"kern.stackgap_random", []_C_int{1, 50}}, - {"kern.sysvipc_info", []_C_int{1, 51}}, - {"kern.sysvmsg", []_C_int{1, 34}}, - {"kern.sysvsem", []_C_int{1, 35}}, - {"kern.sysvshm", []_C_int{1, 36}}, - {"kern.timecounter.choice", []_C_int{1, 69, 4}}, - {"kern.timecounter.hardware", []_C_int{1, 69, 3}}, - {"kern.timecounter.tick", []_C_int{1, 69, 1}}, - {"kern.timecounter.timestepwarnings", []_C_int{1, 69, 2}}, - {"kern.tty.maxptys", []_C_int{1, 44, 6}}, - {"kern.tty.nptys", []_C_int{1, 44, 7}}, - {"kern.tty.tk_cancc", []_C_int{1, 44, 4}}, - {"kern.tty.tk_nin", []_C_int{1, 44, 1}}, - {"kern.tty.tk_nout", []_C_int{1, 44, 2}}, - {"kern.tty.tk_rawcc", []_C_int{1, 44, 3}}, - {"kern.tty.ttyinfo", []_C_int{1, 44, 5}}, - {"kern.ttycount", []_C_int{1, 57}}, - {"kern.userasymcrypto", []_C_int{1, 60}}, - {"kern.usercrypto", []_C_int{1, 52}}, - {"kern.usermount", []_C_int{1, 30}}, - {"kern.version", []_C_int{1, 4}}, - {"kern.vnode", []_C_int{1, 13}}, - {"kern.watchdog.auto", []_C_int{1, 64, 2}}, - {"kern.watchdog.period", []_C_int{1, 64, 1}}, - {"net.bpf.bufsize", []_C_int{4, 31, 1}}, - {"net.bpf.maxbufsize", []_C_int{4, 31, 2}}, - {"net.inet.ah.enable", []_C_int{4, 2, 51, 1}}, - {"net.inet.ah.stats", []_C_int{4, 2, 51, 2}}, - {"net.inet.carp.allow", []_C_int{4, 2, 112, 1}}, - {"net.inet.carp.log", []_C_int{4, 2, 112, 3}}, - {"net.inet.carp.preempt", []_C_int{4, 2, 112, 2}}, - {"net.inet.carp.stats", []_C_int{4, 2, 112, 4}}, - {"net.inet.divert.recvspace", []_C_int{4, 2, 258, 1}}, - {"net.inet.divert.sendspace", []_C_int{4, 2, 258, 2}}, - {"net.inet.divert.stats", []_C_int{4, 2, 258, 3}}, - {"net.inet.esp.enable", []_C_int{4, 2, 50, 1}}, - {"net.inet.esp.stats", []_C_int{4, 2, 50, 4}}, - {"net.inet.esp.udpencap", []_C_int{4, 2, 50, 2}}, - {"net.inet.esp.udpencap_port", []_C_int{4, 2, 50, 3}}, - {"net.inet.etherip.allow", []_C_int{4, 2, 97, 1}}, - {"net.inet.etherip.stats", []_C_int{4, 2, 97, 2}}, - {"net.inet.gre.allow", []_C_int{4, 2, 47, 1}}, - {"net.inet.gre.wccp", []_C_int{4, 2, 47, 2}}, - {"net.inet.icmp.bmcastecho", []_C_int{4, 2, 1, 2}}, - {"net.inet.icmp.errppslimit", []_C_int{4, 2, 1, 3}}, - {"net.inet.icmp.maskrepl", []_C_int{4, 2, 1, 1}}, - {"net.inet.icmp.rediraccept", []_C_int{4, 2, 1, 4}}, - {"net.inet.icmp.redirtimeout", []_C_int{4, 2, 1, 5}}, - {"net.inet.icmp.stats", []_C_int{4, 2, 1, 7}}, - {"net.inet.icmp.tstamprepl", []_C_int{4, 2, 1, 6}}, - {"net.inet.igmp.stats", []_C_int{4, 2, 2, 1}}, - {"net.inet.ip.arpqueued", []_C_int{4, 2, 0, 36}}, - {"net.inet.ip.encdebug", []_C_int{4, 2, 0, 12}}, - {"net.inet.ip.forwarding", []_C_int{4, 2, 0, 1}}, - {"net.inet.ip.ifq.congestion", []_C_int{4, 2, 0, 30, 4}}, - {"net.inet.ip.ifq.drops", []_C_int{4, 2, 0, 30, 3}}, - {"net.inet.ip.ifq.len", []_C_int{4, 2, 0, 30, 1}}, - {"net.inet.ip.ifq.maxlen", []_C_int{4, 2, 0, 30, 2}}, - {"net.inet.ip.maxqueue", []_C_int{4, 2, 0, 11}}, - {"net.inet.ip.mforwarding", []_C_int{4, 2, 0, 31}}, - {"net.inet.ip.mrtproto", []_C_int{4, 2, 0, 34}}, - {"net.inet.ip.mrtstats", []_C_int{4, 2, 0, 35}}, - {"net.inet.ip.mtu", []_C_int{4, 2, 0, 4}}, - {"net.inet.ip.mtudisc", []_C_int{4, 2, 0, 27}}, - {"net.inet.ip.mtudisctimeout", []_C_int{4, 2, 0, 28}}, - {"net.inet.ip.multipath", []_C_int{4, 2, 0, 32}}, - {"net.inet.ip.portfirst", []_C_int{4, 2, 0, 7}}, - {"net.inet.ip.porthifirst", []_C_int{4, 2, 0, 9}}, - {"net.inet.ip.porthilast", []_C_int{4, 2, 0, 10}}, - {"net.inet.ip.portlast", []_C_int{4, 2, 0, 8}}, - {"net.inet.ip.redirect", []_C_int{4, 2, 0, 2}}, - {"net.inet.ip.sourceroute", []_C_int{4, 2, 0, 5}}, - {"net.inet.ip.stats", []_C_int{4, 2, 0, 33}}, - {"net.inet.ip.ttl", []_C_int{4, 2, 0, 3}}, - {"net.inet.ipcomp.enable", []_C_int{4, 2, 108, 1}}, - {"net.inet.ipcomp.stats", []_C_int{4, 2, 108, 2}}, - {"net.inet.ipip.allow", []_C_int{4, 2, 4, 1}}, - {"net.inet.ipip.stats", []_C_int{4, 2, 4, 2}}, - {"net.inet.mobileip.allow", []_C_int{4, 2, 55, 1}}, - {"net.inet.pfsync.stats", []_C_int{4, 2, 240, 1}}, - {"net.inet.pim.stats", []_C_int{4, 2, 103, 1}}, - {"net.inet.tcp.ackonpush", []_C_int{4, 2, 6, 13}}, - {"net.inet.tcp.always_keepalive", []_C_int{4, 2, 6, 22}}, - {"net.inet.tcp.baddynamic", []_C_int{4, 2, 6, 6}}, - {"net.inet.tcp.drop", []_C_int{4, 2, 6, 19}}, - {"net.inet.tcp.ecn", []_C_int{4, 2, 6, 14}}, - {"net.inet.tcp.ident", []_C_int{4, 2, 6, 9}}, - {"net.inet.tcp.keepidle", []_C_int{4, 2, 6, 3}}, - {"net.inet.tcp.keepinittime", []_C_int{4, 2, 6, 2}}, - {"net.inet.tcp.keepintvl", []_C_int{4, 2, 6, 4}}, - {"net.inet.tcp.mssdflt", []_C_int{4, 2, 6, 11}}, - {"net.inet.tcp.reasslimit", []_C_int{4, 2, 6, 18}}, - {"net.inet.tcp.rfc1323", []_C_int{4, 2, 6, 1}}, - {"net.inet.tcp.rfc3390", []_C_int{4, 2, 6, 17}}, - {"net.inet.tcp.rstppslimit", []_C_int{4, 2, 6, 12}}, - {"net.inet.tcp.sack", []_C_int{4, 2, 6, 10}}, - {"net.inet.tcp.sackholelimit", []_C_int{4, 2, 6, 20}}, - {"net.inet.tcp.slowhz", []_C_int{4, 2, 6, 5}}, - {"net.inet.tcp.stats", []_C_int{4, 2, 6, 21}}, - {"net.inet.tcp.synbucketlimit", []_C_int{4, 2, 6, 16}}, - {"net.inet.tcp.syncachelimit", []_C_int{4, 2, 6, 15}}, - {"net.inet.udp.baddynamic", []_C_int{4, 2, 17, 2}}, - {"net.inet.udp.checksum", []_C_int{4, 2, 17, 1}}, - {"net.inet.udp.recvspace", []_C_int{4, 2, 17, 3}}, - {"net.inet.udp.sendspace", []_C_int{4, 2, 17, 4}}, - {"net.inet.udp.stats", []_C_int{4, 2, 17, 5}}, - {"net.inet6.divert.recvspace", []_C_int{4, 24, 86, 1}}, - {"net.inet6.divert.sendspace", []_C_int{4, 24, 86, 2}}, - {"net.inet6.divert.stats", []_C_int{4, 24, 86, 3}}, - {"net.inet6.icmp6.errppslimit", []_C_int{4, 24, 30, 14}}, - {"net.inet6.icmp6.mtudisc_hiwat", []_C_int{4, 24, 30, 16}}, - {"net.inet6.icmp6.mtudisc_lowat", []_C_int{4, 24, 30, 17}}, - {"net.inet6.icmp6.nd6_debug", []_C_int{4, 24, 30, 18}}, - {"net.inet6.icmp6.nd6_delay", []_C_int{4, 24, 30, 8}}, - {"net.inet6.icmp6.nd6_maxnudhint", []_C_int{4, 24, 30, 15}}, - {"net.inet6.icmp6.nd6_mmaxtries", []_C_int{4, 24, 30, 10}}, - {"net.inet6.icmp6.nd6_prune", []_C_int{4, 24, 30, 6}}, - {"net.inet6.icmp6.nd6_umaxtries", []_C_int{4, 24, 30, 9}}, - {"net.inet6.icmp6.nd6_useloopback", []_C_int{4, 24, 30, 11}}, - {"net.inet6.icmp6.nodeinfo", []_C_int{4, 24, 30, 13}}, - {"net.inet6.icmp6.rediraccept", []_C_int{4, 24, 30, 2}}, - {"net.inet6.icmp6.redirtimeout", []_C_int{4, 24, 30, 3}}, - {"net.inet6.ip6.accept_rtadv", []_C_int{4, 24, 17, 12}}, - {"net.inet6.ip6.auto_flowlabel", []_C_int{4, 24, 17, 17}}, - {"net.inet6.ip6.dad_count", []_C_int{4, 24, 17, 16}}, - {"net.inet6.ip6.dad_pending", []_C_int{4, 24, 17, 49}}, - {"net.inet6.ip6.defmcasthlim", []_C_int{4, 24, 17, 18}}, - {"net.inet6.ip6.forwarding", []_C_int{4, 24, 17, 1}}, - {"net.inet6.ip6.forwsrcrt", []_C_int{4, 24, 17, 5}}, - {"net.inet6.ip6.hdrnestlimit", []_C_int{4, 24, 17, 15}}, - {"net.inet6.ip6.hlim", []_C_int{4, 24, 17, 3}}, - {"net.inet6.ip6.log_interval", []_C_int{4, 24, 17, 14}}, - {"net.inet6.ip6.maxdynroutes", []_C_int{4, 24, 17, 48}}, - {"net.inet6.ip6.maxfragpackets", []_C_int{4, 24, 17, 9}}, - {"net.inet6.ip6.maxfrags", []_C_int{4, 24, 17, 41}}, - {"net.inet6.ip6.maxifdefrouters", []_C_int{4, 24, 17, 47}}, - {"net.inet6.ip6.maxifprefixes", []_C_int{4, 24, 17, 46}}, - {"net.inet6.ip6.mforwarding", []_C_int{4, 24, 17, 42}}, - {"net.inet6.ip6.mrtproto", []_C_int{4, 24, 17, 8}}, - {"net.inet6.ip6.mtudisctimeout", []_C_int{4, 24, 17, 50}}, - {"net.inet6.ip6.multicast_mtudisc", []_C_int{4, 24, 17, 44}}, - {"net.inet6.ip6.multipath", []_C_int{4, 24, 17, 43}}, - {"net.inet6.ip6.neighborgcthresh", []_C_int{4, 24, 17, 45}}, - {"net.inet6.ip6.redirect", []_C_int{4, 24, 17, 2}}, - {"net.inet6.ip6.rr_prune", []_C_int{4, 24, 17, 22}}, - {"net.inet6.ip6.sourcecheck", []_C_int{4, 24, 17, 10}}, - {"net.inet6.ip6.sourcecheck_logint", []_C_int{4, 24, 17, 11}}, - {"net.inet6.ip6.use_deprecated", []_C_int{4, 24, 17, 21}}, - {"net.inet6.ip6.v6only", []_C_int{4, 24, 17, 24}}, - {"net.key.sadb_dump", []_C_int{4, 30, 1}}, - {"net.key.spd_dump", []_C_int{4, 30, 2}}, - {"net.mpls.ifq.congestion", []_C_int{4, 33, 3, 4}}, - {"net.mpls.ifq.drops", []_C_int{4, 33, 3, 3}}, - {"net.mpls.ifq.len", []_C_int{4, 33, 3, 1}}, - {"net.mpls.ifq.maxlen", []_C_int{4, 33, 3, 2}}, - {"net.mpls.mapttl_ip", []_C_int{4, 33, 5}}, - {"net.mpls.mapttl_ip6", []_C_int{4, 33, 6}}, - {"net.mpls.maxloop_inkernel", []_C_int{4, 33, 4}}, - {"net.mpls.ttl", []_C_int{4, 33, 2}}, - {"net.pflow.stats", []_C_int{4, 34, 1}}, - {"net.pipex.enable", []_C_int{4, 35, 1}}, - {"vm.anonmin", []_C_int{2, 7}}, - {"vm.loadavg", []_C_int{2, 2}}, - {"vm.maxslp", []_C_int{2, 10}}, - {"vm.nkmempages", []_C_int{2, 6}}, - {"vm.psstrings", []_C_int{2, 3}}, - {"vm.swapencrypt.enable", []_C_int{2, 5, 0}}, - {"vm.swapencrypt.keyscreated", []_C_int{2, 5, 1}}, - {"vm.swapencrypt.keysdeleted", []_C_int{2, 5, 2}}, - {"vm.uspace", []_C_int{2, 11}}, - {"vm.uvmexp", []_C_int{2, 4}}, - {"vm.vmmeter", []_C_int{2, 1}}, - {"vm.vnodemin", []_C_int{2, 9}}, - {"vm.vtextmin", []_C_int{2, 8}}, -} diff --git a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go b/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go deleted file mode 100644 index 83bb935b9..000000000 --- a/vendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go +++ /dev/null @@ -1,270 +0,0 @@ -// mksysctl_openbsd.pl -// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT - -package unix - -type mibentry struct { - ctlname string - ctloid []_C_int -} - -var sysctlMib = []mibentry{ - {"ddb.console", []_C_int{9, 6}}, - {"ddb.log", []_C_int{9, 7}}, - {"ddb.max_line", []_C_int{9, 3}}, - {"ddb.max_width", []_C_int{9, 2}}, - {"ddb.panic", []_C_int{9, 5}}, - {"ddb.radix", []_C_int{9, 1}}, - {"ddb.tab_stop_width", []_C_int{9, 4}}, - {"ddb.trigger", []_C_int{9, 8}}, - {"fs.posix.setuid", []_C_int{3, 1, 1}}, - {"hw.allowpowerdown", []_C_int{6, 22}}, - {"hw.byteorder", []_C_int{6, 4}}, - {"hw.cpuspeed", []_C_int{6, 12}}, - {"hw.diskcount", []_C_int{6, 10}}, - {"hw.disknames", []_C_int{6, 8}}, - {"hw.diskstats", []_C_int{6, 9}}, - {"hw.machine", []_C_int{6, 1}}, - {"hw.model", []_C_int{6, 2}}, - {"hw.ncpu", []_C_int{6, 3}}, - {"hw.ncpufound", []_C_int{6, 21}}, - {"hw.pagesize", []_C_int{6, 7}}, - {"hw.physmem", []_C_int{6, 19}}, - {"hw.product", []_C_int{6, 15}}, - {"hw.serialno", []_C_int{6, 17}}, - {"hw.setperf", []_C_int{6, 13}}, - {"hw.usermem", []_C_int{6, 20}}, - {"hw.uuid", []_C_int{6, 18}}, - {"hw.vendor", []_C_int{6, 14}}, - {"hw.version", []_C_int{6, 16}}, - {"kern.arandom", []_C_int{1, 37}}, - {"kern.argmax", []_C_int{1, 8}}, - {"kern.boottime", []_C_int{1, 21}}, - {"kern.bufcachepercent", []_C_int{1, 72}}, - {"kern.ccpu", []_C_int{1, 45}}, - {"kern.clockrate", []_C_int{1, 12}}, - {"kern.consdev", []_C_int{1, 75}}, - {"kern.cp_time", []_C_int{1, 40}}, - {"kern.cp_time2", []_C_int{1, 71}}, - {"kern.cryptodevallowsoft", []_C_int{1, 53}}, - {"kern.domainname", []_C_int{1, 22}}, - {"kern.file", []_C_int{1, 73}}, - {"kern.forkstat", []_C_int{1, 42}}, - {"kern.fscale", []_C_int{1, 46}}, - {"kern.fsync", []_C_int{1, 33}}, - {"kern.hostid", []_C_int{1, 11}}, - {"kern.hostname", []_C_int{1, 10}}, - {"kern.intrcnt.nintrcnt", []_C_int{1, 63, 1}}, - {"kern.job_control", []_C_int{1, 19}}, - {"kern.malloc.buckets", []_C_int{1, 39, 1}}, - {"kern.malloc.kmemnames", []_C_int{1, 39, 3}}, - {"kern.maxclusters", []_C_int{1, 67}}, - {"kern.maxfiles", []_C_int{1, 7}}, - {"kern.maxlocksperuid", []_C_int{1, 70}}, - {"kern.maxpartitions", []_C_int{1, 23}}, - {"kern.maxproc", []_C_int{1, 6}}, - {"kern.maxthread", []_C_int{1, 25}}, - {"kern.maxvnodes", []_C_int{1, 5}}, - {"kern.mbstat", []_C_int{1, 59}}, - {"kern.msgbuf", []_C_int{1, 48}}, - {"kern.msgbufsize", []_C_int{1, 38}}, - {"kern.nchstats", []_C_int{1, 41}}, - {"kern.netlivelocks", []_C_int{1, 76}}, - {"kern.nfiles", []_C_int{1, 56}}, - {"kern.ngroups", []_C_int{1, 18}}, - {"kern.nosuidcoredump", []_C_int{1, 32}}, - {"kern.nprocs", []_C_int{1, 47}}, - {"kern.nselcoll", []_C_int{1, 43}}, - {"kern.nthreads", []_C_int{1, 26}}, - {"kern.numvnodes", []_C_int{1, 58}}, - {"kern.osrelease", []_C_int{1, 2}}, - {"kern.osrevision", []_C_int{1, 3}}, - {"kern.ostype", []_C_int{1, 1}}, - {"kern.osversion", []_C_int{1, 27}}, - {"kern.pool_debug", []_C_int{1, 77}}, - {"kern.posix1version", []_C_int{1, 17}}, - {"kern.proc", []_C_int{1, 66}}, - {"kern.random", []_C_int{1, 31}}, - {"kern.rawpartition", []_C_int{1, 24}}, - {"kern.saved_ids", []_C_int{1, 20}}, - {"kern.securelevel", []_C_int{1, 9}}, - {"kern.seminfo", []_C_int{1, 61}}, - {"kern.shminfo", []_C_int{1, 62}}, - {"kern.somaxconn", []_C_int{1, 28}}, - {"kern.sominconn", []_C_int{1, 29}}, - {"kern.splassert", []_C_int{1, 54}}, - {"kern.stackgap_random", []_C_int{1, 50}}, - {"kern.sysvipc_info", []_C_int{1, 51}}, - {"kern.sysvmsg", []_C_int{1, 34}}, - {"kern.sysvsem", []_C_int{1, 35}}, - {"kern.sysvshm", []_C_int{1, 36}}, - {"kern.timecounter.choice", []_C_int{1, 69, 4}}, - {"kern.timecounter.hardware", []_C_int{1, 69, 3}}, - {"kern.timecounter.tick", []_C_int{1, 69, 1}}, - {"kern.timecounter.timestepwarnings", []_C_int{1, 69, 2}}, - {"kern.tty.maxptys", []_C_int{1, 44, 6}}, - {"kern.tty.nptys", []_C_int{1, 44, 7}}, - {"kern.tty.tk_cancc", []_C_int{1, 44, 4}}, - {"kern.tty.tk_nin", []_C_int{1, 44, 1}}, - {"kern.tty.tk_nout", []_C_int{1, 44, 2}}, - {"kern.tty.tk_rawcc", []_C_int{1, 44, 3}}, - {"kern.tty.ttyinfo", []_C_int{1, 44, 5}}, - {"kern.ttycount", []_C_int{1, 57}}, - {"kern.userasymcrypto", []_C_int{1, 60}}, - {"kern.usercrypto", []_C_int{1, 52}}, - {"kern.usermount", []_C_int{1, 30}}, - {"kern.version", []_C_int{1, 4}}, - {"kern.vnode", []_C_int{1, 13}}, - {"kern.watchdog.auto", []_C_int{1, 64, 2}}, - {"kern.watchdog.period", []_C_int{1, 64, 1}}, - {"net.bpf.bufsize", []_C_int{4, 31, 1}}, - {"net.bpf.maxbufsize", []_C_int{4, 31, 2}}, - {"net.inet.ah.enable", []_C_int{4, 2, 51, 1}}, - {"net.inet.ah.stats", []_C_int{4, 2, 51, 2}}, - {"net.inet.carp.allow", []_C_int{4, 2, 112, 1}}, - {"net.inet.carp.log", []_C_int{4, 2, 112, 3}}, - {"net.inet.carp.preempt", []_C_int{4, 2, 112, 2}}, - {"net.inet.carp.stats", []_C_int{4, 2, 112, 4}}, - {"net.inet.divert.recvspace", []_C_int{4, 2, 258, 1}}, - {"net.inet.divert.sendspace", []_C_int{4, 2, 258, 2}}, - {"net.inet.divert.stats", []_C_int{4, 2, 258, 3}}, - {"net.inet.esp.enable", []_C_int{4, 2, 50, 1}}, - {"net.inet.esp.stats", []_C_int{4, 2, 50, 4}}, - {"net.inet.esp.udpencap", []_C_int{4, 2, 50, 2}}, - {"net.inet.esp.udpencap_port", []_C_int{4, 2, 50, 3}}, - {"net.inet.etherip.allow", []_C_int{4, 2, 97, 1}}, - {"net.inet.etherip.stats", []_C_int{4, 2, 97, 2}}, - {"net.inet.gre.allow", []_C_int{4, 2, 47, 1}}, - {"net.inet.gre.wccp", []_C_int{4, 2, 47, 2}}, - {"net.inet.icmp.bmcastecho", []_C_int{4, 2, 1, 2}}, - {"net.inet.icmp.errppslimit", []_C_int{4, 2, 1, 3}}, - {"net.inet.icmp.maskrepl", []_C_int{4, 2, 1, 1}}, - {"net.inet.icmp.rediraccept", []_C_int{4, 2, 1, 4}}, - {"net.inet.icmp.redirtimeout", []_C_int{4, 2, 1, 5}}, - {"net.inet.icmp.stats", []_C_int{4, 2, 1, 7}}, - {"net.inet.icmp.tstamprepl", []_C_int{4, 2, 1, 6}}, - {"net.inet.igmp.stats", []_C_int{4, 2, 2, 1}}, - {"net.inet.ip.arpqueued", []_C_int{4, 2, 0, 36}}, - {"net.inet.ip.encdebug", []_C_int{4, 2, 0, 12}}, - {"net.inet.ip.forwarding", []_C_int{4, 2, 0, 1}}, - {"net.inet.ip.ifq.congestion", []_C_int{4, 2, 0, 30, 4}}, - {"net.inet.ip.ifq.drops", []_C_int{4, 2, 0, 30, 3}}, - {"net.inet.ip.ifq.len", []_C_int{4, 2, 0, 30, 1}}, - {"net.inet.ip.ifq.maxlen", []_C_int{4, 2, 0, 30, 2}}, - {"net.inet.ip.maxqueue", []_C_int{4, 2, 0, 11}}, - {"net.inet.ip.mforwarding", []_C_int{4, 2, 0, 31}}, - {"net.inet.ip.mrtproto", []_C_int{4, 2, 0, 34}}, - {"net.inet.ip.mrtstats", []_C_int{4, 2, 0, 35}}, - {"net.inet.ip.mtu", []_C_int{4, 2, 0, 4}}, - {"net.inet.ip.mtudisc", []_C_int{4, 2, 0, 27}}, - {"net.inet.ip.mtudisctimeout", []_C_int{4, 2, 0, 28}}, - {"net.inet.ip.multipath", []_C_int{4, 2, 0, 32}}, - {"net.inet.ip.portfirst", []_C_int{4, 2, 0, 7}}, - {"net.inet.ip.porthifirst", []_C_int{4, 2, 0, 9}}, - {"net.inet.ip.porthilast", []_C_int{4, 2, 0, 10}}, - {"net.inet.ip.portlast", []_C_int{4, 2, 0, 8}}, - {"net.inet.ip.redirect", []_C_int{4, 2, 0, 2}}, - {"net.inet.ip.sourceroute", []_C_int{4, 2, 0, 5}}, - {"net.inet.ip.stats", []_C_int{4, 2, 0, 33}}, - {"net.inet.ip.ttl", []_C_int{4, 2, 0, 3}}, - {"net.inet.ipcomp.enable", []_C_int{4, 2, 108, 1}}, - {"net.inet.ipcomp.stats", []_C_int{4, 2, 108, 2}}, - {"net.inet.ipip.allow", []_C_int{4, 2, 4, 1}}, - {"net.inet.ipip.stats", []_C_int{4, 2, 4, 2}}, - {"net.inet.mobileip.allow", []_C_int{4, 2, 55, 1}}, - {"net.inet.pfsync.stats", []_C_int{4, 2, 240, 1}}, - {"net.inet.pim.stats", []_C_int{4, 2, 103, 1}}, - {"net.inet.tcp.ackonpush", []_C_int{4, 2, 6, 13}}, - {"net.inet.tcp.always_keepalive", []_C_int{4, 2, 6, 22}}, - {"net.inet.tcp.baddynamic", []_C_int{4, 2, 6, 6}}, - {"net.inet.tcp.drop", []_C_int{4, 2, 6, 19}}, - {"net.inet.tcp.ecn", []_C_int{4, 2, 6, 14}}, - {"net.inet.tcp.ident", []_C_int{4, 2, 6, 9}}, - {"net.inet.tcp.keepidle", []_C_int{4, 2, 6, 3}}, - {"net.inet.tcp.keepinittime", []_C_int{4, 2, 6, 2}}, - {"net.inet.tcp.keepintvl", []_C_int{4, 2, 6, 4}}, - {"net.inet.tcp.mssdflt", []_C_int{4, 2, 6, 11}}, - {"net.inet.tcp.reasslimit", []_C_int{4, 2, 6, 18}}, - {"net.inet.tcp.rfc1323", []_C_int{4, 2, 6, 1}}, - {"net.inet.tcp.rfc3390", []_C_int{4, 2, 6, 17}}, - {"net.inet.tcp.rstppslimit", []_C_int{4, 2, 6, 12}}, - {"net.inet.tcp.sack", []_C_int{4, 2, 6, 10}}, - {"net.inet.tcp.sackholelimit", []_C_int{4, 2, 6, 20}}, - {"net.inet.tcp.slowhz", []_C_int{4, 2, 6, 5}}, - {"net.inet.tcp.stats", []_C_int{4, 2, 6, 21}}, - {"net.inet.tcp.synbucketlimit", []_C_int{4, 2, 6, 16}}, - {"net.inet.tcp.syncachelimit", []_C_int{4, 2, 6, 15}}, - {"net.inet.udp.baddynamic", []_C_int{4, 2, 17, 2}}, - {"net.inet.udp.checksum", []_C_int{4, 2, 17, 1}}, - {"net.inet.udp.recvspace", []_C_int{4, 2, 17, 3}}, - {"net.inet.udp.sendspace", []_C_int{4, 2, 17, 4}}, - {"net.inet.udp.stats", []_C_int{4, 2, 17, 5}}, - {"net.inet6.divert.recvspace", []_C_int{4, 24, 86, 1}}, - {"net.inet6.divert.sendspace", []_C_int{4, 24, 86, 2}}, - {"net.inet6.divert.stats", []_C_int{4, 24, 86, 3}}, - {"net.inet6.icmp6.errppslimit", []_C_int{4, 24, 30, 14}}, - {"net.inet6.icmp6.mtudisc_hiwat", []_C_int{4, 24, 30, 16}}, - {"net.inet6.icmp6.mtudisc_lowat", []_C_int{4, 24, 30, 17}}, - {"net.inet6.icmp6.nd6_debug", []_C_int{4, 24, 30, 18}}, - {"net.inet6.icmp6.nd6_delay", []_C_int{4, 24, 30, 8}}, - {"net.inet6.icmp6.nd6_maxnudhint", []_C_int{4, 24, 30, 15}}, - {"net.inet6.icmp6.nd6_mmaxtries", []_C_int{4, 24, 30, 10}}, - {"net.inet6.icmp6.nd6_prune", []_C_int{4, 24, 30, 6}}, - {"net.inet6.icmp6.nd6_umaxtries", []_C_int{4, 24, 30, 9}}, - {"net.inet6.icmp6.nd6_useloopback", []_C_int{4, 24, 30, 11}}, - {"net.inet6.icmp6.nodeinfo", []_C_int{4, 24, 30, 13}}, - {"net.inet6.icmp6.rediraccept", []_C_int{4, 24, 30, 2}}, - {"net.inet6.icmp6.redirtimeout", []_C_int{4, 24, 30, 3}}, - {"net.inet6.ip6.accept_rtadv", []_C_int{4, 24, 17, 12}}, - {"net.inet6.ip6.auto_flowlabel", []_C_int{4, 24, 17, 17}}, - {"net.inet6.ip6.dad_count", []_C_int{4, 24, 17, 16}}, - {"net.inet6.ip6.dad_pending", []_C_int{4, 24, 17, 49}}, - {"net.inet6.ip6.defmcasthlim", []_C_int{4, 24, 17, 18}}, - {"net.inet6.ip6.forwarding", []_C_int{4, 24, 17, 1}}, - {"net.inet6.ip6.forwsrcrt", []_C_int{4, 24, 17, 5}}, - {"net.inet6.ip6.hdrnestlimit", []_C_int{4, 24, 17, 15}}, - {"net.inet6.ip6.hlim", []_C_int{4, 24, 17, 3}}, - {"net.inet6.ip6.log_interval", []_C_int{4, 24, 17, 14}}, - {"net.inet6.ip6.maxdynroutes", []_C_int{4, 24, 17, 48}}, - {"net.inet6.ip6.maxfragpackets", []_C_int{4, 24, 17, 9}}, - {"net.inet6.ip6.maxfrags", []_C_int{4, 24, 17, 41}}, - {"net.inet6.ip6.maxifdefrouters", []_C_int{4, 24, 17, 47}}, - {"net.inet6.ip6.maxifprefixes", []_C_int{4, 24, 17, 46}}, - {"net.inet6.ip6.mforwarding", []_C_int{4, 24, 17, 42}}, - {"net.inet6.ip6.mrtproto", []_C_int{4, 24, 17, 8}}, - {"net.inet6.ip6.mtudisctimeout", []_C_int{4, 24, 17, 50}}, - {"net.inet6.ip6.multicast_mtudisc", []_C_int{4, 24, 17, 44}}, - {"net.inet6.ip6.multipath", []_C_int{4, 24, 17, 43}}, - {"net.inet6.ip6.neighborgcthresh", []_C_int{4, 24, 17, 45}}, - {"net.inet6.ip6.redirect", []_C_int{4, 24, 17, 2}}, - {"net.inet6.ip6.rr_prune", []_C_int{4, 24, 17, 22}}, - {"net.inet6.ip6.sourcecheck", []_C_int{4, 24, 17, 10}}, - {"net.inet6.ip6.sourcecheck_logint", []_C_int{4, 24, 17, 11}}, - {"net.inet6.ip6.use_deprecated", []_C_int{4, 24, 17, 21}}, - {"net.inet6.ip6.v6only", []_C_int{4, 24, 17, 24}}, - {"net.key.sadb_dump", []_C_int{4, 30, 1}}, - {"net.key.spd_dump", []_C_int{4, 30, 2}}, - {"net.mpls.ifq.congestion", []_C_int{4, 33, 3, 4}}, - {"net.mpls.ifq.drops", []_C_int{4, 33, 3, 3}}, - {"net.mpls.ifq.len", []_C_int{4, 33, 3, 1}}, - {"net.mpls.ifq.maxlen", []_C_int{4, 33, 3, 2}}, - {"net.mpls.mapttl_ip", []_C_int{4, 33, 5}}, - {"net.mpls.mapttl_ip6", []_C_int{4, 33, 6}}, - {"net.mpls.maxloop_inkernel", []_C_int{4, 33, 4}}, - {"net.mpls.ttl", []_C_int{4, 33, 2}}, - {"net.pflow.stats", []_C_int{4, 34, 1}}, - {"net.pipex.enable", []_C_int{4, 35, 1}}, - {"vm.anonmin", []_C_int{2, 7}}, - {"vm.loadavg", []_C_int{2, 2}}, - {"vm.maxslp", []_C_int{2, 10}}, - {"vm.nkmempages", []_C_int{2, 6}}, - {"vm.psstrings", []_C_int{2, 3}}, - {"vm.swapencrypt.enable", []_C_int{2, 5, 0}}, - {"vm.swapencrypt.keyscreated", []_C_int{2, 5, 1}}, - {"vm.swapencrypt.keysdeleted", []_C_int{2, 5, 2}}, - {"vm.uspace", []_C_int{2, 11}}, - {"vm.uvmexp", []_C_int{2, 4}}, - {"vm.vmmeter", []_C_int{2, 1}}, - {"vm.vnodemin", []_C_int{2, 9}}, - {"vm.vtextmin", []_C_int{2, 8}}, -} diff --git a/vendor/golang.org/x/sys/windows/syscall_windows.go b/vendor/golang.org/x/sys/windows/syscall_windows.go index acd06e369..9b5ed549a 100644 --- a/vendor/golang.org/x/sys/windows/syscall_windows.go +++ b/vendor/golang.org/x/sys/windows/syscall_windows.go @@ -202,21 +202,6 @@ func NewCallbackCDecl(fn interface{}) uintptr { // syscall interface implementation for other packages -// GetProcAddressByOrdinal retrieves the address of the exported -// function from module by ordinal. -func GetProcAddressByOrdinal(module Handle, ordinal uintptr) (proc uintptr, err error) { - r0, _, e1 := syscall.Syscall(procGetProcAddress.Addr(), 2, uintptr(module), ordinal, 0) - proc = uintptr(r0) - if proc == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - func Exit(code int) { ExitProcess(uint32(code)) } func makeInheritSa() *SecurityAttributes {