vendor: update dependencies with github.com/kardianos/govendor

This commit is contained in:
Felix Lange 2017-02-16 13:21:11 +01:00
parent c8695fae35
commit 2c4455b12a
168 changed files with 3394 additions and 6327 deletions

View File

@ -1,44 +0,0 @@
# package
github.com/ethereum/go-ethereum
# import
github.com/Azure/azure-sdk-for-go v5.0.0-beta-5-gbd73d95
github.com/aristanetworks/goarista ockafka-v0.0.2-21-g34c98d5
github.com/cespare/cp 165db2f
github.com/davecgh/go-spew v1.1.0
github.com/ethereum/ethash v23.1-249-g214d4c0
github.com/fatih/color v1.2-2-ge8e01ee
github.com/gizak/termui v2.1.1-9-gf63e0cd
github.com/golang/snappy d9eb7a3
github.com/hashicorp/golang-lru 0a025b7
github.com/huin/goupnp 679507a
github.com/jackpal/go-nat-pmp v1.0.1-4-g1fa385a
github.com/karalabe/gousb ffa821b
github.com/maruel/panicparse ad66119
github.com/mattn/go-colorable v0.0.6-9-gd228849
github.com/mattn/go-isatty 30a891c
github.com/mattn/go-runewidth v0.0.1-10-g737072b
github.com/mitchellh/go-wordwrap ad45545
github.com/nsf/termbox-go abe82ce
github.com/pborman/uuid v1.0-19-g5007efa
github.com/peterh/liner 3c5f577
github.com/rcrowley/go-metrics 1f30fe9
github.com/rjeczalik/notify 7e20c15
github.com/robertkrimen/otto bf1c379
github.com/rs/cors v1.0
github.com/rs/xhandler v1.0-1-ged27b6f
github.com/syndtr/goleveldb 23851d9
golang.org/x/crypto 7c6cc32
golang.org/x/net 60c41d1
golang.org/x/sys d75a526
golang.org/x/text 44f4f65
golang.org/x/tools 116266f6
gopkg.in/check.v1 20d25e2
gopkg.in/fatih/set.v0 v0.1.0-3-g27c4092
gopkg.in/karalabe/cookiejar.v2 8dcd6a7
gopkg.in/natefinch/npipe.v2 c1b8fa8
gopkg.in/sourcemap.v1 v1.0.3
gopkg.in/urfave/cli.v1 v1.19.1
# exclude
-golang.org/x/net/context

View File

@ -1,32 +0,0 @@
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so
# Folders
_obj
_test
# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out
*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*
_testmain.go
*.exe
*.test
*.prof
# Editor swap files
*.swp
*~
.DS_Store
# ignore vendor/
vendor/

View File

@ -1,33 +0,0 @@
sudo: false
language: go
go: 1.7
install:
- go get -u github.com/golang/lint/golint
- go get -u github.com/Masterminds/glide
- go get -u golang.org/x/net/context
- go get -u github.com/HewlettPackard/gas
- go get -u gopkg.in/godo.v2/cmd/godo
- export GO15VENDOREXPERIMENT=1
- glide install
script:
- gas -skip=management/examples/*.go -skip=*vendor* -skip=Gododir/* ./... | tee gas-scan.txt
- test -z "$(grep 'Severity:\s*HIGH' gas-scan.txt)"
- test -z "$(gofmt -s -l $(find ./arm/* -type d -print) | tee /dev/stderr)"
- test -z "$(gofmt -s -l -w management | tee /dev/stderr)"
- test -z "$(gofmt -s -l -w storage | tee /dev/stderr)"
- test -z "$(gofmt -s -l -w Gododir | tee /dev/stderr)"
- test -z "$(go build $(find ./* -type d -print | grep -v '^./vendor$') | tee /dev/stderr)"
- test -z "$(go vet $(find ./arm/* -type d -print) | tee /dev/stderr)"
- test -z "$(golint ./arm/... | tee /dev/stderr)"
- go test -v ./storage/... -check.v
- test -z "$(golint ./storage/... | tee /dev/stderr)"
- go vet ./storage/...
- go test -v ./management/...
- test -z "$(golint ./management/... | grep -v 'should have comment' | grep -v 'stutters' | tee /dev/stderr)"
- go vet ./management/...
- test -z "$(golint ./Gododir/... | tee /dev/stderr)"
- go vet ./Gododir/...

View File

@ -6,6 +6,7 @@
package monotime package monotime
import ( import (
"time"
_ "unsafe" // required to use //go:linkname _ "unsafe" // required to use //go:linkname
) )
@ -22,3 +23,9 @@ func nanotime() int64
func Now() uint64 { func Now() uint64 {
return uint64(nanotime()) return uint64(nanotime())
} }
// Since returns the amount of time that has elapsed since t. t should be
// the result of a call to Now() on the same machine.
func Since(t uint64) time.Duration {
return time.Duration(Now() - t)
}

View File

@ -1,12 +0,0 @@
.idea/
.DS_Store
*/**/*un~
.vagrant/
*.pyc
build/
pyethash.egg-info/
*.so
*~
*.swp
MANIFEST
dist/

View File

@ -1,23 +0,0 @@
language: go
go:
- 1.4.2
before_install:
# for g++4.8 and C++11
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
# Set up go-ethereum
- sudo apt-get update -y -qq
- sudo apt-get install -yqq libgmp3-dev
- git clone --depth=10 https://github.com/ethereum/go-ethereum ${GOPATH}/src/github.com/ethereum/go-ethereum
# use canned dependencies from the go-ethereum repository
- export GOPATH=$GOPATH:$GOPATH/src/github.com/ethereum/go-ethereum/Godeps/_workspace/
- echo $GOPATH
install:
# need to explicitly request version 1.48 since by default we get 1.46 which does not work with C++11
- sudo apt-get install -qq --yes --force-yes g++-4.8
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50
- sudo apt-get install -qq wget cmake bash libboost-test1.48-dev libboost-system1.48-dev libboost-filesystem1.48-dev nodejs python-pip python-dev valgrind
- sudo pip install virtualenv -q
script: "./test/test.sh"

View File

@ -1,5 +0,0 @@
language: go
go:
- 1.6
- tip

View File

@ -87,7 +87,7 @@ blue(myWriter, "important notice: %s", stars)
// Mix up with multiple attributes // Mix up with multiple attributes
success := color.New(color.Bold, color.FgGreen).FprintlnFunc() success := color.New(color.Bold, color.FgGreen).FprintlnFunc()
success(myWriter, don't forget this...") success(myWriter, "Don't forget this...")
``` ```
### Insert into noncolor strings (SprintFunc) ### Insert into noncolor strings (SprintFunc)

View File

@ -247,6 +247,21 @@ func (c *Color) Println(a ...interface{}) (n int, err error) {
return fmt.Fprintln(Output, a...) return fmt.Fprintln(Output, a...)
} }
// Sprint is just like Print, but returns a string instead of printing it.
func (c *Color) Sprint(a ...interface{}) string {
return c.wrap(fmt.Sprint(a...))
}
// Sprintln is just like Println, but returns a string instead of printing it.
func (c *Color) Sprintln(a ...interface{}) string {
return c.wrap(fmt.Sprintln(a...))
}
// Sprintf is just like Printf, but returns a string instead of printing it.
func (c *Color) Sprintf(format string, a ...interface{}) string {
return c.wrap(fmt.Sprintf(format, a...))
}
// FprintFunc returns a new function that prints the passed arguments as // FprintFunc returns a new function that prints the passed arguments as
// colorized with color.Fprint(). // colorized with color.Fprint().
func (c *Color) FprintFunc() func(w io.Writer, a ...interface{}) { func (c *Color) FprintFunc() func(w io.Writer, a ...interface{}) {

View File

@ -1,26 +0,0 @@
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so
# Folders
_obj
_test
# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out
*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*
_testmain.go
*.exe
*.test
*.prof
.DS_Store
/vendor

View File

@ -1,6 +0,0 @@
language: go
go:
- tip
script: go test -v ./

View File

@ -131,6 +131,7 @@ Click image to see the corresponding demo codes.
[<img src="./_example/barchart.png" alt="barchart" type="image/png" width="45%">](https://github.com/gizak/termui/blob/master/_example/barchart.go) [<img src="./_example/barchart.png" alt="barchart" type="image/png" width="45%">](https://github.com/gizak/termui/blob/master/_example/barchart.go)
[<img src="./_example/mbarchart.png" alt="barchart" type="image/png" width="45%">](https://github.com/gizak/termui/blob/master/_example/mbarchart.go) [<img src="./_example/mbarchart.png" alt="barchart" type="image/png" width="45%">](https://github.com/gizak/termui/blob/master/_example/mbarchart.go)
[<img src="./_example/sparklines.png" alt="sparklines" type="image/png" width="45%">](https://github.com/gizak/termui/blob/master/_example/sparklines.go) [<img src="./_example/sparklines.png" alt="sparklines" type="image/png" width="45%">](https://github.com/gizak/termui/blob/master/_example/sparklines.go)
[<img src="./_example/table.png" alt="table" type="image/png" width="45%">](https://github.com/gizak/termui/blob/master/_example/table.go)
## GoDoc ## GoDoc

View File

@ -1,4 +1,4 @@
// Copyright 2016 Zack Guo <zack.y.guo@gmail.com>. All rights reserved. // Copyright 2017 Zack Guo <zack.y.guo@gmail.com>. All rights reserved.
// Use of this source code is governed by a MIT license that can // Use of this source code is governed by a MIT license that can
// be found in the LICENSE file. // be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2016 Zack Guo <zack.y.guo@gmail.com>. All rights reserved. // Copyright 2017 Zack Guo <zack.y.guo@gmail.com>. All rights reserved.
// Use of this source code is governed by a MIT license that can // Use of this source code is governed by a MIT license that can
// be found in the LICENSE file. // be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2016 Zack Guo <zack.y.guo@gmail.com>. All rights reserved. // Copyright 2017 Zack Guo <zack.y.guo@gmail.com>. All rights reserved.
// Use of this source code is governed by a MIT license that can // Use of this source code is governed by a MIT license that can
// be found in the LICENSE file. // be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2016 Zack Guo <zack.y.guo@gmail.com>. All rights reserved. // Copyright 2017 Zack Guo <zack.y.guo@gmail.com>. All rights reserved.
// Use of this source code is governed by a MIT license that can // Use of this source code is governed by a MIT license that can
// be found in the LICENSE file. // be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2016 Zack Guo <zack.y.guo@gmail.com>. All rights reserved. // Copyright 2017 Zack Guo <zack.y.guo@gmail.com>. All rights reserved.
// Use of this source code is governed by a MIT license that can // Use of this source code is governed by a MIT license that can
// be found in the LICENSE file. // be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2016 Zack Guo <zack.y.guo@gmail.com>. All rights reserved. // Copyright 2017 Zack Guo <zack.y.guo@gmail.com>. All rights reserved.
// Use of this source code is governed by a MIT license that can // Use of this source code is governed by a MIT license that can
// be found in the LICENSE file. // be found in the LICENSE file.

View File

@ -1,35 +1,10 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# use v6;
#
# my $copyright = '// Copyright 2016 Zack Guo <gizak@icloud.com>. All rights reserved.
# // Use of this source code is governed by a MIT license that can
# // be found in the LICENSE file.
#
# ';
#
# sub MAIN('update-docstr', Str $srcp) {
# if $srcp.IO.f {
# $_ = $srcp.IO.slurp;
# if m/^ \/\/\s Copyright .+? \n\n/ {
# unless ~$/ eq $copyright {
# s/^ \/\/\s Copyright .+? \n\n /$copyright/;
# spurt $srcp, $_;
# say "[updated] doc string for:"~$srcp;
# }
# } else {
# say "[added] doc string for "~$srcp~" (no match found)";
# $_ = $copyright ~ $_;
# spurt $srcp, $_;
# }
# }
# }
import re import re
import os import os
import io import io
copyright = """// Copyright 2016 Zack Guo <zack.y.guo@gmail.com>. All rights reserved. copyright = """// Copyright 2017 Zack Guo <zack.y.guo@gmail.com>. All rights reserved.
// Use of this source code is governed by a MIT license that can // Use of this source code is governed by a MIT license that can
// be found in the LICENSE file. // be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2016 Zack Guo <zack.y.guo@gmail.com>. All rights reserved. // Copyright 2017 Zack Guo <zack.y.guo@gmail.com>. All rights reserved.
// Use of this source code is governed by a MIT license that can // Use of this source code is governed by a MIT license that can
// be found in the LICENSE file. // be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2016 Zack Guo <zack.y.guo@gmail.com>. All rights reserved. // Copyright 2017 Zack Guo <zack.y.guo@gmail.com>. All rights reserved.
// Use of this source code is governed by a MIT license that can // Use of this source code is governed by a MIT license that can
// be found in the LICENSE file. // be found in the LICENSE file.
@ -221,6 +221,7 @@ func findMatch(mux map[string]func(Event), path string) string {
return pattern return pattern
} }
// Remove all existing defined Handlers from the map // Remove all existing defined Handlers from the map
func (es *EvtStream) ResetHandlers() { func (es *EvtStream) ResetHandlers() {
for Path, _ := range es.Handlers { for Path, _ := range es.Handlers {
@ -309,7 +310,7 @@ func NewTimerCh(du time.Duration) chan Event {
return t return t
} }
var DefualtHandler = func(e Event) { var DefaultHandler = func(e Event) {
} }
var usrEvtCh = make(chan Event) var usrEvtCh = make(chan Event)

View File

@ -1,4 +1,4 @@
// Copyright 2016 Zack Guo <zack.y.guo@gmail.com>. All rights reserved. // Copyright 2017 Zack Guo <zack.y.guo@gmail.com>. All rights reserved.
// Use of this source code is governed by a MIT license that can // Use of this source code is governed by a MIT license that can
// be found in the LICENSE file. // be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2016 Zack Guo <zack.y.guo@gmail.com>. All rights reserved. // Copyright 2017 Zack Guo <zack.y.guo@gmail.com>. All rights reserved.
// Use of this source code is governed by a MIT license that can // Use of this source code is governed by a MIT license that can
// be found in the LICENSE file. // be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2016 Zack Guo <zack.y.guo@gmail.com>. All rights reserved. // Copyright 2017 Zack Guo <zack.y.guo@gmail.com>. All rights reserved.
// Use of this source code is governed by a MIT license that can // Use of this source code is governed by a MIT license that can
// be found in the LICENSE file. // be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2016 Zack Guo <zack.y.guo@gmail.com>. All rights reserved. // Copyright 2017 Zack Guo <zack.y.guo@gmail.com>. All rights reserved.
// Use of this source code is governed by a MIT license that can // Use of this source code is governed by a MIT license that can
// be found in the LICENSE file. // be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2016 Zack Guo <zack.y.guo@gmail.com>. All rights reserved. // Copyright 2017 Zack Guo <zack.y.guo@gmail.com>. All rights reserved.
// Use of this source code is governed by a MIT license that can // Use of this source code is governed by a MIT license that can
// be found in the LICENSE file. // be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2016 Zack Guo <zack.y.guo@gmail.com>. All rights reserved. // Copyright 2017 Zack Guo <zack.y.guo@gmail.com>. All rights reserved.
// Use of this source code is governed by a MIT license that can // Use of this source code is governed by a MIT license that can
// be found in the LICENSE file. // be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2016 Zack Guo <zack.y.guo@gmail.com>. All rights reserved. // Copyright 2017 Zack Guo <zack.y.guo@gmail.com>. All rights reserved.
// Use of this source code is governed by a MIT license that can // Use of this source code is governed by a MIT license that can
// be found in the LICENSE file. // be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2016 Zack Guo <zack.y.guo@gmail.com>. All rights reserved. // Copyright 2017 Zack Guo <zack.y.guo@gmail.com>. All rights reserved.
// Use of this source code is governed by a MIT license that can // Use of this source code is governed by a MIT license that can
// be found in the LICENSE file. // be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2016 Zack Guo <zack.y.guo@gmail.com>. All rights reserved. // Copyright 2017 Zack Guo <zack.y.guo@gmail.com>. All rights reserved.
// Use of this source code is governed by a MIT license that can // Use of this source code is governed by a MIT license that can
// be found in the LICENSE file. // be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2016 Zack Guo <zack.y.guo@gmail.com>. All rights reserved. // Copyright 2017 Zack Guo <zack.y.guo@gmail.com>. All rights reserved.
// Use of this source code is governed by a MIT license that can // Use of this source code is governed by a MIT license that can
// be found in the LICENSE file. // be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2016 Zack Guo <zack.y.guo@gmail.com>. All rights reserved. // Copyright 2017 Zack Guo <zack.y.guo@gmail.com>. All rights reserved.
// Use of this source code is governed by a MIT license that can // Use of this source code is governed by a MIT license that can
// be found in the LICENSE file. // be found in the LICENSE file.
@ -51,7 +51,7 @@ func Init() error {
DefaultEvtStream.Merge("timer", NewTimerCh(time.Second)) DefaultEvtStream.Merge("timer", NewTimerCh(time.Second))
DefaultEvtStream.Merge("custom", usrEvtCh) DefaultEvtStream.Merge("custom", usrEvtCh)
DefaultEvtStream.Handle("/", DefualtHandler) DefaultEvtStream.Handle("/", DefaultHandler)
DefaultEvtStream.Handle("/sys/wnd/resize", func(e Event) { DefaultEvtStream.Handle("/sys/wnd/resize", func(e Event) {
w := e.Data.(EvtWnd) w := e.Data.(EvtWnd)
Body.Width = w.Width Body.Width = w.Width

View File

@ -1,4 +1,4 @@
// Copyright 2016 Zack Guo <zack.y.guo@gmail.com>. All rights reserved. // Copyright 2017 Zack Guo <zack.y.guo@gmail.com>. All rights reserved.
// Use of this source code is governed by a MIT license that can // Use of this source code is governed by a MIT license that can
// be found in the LICENSE file. // be found in the LICENSE file.

View File

@ -1,10 +1,32 @@
// Copyright 2017 Zack Guo <zack.y.guo@gmail.com>. All rights reserved.
// Use of this source code is governed by a MIT license that can
// be found in the LICENSE file.
package termui package termui
import "strings" import "strings"
/* /* Table is like:
Awesome Table
Col0 | Col1 | Col2 | Col3 | Col4 | Col5 | Col6 |
Some Item #1 | AAA | 123 | CCCCC | EEEEE | GGGGG | IIIII |
Some Item #2 | BBB | 456 | DDDDD | FFFFF | HHHHH | JJJJJ |
Datapoints are a two dimensional array of strings: [][]string
Example:
data := [][]string{
{"Col0", "Col1", "Col3", "Col4", "Col5", "Col6"},
{"Some Item #1", "AAA", "123", "CCCCC", "EEEEE", "GGGGG", "IIIII"},
{"Some Item #2", "BBB", "456", "DDDDD", "FFFFF", "HHHHH", "JJJJJ"},
}
table := termui.NewTable() table := termui.NewTable()
table.Rows = rows table.Rows = data // type [][]string
table.FgColor = termui.ColorWhite table.FgColor = termui.ColorWhite
table.BgColor = termui.ColorDefault table.BgColor = termui.ColorDefault
table.Height = 7 table.Height = 7
@ -14,6 +36,7 @@ import "strings"
table.Border = true table.Border = true
*/ */
// Table tracks all the attributes of a Table instance
type Table struct { type Table struct {
Block Block
Rows [][]string Rows [][]string
@ -22,22 +45,34 @@ type Table struct {
BgColor Attribute BgColor Attribute
FgColors []Attribute FgColors []Attribute
BgColors []Attribute BgColors []Attribute
Seperator bool Separator bool
TextAlign Align TextAlign Align
} }
// NewTable returns a new Table instance
func NewTable() *Table { func NewTable() *Table {
table := &Table{Block: *NewBlock()} table := &Table{Block: *NewBlock()}
table.FgColor = ColorWhite table.FgColor = ColorWhite
table.BgColor = ColorDefault table.BgColor = ColorDefault
table.Seperator = true table.Separator = true
return table return table
} }
func (table *Table) Analysis() { // CellsWidth calculates the width of a cell array and returns an int
func cellsWidth(cells []Cell) int {
width := 0
for _, c := range cells {
width += c.Width()
}
return width
}
// Analysis generates and returns an array of []Cell that represent all columns in the Table
func (table *Table) Analysis() [][]Cell {
var rowCells [][]Cell
length := len(table.Rows) length := len(table.Rows)
if length < 1 { if length < 1 {
return return rowCells
} }
if len(table.FgColors) == 0 { if len(table.FgColors) == 0 {
@ -47,121 +82,101 @@ func (table *Table) Analysis() {
table.BgColors = make([]Attribute, len(table.Rows)) table.BgColors = make([]Attribute, len(table.Rows))
} }
row_width := len(table.Rows[0]) cellWidths := make([]int, len(table.Rows[0]))
cellWidthes := make([]int, row_width)
for index, row := range table.Rows { for y, row := range table.Rows {
for i, str := range row { if table.FgColors[y] == 0 {
if cellWidthes[i] < len(str) { table.FgColors[y] = table.FgColor
cellWidthes[i] = len(str) }
if table.BgColors[y] == 0 {
table.BgColors[y] = table.BgColor
}
for x, str := range row {
cells := DefaultTxBuilder.Build(str, table.FgColors[y], table.BgColors[y])
cw := cellsWidth(cells)
if cellWidths[x] < cw {
cellWidths[x] = cw
}
rowCells = append(rowCells, cells)
} }
} }
table.CellWidth = cellWidths
if table.FgColors[index] == 0 { return rowCells
table.FgColors[index] = table.FgColor
}
if table.BgColors[index] == 0 {
table.BgColors[index] = table.BgColor
}
}
table.CellWidth = cellWidthes
//width_sum := 2
//for i, width := range cellWidthes {
// width_sum += (width + 2)
// for u, row := range table.Rows {
// switch table.TextAlign {
// case "right":
// row[i] = fmt.Sprintf(" %*s ", width, table.Rows[u][i])
// case "center":
// word_width := len(table.Rows[u][i])
// offset := (width - word_width) / 2
// row[i] = fmt.Sprintf(" %*s ", width, fmt.Sprintf("%-*s", offset+word_width, table.Rows[u][i]))
// default: // left
// row[i] = fmt.Sprintf(" %-*s ", width, table.Rows[u][i])
// }
// }
//}
//if table.Width == 0 {
// table.Width = width_sum
//}
} }
// SetSize calculates the table size and sets the internal value
func (table *Table) SetSize() { func (table *Table) SetSize() {
length := len(table.Rows) length := len(table.Rows)
if table.Seperator { if table.Separator {
table.Height = length*2 + 1 table.Height = length*2 + 1
} else { } else {
table.Height = length + 2 table.Height = length + 2
} }
table.Width = 2 table.Width = 2
if length != 0 { if length != 0 {
for _, cell_width := range table.CellWidth { for _, cellWidth := range table.CellWidth {
table.Width += cell_width + 3 table.Width += cellWidth + 3
} }
} }
} }
func (table *Table) CalculatePosition(x int, y int, x_coordinate *int, y_coordibate *int, cell_beginning *int) { // CalculatePosition ...
if table.Seperator { func (table *Table) CalculatePosition(x int, y int, coordinateX *int, coordinateY *int, cellStart *int) {
*y_coordibate = table.innerArea.Min.Y + y*2 if table.Separator {
*coordinateY = table.innerArea.Min.Y + y*2
} else { } else {
*y_coordibate = table.innerArea.Min.Y + y *coordinateY = table.innerArea.Min.Y + y
} }
if x == 0 { if x == 0 {
*cell_beginning = table.innerArea.Min.X *cellStart = table.innerArea.Min.X
} else { } else {
*cell_beginning += table.CellWidth[x-1] + 3 *cellStart += table.CellWidth[x-1] + 3
} }
switch table.TextAlign { switch table.TextAlign {
case AlignRight: case AlignRight:
*x_coordinate = *cell_beginning + (table.CellWidth[x] - len(table.Rows[y][x])) + 2 *coordinateX = *cellStart + (table.CellWidth[x] - len(table.Rows[y][x])) + 2
case AlignCenter: case AlignCenter:
*x_coordinate = *cell_beginning + (table.CellWidth[x]-len(table.Rows[y][x]))/2 + 2 *coordinateX = *cellStart + (table.CellWidth[x]-len(table.Rows[y][x]))/2 + 2
default: default:
*x_coordinate = *cell_beginning + 2 *coordinateX = *cellStart + 2
} }
} }
// Buffer ...
func (table *Table) Buffer() Buffer { func (table *Table) Buffer() Buffer {
buffer := table.Block.Buffer() buffer := table.Block.Buffer()
table.Analysis() rowCells := table.Analysis()
pointerX := table.innerArea.Min.X + 2
pointer_x := table.innerArea.Min.X + 2 pointerY := table.innerArea.Min.Y
pointer_y := table.innerArea.Min.Y borderPointerX := table.innerArea.Min.X
border_pointer_x := table.innerArea.Min.X
for y, row := range table.Rows { for y, row := range table.Rows {
for x, cell := range row { for x := range row {
table.CalculatePosition(x, y, &pointer_x, &pointer_y, &border_pointer_x) table.CalculatePosition(x, y, &pointerX, &pointerY, &borderPointerX)
backgraound := DefaultTxBuilder.Build(strings.Repeat(" ", table.CellWidth[x]+3), table.BgColors[y], table.BgColors[y]) background := DefaultTxBuilder.Build(strings.Repeat(" ", table.CellWidth[x]+3), table.BgColors[y], table.BgColors[y])
cells := DefaultTxBuilder.Build(cell, table.FgColors[y], table.BgColors[y]) cells := rowCells[y*len(row)+x]
for i, back := range background {
for i, back := range backgraound { buffer.Set(borderPointerX+i, pointerY, back)
buffer.Set(border_pointer_x+i, pointer_y, back)
} }
coordinate_x := pointer_x coordinateX := pointerX
for _, printer := range cells { for _, printer := range cells {
buffer.Set(coordinate_x, pointer_y, printer) buffer.Set(coordinateX, pointerY, printer)
coordinate_x += printer.Width() coordinateX += printer.Width()
} }
if x != 0 { if x != 0 {
devidors := DefaultTxBuilder.Build("|", table.FgColors[y], table.BgColors[y]) dividors := DefaultTxBuilder.Build("|", table.FgColors[y], table.BgColors[y])
for _, devidor := range devidors { for _, dividor := range dividors {
buffer.Set(border_pointer_x, pointer_y, devidor) buffer.Set(borderPointerX, pointerY, dividor)
} }
} }
} }
if table.Seperator { if table.Separator {
border := DefaultTxBuilder.Build(strings.Repeat("─", table.Width-2), table.FgColor, table.BgColor) border := DefaultTxBuilder.Build(strings.Repeat("─", table.Width-2), table.FgColor, table.BgColor)
for i, cell := range border { for i, cell := range border {
buffer.Set(i+1, pointer_y+1, cell) buffer.Set(i+1, pointerY+1, cell)
} }
} }
} }

View File

@ -1,4 +1,4 @@
// Copyright 2016 Zack Guo <zack.y.guo@gmail.com>. All rights reserved. // Copyright 2017 Zack Guo <zack.y.guo@gmail.com>. All rights reserved.
// Use of this source code is governed by a MIT license that can // Use of this source code is governed by a MIT license that can
// be found in the LICENSE file. // be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2016 Zack Guo <zack.y.guo@gmail.com>. All rights reserved. // Copyright 2017 Zack Guo <zack.y.guo@gmail.com>. All rights reserved.
// Use of this source code is governed by a MIT license that can // Use of this source code is governed by a MIT license that can
// be found in the LICENSE file. // be found in the LICENSE file.

View File

@ -1,4 +1,4 @@
// Copyright 2016 Zack Guo <zack.y.guo@gmail.com>. All rights reserved. // Copyright 2017 Zack Guo <zack.y.guo@gmail.com>. All rights reserved.
// Use of this source code is governed by a MIT license that can // Use of this source code is governed by a MIT license that can
// be found in the LICENSE file. // be found in the LICENSE file.

View File

@ -1,16 +0,0 @@
cmd/snappytool/snappytool
testdata/bench
# These explicitly listed benchmark data files are for an obsolete version of
# snappy_test.go.
testdata/alice29.txt
testdata/asyoulik.txt
testdata/fireworks.jpeg
testdata/geo.protodata
testdata/html
testdata/html_x_4
testdata/kppkn.gtb
testdata/lcet10.txt
testdata/paper-100k.pdf
testdata/plrabn12.txt
testdata/urls.10K

View File

@ -138,7 +138,7 @@ func NewBufferedWriter(w io.Writer) *Writer {
} }
} }
// Writer is an io.Writer than can write Snappy-compressed bytes. // Writer is an io.Writer that can write Snappy-compressed bytes.
type Writer struct { type Writer struct {
w io.Writer w io.Writer
err error err error

View File

@ -1,23 +0,0 @@
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so
# Folders
_obj
_test
# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out
*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*
_testmain.go
*.exe
*.test

View File

@ -1 +0,0 @@
/gotasks/specs

View File

@ -1,13 +0,0 @@
language: go
go:
- 1.6.2
- tip
allowed_failures:
- go: tip
install:
- go get -d -v ./... && go install -race -v ./...
script: go test -race -v ./...

View File

@ -1,8 +0,0 @@
language: go
go:
- tip
sudo: false
script:
- go test -v

View File

@ -1,5 +1,7 @@
# go-isatty # go-isatty
[![Build Status](https://travis-ci.org/mattn/go-isatty.svg?branch=master)](https://travis-ci.org/mattn/go-isatty) [![Coverage Status](https://coveralls.io/repos/github/mattn/go-isatty/badge.svg?branch=master)](https://coveralls.io/github/mattn/go-isatty?branch=master)
isatty for golang isatty for golang
## Usage ## Usage
@ -16,6 +18,8 @@ import (
func main() { func main() {
if isatty.IsTerminal(os.Stdout.Fd()) { if isatty.IsTerminal(os.Stdout.Fd()) {
fmt.Println("Is Terminal") fmt.Println("Is Terminal")
} else if isatty.IsCygwinTerminal(os.Stdout.Fd()) {
fmt.Println("Is Cygwin/MSYS2 Terminal")
} else { } else {
fmt.Println("Is Not Terminal") fmt.Println("Is Not Terminal")
} }
@ -28,10 +32,16 @@ func main() {
$ go get github.com/mattn/go-isatty $ go get github.com/mattn/go-isatty
``` ```
# License ## License
MIT MIT
# Author ## Author
Yasuhiro Matsumoto (a.k.a mattn) Yasuhiro Matsumoto (a.k.a mattn)
## Thanks
* k-takata: base idea for IsCygwinTerminal
https://github.com/k-takata/go-iscygpty

View File

@ -0,0 +1,9 @@
// +build !windows appengine
package isatty
// IsCygwinTerminal() return true if the file descriptor is a cygwin or msys2
// terminal. This is also always false on this environment.
func IsCygwinTerminal(fd uintptr) bool {
return false
}

View File

@ -4,12 +4,30 @@
package isatty package isatty
import ( import (
"strings"
"syscall" "syscall"
"unicode/utf16"
"unsafe" "unsafe"
) )
var kernel32 = syscall.NewLazyDLL("kernel32.dll") const (
var procGetConsoleMode = kernel32.NewProc("GetConsoleMode") fileNameInfo uintptr = 2
fileTypePipe = 3
)
var (
kernel32 = syscall.NewLazyDLL("kernel32.dll")
procGetConsoleMode = kernel32.NewProc("GetConsoleMode")
procGetFileInformationByHandleEx = kernel32.NewProc("GetFileInformationByHandleEx")
procGetFileType = kernel32.NewProc("GetFileType")
)
func init() {
// Check if GetFileInformationByHandleEx is available.
if procGetFileInformationByHandleEx.Find() != nil {
procGetFileInformationByHandleEx = nil
}
}
// IsTerminal return true if the file descriptor is terminal. // IsTerminal return true if the file descriptor is terminal.
func IsTerminal(fd uintptr) bool { func IsTerminal(fd uintptr) bool {
@ -17,3 +35,60 @@ func IsTerminal(fd uintptr) bool {
r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, fd, uintptr(unsafe.Pointer(&st)), 0) r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, fd, uintptr(unsafe.Pointer(&st)), 0)
return r != 0 && e == 0 return r != 0 && e == 0
} }
// Check pipe name is used for cygwin/msys2 pty.
// Cygwin/MSYS2 PTY has a name like:
// \{cygwin,msys}-XXXXXXXXXXXXXXXX-ptyN-{from,to}-master
func isCygwinPipeName(name string) bool {
token := strings.Split(name, "-")
if len(token) < 5 {
return false
}
if token[0] != `\msys` && token[0] != `\cygwin` {
return false
}
if token[1] == "" {
return false
}
if !strings.HasPrefix(token[2], "pty") {
return false
}
if token[3] != `from` && token[3] != `to` {
return false
}
if token[4] != "master" {
return false
}
return true
}
// IsCygwinTerminal() return true if the file descriptor is a cygwin or msys2
// terminal.
func IsCygwinTerminal(fd uintptr) bool {
if procGetFileInformationByHandleEx == nil {
return false
}
// Cygwin/msys's pty is a pipe.
ft, _, e := syscall.Syscall(procGetFileType.Addr(), 1, fd, 0, 0)
if ft != fileTypePipe || e != 0 {
return false
}
var buf [2 + syscall.MAX_PATH]uint16
r, _, e := syscall.Syscall6(procGetFileInformationByHandleEx.Addr(),
4, fd, fileNameInfo, uintptr(unsafe.Pointer(&buf)),
uintptr(len(buf)*2), 0, 0)
if r == 0 || e != 0 {
return false
}
l := *(*uint32)(unsafe.Pointer(&buf))
return isCygwinPipeName(string(utf16.Decode(buf[2 : 2+l/2])))
}

View File

@ -1,8 +0,0 @@
language: go
go:
- tip
before_install:
- go get github.com/mattn/goveralls
- go get golang.org/x/tools/cmd/cover
script:
- $HOME/gopath/bin/goveralls -repotoken lAKAWPzcGsD3A8yBX3BGGtRUdJ6CaGERL

File diff suppressed because it is too large Load Diff

View File

@ -25,6 +25,7 @@ There are also some interesting projects using termbox-go:
- [gone](https://github.com/guillaumebreton/gone) is a CLI pomodoro® timer. - [gone](https://github.com/guillaumebreton/gone) is a CLI pomodoro® timer.
- [Spoof.go](https://github.com/sabey/spoofgo) controllable movement spoofing from the cli - [Spoof.go](https://github.com/sabey/spoofgo) controllable movement spoofing from the cli
- [lf](https://github.com/gokcehan/lf) is a terminal file manager - [lf](https://github.com/gokcehan/lf) is a terminal file manager
- [rat](https://github.com/ericfreese/rat) lets you compose shell commands to build terminal applications.
### API reference ### API reference
[godoc.org/github.com/nsf/termbox-go](http://godoc.org/github.com/nsf/termbox-go) [godoc.org/github.com/nsf/termbox-go](http://godoc.org/github.com/nsf/termbox-go)

View File

@ -1,9 +0,0 @@
language: go
go:
- 1.4.3
- 1.5.3
- tip
script:
- go test -v ./...

View File

@ -1,34 +0,0 @@
// Copyright 2014 Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package uuid
import "errors"
func (u UUID) MarshalJSON() ([]byte, error) {
if len(u) != 16 {
return []byte(`""`), nil
}
var js [38]byte
js[0] = '"'
encodeHex(js[1:], u)
js[37] = '"'
return js[:], nil
}
func (u *UUID) UnmarshalJSON(data []byte) error {
if string(data) == `""` {
return nil
}
if data[0] != '"' {
return errors.New("invalid UUID format")
}
data = data[1 : len(data)-1]
uu := Parse(string(data))
if uu == nil {
return errors.New("invalid UUID format")
}
*u = uu
return nil
}

83
vendor/github.com/pborman/uuid/marshal.go generated vendored Normal file
View File

@ -0,0 +1,83 @@
// Copyright 2016 Google Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package uuid
import (
"errors"
"fmt"
)
// MarshalText implements encoding.TextMarshaler.
func (u UUID) MarshalText() ([]byte, error) {
if len(u) != 16 {
return nil, nil
}
var js [36]byte
encodeHex(js[:], u)
return js[:], nil
}
// UnmarshalText implements encoding.TextUnmarshaler.
func (u *UUID) UnmarshalText(data []byte) error {
if len(data) == 0 {
return nil
}
id := Parse(string(data))
if id == nil {
return errors.New("invalid UUID")
}
*u = id
return nil
}
// MarshalBinary implements encoding.BinaryMarshaler.
func (u UUID) MarshalBinary() ([]byte, error) {
return u[:], nil
}
// UnmarshalBinary implements encoding.BinaryUnmarshaler.
func (u *UUID) UnmarshalBinary(data []byte) error {
if len(data) == 0 {
return nil
}
if len(data) != 16 {
return fmt.Errorf("invalid UUID (got %d bytes)", len(data))
}
var id [16]byte
copy(id[:], data)
*u = id[:]
return nil
}
// MarshalText implements encoding.TextMarshaler.
func (u Array) MarshalText() ([]byte, error) {
var js [36]byte
encodeHex(js[:], u[:])
return js[:], nil
}
// UnmarshalText implements encoding.TextUnmarshaler.
func (u *Array) UnmarshalText(data []byte) error {
id := Parse(string(data))
if id == nil {
return errors.New("invalid UUID")
}
*u = id.Array()
return nil
}
// MarshalBinary implements encoding.BinaryMarshaler.
func (u Array) MarshalBinary() ([]byte, error) {
return u[:], nil
}
// UnmarshalBinary implements encoding.BinaryUnmarshaler.
func (u *Array) UnmarshalBinary(data []byte) error {
if len(data) != 16 {
return fmt.Errorf("invalid UUID (got %d bytes)", len(data))
}
copy(u[:], data)
return nil
}

View File

@ -623,6 +623,9 @@ mainLoop:
case rune: case rune:
switch v { switch v {
case cr, lf: case cr, lf:
if s.needRefresh {
s.refresh(p, line, pos)
}
if s.multiLineMode { if s.multiLineMode {
s.resetMultiLine(p, line, pos) s.resetMultiLine(p, line, pos)
} }
@ -1010,6 +1013,9 @@ mainLoop:
case rune: case rune:
switch v { switch v {
case cr, lf: case cr, lf:
if s.needRefresh {
s.refresh(p, line, pos)
}
if s.multiLineMode { if s.multiLineMode {
s.resetMultiLine(p, line, pos) s.resetMultiLine(p, line, pos)
} }

View File

@ -1,9 +0,0 @@
*.[68]
*.a
*.out
*.swp
_obj
_testmain.go
cmd/metrics-bench/metrics-bench
cmd/metrics-example/metrics-example
cmd/never-read/never-read

View File

@ -1,14 +0,0 @@
language: go
go:
- 1.2
- 1.3
- 1.4
- 1.5
script:
- ./validate.sh
# this should give us faster builds according to
# http://docs.travis-ci.com/user/migrating-from-legacy/
sudo: false

View File

@ -1,88 +0,0 @@
# Created by https://www.gitignore.io
### OSX ###
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear on external disk
.Spotlight-V100
.Trashes
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### Windows ###
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msm
*.msp
# Windows shortcuts
*.lnk
### Linux ###
*~
# KDE directory preferences
.directory
### Go ###
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so
# Folders
_obj
_test
# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out
*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*
_testmain.go
*.exe
*.test
*.prof
### vim ###
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
*.un~
Session.vim
.netrwhist
*~

View File

@ -1,29 +0,0 @@
language: go
go:
- 1.4.3
- 1.6
os:
- linux
- osx
matrix:
include:
- os: osx
go: 1.6
env:
- GOFLAGS="-tags kqueue"
env:
global:
- GOBIN=$HOME/bin
- PATH=$HOME/bin:$PATH
install:
- go get -t -v ./...
script:
- "(go version | grep -q 1.4) || go tool vet -all ."
- go install $GOFLAGS ./...
- go test -v -race $GOFLAGS ./...

View File

@ -20,15 +20,26 @@ const (
) )
const ( const (
// FileAccess is an event reported when monitored file/directory was accessed.
FileAccess = fileAccess FileAccess = fileAccess
// FileModified is an event reported when monitored file/directory was modified.
FileModified = fileModified FileModified = fileModified
// FileAttrib is an event reported when monitored file/directory's ATTRIB
// was changed.
FileAttrib = fileAttrib FileAttrib = fileAttrib
// FileDelete is an event reported when monitored file/directory was deleted.
FileDelete = fileDelete FileDelete = fileDelete
// FileRenameTo to is an event reported when monitored file/directory was renamed.
FileRenameTo = fileRenameTo FileRenameTo = fileRenameTo
// FileRenameFrom is an event reported when monitored file/directory was renamed.
FileRenameFrom = fileRenameFrom FileRenameFrom = fileRenameFrom
// FileTrunc is an event reported when monitored file/directory was truncated.
FileTrunc = fileTrunc FileTrunc = fileTrunc
// FileNoFollow is an flag to indicate not to follow symbolic links.
FileNoFollow = fileNoFollow FileNoFollow = fileNoFollow
// Unmounted is an event reported when monitored filesystem was unmounted.
Unmounted = unmounted Unmounted = unmounted
// MountedOver is an event reported when monitored file/directory was mounted on.
MountedOver = mountedOver MountedOver = mountedOver
) )

View File

@ -26,7 +26,7 @@ const (
) )
const ( const (
// NoteDelete is an even reported when the unlink() system call was called // NoteDelete is an event reported when the unlink() system call was called
// on the file referenced by the descriptor. // on the file referenced by the descriptor.
NoteDelete = Event(syscall.NOTE_DELETE) NoteDelete = Event(syscall.NOTE_DELETE)
// NoteWrite is an event reported when a write occurred on the file // NoteWrite is an event reported when a write occurred on the file

View File

@ -4,7 +4,7 @@
// BUG(rjeczalik): Notify does not collect watchpoints, when underlying watches // BUG(rjeczalik): Notify does not collect watchpoints, when underlying watches
// were removed by their os-specific watcher implementations. Instead users are // were removed by their os-specific watcher implementations. Instead users are
// advised to listen on persistant paths to have guarantee they receive events // advised to listen on persistent paths to have guarantee they receive events
// for the whole lifetime of their applications (to discuss see #69). // for the whole lifetime of their applications (to discuss see #69).
// BUG(ppknap): Linux (inotify) does not support watcher behavior masks like // BUG(ppknap): Linux (inotify) does not support watcher behavior masks like
@ -58,7 +58,7 @@ var defaultTree = newTree()
// If a directory which path was used to create recursive watch under Windows // If a directory which path was used to create recursive watch under Windows
// gets deleted, the OS will not report such event. It is advised to keep in // gets deleted, the OS will not report such event. It is advised to keep in
// mind this limitation while setting recursive watchpoints for your application, // mind this limitation while setting recursive watchpoints for your application,
// e.g. use persistant paths like %userprofile% or watch additionally parent // e.g. use persistent paths like %userprofile% or watch additionally parent
// directory of a recursive watchpoint in order to receive delete events for it. // directory of a recursive watchpoint in order to receive delete events for it.
func Watch(path string, c chan<- EventInfo, events ...Event) error { func Watch(path string, c chan<- EventInfo, events ...Event) error {
return defaultTree.Watch(path, c, events...) return defaultTree.Watch(path, c, events...)
@ -67,7 +67,7 @@ func Watch(path string, c chan<- EventInfo, events ...Event) error {
// Stop removes all watchpoints registered for c. All underlying watches are // Stop removes all watchpoints registered for c. All underlying watches are
// also removed, for which c was the last channel listening for events. // also removed, for which c was the last channel listening for events.
// //
// Stop does not close c. When Stop returns, it is guranteed that c will // Stop does not close c. When Stop returns, it is guaranteed that c will
// receive no more signals. // receive no more signals.
func Stop(c chan<- EventInfo) { func Stop(c chan<- EventInfo) {
defaultTree.Stop(c) defaultTree.Stop(c)

View File

@ -45,7 +45,7 @@ type watched struct {
// Stop implements trigger. // Stop implements trigger.
func (f *fen) Stop() error { func (f *fen) Stop() error {
return f.cf.port_alert(f.p) return f.cf.portAlert(f.p)
} }
// Close implements trigger. // Close implements trigger.
@ -92,7 +92,7 @@ func (f *fen) Watched(n interface{}) (*watched, int64, error) {
// init initializes FEN. // init initializes FEN.
func (f *fen) Init() (err error) { func (f *fen) Init() (err error) {
f.p, err = f.cf.port_create() f.p, err = f.cf.portCreate()
return return
} }
@ -106,12 +106,12 @@ func fi2fo(fi os.FileInfo, p string) FileObj {
// Unwatch implements trigger. // Unwatch implements trigger.
func (f *fen) Unwatch(w *watched) error { func (f *fen) Unwatch(w *watched) error {
return f.cf.port_dissociate(f.p, FileObj{Name: w.p}) return f.cf.portDissociate(f.p, FileObj{Name: w.p})
} }
// Watch implements trigger. // Watch implements trigger.
func (f *fen) Watch(fi os.FileInfo, w *watched, e int64) error { func (f *fen) Watch(fi os.FileInfo, w *watched, e int64) error {
return f.cf.port_associate(f.p, fi2fo(fi, w.p), int(e)) return f.cf.portAssociate(f.p, fi2fo(fi, w.p), int(e))
} }
// Wait implements trigger. // Wait implements trigger.
@ -120,7 +120,7 @@ func (f *fen) Wait() (interface{}, error) {
pe PortEvent pe PortEvent
err error err error
) )
err = f.cf.port_get(f.p, &pe) err = f.cf.portGet(f.p, &pe)
return pe, err return pe, err
} }
@ -130,16 +130,14 @@ func (f *fen) IsStop(n interface{}, err error) bool {
} }
func init() { func init() {
encode = func(e Event) (o int64) { encode = func(e Event, dir bool) (o int64) {
// Create event is not supported by FEN. Instead FileModified event will // Create event is not supported by FEN. Instead FileModified event will
// be registered. If this event will be reported on dir which is to be // be registered. If this event will be reported on dir which is to be
// monitored for Create, dir will be rescanned and Create events will // monitored for Create, dir will be rescanned and Create events will
// be generated and returned for new files. In case of files, // be generated and returned for new files. In case of files,
// if not requested FileModified event is reported, it will be ignored. // if not requested FileModified event is reported, it will be ignored.
if e&Create != 0 { o = int64(e &^ Create)
o = (o &^ int64(Create)) | int64(FileModified) if (e&Create != 0 && dir) || e&Write != 0 {
}
if e&Write != 0 {
o = (o &^ int64(Write)) | int64(FileModified) o = (o &^ int64(Write)) | int64(FileModified)
} }
// Following events are 'exception events' and as such cannot be requested // Following events are 'exception events' and as such cannot be requested

View File

@ -67,7 +67,7 @@ func unix2C(sec int64, nsec int64) (C.time_t, C.long) {
return C.time_t(sec), C.long(nsec) return C.time_t(sec), C.long(nsec)
} }
func (c *cfen) port_associate(p int, fo FileObj, e int) (err error) { func (c *cfen) portAssociate(p int, fo FileObj, e int) (err error) {
cfo := C.newFo() cfo := C.newFo()
cfo.fo_atime.tv_sec, cfo.fo_atime.tv_nsec = unix2C(fo.Atim.Unix()) cfo.fo_atime.tv_sec, cfo.fo_atime.tv_nsec = unix2C(fo.Atim.Unix())
cfo.fo_mtime.tv_sec, cfo.fo_mtime.tv_nsec = unix2C(fo.Mtim.Unix()) cfo.fo_mtime.tv_sec, cfo.fo_mtime.tv_nsec = unix2C(fo.Mtim.Unix())
@ -78,7 +78,7 @@ func (c *cfen) port_associate(p int, fo FileObj, e int) (err error) {
return return
} }
func (c *cfen) port_dissociate(port int, fo FileObj) (err error) { func (c *cfen) portDissociate(port int, fo FileObj) (err error) {
cfo, ok := c.p2fo[fo.Name] cfo, ok := c.p2fo[fo.Name]
if !ok { if !ok {
return errNotWatched return errNotWatched
@ -104,7 +104,7 @@ func cfo2fo(cfo *C.struct_file_obj) *FileObj {
return &fo return &fo
} }
func (c *cfen) port_get(port int, pe *PortEvent) (err error) { func (c *cfen) portGet(port int, pe *PortEvent) (err error) {
cpe := C.newPe() cpe := C.newPe()
if _, err = C.port_get(C.int(port), cpe, nil); err != nil { if _, err = C.port_get(C.int(port), cpe, nil); err != nil {
C.free(unsafe.Pointer(cpe)) C.free(unsafe.Pointer(cpe))
@ -118,12 +118,12 @@ func (c *cfen) port_get(port int, pe *PortEvent) (err error) {
return return
} }
func (c *cfen) port_create() (int, error) { func (c *cfen) portCreate() (int, error) {
p, err := C.port_create() p, err := C.port_create()
return int(p), err return int(p), err
} }
func (c *cfen) port_alert(p int) (err error) { func (c *cfen) portAlert(p int) (err error) {
_, err = C.port_alert(C.int(p), alertSet, C.int(666), nil) _, err = C.port_alert(C.int(p), alertSet, C.int(666), nil)
return return
} }

View File

@ -144,7 +144,7 @@ type stream struct {
} }
// NewStream creates a stream for given path, listening for file events and // NewStream creates a stream for given path, listening for file events and
// calling fn upon receving any. // calling fn upon receiving any.
func newStream(path string, fn streamFunc) *stream { func newStream(path string, fn streamFunc) *stream {
return &stream{ return &stream{
path: path, path: path,

View File

@ -157,14 +157,15 @@ func (k *kq) IsStop(n interface{}, err error) bool {
} }
func init() { func init() {
encode = func(e Event) (o int64) { encode = func(e Event, dir bool) (o int64) {
// Create event is not supported by kqueue. Instead NoteWrite event will // Create event is not supported by kqueue. Instead NoteWrite event will
// be registered. If this event will be reported on dir which is to be // be registered for a directory. If this event will be reported on dir
// monitored for Create, dir will be rescanned and Create events will // which is to be monitored for Create, dir will be rescanned
// be generated and returned for new files. In case of files, // and Create events will be generated and returned for new files.
// if not requested NoteRename event is reported, it will be ignored. // In case of files, if not requested NoteRename event is reported,
// it will be ignored.
o = int64(e &^ Create) o = int64(e &^ Create)
if e&Write != 0 { if (e&Create != 0 && dir) || e&Write != 0 {
o = (o &^ int64(Write)) | int64(NoteWrite) o = (o &^ int64(Write)) | int64(NoteWrite)
} }
if e&Rename != 0 { if e&Rename != 0 {

View File

@ -58,7 +58,7 @@ type trigger interface {
// encode Event to native representation. Implementation is to be provided by // encode Event to native representation. Implementation is to be provided by
// platform specific implementation. // platform specific implementation.
var encode func(Event) int64 var encode func(Event, bool) int64
var ( var (
// nat2not matches native events to notify's ones. To be initialized by // nat2not matches native events to notify's ones. To be initialized by
@ -145,13 +145,7 @@ func (t *trg) singlewatch(p string, e Event, direct mode, fi os.FileInfo) (err e
w.eDir |= e w.eDir |= e
w.eNonDir |= e w.eNonDir |= e
} }
var ee int64 if err = t.t.Watch(fi, w, encode(w.eDir|w.eNonDir, fi.IsDir())); err != nil {
// Native Write event is added to wait for Create events (Write event on
// directory triggers it's rescan).
if e&Create != 0 && fi.IsDir() {
ee = int64(not2nat[Write])
}
if err = t.t.Watch(fi, w, encode(w.eDir|w.eNonDir)|ee); err != nil {
return return
} }
if !ok { if !ok {
@ -290,7 +284,7 @@ func (t *trg) dir(w *watched, n interface{}, e, ge Event) (evn []event) {
// However events for rename must be generated for all monitored files // However events for rename must be generated for all monitored files
// inside of moved directory, because native impl does not report it independently // inside of moved directory, because native impl does not report it independently
// for each file descriptor being moved in result of move action on // for each file descriptor being moved in result of move action on
// parent dirLiczba dostępnych dni urlopowych: 0ectory. // parent directory.
if (ge & (not2nat[Rename] | not2nat[Remove])) != 0 { if (ge & (not2nat[Rename] | not2nat[Remove])) != 0 {
// Write is reported also for Remove on directory. Because of that // Write is reported also for Remove on directory. Because of that
// we have to filter it out explicitly. // we have to filter it out explicitly.
@ -399,7 +393,7 @@ func (t *trg) monitor() {
} }
} }
// process event returned by port_get call. // process event returned by native call.
func (t *trg) process(n interface{}) (evn []event) { func (t *trg) process(n interface{}) (evn []event) {
t.Lock() t.Lock()
w, ge, err := t.t.Watched(n) w, ge, err := t.t.Watched(n)
@ -414,13 +408,13 @@ func (t *trg) process(n interface{}) (evn []event) {
switch fi, err := os.Stat(w.p); { switch fi, err := os.Stat(w.p); {
case err != nil: case err != nil:
default: default:
if err = t.t.Watch(fi, w, (encode(w.eDir | w.eNonDir))); err != nil { if err = t.t.Watch(fi, w, encode(w.eDir|w.eNonDir, fi.IsDir())); err != nil {
dbgprintf("trg: %q is no longer watched: %q", w.p, err) dbgprintf("trg: %q is no longer watched: %q", w.p, err)
t.t.Del(w) t.t.Del(w)
} }
} }
} }
if e == Event(0) { if e == Event(0) && (!w.fi.IsDir() || (ge&int64(not2nat[Write])) == 0) {
t.Unlock() t.Unlock()
return return
} }

View File

@ -15,7 +15,7 @@ func eventmask(ei EventInfo, extra Event) Event {
// matches reports a match only when: // matches reports a match only when:
// //
// - for user events, when event is present in the given set // - for user events, when event is present in the given set
// - for internal events, when additionaly both event and set have omit bit set // - for internal events, when additionally both event and set have omit bit set
// //
// Internal events must not be sent to user channels and vice versa. // Internal events must not be sent to user channels and vice versa.
func matches(set, event Event) bool { func matches(set, event Event) bool {

View File

@ -1,5 +0,0 @@
/.test
/otto/otto
/otto/otto-*
/test/test-*.js
/test/tester

View File

@ -114,7 +114,7 @@ http://godoc.org/github.com/robertkrimen/otto/parser
Parse and return an AST Parse and return an AST
```go ```go
filenamee := "" // A filename is optional filename := "" // A filename is optional
src := ` src := `
// Sample xyzzy example // Sample xyzzy example
(function(){ (function(){

View File

@ -70,7 +70,7 @@ func digitValue(chr rune) int {
} }
func builtinGlobal_parseInt(call FunctionCall) Value { func builtinGlobal_parseInt(call FunctionCall) Value {
input := strings.TrimSpace(call.Argument(0).string()) input := strings.Trim(call.Argument(0).string(), builtinString_trim_whitespace)
if len(input) == 0 { if len(input) == 0 {
return NaNValue() return NaNValue()
} }
@ -153,7 +153,8 @@ var parseFloat_matchValid = regexp.MustCompile(`[0-9eE\+\-\.]|Infinity`)
func builtinGlobal_parseFloat(call FunctionCall) Value { func builtinGlobal_parseFloat(call FunctionCall) Value {
// Caveat emptor: This implementation does NOT match the specification // Caveat emptor: This implementation does NOT match the specification
input := strings.TrimSpace(call.Argument(0).string()) input := strings.Trim(call.Argument(0).string(), builtinString_trim_whitespace)
if parseFloat_matchBadSpecial.MatchString(input) { if parseFloat_matchBadSpecial.MatchString(input) {
return NaNValue() return NaNValue()
} }

View File

@ -380,7 +380,12 @@ func builtinString_split(call FunctionCall) Value {
split = split[:limit] split = split[:limit]
} }
return call.runtime.toValue(split) valueArray := make([]Value, len(split))
for index, value := range split {
valueArray[index] = toValue_string(value)
}
return toValue_object(call.runtime.newArrayOf(valueArray))
} }
} }

View File

@ -4,6 +4,7 @@ import (
"fmt" "fmt"
"math" "math"
"reflect" "reflect"
"unicode/utf16"
) )
func (value Value) bool() bool { func (value Value) bool() bool {
@ -32,6 +33,8 @@ func (value Value) bool() bool {
return true return true
case string: case string:
return 0 != len(value) return 0 != len(value)
case []uint16:
return 0 != len(utf16.Decode(value))
} }
if value.IsObject() { if value.IsObject() {
return true return true

View File

@ -11,7 +11,7 @@ import (
var stringToNumberParseInteger = regexp.MustCompile(`^(?:0[xX])`) var stringToNumberParseInteger = regexp.MustCompile(`^(?:0[xX])`)
func parseNumber(value string) float64 { func parseNumber(value string) float64 {
value = strings.TrimSpace(value) value = strings.Trim(value, builtinString_trim_whitespace)
if value == "" { if value == "" {
return 0 return 0

View File

@ -1,4 +0,0 @@
language: go
go:
- 1.3
- 1.4

View File

@ -1,7 +0,0 @@
language: go
go:
- 1.5
- tip
matrix:
allow_failures:
- go: tip

View File

@ -1 +0,0 @@
_obj/

10
vendor/golang.org/x/sys/unix/asm.s generated vendored
View File

@ -1,10 +0,0 @@
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build !gccgo
#include "textflag.h"
TEXT ·use(SB),NOSPLIT,$0
RET

View File

@ -89,6 +89,8 @@ case "$1" in
-syscalls) -syscalls)
for i in zsyscall*go for i in zsyscall*go
do do
# Run the command line that appears in the first line
# of the generated file to regenerate it.
sed 1q $i | sed 's;^// ;;' | sh > _$i && gofmt < _$i > $i sed 1q $i | sed 's;^// ;;' | sh > _$i && gofmt < _$i > $i
rm _$i rm _$i
done done
@ -280,7 +282,7 @@ esac
syscall_goos="syscall_bsd.go $syscall_goos" syscall_goos="syscall_bsd.go $syscall_goos"
;; ;;
esac esac
if [ -n "$mksyscall" ]; then echo "$mksyscall $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go"; fi if [ -n "$mksyscall" ]; then echo "$mksyscall -tags $GOOS,$GOARCH $syscall_goos $GOOSARCH_in |gofmt >zsyscall_$GOOSARCH.go"; fi
;; ;;
esac esac
if [ -n "$mksysctl" ]; then echo "$mksysctl |gofmt >$zsysctl"; fi if [ -n "$mksysctl" ]; then echo "$mksysctl |gofmt >$zsysctl"; fi

View File

@ -114,11 +114,13 @@ includes_Linux='
#include <sys/time.h> #include <sys/time.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <linux/if.h> #include <linux/if.h>
#include <linux/if_alg.h>
#include <linux/if_arp.h> #include <linux/if_arp.h>
#include <linux/if_ether.h> #include <linux/if_ether.h>
#include <linux/if_tun.h> #include <linux/if_tun.h>
#include <linux/if_packet.h> #include <linux/if_packet.h>
#include <linux/if_addr.h> #include <linux/if_addr.h>
#include <linux/falloc.h>
#include <linux/filter.h> #include <linux/filter.h>
#include <linux/netlink.h> #include <linux/netlink.h>
#include <linux/reboot.h> #include <linux/reboot.h>
@ -312,6 +314,7 @@ ccflags="$@"
$2 ~ /^IN_/ || $2 ~ /^IN_/ ||
$2 ~ /^LOCK_(SH|EX|NB|UN)$/ || $2 ~ /^LOCK_(SH|EX|NB|UN)$/ ||
$2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|ICMP6|TCP|EVFILT|NOTE|EV|SHUT|PROT|MAP|PACKET|MSG|SCM|MCL|DT|MADV|PR)_/ || $2 ~ /^(AF|SOCK|SO|SOL|IPPROTO|IP|IPV6|ICMP6|TCP|EVFILT|NOTE|EV|SHUT|PROT|MAP|PACKET|MSG|SCM|MCL|DT|MADV|PR)_/ ||
$2 ~ /^FALLOC_/ ||
$2 == "ICMPV6_FILTER" || $2 == "ICMPV6_FILTER" ||
$2 == "SOMAXCONN" || $2 == "SOMAXCONN" ||
$2 == "NAME_MAX" || $2 == "NAME_MAX" ||
@ -341,6 +344,7 @@ ccflags="$@"
$2 ~ /^(BPF|DLT)_/ || $2 ~ /^(BPF|DLT)_/ ||
$2 ~ /^CLOCK_/ || $2 ~ /^CLOCK_/ ||
$2 ~ /^CAN_/ || $2 ~ /^CAN_/ ||
$2 ~ /^ALG_/ ||
$2 !~ "WMESGLEN" && $2 !~ "WMESGLEN" &&
$2 ~ /^W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", $2, $2)} $2 ~ /^W[A-Z0-9]+$/ {printf("\t%s = C.%s\n", $2, $2)}
$2 ~ /^__WCOREFLAG$/ {next} $2 ~ /^__WCOREFLAG$/ {next}

View File

@ -29,6 +29,7 @@ my $openbsd = 0;
my $netbsd = 0; my $netbsd = 0;
my $dragonfly = 0; my $dragonfly = 0;
my $arm = 0; # 64-bit value should use (even, odd)-pair my $arm = 0; # 64-bit value should use (even, odd)-pair
my $tags = ""; # build tags
if($ARGV[0] eq "-b32") { if($ARGV[0] eq "-b32") {
$_32bit = "big-endian"; $_32bit = "big-endian";
@ -57,14 +58,14 @@ if($ARGV[0] eq "-arm") {
$arm = 1; $arm = 1;
shift; shift;
} }
if($ARGV[0] eq "-tags") {
if($ARGV[0] =~ /^-/) { shift;
print STDERR "usage: mksyscall.pl [-b32 | -l32] [file ...]\n"; $tags = $ARGV[0];
exit 1; shift;
} }
if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") { if($ARGV[0] =~ /^-/) {
print STDERR "GOARCH or GOOS not defined in environment\n"; print STDERR "usage: mksyscall.pl [-b32 | -l32] [-tags x,y] [file ...]\n";
exit 1; exit 1;
} }
@ -132,7 +133,6 @@ while(<>) {
# Prepare arguments to Syscall. # Prepare arguments to Syscall.
my @args = (); my @args = ();
my @uses = ();
my $n = 0; my $n = 0;
foreach my $p (@in) { foreach my $p (@in) {
my ($name, $type) = parseparam($p); my ($name, $type) = parseparam($p);
@ -143,14 +143,12 @@ while(<>) {
$text .= "\t_p$n, $errvar = BytePtrFromString($name)\n"; $text .= "\t_p$n, $errvar = BytePtrFromString($name)\n";
$text .= "\tif $errvar != nil {\n\t\treturn\n\t}\n"; $text .= "\tif $errvar != nil {\n\t\treturn\n\t}\n";
push @args, "uintptr(unsafe.Pointer(_p$n))"; push @args, "uintptr(unsafe.Pointer(_p$n))";
push @uses, "use(unsafe.Pointer(_p$n))";
$n++; $n++;
} elsif($type eq "string") { } elsif($type eq "string") {
print STDERR "$ARGV:$.: $func uses string arguments, but has no error return\n"; print STDERR "$ARGV:$.: $func uses string arguments, but has no error return\n";
$text .= "\tvar _p$n *byte\n"; $text .= "\tvar _p$n *byte\n";
$text .= "\t_p$n, _ = BytePtrFromString($name)\n"; $text .= "\t_p$n, _ = BytePtrFromString($name)\n";
push @args, "uintptr(unsafe.Pointer(_p$n))"; push @args, "uintptr(unsafe.Pointer(_p$n))";
push @uses, "use(unsafe.Pointer(_p$n))";
$n++; $n++;
} elsif($type =~ /^\[\](.*)/) { } elsif($type =~ /^\[\](.*)/) {
# Convert slice into pointer, length. # Convert slice into pointer, length.
@ -278,9 +276,6 @@ while(<>) {
} else { } else {
$text .= "\t$ret[0], $ret[1], $ret[2] := $call\n"; $text .= "\t$ret[0], $ret[1], $ret[2] := $call\n";
} }
foreach my $use (@uses) {
$text .= "\t$use\n";
}
$text .= $body; $text .= $body;
if ($plan9 && $ret[2] eq "e1") { if ($plan9 && $ret[2] eq "e1") {
@ -307,7 +302,7 @@ print <<EOF;
// $cmdline // $cmdline
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// +build $ENV{'GOARCH'},$ENV{'GOOS'} // +build $tags
package unix package unix

View File

@ -22,6 +22,7 @@ use strict;
my $cmdline = "mksyscall_solaris.pl " . join(' ', @ARGV); my $cmdline = "mksyscall_solaris.pl " . join(' ', @ARGV);
my $errors = 0; my $errors = 0;
my $_32bit = ""; my $_32bit = "";
my $tags = ""; # build tags
binmode STDOUT; binmode STDOUT;
@ -32,14 +33,14 @@ if($ARGV[0] eq "-b32") {
$_32bit = "little-endian"; $_32bit = "little-endian";
shift; shift;
} }
if($ARGV[0] eq "-tags") {
if($ARGV[0] =~ /^-/) { shift;
print STDERR "usage: mksyscall_solaris.pl [-b32 | -l32] [file ...]\n"; $tags = $ARGV[0];
exit 1; shift;
} }
if($ENV{'GOARCH'} eq "" || $ENV{'GOOS'} eq "") { if($ARGV[0] =~ /^-/) {
print STDERR "GOARCH or GOOS not defined in environment\n"; print STDERR "usage: mksyscall_solaris.pl [-b32 | -l32] [-tags x,y] [file ...]\n";
exit 1; exit 1;
} }
@ -138,7 +139,6 @@ while(<>) {
# Prepare arguments to Syscall. # Prepare arguments to Syscall.
my @args = (); my @args = ();
my @uses = ();
my $n = 0; my $n = 0;
foreach my $p (@in) { foreach my $p (@in) {
my ($name, $type) = parseparam($p); my ($name, $type) = parseparam($p);
@ -149,14 +149,12 @@ while(<>) {
$text .= "\t_p$n, $errvar = $strconvfunc($name)\n"; $text .= "\t_p$n, $errvar = $strconvfunc($name)\n";
$text .= "\tif $errvar != nil {\n\t\treturn\n\t}\n"; $text .= "\tif $errvar != nil {\n\t\treturn\n\t}\n";
push @args, "uintptr(unsafe.Pointer(_p$n))"; push @args, "uintptr(unsafe.Pointer(_p$n))";
push @uses, "use(unsafe.Pointer(_p$n))";
$n++; $n++;
} elsif($type eq "string") { } elsif($type eq "string") {
print STDERR "$ARGV:$.: $func uses string arguments, but has no error return\n"; print STDERR "$ARGV:$.: $func uses string arguments, but has no error return\n";
$text .= "\tvar _p$n $strconvtype\n"; $text .= "\tvar _p$n $strconvtype\n";
$text .= "\t_p$n, _ = $strconvfunc($name)\n"; $text .= "\t_p$n, _ = $strconvfunc($name)\n";
push @args, "uintptr(unsafe.Pointer(_p$n))"; push @args, "uintptr(unsafe.Pointer(_p$n))";
push @uses, "use(unsafe.Pointer(_p$n))";
$n++; $n++;
} elsif($type =~ /^\[\](.*)/) { } elsif($type =~ /^\[\](.*)/) {
# Convert slice into pointer, length. # Convert slice into pointer, length.
@ -243,9 +241,6 @@ while(<>) {
} else { } else {
$text .= "\t$ret[0], $ret[1], $ret[2] := $call\n"; $text .= "\t$ret[0], $ret[1], $ret[2] := $call\n";
} }
foreach my $use (@uses) {
$text .= "\t$use\n";
}
$text .= $body; $text .= $body;
if ($do_errno) { if ($do_errno) {
@ -265,7 +260,7 @@ print <<EOF;
// $cmdline // $cmdline
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// +build $ENV{'GOARCH'},$ENV{'GOOS'} // +build $tags
package $package package $package

View File

@ -21,8 +21,6 @@
// holds a value of type syscall.Errno. // holds a value of type syscall.Errno.
package unix // import "golang.org/x/sys/unix" package unix // import "golang.org/x/sys/unix"
import "unsafe"
// ByteSliceFromString returns a NUL-terminated slice of bytes // ByteSliceFromString returns a NUL-terminated slice of bytes
// containing the text of s. If s contains a NUL byte at any // containing the text of s. If s contains a NUL byte at any
// location, it returns (nil, EINVAL). // location, it returns (nil, EINVAL).
@ -69,8 +67,3 @@ func (tv *Timeval) Nano() int64 {
} }
func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 } func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec)*1e3 }
// use is a no-op, but the compiler cannot see that it is.
// Calling use(p) ensures that p is kept live until that point.
//go:noescape
func use(p unsafe.Pointer)

View File

@ -144,7 +144,6 @@ func getAttrList(path string, attrList attrList, attrBuf []byte, options uint) (
uintptr(options), uintptr(options),
0, 0,
) )
use(unsafe.Pointer(_p0))
if e1 != 0 { if e1 != 0 {
return nil, e1 return nil, e1
} }
@ -197,7 +196,6 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf)) bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf))
} }
r0, _, e1 := Syscall(SYS_GETFSSTAT64, uintptr(_p0), bufsize, uintptr(flags)) r0, _, e1 := Syscall(SYS_GETFSSTAT64, uintptr(_p0), bufsize, uintptr(flags))
use(unsafe.Pointer(_p0))
n = int(r0) n = int(r0)
if e1 != 0 { if e1 != 0 {
err = e1 err = e1

View File

@ -109,7 +109,6 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf)) bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf))
} }
r0, _, e1 := Syscall(SYS_GETFSSTAT, uintptr(_p0), bufsize, uintptr(flags)) r0, _, e1 := Syscall(SYS_GETFSSTAT, uintptr(_p0), bufsize, uintptr(flags))
use(unsafe.Pointer(_p0))
n = int(r0) n = int(r0)
if e1 != 0 { if e1 != 0 {
err = e1 err = e1

View File

@ -129,7 +129,6 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf)) bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf))
} }
r0, _, e1 := Syscall(SYS_GETFSSTAT, uintptr(_p0), bufsize, uintptr(flags)) r0, _, e1 := Syscall(SYS_GETFSSTAT, uintptr(_p0), bufsize, uintptr(flags))
use(unsafe.Pointer(_p0))
n = int(r0) n = int(r0)
if e1 != 0 { if e1 != 0 {
err = e1 err = e1

View File

@ -452,6 +452,105 @@ func (sa *SockaddrCAN) sockaddr() (unsafe.Pointer, _Socklen, error) {
return unsafe.Pointer(&sa.raw), SizeofSockaddrCAN, nil return unsafe.Pointer(&sa.raw), SizeofSockaddrCAN, nil
} }
// SockaddrALG implements the Sockaddr interface for AF_ALG type sockets.
// SockaddrALG enables userspace access to the Linux kernel's cryptography
// subsystem. The Type and Name fields specify which type of hash or cipher
// should be used with a given socket.
//
// To create a file descriptor that provides access to a hash or cipher, both
// Bind and Accept must be used. Once the setup process is complete, input
// data can be written to the socket, processed by the kernel, and then read
// back as hash output or ciphertext.
//
// Here is an example of using an AF_ALG socket with SHA1 hashing.
// The initial socket setup process is as follows:
//
// // Open a socket to perform SHA1 hashing.
// fd, _ := unix.Socket(unix.AF_ALG, unix.SOCK_SEQPACKET, 0)
// addr := &unix.SockaddrALG{Type: "hash", Name: "sha1"}
// unix.Bind(fd, addr)
// // Note: unix.Accept does not work at this time; must invoke accept()
// // manually using unix.Syscall.
// hashfd, _, _ := unix.Syscall(unix.SYS_ACCEPT, uintptr(fd), 0, 0)
//
// Once a file descriptor has been returned from Accept, it may be used to
// perform SHA1 hashing. The descriptor is not safe for concurrent use, but
// may be re-used repeatedly with subsequent Write and Read operations.
//
// When hashing a small byte slice or string, a single Write and Read may
// be used:
//
// // Assume hashfd is already configured using the setup process.
// hash := os.NewFile(hashfd, "sha1")
// // Hash an input string and read the results. Each Write discards
// // previous hash state. Read always reads the current state.
// b := make([]byte, 20)
// for i := 0; i < 2; i++ {
// io.WriteString(hash, "Hello, world.")
// hash.Read(b)
// fmt.Println(hex.EncodeToString(b))
// }
// // Output:
// // 2ae01472317d1935a84797ec1983ae243fc6aa28
// // 2ae01472317d1935a84797ec1983ae243fc6aa28
//
// For hashing larger byte slices, or byte streams such as those read from
// a file or socket, use Sendto with MSG_MORE to instruct the kernel to update
// the hash digest instead of creating a new one for a given chunk and finalizing it.
//
// // Assume hashfd and addr are already configured using the setup process.
// hash := os.NewFile(hashfd, "sha1")
// // Hash the contents of a file.
// f, _ := os.Open("/tmp/linux-4.10-rc7.tar.xz")
// b := make([]byte, 4096)
// for {
// n, err := f.Read(b)
// if err == io.EOF {
// break
// }
// unix.Sendto(hashfd, b[:n], unix.MSG_MORE, addr)
// }
// hash.Read(b)
// fmt.Println(hex.EncodeToString(b))
// // Output: 85cdcad0c06eef66f805ecce353bec9accbeecc5
//
// For more information, see: http://www.chronox.de/crypto-API/crypto/userspace-if.html.
type SockaddrALG struct {
Type string
Name string
Feature uint32
Mask uint32
raw RawSockaddrALG
}
func (sa *SockaddrALG) sockaddr() (unsafe.Pointer, _Socklen, error) {
// Leave room for NUL byte terminator.
if len(sa.Type) > 13 {
return nil, 0, EINVAL
}
if len(sa.Name) > 63 {
return nil, 0, EINVAL
}
sa.raw.Family = AF_ALG
sa.raw.Feat = sa.Feature
sa.raw.Mask = sa.Mask
typ, err := ByteSliceFromString(sa.Type)
if err != nil {
return nil, 0, err
}
name, err := ByteSliceFromString(sa.Name)
if err != nil {
return nil, 0, err
}
copy(sa.raw.Type[:], typ)
copy(sa.raw.Name[:], name)
return unsafe.Pointer(&sa.raw), SizeofSockaddrALG, nil
}
func anyToSockaddr(rsa *RawSockaddrAny) (Sockaddr, error) { func anyToSockaddr(rsa *RawSockaddrAny) (Sockaddr, error) {
switch rsa.Addr.Family { switch rsa.Addr.Family {
case AF_NETLINK: case AF_NETLINK:

View File

@ -73,7 +73,6 @@ func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr,
func Fstatfs(fd int, buf *Statfs_t) (err error) { func Fstatfs(fd int, buf *Statfs_t) (err error) {
_, _, e := Syscall(SYS_FSTATFS64, uintptr(fd), unsafe.Sizeof(*buf), uintptr(unsafe.Pointer(buf))) _, _, e := Syscall(SYS_FSTATFS64, uintptr(fd), unsafe.Sizeof(*buf), uintptr(unsafe.Pointer(buf)))
use(unsafe.Pointer(buf))
if e != 0 { if e != 0 {
err = errnoErr(e) err = errnoErr(e)
} }
@ -86,7 +85,6 @@ func Statfs(path string, buf *Statfs_t) (err error) {
return err return err
} }
_, _, e := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(p)), unsafe.Sizeof(*buf), uintptr(unsafe.Pointer(buf))) _, _, e := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(p)), unsafe.Sizeof(*buf), uintptr(unsafe.Pointer(buf)))
use(unsafe.Pointer(p))
if e != 0 { if e != 0 {
err = errnoErr(e) err = errnoErr(e)
} }

View File

@ -132,7 +132,6 @@ func (cmsg *Cmsghdr) SetLen(length int) {
func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) { func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) {
mmap_args := [6]uintptr{addr, length, uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset)} mmap_args := [6]uintptr{addr, length, uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset)}
r0, _, e1 := Syscall(SYS_MMAP, uintptr(unsafe.Pointer(&mmap_args[0])), 0, 0) r0, _, e1 := Syscall(SYS_MMAP, uintptr(unsafe.Pointer(&mmap_args[0])), 0, 0)
use(unsafe.Pointer(&mmap_args[0]))
xaddr = uintptr(r0) xaddr = uintptr(r0)
if e1 != 0 { if e1 != 0 {
err = errnoErr(e1) err = errnoErr(e1)

View File

@ -111,7 +111,6 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf)) bufsize = unsafe.Sizeof(Statfs_t{}) * uintptr(len(buf))
} }
r0, _, e1 := Syscall(SYS_GETFSSTAT, uintptr(_p0), bufsize, uintptr(flags)) r0, _, e1 := Syscall(SYS_GETFSSTAT, uintptr(_p0), bufsize, uintptr(flags))
use(unsafe.Pointer(_p0))
n = int(r0) n = int(r0)
if e1 != 0 { if e1 != 0 {
err = e1 err = e1

View File

@ -59,6 +59,7 @@ package unix
#include <bluetooth/bluetooth.h> #include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h> #include <bluetooth/hci.h>
#include <linux/can.h> #include <linux/can.h>
#include <linux/if_alg.h>
#ifdef TCSETS2 #ifdef TCSETS2
// On systems that have "struct termios2" use this as type Termios. // On systems that have "struct termios2" use this as type Termios.
@ -221,6 +222,8 @@ type RawSockaddrHCI C.struct_sockaddr_hci
type RawSockaddrCAN C.struct_sockaddr_can type RawSockaddrCAN C.struct_sockaddr_can
type RawSockaddrALG C.struct_sockaddr_alg
type RawSockaddr C.struct_sockaddr type RawSockaddr C.struct_sockaddr
type RawSockaddrAny C.struct_sockaddr_any type RawSockaddrAny C.struct_sockaddr_any
@ -262,6 +265,7 @@ const (
SizeofSockaddrNetlink = C.sizeof_struct_sockaddr_nl SizeofSockaddrNetlink = C.sizeof_struct_sockaddr_nl
SizeofSockaddrHCI = C.sizeof_struct_sockaddr_hci SizeofSockaddrHCI = C.sizeof_struct_sockaddr_hci
SizeofSockaddrCAN = C.sizeof_struct_sockaddr_can SizeofSockaddrCAN = C.sizeof_struct_sockaddr_can
SizeofSockaddrALG = C.sizeof_struct_sockaddr_alg
SizeofLinger = C.sizeof_struct_linger SizeofLinger = C.sizeof_struct_linger
SizeofIPMreq = C.sizeof_struct_ip_mreq SizeofIPMreq = C.sizeof_struct_ip_mreq
SizeofIPMreqn = C.sizeof_struct_ip_mreqn SizeofIPMreqn = C.sizeof_struct_ip_mreqn

View File

@ -53,6 +53,13 @@ const (
AF_UNSPEC = 0x0 AF_UNSPEC = 0x0
AF_WANPIPE = 0x19 AF_WANPIPE = 0x19
AF_X25 = 0x9 AF_X25 = 0x9
ALG_OP_DECRYPT = 0x0
ALG_OP_ENCRYPT = 0x1
ALG_SET_AEAD_ASSOCLEN = 0x4
ALG_SET_AEAD_AUTHSIZE = 0x5
ALG_SET_IV = 0x2
ALG_SET_KEY = 0x1
ALG_SET_OP = 0x3
ARPHRD_ADAPT = 0x108 ARPHRD_ADAPT = 0x108
ARPHRD_APPLETLK = 0x8 ARPHRD_APPLETLK = 0x8
ARPHRD_ARCNET = 0x7 ARPHRD_ARCNET = 0x7
@ -385,6 +392,12 @@ const (
EXTA = 0xe EXTA = 0xe
EXTB = 0xf EXTB = 0xf
EXTPROC = 0x10000 EXTPROC = 0x10000
FALLOC_FL_COLLAPSE_RANGE = 0x8
FALLOC_FL_INSERT_RANGE = 0x20
FALLOC_FL_KEEP_SIZE = 0x1
FALLOC_FL_NO_HIDE_STALE = 0x4
FALLOC_FL_PUNCH_HOLE = 0x2
FALLOC_FL_ZERO_RANGE = 0x10
FD_CLOEXEC = 0x1 FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400 FD_SETSIZE = 0x400
FF0 = 0x0 FF0 = 0x0

View File

@ -53,6 +53,13 @@ const (
AF_UNSPEC = 0x0 AF_UNSPEC = 0x0
AF_WANPIPE = 0x19 AF_WANPIPE = 0x19
AF_X25 = 0x9 AF_X25 = 0x9
ALG_OP_DECRYPT = 0x0
ALG_OP_ENCRYPT = 0x1
ALG_SET_AEAD_ASSOCLEN = 0x4
ALG_SET_AEAD_AUTHSIZE = 0x5
ALG_SET_IV = 0x2
ALG_SET_KEY = 0x1
ALG_SET_OP = 0x3
ARPHRD_ADAPT = 0x108 ARPHRD_ADAPT = 0x108
ARPHRD_APPLETLK = 0x8 ARPHRD_APPLETLK = 0x8
ARPHRD_ARCNET = 0x7 ARPHRD_ARCNET = 0x7
@ -385,6 +392,12 @@ const (
EXTA = 0xe EXTA = 0xe
EXTB = 0xf EXTB = 0xf
EXTPROC = 0x10000 EXTPROC = 0x10000
FALLOC_FL_COLLAPSE_RANGE = 0x8
FALLOC_FL_INSERT_RANGE = 0x20
FALLOC_FL_KEEP_SIZE = 0x1
FALLOC_FL_NO_HIDE_STALE = 0x4
FALLOC_FL_PUNCH_HOLE = 0x2
FALLOC_FL_ZERO_RANGE = 0x10
FD_CLOEXEC = 0x1 FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400 FD_SETSIZE = 0x400
FF0 = 0x0 FF0 = 0x0

View File

@ -52,6 +52,13 @@ const (
AF_UNSPEC = 0x0 AF_UNSPEC = 0x0
AF_WANPIPE = 0x19 AF_WANPIPE = 0x19
AF_X25 = 0x9 AF_X25 = 0x9
ALG_OP_DECRYPT = 0x0
ALG_OP_ENCRYPT = 0x1
ALG_SET_AEAD_ASSOCLEN = 0x4
ALG_SET_AEAD_AUTHSIZE = 0x5
ALG_SET_IV = 0x2
ALG_SET_KEY = 0x1
ALG_SET_OP = 0x3
ARPHRD_ADAPT = 0x108 ARPHRD_ADAPT = 0x108
ARPHRD_APPLETLK = 0x8 ARPHRD_APPLETLK = 0x8
ARPHRD_ARCNET = 0x7 ARPHRD_ARCNET = 0x7
@ -370,6 +377,12 @@ const (
EXTA = 0xe EXTA = 0xe
EXTB = 0xf EXTB = 0xf
EXTPROC = 0x10000 EXTPROC = 0x10000
FALLOC_FL_COLLAPSE_RANGE = 0x8
FALLOC_FL_INSERT_RANGE = 0x20
FALLOC_FL_KEEP_SIZE = 0x1
FALLOC_FL_NO_HIDE_STALE = 0x4
FALLOC_FL_PUNCH_HOLE = 0x2
FALLOC_FL_ZERO_RANGE = 0x10
FD_CLOEXEC = 0x1 FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400 FD_SETSIZE = 0x400
FF0 = 0x0 FF0 = 0x0

View File

@ -54,6 +54,13 @@ const (
AF_VSOCK = 0x28 AF_VSOCK = 0x28
AF_WANPIPE = 0x19 AF_WANPIPE = 0x19
AF_X25 = 0x9 AF_X25 = 0x9
ALG_OP_DECRYPT = 0x0
ALG_OP_ENCRYPT = 0x1
ALG_SET_AEAD_ASSOCLEN = 0x4
ALG_SET_AEAD_AUTHSIZE = 0x5
ALG_SET_IV = 0x2
ALG_SET_KEY = 0x1
ALG_SET_OP = 0x3
ARPHRD_ADAPT = 0x108 ARPHRD_ADAPT = 0x108
ARPHRD_APPLETLK = 0x8 ARPHRD_APPLETLK = 0x8
ARPHRD_ARCNET = 0x7 ARPHRD_ARCNET = 0x7
@ -399,6 +406,12 @@ const (
EXTA = 0xe EXTA = 0xe
EXTB = 0xf EXTB = 0xf
EXTPROC = 0x10000 EXTPROC = 0x10000
FALLOC_FL_COLLAPSE_RANGE = 0x8
FALLOC_FL_INSERT_RANGE = 0x20
FALLOC_FL_KEEP_SIZE = 0x1
FALLOC_FL_NO_HIDE_STALE = 0x4
FALLOC_FL_PUNCH_HOLE = 0x2
FALLOC_FL_ZERO_RANGE = 0x10
FD_CLOEXEC = 0x1 FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400 FD_SETSIZE = 0x400
FF0 = 0x0 FF0 = 0x0

View File

@ -52,6 +52,13 @@ const (
AF_UNSPEC = 0x0 AF_UNSPEC = 0x0
AF_WANPIPE = 0x19 AF_WANPIPE = 0x19
AF_X25 = 0x9 AF_X25 = 0x9
ALG_OP_DECRYPT = 0x0
ALG_OP_ENCRYPT = 0x1
ALG_SET_AEAD_ASSOCLEN = 0x4
ALG_SET_AEAD_AUTHSIZE = 0x5
ALG_SET_IV = 0x2
ALG_SET_KEY = 0x1
ALG_SET_OP = 0x3
ARPHRD_ADAPT = 0x108 ARPHRD_ADAPT = 0x108
ARPHRD_APPLETLK = 0x8 ARPHRD_APPLETLK = 0x8
ARPHRD_ARCNET = 0x7 ARPHRD_ARCNET = 0x7
@ -375,6 +382,12 @@ const (
EXTA = 0xe EXTA = 0xe
EXTB = 0xf EXTB = 0xf
EXTPROC = 0x10000 EXTPROC = 0x10000
FALLOC_FL_COLLAPSE_RANGE = 0x8
FALLOC_FL_INSERT_RANGE = 0x20
FALLOC_FL_KEEP_SIZE = 0x1
FALLOC_FL_NO_HIDE_STALE = 0x4
FALLOC_FL_PUNCH_HOLE = 0x2
FALLOC_FL_ZERO_RANGE = 0x10
FD_CLOEXEC = 0x1 FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400 FD_SETSIZE = 0x400
FF0 = 0x0 FF0 = 0x0

View File

@ -56,6 +56,13 @@ const (
AF_VSOCK = 0x28 AF_VSOCK = 0x28
AF_WANPIPE = 0x19 AF_WANPIPE = 0x19
AF_X25 = 0x9 AF_X25 = 0x9
ALG_OP_DECRYPT = 0x0
ALG_OP_ENCRYPT = 0x1
ALG_SET_AEAD_ASSOCLEN = 0x4
ALG_SET_AEAD_AUTHSIZE = 0x5
ALG_SET_IV = 0x2
ALG_SET_KEY = 0x1
ALG_SET_OP = 0x3
ARPHRD_6LOWPAN = 0x339 ARPHRD_6LOWPAN = 0x339
ARPHRD_ADAPT = 0x108 ARPHRD_ADAPT = 0x108
ARPHRD_APPLETLK = 0x8 ARPHRD_APPLETLK = 0x8
@ -374,6 +381,12 @@ const (
EXTA = 0xe EXTA = 0xe
EXTB = 0xf EXTB = 0xf
EXTPROC = 0x10000 EXTPROC = 0x10000
FALLOC_FL_COLLAPSE_RANGE = 0x8
FALLOC_FL_INSERT_RANGE = 0x20
FALLOC_FL_KEEP_SIZE = 0x1
FALLOC_FL_NO_HIDE_STALE = 0x4
FALLOC_FL_PUNCH_HOLE = 0x2
FALLOC_FL_ZERO_RANGE = 0x10
FD_CLOEXEC = 0x1 FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400 FD_SETSIZE = 0x400
FLUSHO = 0x2000 FLUSHO = 0x2000

View File

@ -56,6 +56,13 @@ const (
AF_VSOCK = 0x28 AF_VSOCK = 0x28
AF_WANPIPE = 0x19 AF_WANPIPE = 0x19
AF_X25 = 0x9 AF_X25 = 0x9
ALG_OP_DECRYPT = 0x0
ALG_OP_ENCRYPT = 0x1
ALG_SET_AEAD_ASSOCLEN = 0x4
ALG_SET_AEAD_AUTHSIZE = 0x5
ALG_SET_IV = 0x2
ALG_SET_KEY = 0x1
ALG_SET_OP = 0x3
ARPHRD_6LOWPAN = 0x339 ARPHRD_6LOWPAN = 0x339
ARPHRD_ADAPT = 0x108 ARPHRD_ADAPT = 0x108
ARPHRD_APPLETLK = 0x8 ARPHRD_APPLETLK = 0x8
@ -374,6 +381,12 @@ const (
EXTA = 0xe EXTA = 0xe
EXTB = 0xf EXTB = 0xf
EXTPROC = 0x10000 EXTPROC = 0x10000
FALLOC_FL_COLLAPSE_RANGE = 0x8
FALLOC_FL_INSERT_RANGE = 0x20
FALLOC_FL_KEEP_SIZE = 0x1
FALLOC_FL_NO_HIDE_STALE = 0x4
FALLOC_FL_PUNCH_HOLE = 0x2
FALLOC_FL_ZERO_RANGE = 0x10
FD_CLOEXEC = 0x1 FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400 FD_SETSIZE = 0x400
FLUSHO = 0x2000 FLUSHO = 0x2000

View File

@ -57,6 +57,13 @@ const (
AF_VSOCK = 0x28 AF_VSOCK = 0x28
AF_WANPIPE = 0x19 AF_WANPIPE = 0x19
AF_X25 = 0x9 AF_X25 = 0x9
ALG_OP_DECRYPT = 0x0
ALG_OP_ENCRYPT = 0x1
ALG_SET_AEAD_ASSOCLEN = 0x4
ALG_SET_AEAD_AUTHSIZE = 0x5
ALG_SET_IV = 0x2
ALG_SET_KEY = 0x1
ALG_SET_OP = 0x3
ARPHRD_6LOWPAN = 0x339 ARPHRD_6LOWPAN = 0x339
ARPHRD_ADAPT = 0x108 ARPHRD_ADAPT = 0x108
ARPHRD_APPLETLK = 0x8 ARPHRD_APPLETLK = 0x8
@ -411,6 +418,12 @@ const (
EXTA = 0xe EXTA = 0xe
EXTB = 0xf EXTB = 0xf
EXTPROC = 0x10000 EXTPROC = 0x10000
FALLOC_FL_COLLAPSE_RANGE = 0x8
FALLOC_FL_INSERT_RANGE = 0x20
FALLOC_FL_KEEP_SIZE = 0x1
FALLOC_FL_NO_HIDE_STALE = 0x4
FALLOC_FL_PUNCH_HOLE = 0x2
FALLOC_FL_ZERO_RANGE = 0x10
FD_CLOEXEC = 0x1 FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400 FD_SETSIZE = 0x400
FF0 = 0x0 FF0 = 0x0

View File

@ -54,6 +54,13 @@ const (
AF_VSOCK = 0x28 AF_VSOCK = 0x28
AF_WANPIPE = 0x19 AF_WANPIPE = 0x19
AF_X25 = 0x9 AF_X25 = 0x9
ALG_OP_DECRYPT = 0x0
ALG_OP_ENCRYPT = 0x1
ALG_SET_AEAD_ASSOCLEN = 0x4
ALG_SET_AEAD_AUTHSIZE = 0x5
ALG_SET_IV = 0x2
ALG_SET_KEY = 0x1
ALG_SET_OP = 0x3
ARPHRD_6LOWPAN = 0x339 ARPHRD_6LOWPAN = 0x339
ARPHRD_ADAPT = 0x108 ARPHRD_ADAPT = 0x108
ARPHRD_APPLETLK = 0x8 ARPHRD_APPLETLK = 0x8
@ -401,6 +408,12 @@ const (
EXTA = 0xe EXTA = 0xe
EXTB = 0xf EXTB = 0xf
EXTPROC = 0x10000000 EXTPROC = 0x10000000
FALLOC_FL_COLLAPSE_RANGE = 0x8
FALLOC_FL_INSERT_RANGE = 0x20
FALLOC_FL_KEEP_SIZE = 0x1
FALLOC_FL_NO_HIDE_STALE = 0x4
FALLOC_FL_PUNCH_HOLE = 0x2
FALLOC_FL_ZERO_RANGE = 0x10
FD_CLOEXEC = 0x1 FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400 FD_SETSIZE = 0x400
FF0 = 0x0 FF0 = 0x0

View File

@ -54,6 +54,13 @@ const (
AF_VSOCK = 0x28 AF_VSOCK = 0x28
AF_WANPIPE = 0x19 AF_WANPIPE = 0x19
AF_X25 = 0x9 AF_X25 = 0x9
ALG_OP_DECRYPT = 0x0
ALG_OP_ENCRYPT = 0x1
ALG_SET_AEAD_ASSOCLEN = 0x4
ALG_SET_AEAD_AUTHSIZE = 0x5
ALG_SET_IV = 0x2
ALG_SET_KEY = 0x1
ALG_SET_OP = 0x3
ARPHRD_ADAPT = 0x108 ARPHRD_ADAPT = 0x108
ARPHRD_APPLETLK = 0x8 ARPHRD_APPLETLK = 0x8
ARPHRD_ARCNET = 0x7 ARPHRD_ARCNET = 0x7
@ -397,6 +404,12 @@ const (
EXTA = 0xe EXTA = 0xe
EXTB = 0xf EXTB = 0xf
EXTPROC = 0x10000000 EXTPROC = 0x10000000
FALLOC_FL_COLLAPSE_RANGE = 0x8
FALLOC_FL_INSERT_RANGE = 0x20
FALLOC_FL_KEEP_SIZE = 0x1
FALLOC_FL_NO_HIDE_STALE = 0x4
FALLOC_FL_PUNCH_HOLE = 0x2
FALLOC_FL_ZERO_RANGE = 0x10
FD_CLOEXEC = 0x1 FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400 FD_SETSIZE = 0x400
FF0 = 0x0 FF0 = 0x0

View File

@ -56,6 +56,13 @@ const (
AF_VSOCK = 0x28 AF_VSOCK = 0x28
AF_WANPIPE = 0x19 AF_WANPIPE = 0x19
AF_X25 = 0x9 AF_X25 = 0x9
ALG_OP_DECRYPT = 0x0
ALG_OP_ENCRYPT = 0x1
ALG_SET_AEAD_ASSOCLEN = 0x4
ALG_SET_AEAD_AUTHSIZE = 0x5
ALG_SET_IV = 0x2
ALG_SET_KEY = 0x1
ALG_SET_OP = 0x3
ARPHRD_6LOWPAN = 0x339 ARPHRD_6LOWPAN = 0x339
ARPHRD_ADAPT = 0x108 ARPHRD_ADAPT = 0x108
ARPHRD_APPLETLK = 0x8 ARPHRD_APPLETLK = 0x8
@ -407,6 +414,12 @@ const (
EXTA = 0xe EXTA = 0xe
EXTB = 0xf EXTB = 0xf
EXTPROC = 0x10000 EXTPROC = 0x10000
FALLOC_FL_COLLAPSE_RANGE = 0x8
FALLOC_FL_INSERT_RANGE = 0x20
FALLOC_FL_KEEP_SIZE = 0x1
FALLOC_FL_NO_HIDE_STALE = 0x4
FALLOC_FL_PUNCH_HOLE = 0x2
FALLOC_FL_ZERO_RANGE = 0x10
FD_CLOEXEC = 0x1 FD_CLOEXEC = 0x1
FD_SETSIZE = 0x400 FD_SETSIZE = 0x400
FF0 = 0x0 FF0 = 0x0

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