summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stapelberg <stapelberg@debian.org>2013-05-14 18:49:42 +0200
committerMichael Stapelberg <michael@stapelberg.de>2013-05-14 18:50:46 +0200
commit39b34e75d2776044e6d771c808ddf5043db5a0fd (patch)
tree1563b8215307a1c3684da43eb372cc8740fed148
parent75cafdb248f321775838731e79fbdc0db4ffdd1b (diff)
parentefcc50dfdc94c82ee0292bf71992ecb7c0123061 (diff)
downloadgolang-39b34e75d2776044e6d771c808ddf5043db5a0fd.tar.gz
Merge branch 'upstream-sid' into debian-sid
Conflicts: lib/codereview/codereview.py lib/time/zoneinfo.zip src/pkg/go/types/testdata/expr1.src test/fixedbugs/issue5105.dir/a.go test/fixedbugs/issue5260.dir/a.go In the end, I extracted go1.1.src.tar.gz and used cp -r /tmp/go/* . To be honest, I still don’t understand why git-import-orig yields merge errors at all or how that workflow is supposed to work. If someone could enlighten me, I’d be happy.
-rw-r--r--AUTHORS2
-rw-r--r--CONTRIBUTORS3
-rw-r--r--VERSION1
-rw-r--r--api/except.txt6
-rw-r--r--api/go1.1.txt1773
-rw-r--r--api/next.txt1766
-rw-r--r--doc/articles/godoc_documenting_go_code.html7
-rw-r--r--doc/articles/image_package.html4
-rw-r--r--doc/articles/race_detector.html4
-rw-r--r--doc/code.html8
-rw-r--r--doc/codewalk/urlpoll.go2
-rw-r--r--doc/devel/weekly.html4
-rw-r--r--doc/docs.html6
-rw-r--r--doc/effective_go.html16
-rw-r--r--doc/gccgo_contribute.html2
-rw-r--r--doc/go1.1.html114
-rw-r--r--doc/go1.html10
-rw-r--r--doc/go_faq.html28
-rw-r--r--doc/go_spec.html5
-rw-r--r--doc/install.html2
-rw-r--r--doc/reference.html6
-rw-r--r--doc/root.html41
-rw-r--r--lib/codereview/codereview.cfg1
-rw-r--r--lib/codereview/codereview.py3553
-rwxr-xr-xlib/codereview/test.sh198
-rwxr-xr-xlib/time/update.bash4
-rw-r--r--lib/time/zoneinfo.zipbin374065 -> 374530 bytes
-rw-r--r--misc/cgo/test/cflags.go32
-rw-r--r--misc/cgo/test/cgo_test.go2
-rw-r--r--misc/cgo/test/cthread.go5
-rw-r--r--misc/cgo/test/issue5227.go38
-rw-r--r--misc/cgo/testso/cgoso.c14
-rw-r--r--misc/cgo/testso/cgoso.go2
-rw-r--r--misc/cgo/testso/cgoso_c.c16
-rw-r--r--misc/cgo/testso/test.bat18
-rw-r--r--misc/dashboard/builder/main.go20
-rw-r--r--misc/dist/bindist.go9
-rwxr-xr-x[-rw-r--r--]misc/dist/darwin/scripts/preinstall0
-rw-r--r--misc/zsh/go23
-rw-r--r--src/cmd/5g/cgen.c67
-rw-r--r--src/cmd/5g/gsubr.c5
-rw-r--r--src/cmd/6g/cgen.c59
-rw-r--r--src/cmd/6g/ggen.c2
-rw-r--r--src/cmd/6g/gobj.c3
-rw-r--r--src/cmd/6g/gsubr.c8
-rw-r--r--src/cmd/6g/reg.c6
-rw-r--r--src/cmd/8g/cgen.c53
-rw-r--r--src/cmd/8g/gsubr.c3
-rw-r--r--src/cmd/api/goapi.go9
-rw-r--r--src/cmd/cgo/doc.go6
-rw-r--r--src/cmd/cgo/gcc.go102
-rw-r--r--src/cmd/cgo/main.go27
-rw-r--r--src/cmd/cov/Makefile5
-rw-r--r--src/cmd/cov/doc.go36
-rw-r--r--src/cmd/cov/main.c484
-rw-r--r--src/cmd/cov/tree.c245
-rw-r--r--src/cmd/cov/tree.h47
-rw-r--r--src/cmd/dist/build.c4
-rw-r--r--src/cmd/dist/goc2c.c3
-rw-r--r--src/cmd/gc/align.c7
-rw-r--r--src/cmd/gc/closure.c19
-rw-r--r--src/cmd/gc/fmt.c3
-rw-r--r--src/cmd/gc/gen.c2
-rw-r--r--src/cmd/gc/go.h12
-rw-r--r--src/cmd/gc/inl.c1
-rw-r--r--src/cmd/gc/pgen.c13
-rw-r--r--src/cmd/gc/reflect.c8
-rw-r--r--src/cmd/gc/sinit.c8
-rw-r--r--src/cmd/gc/subr.c11
-rw-r--r--src/cmd/gc/swt.c2
-rw-r--r--src/cmd/gc/typecheck.c3
-rw-r--r--src/cmd/gc/unsafe.c42
-rw-r--r--src/cmd/go/build.go78
-rw-r--r--src/cmd/go/doc.go8
-rw-r--r--src/cmd/go/help.go8
-rw-r--r--src/cmd/go/main.go26
-rw-r--r--src/cmd/go/run.go16
-rw-r--r--src/cmd/go/test.go4
-rw-r--r--src/cmd/go/vcs.go2
-rw-r--r--src/cmd/ld/data.c87
-rw-r--r--src/cmd/ld/doc.go14
-rw-r--r--src/cmd/ld/dwarf.c230
-rw-r--r--src/cmd/ld/elf.c15
-rw-r--r--src/cmd/ld/elf.h5
-rw-r--r--src/cmd/ld/go.c5
-rw-r--r--src/cmd/ld/ldmacho.c4
-rw-r--r--src/cmd/ld/ldpe.c16
-rw-r--r--src/cmd/ld/lib.c50
-rw-r--r--src/cmd/ld/lib.h8
-rw-r--r--src/cmd/ld/symtab.c29
-rw-r--r--src/cmd/prof/Makefile5
-rw-r--r--src/cmd/prof/doc.go49
-rw-r--r--src/cmd/prof/main.c910
-rw-r--r--src/cmd/vet/Makefile6
-rw-r--r--src/cmd/vet/test_buildtag_bad.go (renamed from src/cmd/vet/buildtag_bad.go)6
-rw-r--r--src/lib9/run_plan9.c2
-rw-r--r--src/lib9/run_unix.c2
-rw-r--r--src/lib9/tempdir_unix.c2
-rw-r--r--src/libmach/8.c1
-rwxr-xr-xsrc/make.bash4
-rw-r--r--src/pkg/archive/zip/reader.go7
-rw-r--r--src/pkg/archive/zip/reader_test.go20
-rw-r--r--src/pkg/archive/zip/struct.go9
-rw-r--r--src/pkg/archive/zip/testdata/test-trailing-junk.zipbin0 -> 1184 bytes
-rw-r--r--src/pkg/archive/zip/writer.go3
-rw-r--r--src/pkg/bufio/scan.go26
-rw-r--r--src/pkg/bufio/scan_test.go36
-rw-r--r--src/pkg/builtin/builtin.go6
-rw-r--r--src/pkg/crypto/ecdsa/ecdsa.go2
-rw-r--r--src/pkg/crypto/rand/util.go5
-rw-r--r--src/pkg/database/sql/driver/driver.go4
-rw-r--r--src/pkg/database/sql/fakedb_test.go40
-rw-r--r--src/pkg/database/sql/sql.go131
-rw-r--r--src/pkg/database/sql/sql_test.go203
-rw-r--r--src/pkg/encoding/json/decode_test.go2
-rw-r--r--src/pkg/encoding/json/encode.go98
-rw-r--r--src/pkg/encoding/json/encode_test.go104
-rw-r--r--src/pkg/fmt/doc.go10
-rw-r--r--src/pkg/fmt/fmt_test.go3
-rw-r--r--src/pkg/fmt/print.go7
-rw-r--r--src/pkg/go/ast/filter.go25
-rw-r--r--src/pkg/go/ast/filter_test.go86
-rw-r--r--src/pkg/go/ast/print.go2
-rw-r--r--src/pkg/go/build/deps_test.go2
-rw-r--r--src/pkg/go/build/doc.go16
-rw-r--r--src/pkg/go/doc/example.go7
-rw-r--r--src/pkg/go/doc/example_test.go80
-rw-r--r--src/pkg/go/scanner/scanner.go13
-rw-r--r--src/pkg/go/scanner/scanner_test.go5
-rw-r--r--src/pkg/go/token/token.go4
-rw-r--r--src/pkg/image/png/writer.go2
-rw-r--r--src/pkg/io/io.go12
-rw-r--r--src/pkg/math/rand/zipf.go6
-rw-r--r--src/pkg/mime/multipart/multipart.go7
-rw-r--r--src/pkg/mime/multipart/quotedprintable.go20
-rw-r--r--src/pkg/mime/multipart/quotedprintable_test.go9
-rw-r--r--src/pkg/net/dial_gen.go18
-rw-r--r--src/pkg/net/dial_gen_test.go11
-rw-r--r--src/pkg/net/dial_test.go77
-rw-r--r--src/pkg/net/fd_unix.go12
-rw-r--r--src/pkg/net/fd_windows.go25
-rw-r--r--src/pkg/net/http/client_test.go2
-rw-r--r--src/pkg/net/http/cookiejar/jar.go3
-rw-r--r--src/pkg/net/http/httptest/example_test.go2
-rw-r--r--src/pkg/net/http/request.go2
-rw-r--r--src/pkg/net/http/serve_test.go28
-rw-r--r--src/pkg/net/http/server.go8
-rw-r--r--src/pkg/net/http/server_test.go35
-rw-r--r--src/pkg/net/http/z_last_test.go1
-rw-r--r--src/pkg/net/ipraw_test.go7
-rw-r--r--src/pkg/net/sock_posix.go4
-rw-r--r--src/pkg/net/tcpsock_plan9.go4
-rw-r--r--src/pkg/net/tcpsock_posix.go6
-rw-r--r--src/pkg/net/unixsock_plan9.go4
-rw-r--r--src/pkg/net/unixsock_posix.go6
-rw-r--r--src/pkg/os/exec/exec_test.go129
-rw-r--r--src/pkg/reflect/value.go12
-rw-r--r--src/pkg/regexp/regexp.go6
-rw-r--r--src/pkg/runtime/arch_arm.h2
-rw-r--r--src/pkg/runtime/asm_arm.s2
-rw-r--r--src/pkg/runtime/atomic_arm.c4
-rw-r--r--src/pkg/runtime/cgo/callbacks.c6
-rw-r--r--src/pkg/runtime/cgo/gcc_386.S3
-rw-r--r--src/pkg/runtime/cgo/gcc_amd64.S4
-rw-r--r--src/pkg/runtime/cgo/gcc_arm.S3
-rw-r--r--src/pkg/runtime/chan.c31
-rw-r--r--src/pkg/runtime/crash_test.go20
-rw-r--r--src/pkg/runtime/debug/garbage_test.go2
-rw-r--r--src/pkg/runtime/defs_freebsd.go4
-rw-r--r--src/pkg/runtime/defs_freebsd_386.h4
-rw-r--r--src/pkg/runtime/defs_freebsd_amd64.h4
-rw-r--r--src/pkg/runtime/defs_freebsd_arm.h4
-rw-r--r--src/pkg/runtime/hashmap.c35
-rw-r--r--src/pkg/runtime/lock_futex.c28
-rw-r--r--src/pkg/runtime/lock_sema.c34
-rw-r--r--src/pkg/runtime/malloc.h16
-rw-r--r--src/pkg/runtime/map_test.go29
-rw-r--r--src/pkg/runtime/mgc0.c70
-rw-r--r--src/pkg/runtime/mheap.c19
-rw-r--r--src/pkg/runtime/mprof.goc2
-rw-r--r--src/pkg/runtime/os_darwin.c11
-rw-r--r--src/pkg/runtime/os_freebsd.c11
-rw-r--r--src/pkg/runtime/os_linux.c9
-rw-r--r--src/pkg/runtime/os_netbsd.c9
-rw-r--r--src/pkg/runtime/os_openbsd.c9
-rw-r--r--src/pkg/runtime/proc.c9
-rw-r--r--src/pkg/runtime/race/doc.go9
-rw-r--r--src/pkg/runtime/race/race.go1
-rw-r--r--src/pkg/runtime/race/race_test.go2
-rw-r--r--src/pkg/runtime/race/testdata/atomic_test.go19
-rw-r--r--src/pkg/runtime/race/testdata/sync_test.go19
-rw-r--r--src/pkg/runtime/runtime.h24
-rw-r--r--src/pkg/runtime/sema.goc6
-rw-r--r--src/pkg/runtime/signal_openbsd_386.h2
-rw-r--r--src/pkg/sort/sort.go9
-rw-r--r--src/pkg/sync/atomic/race.go15
-rw-r--r--src/pkg/sync/cond.go3
-rw-r--r--src/pkg/sync/mutex.go1
-rw-r--r--src/pkg/sync/rwmutex.go4
-rw-r--r--src/pkg/sync/waitgroup.go2
-rw-r--r--src/pkg/syscall/exec_bsd.go9
-rw-r--r--src/pkg/syscall/exec_linux.go10
-rw-r--r--src/pkg/syscall/exec_plan9.go10
-rw-r--r--src/pkg/syscall/syscall_darwin.go2
-rw-r--r--src/pkg/syscall/syscall_freebsd.go2
-rw-r--r--src/pkg/syscall/syscall_netbsd.go2
-rw-r--r--src/pkg/syscall/syscall_openbsd.go2
-rw-r--r--src/pkg/syscall/zsyscall_darwin_386.go9
-rw-r--r--src/pkg/syscall/zsyscall_darwin_amd64.go9
-rw-r--r--src/pkg/syscall/zsyscall_freebsd_386.go9
-rw-r--r--src/pkg/syscall/zsyscall_freebsd_amd64.go9
-rw-r--r--src/pkg/syscall/zsyscall_netbsd_386.go9
-rw-r--r--src/pkg/syscall/zsyscall_netbsd_amd64.go9
-rw-r--r--src/pkg/syscall/zsyscall_openbsd_386.go9
-rw-r--r--src/pkg/syscall/zsyscall_openbsd_amd64.go9
-rw-r--r--src/pkg/testing/iotest/reader.go8
-rw-r--r--src/pkg/text/template/funcs.go2
-rw-r--r--src/pkg/time/example_test.go11
-rw-r--r--src/pkg/time/format.go41
-rw-r--r--src/pkg/time/sleep_test.go5
-rwxr-xr-xsrc/run.bash2
-rw-r--r--src/run.bat12
-rw-r--r--test/chan/select2.go2
-rw-r--r--test/fixedbugs/issue4909a.go35
-rw-r--r--test/fixedbugs/issue4909b.go80
-rw-r--r--test/fixedbugs/issue5231.go45
-rw-r--r--test/fixedbugs/issue5259.dir/bug.go17
-rw-r--r--test/fixedbugs/issue5259.dir/main.go16
-rw-r--r--test/fixedbugs/issue5259.go9
-rw-r--r--test/fixedbugs/issue5260.dir/a.go7
-rw-r--r--test/fixedbugs/issue5260.dir/b.go11
-rw-r--r--test/fixedbugs/issue5260.go10
-rw-r--r--test/fixedbugs/issue5291.dir/pkg1.go34
-rw-r--r--test/fixedbugs/issue5291.dir/prog.go17
-rw-r--r--test/fixedbugs/issue5291.go9
-rw-r--r--test/goprint.go2
-rw-r--r--test/map.go55
-rw-r--r--test/mapnan.go64
-rw-r--r--test/nilptr.go22
-rw-r--r--test/sizeof.go137
-rw-r--r--test/stress/maps.go111
-rw-r--r--test/stress/parsego.go220
-rw-r--r--test/stress/runstress.go164
243 files changed, 5632 insertions, 8181 deletions
diff --git a/AUTHORS b/AUTHORS
index b7acdc6cd..c21dce7e5 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -153,6 +153,7 @@ Joakim Sernbrant <serbaut@gmail.com>
Joe Poirier <jdpoirier@gmail.com>
John Asmuth <jasmuth@gmail.com>
John Graham-Cumming <jgc@jgc.org> <jgrahamc@gmail.com>
+John Howard Palevich <jack.palevich@gmail.com>
Jonathan Gold <jgold.bg@gmail.com>
Jonathan Mark <jhmark@xenops.com>
Jonathan Rudenberg <jonathan@titanous.com>
@@ -206,6 +207,7 @@ Miquel Sabaté Solà <mikisabate@gmail.com>
Moriyoshi Koizumi <mozo@mozo.jp>
Môshe van der Sterre <moshevds@gmail.com>
ngmoco, LLC
+Nicholas Presta <nick@nickpresta.ca> <nick1presta@gmail.com>
Nicholas Waples <nwaples@gmail.com>
Nick Craig-Wood <nick@craig-wood.com> <nickcw@gmail.com>
Nigel Kerr <nigel.kerr@gmail.com>
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 7b8779be9..6298dc828 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -214,6 +214,7 @@ Jean-Marc Eurin <jmeurin@google.com>
Jeff Hodges <jeff@somethingsimilar.com>
Jeff R. Allen <jra@nella.org> <jeff.allen@gmail.com>
Jeff Wendling <jeff@spacemonkey.com>
+Jeremiah Harmsen <jeremiah@google.com>
Jeremy Jackins <jeremyjackins@gmail.com>
Jeremy Schlatter <jeremy.schlatter@gmail.com>
Jim McGrath <jimmc2@gmail.com>
@@ -227,6 +228,7 @@ John Asmuth <jasmuth@gmail.com>
John Beisley <huin@google.com>
John DeNero <denero@google.com>
John Graham-Cumming <jgc@jgc.org> <jgrahamc@gmail.com>
+John Howard Palevich <jack.palevich@gmail.com>
Jonathan Allie <jonallie@google.com>
Jonathan Feinberg <feinberg@google.com>
Jonathan Gold <jgold.bg@gmail.com>
@@ -305,6 +307,7 @@ Mikkel Krautz <mikkel@krautz.dk> <krautz@gmail.com>
Miquel Sabaté Solà <mikisabate@gmail.com>
Moriyoshi Koizumi <mozo@mozo.jp>
Môshe van der Sterre <moshevds@gmail.com>
+Nicholas Presta <nick@nickpresta.ca> <nick1presta@gmail.com>
Nicholas Waples <nwaples@gmail.com>
Nick Craig-Wood <nick@craig-wood.com> <nickcw@gmail.com>
Nigel Kerr <nigel.kerr@gmail.com>
diff --git a/VERSION b/VERSION
new file mode 100644
index 000000000..d843d5c32
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+go1.1 \ No newline at end of file
diff --git a/api/except.txt b/api/except.txt
index 7f8f81df5..930d03721 100644
--- a/api/except.txt
+++ b/api/except.txt
@@ -1,3 +1,9 @@
pkg net, func ListenUnixgram(string, *UnixAddr) (*UDPConn, error)
+pkg syscall (darwin-386), func Fchflags(string, int) error
+pkg syscall (darwin-386-cgo), func Fchflags(string, int) error
+pkg syscall (darwin-amd64), func Fchflags(string, int) error
+pkg syscall (darwin-amd64-cgo), func Fchflags(string, int) error
+pkg syscall (freebsd-386), func Fchflags(string, int) error
+pkg syscall (freebsd-amd64), func Fchflags(string, int) error
pkg text/template/parse, type DotNode bool
pkg text/template/parse, type Node interface { Copy, String, Type }
diff --git a/api/go1.1.txt b/api/go1.1.txt
new file mode 100644
index 000000000..0d0b5e380
--- /dev/null
+++ b/api/go1.1.txt
@@ -0,0 +1,1773 @@
+pkg archive/tar, const TypeGNULongLink ideal-char
+pkg archive/tar, const TypeGNULongName ideal-char
+pkg archive/tar, func FileInfoHeader(os.FileInfo, string) (*Header, error)
+pkg archive/tar, method (*Header) FileInfo() os.FileInfo
+pkg archive/zip, type FileHeader struct, CompressedSize64 uint64
+pkg archive/zip, type FileHeader struct, UncompressedSize64 uint64
+pkg bufio, const MaxScanTokenSize ideal-int
+pkg bufio, func NewScanner(io.Reader) *Scanner
+pkg bufio, func ScanBytes([]uint8, bool) (int, []uint8, error)
+pkg bufio, func ScanLines([]uint8, bool) (int, []uint8, error)
+pkg bufio, func ScanRunes([]uint8, bool) (int, []uint8, error)
+pkg bufio, func ScanWords([]uint8, bool) (int, []uint8, error)
+pkg bufio, method (*Reader) WriteTo(io.Writer) (int64, error)
+pkg bufio, method (*Scanner) Bytes() []uint8
+pkg bufio, method (*Scanner) Err() error
+pkg bufio, method (*Scanner) Scan() bool
+pkg bufio, method (*Scanner) Split(SplitFunc)
+pkg bufio, method (*Scanner) Text() string
+pkg bufio, method (*Writer) ReadFrom(io.Reader) (int64, error)
+pkg bufio, method (ReadWriter) ReadFrom(io.Reader) (int64, error)
+pkg bufio, method (ReadWriter) WriteTo(io.Writer) (int64, error)
+pkg bufio, type Scanner struct
+pkg bufio, type SplitFunc func([]uint8, bool) (int, []uint8, error)
+pkg bufio, var ErrAdvanceTooFar error
+pkg bufio, var ErrNegativeAdvance error
+pkg bufio, var ErrTooLong error
+pkg bytes, func TrimPrefix([]uint8, []uint8) []uint8
+pkg bytes, func TrimSuffix([]uint8, []uint8) []uint8
+pkg bytes, method (*Buffer) Grow(int)
+pkg bytes, method (*Reader) WriteTo(io.Writer) (int64, error)
+pkg compress/gzip, method (*Writer) Flush() error
+pkg crypto/hmac, func Equal([]uint8, []uint8) bool
+pkg crypto/tls, const TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA uint16
+pkg crypto/tls, const TLS_RSA_WITH_AES_256_CBC_SHA uint16
+pkg crypto/tls, type Config struct, PreferServerCipherSuites bool
+pkg crypto/tls, type Config struct, SessionTicketKey [32]uint8
+pkg crypto/tls, type Config struct, SessionTicketsDisabled bool
+pkg crypto/tls, type ConnectionState struct, DidResume bool
+pkg crypto/x509, const ECDSA PublicKeyAlgorithm
+pkg crypto/x509, const ECDSAWithSHA1 SignatureAlgorithm
+pkg crypto/x509, const ECDSAWithSHA256 SignatureAlgorithm
+pkg crypto/x509, const ECDSAWithSHA384 SignatureAlgorithm
+pkg crypto/x509, const ECDSAWithSHA512 SignatureAlgorithm
+pkg crypto/x509, const ExtKeyUsageIPSECEndSystem ExtKeyUsage
+pkg crypto/x509, const ExtKeyUsageIPSECTunnel ExtKeyUsage
+pkg crypto/x509, const ExtKeyUsageIPSECUser ExtKeyUsage
+pkg crypto/x509, const ExtKeyUsageMicrosoftServerGatedCrypto ExtKeyUsage
+pkg crypto/x509, const ExtKeyUsageNetscapeServerGatedCrypto ExtKeyUsage
+pkg crypto/x509, const IncompatibleUsage InvalidReason
+pkg crypto/x509, const PEMCipher3DES PEMCipher
+pkg crypto/x509, const PEMCipherAES128 PEMCipher
+pkg crypto/x509, const PEMCipherAES192 PEMCipher
+pkg crypto/x509, const PEMCipherAES256 PEMCipher
+pkg crypto/x509, const PEMCipherDES PEMCipher
+pkg crypto/x509, func DecryptPEMBlock(*pem.Block, []uint8) ([]uint8, error)
+pkg crypto/x509, func EncryptPEMBlock(io.Reader, string, []uint8, []uint8, PEMCipher) (*pem.Block, error)
+pkg crypto/x509, func IsEncryptedPEMBlock(*pem.Block) bool
+pkg crypto/x509, func ParseECPrivateKey([]uint8) (*ecdsa.PrivateKey, error)
+pkg crypto/x509, method (SystemRootsError) Error() string
+pkg crypto/x509, type Certificate struct, IPAddresses []net.IP
+pkg crypto/x509, type PEMCipher int
+pkg crypto/x509, type SystemRootsError struct
+pkg crypto/x509, type VerifyOptions struct, KeyUsages []ExtKeyUsage
+pkg crypto/x509, var IncorrectPasswordError error
+pkg database/sql, method (*DB) Ping() error
+pkg database/sql, method (*DB) SetMaxIdleConns(int)
+pkg database/sql/driver, type Queryer interface { Query }
+pkg database/sql/driver, type Queryer interface, Query(string, []Value) (Rows, error)
+pkg debug/elf, method (*File) DynString(DynTag) ([]string, error)
+pkg debug/elf, type FileHeader struct, Entry uint64
+pkg debug/pe, const COFFSymbolSize ideal-int
+pkg debug/pe, type COFFSymbol struct
+pkg debug/pe, type COFFSymbol struct, Name [8]uint8
+pkg debug/pe, type COFFSymbol struct, NumberOfAuxSymbols uint8
+pkg debug/pe, type COFFSymbol struct, SectionNumber int16
+pkg debug/pe, type COFFSymbol struct, StorageClass uint8
+pkg debug/pe, type COFFSymbol struct, Type uint16
+pkg debug/pe, type COFFSymbol struct, Value uint32
+pkg debug/pe, type File struct, Symbols []*Symbol
+pkg debug/pe, type Symbol struct
+pkg debug/pe, type Symbol struct, Name string
+pkg debug/pe, type Symbol struct, SectionNumber int16
+pkg debug/pe, type Symbol struct, StorageClass uint8
+pkg debug/pe, type Symbol struct, Type uint16
+pkg debug/pe, type Symbol struct, Value uint32
+pkg encoding/csv, method (*Writer) Error() error
+pkg encoding/json, method (*Decoder) Buffered() io.Reader
+pkg encoding/json, method (*Decoder) UseNumber()
+pkg encoding/json, method (Number) Float64() (float64, error)
+pkg encoding/json, method (Number) Int64() (int64, error)
+pkg encoding/json, method (Number) String() string
+pkg encoding/json, type Number string
+pkg encoding/xml, func EscapeText(io.Writer, []uint8) error
+pkg encoding/xml, method (*Encoder) Indent(string, string)
+pkg encoding/xml, type Decoder struct, DefaultSpace string
+pkg go/ast, func NewCommentMap(*token.FileSet, Node, []*CommentGroup) CommentMap
+pkg go/ast, method (CommentMap) Comments() []*CommentGroup
+pkg go/ast, method (CommentMap) Filter(Node) CommentMap
+pkg go/ast, method (CommentMap) String() string
+pkg go/ast, method (CommentMap) Update(Node, Node) Node
+pkg go/ast, type ChanType struct, Arrow token.Pos
+pkg go/ast, type CommentMap map[Node][]*CommentGroup
+pkg go/build, type Context struct, InstallSuffix string
+pkg go/build, type Context struct, ReleaseTags []string
+pkg go/build, type Package struct, IgnoredGoFiles []string
+pkg go/build, type Package struct, SwigCXXFiles []string
+pkg go/build, type Package struct, SwigFiles []string
+pkg go/doc, type Example struct, EmptyOutput bool
+pkg go/doc, type Example struct, Order int
+pkg go/doc, type Example struct, Play *ast.File
+pkg go/doc, type Note struct
+pkg go/doc, type Note struct, Body string
+pkg go/doc, type Note struct, End token.Pos
+pkg go/doc, type Note struct, Pos token.Pos
+pkg go/doc, type Note struct, UID string
+pkg go/doc, type Package struct, Notes map[string][]*Note
+pkg go/doc, var IllegalPrefixes []string
+pkg go/format, func Node(io.Writer, *token.FileSet, interface{}) error
+pkg go/format, func Source([]uint8) ([]uint8, error)
+pkg go/parser, const AllErrors Mode
+pkg go/printer, type Config struct, Indent int
+pkg image, const YCbCrSubsampleRatio440 YCbCrSubsampleRatio
+pkg io, type ByteWriter interface { WriteByte }
+pkg io, type ByteWriter interface, WriteByte(uint8) error
+pkg io, var ErrNoProgress error
+pkg log/syslog (darwin-386), const LOG_AUTH Priority
+pkg log/syslog (darwin-386), const LOG_AUTHPRIV Priority
+pkg log/syslog (darwin-386), const LOG_CRON Priority
+pkg log/syslog (darwin-386), const LOG_DAEMON Priority
+pkg log/syslog (darwin-386), const LOG_FTP Priority
+pkg log/syslog (darwin-386), const LOG_KERN Priority
+pkg log/syslog (darwin-386), const LOG_LOCAL0 Priority
+pkg log/syslog (darwin-386), const LOG_LOCAL1 Priority
+pkg log/syslog (darwin-386), const LOG_LOCAL2 Priority
+pkg log/syslog (darwin-386), const LOG_LOCAL3 Priority
+pkg log/syslog (darwin-386), const LOG_LOCAL4 Priority
+pkg log/syslog (darwin-386), const LOG_LOCAL5 Priority
+pkg log/syslog (darwin-386), const LOG_LOCAL6 Priority
+pkg log/syslog (darwin-386), const LOG_LOCAL7 Priority
+pkg log/syslog (darwin-386), const LOG_LPR Priority
+pkg log/syslog (darwin-386), const LOG_MAIL Priority
+pkg log/syslog (darwin-386), const LOG_NEWS Priority
+pkg log/syslog (darwin-386), const LOG_SYSLOG Priority
+pkg log/syslog (darwin-386), const LOG_USER Priority
+pkg log/syslog (darwin-386), const LOG_UUCP Priority
+pkg log/syslog (darwin-386-cgo), const LOG_AUTH Priority
+pkg log/syslog (darwin-386-cgo), const LOG_AUTHPRIV Priority
+pkg log/syslog (darwin-386-cgo), const LOG_CRON Priority
+pkg log/syslog (darwin-386-cgo), const LOG_DAEMON Priority
+pkg log/syslog (darwin-386-cgo), const LOG_FTP Priority
+pkg log/syslog (darwin-386-cgo), const LOG_KERN Priority
+pkg log/syslog (darwin-386-cgo), const LOG_LOCAL0 Priority
+pkg log/syslog (darwin-386-cgo), const LOG_LOCAL1 Priority
+pkg log/syslog (darwin-386-cgo), const LOG_LOCAL2 Priority
+pkg log/syslog (darwin-386-cgo), const LOG_LOCAL3 Priority
+pkg log/syslog (darwin-386-cgo), const LOG_LOCAL4 Priority
+pkg log/syslog (darwin-386-cgo), const LOG_LOCAL5 Priority
+pkg log/syslog (darwin-386-cgo), const LOG_LOCAL6 Priority
+pkg log/syslog (darwin-386-cgo), const LOG_LOCAL7 Priority
+pkg log/syslog (darwin-386-cgo), const LOG_LPR Priority
+pkg log/syslog (darwin-386-cgo), const LOG_MAIL Priority
+pkg log/syslog (darwin-386-cgo), const LOG_NEWS Priority
+pkg log/syslog (darwin-386-cgo), const LOG_SYSLOG Priority
+pkg log/syslog (darwin-386-cgo), const LOG_USER Priority
+pkg log/syslog (darwin-386-cgo), const LOG_UUCP Priority
+pkg log/syslog (darwin-amd64), const LOG_AUTH Priority
+pkg log/syslog (darwin-amd64), const LOG_AUTHPRIV Priority
+pkg log/syslog (darwin-amd64), const LOG_CRON Priority
+pkg log/syslog (darwin-amd64), const LOG_DAEMON Priority
+pkg log/syslog (darwin-amd64), const LOG_FTP Priority
+pkg log/syslog (darwin-amd64), const LOG_KERN Priority
+pkg log/syslog (darwin-amd64), const LOG_LOCAL0 Priority
+pkg log/syslog (darwin-amd64), const LOG_LOCAL1 Priority
+pkg log/syslog (darwin-amd64), const LOG_LOCAL2 Priority
+pkg log/syslog (darwin-amd64), const LOG_LOCAL3 Priority
+pkg log/syslog (darwin-amd64), const LOG_LOCAL4 Priority
+pkg log/syslog (darwin-amd64), const LOG_LOCAL5 Priority
+pkg log/syslog (darwin-amd64), const LOG_LOCAL6 Priority
+pkg log/syslog (darwin-amd64), const LOG_LOCAL7 Priority
+pkg log/syslog (darwin-amd64), const LOG_LPR Priority
+pkg log/syslog (darwin-amd64), const LOG_MAIL Priority
+pkg log/syslog (darwin-amd64), const LOG_NEWS Priority
+pkg log/syslog (darwin-amd64), const LOG_SYSLOG Priority
+pkg log/syslog (darwin-amd64), const LOG_USER Priority
+pkg log/syslog (darwin-amd64), const LOG_UUCP Priority
+pkg log/syslog (darwin-amd64-cgo), const LOG_AUTH Priority
+pkg log/syslog (darwin-amd64-cgo), const LOG_AUTHPRIV Priority
+pkg log/syslog (darwin-amd64-cgo), const LOG_CRON Priority
+pkg log/syslog (darwin-amd64-cgo), const LOG_DAEMON Priority
+pkg log/syslog (darwin-amd64-cgo), const LOG_FTP Priority
+pkg log/syslog (darwin-amd64-cgo), const LOG_KERN Priority
+pkg log/syslog (darwin-amd64-cgo), const LOG_LOCAL0 Priority
+pkg log/syslog (darwin-amd64-cgo), const LOG_LOCAL1 Priority
+pkg log/syslog (darwin-amd64-cgo), const LOG_LOCAL2 Priority
+pkg log/syslog (darwin-amd64-cgo), const LOG_LOCAL3 Priority
+pkg log/syslog (darwin-amd64-cgo), const LOG_LOCAL4 Priority
+pkg log/syslog (darwin-amd64-cgo), const LOG_LOCAL5 Priority
+pkg log/syslog (darwin-amd64-cgo), const LOG_LOCAL6 Priority
+pkg log/syslog (darwin-amd64-cgo), const LOG_LOCAL7 Priority
+pkg log/syslog (darwin-amd64-cgo), const LOG_LPR Priority
+pkg log/syslog (darwin-amd64-cgo), const LOG_MAIL Priority
+pkg log/syslog (darwin-amd64-cgo), const LOG_NEWS Priority
+pkg log/syslog (darwin-amd64-cgo), const LOG_SYSLOG Priority
+pkg log/syslog (darwin-amd64-cgo), const LOG_USER Priority
+pkg log/syslog (darwin-amd64-cgo), const LOG_UUCP Priority
+pkg log/syslog (freebsd-386), const LOG_AUTH Priority
+pkg log/syslog (freebsd-386), const LOG_AUTHPRIV Priority
+pkg log/syslog (freebsd-386), const LOG_CRON Priority
+pkg log/syslog (freebsd-386), const LOG_DAEMON Priority
+pkg log/syslog (freebsd-386), const LOG_FTP Priority
+pkg log/syslog (freebsd-386), const LOG_KERN Priority
+pkg log/syslog (freebsd-386), const LOG_LOCAL0 Priority
+pkg log/syslog (freebsd-386), const LOG_LOCAL1 Priority
+pkg log/syslog (freebsd-386), const LOG_LOCAL2 Priority
+pkg log/syslog (freebsd-386), const LOG_LOCAL3 Priority
+pkg log/syslog (freebsd-386), const LOG_LOCAL4 Priority
+pkg log/syslog (freebsd-386), const LOG_LOCAL5 Priority
+pkg log/syslog (freebsd-386), const LOG_LOCAL6 Priority
+pkg log/syslog (freebsd-386), const LOG_LOCAL7 Priority
+pkg log/syslog (freebsd-386), const LOG_LPR Priority
+pkg log/syslog (freebsd-386), const LOG_MAIL Priority
+pkg log/syslog (freebsd-386), const LOG_NEWS Priority
+pkg log/syslog (freebsd-386), const LOG_SYSLOG Priority
+pkg log/syslog (freebsd-386), const LOG_USER Priority
+pkg log/syslog (freebsd-386), const LOG_UUCP Priority
+pkg log/syslog (freebsd-amd64), const LOG_AUTH Priority
+pkg log/syslog (freebsd-amd64), const LOG_AUTHPRIV Priority
+pkg log/syslog (freebsd-amd64), const LOG_CRON Priority
+pkg log/syslog (freebsd-amd64), const LOG_DAEMON Priority
+pkg log/syslog (freebsd-amd64), const LOG_FTP Priority
+pkg log/syslog (freebsd-amd64), const LOG_KERN Priority
+pkg log/syslog (freebsd-amd64), const LOG_LOCAL0 Priority
+pkg log/syslog (freebsd-amd64), const LOG_LOCAL1 Priority
+pkg log/syslog (freebsd-amd64), const LOG_LOCAL2 Priority
+pkg log/syslog (freebsd-amd64), const LOG_LOCAL3 Priority
+pkg log/syslog (freebsd-amd64), const LOG_LOCAL4 Priority
+pkg log/syslog (freebsd-amd64), const LOG_LOCAL5 Priority
+pkg log/syslog (freebsd-amd64), const LOG_LOCAL6 Priority
+pkg log/syslog (freebsd-amd64), const LOG_LOCAL7 Priority
+pkg log/syslog (freebsd-amd64), const LOG_LPR Priority
+pkg log/syslog (freebsd-amd64), const LOG_MAIL Priority
+pkg log/syslog (freebsd-amd64), const LOG_NEWS Priority
+pkg log/syslog (freebsd-amd64), const LOG_SYSLOG Priority
+pkg log/syslog (freebsd-amd64), const LOG_USER Priority
+pkg log/syslog (freebsd-amd64), const LOG_UUCP Priority
+pkg log/syslog (linux-386), const LOG_AUTH Priority
+pkg log/syslog (linux-386), const LOG_AUTHPRIV Priority
+pkg log/syslog (linux-386), const LOG_CRON Priority
+pkg log/syslog (linux-386), const LOG_DAEMON Priority
+pkg log/syslog (linux-386), const LOG_FTP Priority
+pkg log/syslog (linux-386), const LOG_KERN Priority
+pkg log/syslog (linux-386), const LOG_LOCAL0 Priority
+pkg log/syslog (linux-386), const LOG_LOCAL1 Priority
+pkg log/syslog (linux-386), const LOG_LOCAL2 Priority
+pkg log/syslog (linux-386), const LOG_LOCAL3 Priority
+pkg log/syslog (linux-386), const LOG_LOCAL4 Priority
+pkg log/syslog (linux-386), const LOG_LOCAL5 Priority
+pkg log/syslog (linux-386), const LOG_LOCAL6 Priority
+pkg log/syslog (linux-386), const LOG_LOCAL7 Priority
+pkg log/syslog (linux-386), const LOG_LPR Priority
+pkg log/syslog (linux-386), const LOG_MAIL Priority
+pkg log/syslog (linux-386), const LOG_NEWS Priority
+pkg log/syslog (linux-386), const LOG_SYSLOG Priority
+pkg log/syslog (linux-386), const LOG_USER Priority
+pkg log/syslog (linux-386), const LOG_UUCP Priority
+pkg log/syslog (linux-386-cgo), const LOG_AUTH Priority
+pkg log/syslog (linux-386-cgo), const LOG_AUTHPRIV Priority
+pkg log/syslog (linux-386-cgo), const LOG_CRON Priority
+pkg log/syslog (linux-386-cgo), const LOG_DAEMON Priority
+pkg log/syslog (linux-386-cgo), const LOG_FTP Priority
+pkg log/syslog (linux-386-cgo), const LOG_KERN Priority
+pkg log/syslog (linux-386-cgo), const LOG_LOCAL0 Priority
+pkg log/syslog (linux-386-cgo), const LOG_LOCAL1 Priority
+pkg log/syslog (linux-386-cgo), const LOG_LOCAL2 Priority
+pkg log/syslog (linux-386-cgo), const LOG_LOCAL3 Priority
+pkg log/syslog (linux-386-cgo), const LOG_LOCAL4 Priority
+pkg log/syslog (linux-386-cgo), const LOG_LOCAL5 Priority
+pkg log/syslog (linux-386-cgo), const LOG_LOCAL6 Priority
+pkg log/syslog (linux-386-cgo), const LOG_LOCAL7 Priority
+pkg log/syslog (linux-386-cgo), const LOG_LPR Priority
+pkg log/syslog (linux-386-cgo), const LOG_MAIL Priority
+pkg log/syslog (linux-386-cgo), const LOG_NEWS Priority
+pkg log/syslog (linux-386-cgo), const LOG_SYSLOG Priority
+pkg log/syslog (linux-386-cgo), const LOG_USER Priority
+pkg log/syslog (linux-386-cgo), const LOG_UUCP Priority
+pkg log/syslog (linux-amd64), const LOG_AUTH Priority
+pkg log/syslog (linux-amd64), const LOG_AUTHPRIV Priority
+pkg log/syslog (linux-amd64), const LOG_CRON Priority
+pkg log/syslog (linux-amd64), const LOG_DAEMON Priority
+pkg log/syslog (linux-amd64), const LOG_FTP Priority
+pkg log/syslog (linux-amd64), const LOG_KERN Priority
+pkg log/syslog (linux-amd64), const LOG_LOCAL0 Priority
+pkg log/syslog (linux-amd64), const LOG_LOCAL1 Priority
+pkg log/syslog (linux-amd64), const LOG_LOCAL2 Priority
+pkg log/syslog (linux-amd64), const LOG_LOCAL3 Priority
+pkg log/syslog (linux-amd64), const LOG_LOCAL4 Priority
+pkg log/syslog (linux-amd64), const LOG_LOCAL5 Priority
+pkg log/syslog (linux-amd64), const LOG_LOCAL6 Priority
+pkg log/syslog (linux-amd64), const LOG_LOCAL7 Priority
+pkg log/syslog (linux-amd64), const LOG_LPR Priority
+pkg log/syslog (linux-amd64), const LOG_MAIL Priority
+pkg log/syslog (linux-amd64), const LOG_NEWS Priority
+pkg log/syslog (linux-amd64), const LOG_SYSLOG Priority
+pkg log/syslog (linux-amd64), const LOG_USER Priority
+pkg log/syslog (linux-amd64), const LOG_UUCP Priority
+pkg log/syslog (linux-amd64-cgo), const LOG_AUTH Priority
+pkg log/syslog (linux-amd64-cgo), const LOG_AUTHPRIV Priority
+pkg log/syslog (linux-amd64-cgo), const LOG_CRON Priority
+pkg log/syslog (linux-amd64-cgo), const LOG_DAEMON Priority
+pkg log/syslog (linux-amd64-cgo), const LOG_FTP Priority
+pkg log/syslog (linux-amd64-cgo), const LOG_KERN Priority
+pkg log/syslog (linux-amd64-cgo), const LOG_LOCAL0 Priority
+pkg log/syslog (linux-amd64-cgo), const LOG_LOCAL1 Priority
+pkg log/syslog (linux-amd64-cgo), const LOG_LOCAL2 Priority
+pkg log/syslog (linux-amd64-cgo), const LOG_LOCAL3 Priority
+pkg log/syslog (linux-amd64-cgo), const LOG_LOCAL4 Priority
+pkg log/syslog (linux-amd64-cgo), const LOG_LOCAL5 Priority
+pkg log/syslog (linux-amd64-cgo), const LOG_LOCAL6 Priority
+pkg log/syslog (linux-amd64-cgo), const LOG_LOCAL7 Priority
+pkg log/syslog (linux-amd64-cgo), const LOG_LPR Priority
+pkg log/syslog (linux-amd64-cgo), const LOG_MAIL Priority
+pkg log/syslog (linux-amd64-cgo), const LOG_NEWS Priority
+pkg log/syslog (linux-amd64-cgo), const LOG_SYSLOG Priority
+pkg log/syslog (linux-amd64-cgo), const LOG_USER Priority
+pkg log/syslog (linux-amd64-cgo), const LOG_UUCP Priority
+pkg log/syslog (linux-arm), const LOG_AUTH Priority
+pkg log/syslog (linux-arm), const LOG_AUTHPRIV Priority
+pkg log/syslog (linux-arm), const LOG_CRON Priority
+pkg log/syslog (linux-arm), const LOG_DAEMON Priority
+pkg log/syslog (linux-arm), const LOG_FTP Priority
+pkg log/syslog (linux-arm), const LOG_KERN Priority
+pkg log/syslog (linux-arm), const LOG_LOCAL0 Priority
+pkg log/syslog (linux-arm), const LOG_LOCAL1 Priority
+pkg log/syslog (linux-arm), const LOG_LOCAL2 Priority
+pkg log/syslog (linux-arm), const LOG_LOCAL3 Priority
+pkg log/syslog (linux-arm), const LOG_LOCAL4 Priority
+pkg log/syslog (linux-arm), const LOG_LOCAL5 Priority
+pkg log/syslog (linux-arm), const LOG_LOCAL6 Priority
+pkg log/syslog (linux-arm), const LOG_LOCAL7 Priority
+pkg log/syslog (linux-arm), const LOG_LPR Priority
+pkg log/syslog (linux-arm), const LOG_MAIL Priority
+pkg log/syslog (linux-arm), const LOG_NEWS Priority
+pkg log/syslog (linux-arm), const LOG_SYSLOG Priority
+pkg log/syslog (linux-arm), const LOG_USER Priority
+pkg log/syslog (linux-arm), const LOG_UUCP Priority
+pkg math/big, method (*Int) MarshalJSON() ([]uint8, error)
+pkg math/big, method (*Int) SetUint64(uint64) *Int
+pkg math/big, method (*Int) Uint64() uint64
+pkg math/big, method (*Int) UnmarshalJSON([]uint8) error
+pkg math/big, method (*Rat) Float64() (float64, bool)
+pkg math/big, method (*Rat) SetFloat64(float64) *Rat
+pkg mime/multipart, method (*Writer) SetBoundary(string) error
+pkg net, func ListenUnixgram(string, *UnixAddr) (*UnixConn, error)
+pkg net, func LookupNS(string) ([]*NS, error)
+pkg net, method (*Dialer) Dial(string, string) (Conn, error)
+pkg net, method (*IPConn) ReadMsgIP([]uint8, []uint8) (int, int, int, *IPAddr, error)
+pkg net, method (*IPConn) WriteMsgIP([]uint8, []uint8, *IPAddr) (int, int, error)
+pkg net, method (*UDPConn) ReadMsgUDP([]uint8, []uint8) (int, int, int, *UDPAddr, error)
+pkg net, method (*UDPConn) WriteMsgUDP([]uint8, []uint8, *UDPAddr) (int, int, error)
+pkg net, method (*UnixConn) CloseRead() error
+pkg net, method (*UnixConn) CloseWrite() error
+pkg net, type Dialer struct
+pkg net, type Dialer struct, Deadline time.Time
+pkg net, type Dialer struct, LocalAddr Addr
+pkg net, type Dialer struct, Timeout time.Duration
+pkg net, type IPAddr struct, Zone string
+pkg net, type NS struct
+pkg net, type NS struct, Host string
+pkg net, type TCPAddr struct, Zone string
+pkg net, type UDPAddr struct, Zone string
+pkg net/http, func ParseTime(string) (time.Time, error)
+pkg net/http, method (*Request) PostFormValue(string) string
+pkg net/http, method (*ServeMux) Handler(*Request) (Handler, string)
+pkg net/http, method (*Transport) CancelRequest(*Request)
+pkg net/http, type CloseNotifier interface { CloseNotify }
+pkg net/http, type CloseNotifier interface, CloseNotify() <-chan bool
+pkg net/http, type Request struct, PostForm url.Values
+pkg net/http, type Server struct, TLSNextProto map[string]func(*Server, *tls.Conn, Handler)
+pkg net/http, type Transport struct, ResponseHeaderTimeout time.Duration
+pkg net/http/cookiejar, func New(*Options) (*Jar, error)
+pkg net/http/cookiejar, method (*Jar) Cookies(*url.URL) []*http.Cookie
+pkg net/http/cookiejar, method (*Jar) SetCookies(*url.URL, []*http.Cookie)
+pkg net/http/cookiejar, type Jar struct
+pkg net/http/cookiejar, type Options struct
+pkg net/http/cookiejar, type Options struct, PublicSuffixList PublicSuffixList
+pkg net/http/cookiejar, type PublicSuffixList interface { PublicSuffix, String }
+pkg net/http/cookiejar, type PublicSuffixList interface, PublicSuffix(string) string
+pkg net/http/cookiejar, type PublicSuffixList interface, String() string
+pkg net/mail, func ParseAddress(string) (*Address, error)
+pkg net/mail, func ParseAddressList(string) ([]*Address, error)
+pkg net/smtp, method (*Client) Hello(string) error
+pkg net/textproto, func TrimBytes([]uint8) []uint8
+pkg net/textproto, func TrimString(string) string
+pkg os, method (FileMode) IsRegular() bool
+pkg os/signal, func Stop(chan<- os.Signal)
+pkg reflect, const SelectDefault SelectDir
+pkg reflect, const SelectRecv SelectDir
+pkg reflect, const SelectSend SelectDir
+pkg reflect, func ChanOf(ChanDir, Type) Type
+pkg reflect, func MakeFunc(Type, func([]Value) []Value) Value
+pkg reflect, func MapOf(Type, Type) Type
+pkg reflect, func Select([]SelectCase) (int, Value, bool)
+pkg reflect, func SliceOf(Type) Type
+pkg reflect, method (Value) Convert(Type) Value
+pkg reflect, type SelectCase struct
+pkg reflect, type SelectCase struct, Chan Value
+pkg reflect, type SelectCase struct, Dir SelectDir
+pkg reflect, type SelectCase struct, Send Value
+pkg reflect, type SelectDir int
+pkg reflect, type Type interface, ConvertibleTo(Type) bool
+pkg regexp, method (*Regexp) Longest()
+pkg regexp, method (*Regexp) Split(string, int) []string
+pkg regexp/syntax, const ErrUnexpectedParen ErrorCode
+pkg runtime, func BlockProfile([]BlockProfileRecord) (int, bool)
+pkg runtime, func SetBlockProfileRate(int)
+pkg runtime, method (*BlockProfileRecord) Stack() []uintptr
+pkg runtime, type BlockProfileRecord struct
+pkg runtime, type BlockProfileRecord struct, Count int64
+pkg runtime, type BlockProfileRecord struct, Cycles int64
+pkg runtime, type BlockProfileRecord struct, embedded StackRecord
+pkg runtime/debug, func FreeOSMemory()
+pkg runtime/debug, func ReadGCStats(*GCStats)
+pkg runtime/debug, func SetGCPercent(int) int
+pkg runtime/debug, type GCStats struct
+pkg runtime/debug, type GCStats struct, LastGC time.Time
+pkg runtime/debug, type GCStats struct, NumGC int64
+pkg runtime/debug, type GCStats struct, Pause []time.Duration
+pkg runtime/debug, type GCStats struct, PauseQuantiles []time.Duration
+pkg runtime/debug, type GCStats struct, PauseTotal time.Duration
+pkg sort, func Reverse(Interface) Interface
+pkg strings, func TrimPrefix(string, string) string
+pkg strings, func TrimSuffix(string, string) string
+pkg strings, method (*Reader) WriteTo(io.Writer) (int64, error)
+pkg syscall (darwin-386), const B0 ideal-int
+pkg syscall (darwin-386), const B110 ideal-int
+pkg syscall (darwin-386), const B115200 ideal-int
+pkg syscall (darwin-386), const B1200 ideal-int
+pkg syscall (darwin-386), const B134 ideal-int
+pkg syscall (darwin-386), const B14400 ideal-int
+pkg syscall (darwin-386), const B150 ideal-int
+pkg syscall (darwin-386), const B1800 ideal-int
+pkg syscall (darwin-386), const B19200 ideal-int
+pkg syscall (darwin-386), const B200 ideal-int
+pkg syscall (darwin-386), const B230400 ideal-int
+pkg syscall (darwin-386), const B2400 ideal-int
+pkg syscall (darwin-386), const B28800 ideal-int
+pkg syscall (darwin-386), const B300 ideal-int
+pkg syscall (darwin-386), const B38400 ideal-int
+pkg syscall (darwin-386), const B4800 ideal-int
+pkg syscall (darwin-386), const B50 ideal-int
+pkg syscall (darwin-386), const B57600 ideal-int
+pkg syscall (darwin-386), const B600 ideal-int
+pkg syscall (darwin-386), const B7200 ideal-int
+pkg syscall (darwin-386), const B75 ideal-int
+pkg syscall (darwin-386), const B76800 ideal-int
+pkg syscall (darwin-386), const B9600 ideal-int
+pkg syscall (darwin-386), const BRKINT ideal-int
+pkg syscall (darwin-386), const CFLUSH ideal-int
+pkg syscall (darwin-386), const CLOCAL ideal-int
+pkg syscall (darwin-386), const CREAD ideal-int
+pkg syscall (darwin-386), const CS5 ideal-int
+pkg syscall (darwin-386), const CS6 ideal-int
+pkg syscall (darwin-386), const CS7 ideal-int
+pkg syscall (darwin-386), const CS8 ideal-int
+pkg syscall (darwin-386), const CSIZE ideal-int
+pkg syscall (darwin-386), const CSTART ideal-int
+pkg syscall (darwin-386), const CSTATUS ideal-int
+pkg syscall (darwin-386), const CSTOP ideal-int
+pkg syscall (darwin-386), const CSTOPB ideal-int
+pkg syscall (darwin-386), const CSUSP ideal-int
+pkg syscall (darwin-386), const FLUSHO ideal-int
+pkg syscall (darwin-386), const HUPCL ideal-int
+pkg syscall (darwin-386), const ICANON ideal-int
+pkg syscall (darwin-386), const ICRNL ideal-int
+pkg syscall (darwin-386), const IEXTEN ideal-int
+pkg syscall (darwin-386), const IGNBRK ideal-int
+pkg syscall (darwin-386), const IGNCR ideal-int
+pkg syscall (darwin-386), const IGNPAR ideal-int
+pkg syscall (darwin-386), const IMAXBEL ideal-int
+pkg syscall (darwin-386), const INLCR ideal-int
+pkg syscall (darwin-386), const INPCK ideal-int
+pkg syscall (darwin-386), const ISIG ideal-int
+pkg syscall (darwin-386), const ISTRIP ideal-int
+pkg syscall (darwin-386), const IUTF8 ideal-int
+pkg syscall (darwin-386), const IXANY ideal-int
+pkg syscall (darwin-386), const IXOFF ideal-int
+pkg syscall (darwin-386), const IXON ideal-int
+pkg syscall (darwin-386), const NOFLSH ideal-int
+pkg syscall (darwin-386), const OCRNL ideal-int
+pkg syscall (darwin-386), const OFDEL ideal-int
+pkg syscall (darwin-386), const OFILL ideal-int
+pkg syscall (darwin-386), const ONLCR ideal-int
+pkg syscall (darwin-386), const ONLRET ideal-int
+pkg syscall (darwin-386), const ONOCR ideal-int
+pkg syscall (darwin-386), const ONOEOT ideal-int
+pkg syscall (darwin-386), const OPOST ideal-int
+pkg syscall (darwin-386), const PARENB ideal-int
+pkg syscall (darwin-386), const PARMRK ideal-int
+pkg syscall (darwin-386), const PARODD ideal-int
+pkg syscall (darwin-386), const PENDIN ideal-int
+pkg syscall (darwin-386), const SizeofInet4Pktinfo ideal-int
+pkg syscall (darwin-386), const TCIFLUSH ideal-int
+pkg syscall (darwin-386), const TCIOFLUSH ideal-int
+pkg syscall (darwin-386), const TCOFLUSH ideal-int
+pkg syscall (darwin-386), const TCSAFLUSH ideal-int
+pkg syscall (darwin-386), const TOSTOP ideal-int
+pkg syscall (darwin-386), const VDISCARD ideal-int
+pkg syscall (darwin-386), const VDSUSP ideal-int
+pkg syscall (darwin-386), const VEOF ideal-int
+pkg syscall (darwin-386), const VEOL ideal-int
+pkg syscall (darwin-386), const VEOL2 ideal-int
+pkg syscall (darwin-386), const VERASE ideal-int
+pkg syscall (darwin-386), const VINTR ideal-int
+pkg syscall (darwin-386), const VKILL ideal-int
+pkg syscall (darwin-386), const VLNEXT ideal-int
+pkg syscall (darwin-386), const VMIN ideal-int
+pkg syscall (darwin-386), const VQUIT ideal-int
+pkg syscall (darwin-386), const VREPRINT ideal-int
+pkg syscall (darwin-386), const VSTART ideal-int
+pkg syscall (darwin-386), const VSTATUS ideal-int
+pkg syscall (darwin-386), const VSTOP ideal-int
+pkg syscall (darwin-386), const VSUSP ideal-int
+pkg syscall (darwin-386), const VT0 ideal-int
+pkg syscall (darwin-386), const VT1 ideal-int
+pkg syscall (darwin-386), const VTDLY ideal-int
+pkg syscall (darwin-386), const VTIME ideal-int
+pkg syscall (darwin-386), const VWERASE ideal-int
+pkg syscall (darwin-386), func Fchflags(int, int) error
+pkg syscall (darwin-386), func SlicePtrFromStrings([]string) ([]*uint8, error)
+pkg syscall (darwin-386), type Inet4Pktinfo struct
+pkg syscall (darwin-386), type Inet4Pktinfo struct, Addr [4]uint8
+pkg syscall (darwin-386), type Inet4Pktinfo struct, Ifindex uint32
+pkg syscall (darwin-386), type Inet4Pktinfo struct, Spec_dst [4]uint8
+pkg syscall (darwin-386), type Termios struct
+pkg syscall (darwin-386), type Termios struct, Cc [20]uint8
+pkg syscall (darwin-386), type Termios struct, Cflag uint32
+pkg syscall (darwin-386), type Termios struct, Iflag uint32
+pkg syscall (darwin-386), type Termios struct, Ispeed uint32
+pkg syscall (darwin-386), type Termios struct, Lflag uint32
+pkg syscall (darwin-386), type Termios struct, Oflag uint32
+pkg syscall (darwin-386), type Termios struct, Ospeed uint32
+pkg syscall (darwin-386-cgo), const B0 ideal-int
+pkg syscall (darwin-386-cgo), const B110 ideal-int
+pkg syscall (darwin-386-cgo), const B115200 ideal-int
+pkg syscall (darwin-386-cgo), const B1200 ideal-int
+pkg syscall (darwin-386-cgo), const B134 ideal-int
+pkg syscall (darwin-386-cgo), const B14400 ideal-int
+pkg syscall (darwin-386-cgo), const B150 ideal-int
+pkg syscall (darwin-386-cgo), const B1800 ideal-int
+pkg syscall (darwin-386-cgo), const B19200 ideal-int
+pkg syscall (darwin-386-cgo), const B200 ideal-int
+pkg syscall (darwin-386-cgo), const B230400 ideal-int
+pkg syscall (darwin-386-cgo), const B2400 ideal-int
+pkg syscall (darwin-386-cgo), const B28800 ideal-int
+pkg syscall (darwin-386-cgo), const B300 ideal-int
+pkg syscall (darwin-386-cgo), const B38400 ideal-int
+pkg syscall (darwin-386-cgo), const B4800 ideal-int
+pkg syscall (darwin-386-cgo), const B50 ideal-int
+pkg syscall (darwin-386-cgo), const B57600 ideal-int
+pkg syscall (darwin-386-cgo), const B600 ideal-int
+pkg syscall (darwin-386-cgo), const B7200 ideal-int
+pkg syscall (darwin-386-cgo), const B75 ideal-int
+pkg syscall (darwin-386-cgo), const B76800 ideal-int
+pkg syscall (darwin-386-cgo), const B9600 ideal-int
+pkg syscall (darwin-386-cgo), const BRKINT ideal-int
+pkg syscall (darwin-386-cgo), const CFLUSH ideal-int
+pkg syscall (darwin-386-cgo), const CLOCAL ideal-int
+pkg syscall (darwin-386-cgo), const CREAD ideal-int
+pkg syscall (darwin-386-cgo), const CS5 ideal-int
+pkg syscall (darwin-386-cgo), const CS6 ideal-int
+pkg syscall (darwin-386-cgo), const CS7 ideal-int
+pkg syscall (darwin-386-cgo), const CS8 ideal-int
+pkg syscall (darwin-386-cgo), const CSIZE ideal-int
+pkg syscall (darwin-386-cgo), const CSTART ideal-int
+pkg syscall (darwin-386-cgo), const CSTATUS ideal-int
+pkg syscall (darwin-386-cgo), const CSTOP ideal-int
+pkg syscall (darwin-386-cgo), const CSTOPB ideal-int
+pkg syscall (darwin-386-cgo), const CSUSP ideal-int
+pkg syscall (darwin-386-cgo), const FLUSHO ideal-int
+pkg syscall (darwin-386-cgo), const HUPCL ideal-int
+pkg syscall (darwin-386-cgo), const ICANON ideal-int
+pkg syscall (darwin-386-cgo), const ICRNL ideal-int
+pkg syscall (darwin-386-cgo), const IEXTEN ideal-int
+pkg syscall (darwin-386-cgo), const IGNBRK ideal-int
+pkg syscall (darwin-386-cgo), const IGNCR ideal-int
+pkg syscall (darwin-386-cgo), const IGNPAR ideal-int
+pkg syscall (darwin-386-cgo), const IMAXBEL ideal-int
+pkg syscall (darwin-386-cgo), const INLCR ideal-int
+pkg syscall (darwin-386-cgo), const INPCK ideal-int
+pkg syscall (darwin-386-cgo), const ISIG ideal-int
+pkg syscall (darwin-386-cgo), const ISTRIP ideal-int
+pkg syscall (darwin-386-cgo), const IUTF8 ideal-int
+pkg syscall (darwin-386-cgo), const IXANY ideal-int
+pkg syscall (darwin-386-cgo), const IXOFF ideal-int
+pkg syscall (darwin-386-cgo), const IXON ideal-int
+pkg syscall (darwin-386-cgo), const NOFLSH ideal-int
+pkg syscall (darwin-386-cgo), const OCRNL ideal-int
+pkg syscall (darwin-386-cgo), const OFDEL ideal-int
+pkg syscall (darwin-386-cgo), const OFILL ideal-int
+pkg syscall (darwin-386-cgo), const ONLCR ideal-int
+pkg syscall (darwin-386-cgo), const ONLRET ideal-int
+pkg syscall (darwin-386-cgo), const ONOCR ideal-int
+pkg syscall (darwin-386-cgo), const ONOEOT ideal-int
+pkg syscall (darwin-386-cgo), const OPOST ideal-int
+pkg syscall (darwin-386-cgo), const PARENB ideal-int
+pkg syscall (darwin-386-cgo), const PARMRK ideal-int
+pkg syscall (darwin-386-cgo), const PARODD ideal-int
+pkg syscall (darwin-386-cgo), const PENDIN ideal-int
+pkg syscall (darwin-386-cgo), const SizeofInet4Pktinfo ideal-int
+pkg syscall (darwin-386-cgo), const TCIFLUSH ideal-int
+pkg syscall (darwin-386-cgo), const TCIOFLUSH ideal-int
+pkg syscall (darwin-386-cgo), const TCOFLUSH ideal-int
+pkg syscall (darwin-386-cgo), const TCSAFLUSH ideal-int
+pkg syscall (darwin-386-cgo), const TOSTOP ideal-int
+pkg syscall (darwin-386-cgo), const VDISCARD ideal-int
+pkg syscall (darwin-386-cgo), const VDSUSP ideal-int
+pkg syscall (darwin-386-cgo), const VEOF ideal-int
+pkg syscall (darwin-386-cgo), const VEOL ideal-int
+pkg syscall (darwin-386-cgo), const VEOL2 ideal-int
+pkg syscall (darwin-386-cgo), const VERASE ideal-int
+pkg syscall (darwin-386-cgo), const VINTR ideal-int
+pkg syscall (darwin-386-cgo), const VKILL ideal-int
+pkg syscall (darwin-386-cgo), const VLNEXT ideal-int
+pkg syscall (darwin-386-cgo), const VMIN ideal-int
+pkg syscall (darwin-386-cgo), const VQUIT ideal-int
+pkg syscall (darwin-386-cgo), const VREPRINT ideal-int
+pkg syscall (darwin-386-cgo), const VSTART ideal-int
+pkg syscall (darwin-386-cgo), const VSTATUS ideal-int
+pkg syscall (darwin-386-cgo), const VSTOP ideal-int
+pkg syscall (darwin-386-cgo), const VSUSP ideal-int
+pkg syscall (darwin-386-cgo), const VT0 ideal-int
+pkg syscall (darwin-386-cgo), const VT1 ideal-int
+pkg syscall (darwin-386-cgo), const VTDLY ideal-int
+pkg syscall (darwin-386-cgo), const VTIME ideal-int
+pkg syscall (darwin-386-cgo), const VWERASE ideal-int
+pkg syscall (darwin-386-cgo), func Fchflags(int, int) error
+pkg syscall (darwin-386-cgo), func SlicePtrFromStrings([]string) ([]*uint8, error)
+pkg syscall (darwin-386-cgo), type Inet4Pktinfo struct
+pkg syscall (darwin-386-cgo), type Inet4Pktinfo struct, Addr [4]uint8
+pkg syscall (darwin-386-cgo), type Inet4Pktinfo struct, Ifindex uint32
+pkg syscall (darwin-386-cgo), type Inet4Pktinfo struct, Spec_dst [4]uint8
+pkg syscall (darwin-386-cgo), type Termios struct
+pkg syscall (darwin-386-cgo), type Termios struct, Cc [20]uint8
+pkg syscall (darwin-386-cgo), type Termios struct, Cflag uint32
+pkg syscall (darwin-386-cgo), type Termios struct, Iflag uint32
+pkg syscall (darwin-386-cgo), type Termios struct, Ispeed uint32
+pkg syscall (darwin-386-cgo), type Termios struct, Lflag uint32
+pkg syscall (darwin-386-cgo), type Termios struct, Oflag uint32
+pkg syscall (darwin-386-cgo), type Termios struct, Ospeed uint32
+pkg syscall (darwin-amd64), const B0 ideal-int
+pkg syscall (darwin-amd64), const B110 ideal-int
+pkg syscall (darwin-amd64), const B115200 ideal-int
+pkg syscall (darwin-amd64), const B1200 ideal-int
+pkg syscall (darwin-amd64), const B134 ideal-int
+pkg syscall (darwin-amd64), const B14400 ideal-int
+pkg syscall (darwin-amd64), const B150 ideal-int
+pkg syscall (darwin-amd64), const B1800 ideal-int
+pkg syscall (darwin-amd64), const B19200 ideal-int
+pkg syscall (darwin-amd64), const B200 ideal-int
+pkg syscall (darwin-amd64), const B230400 ideal-int
+pkg syscall (darwin-amd64), const B2400 ideal-int
+pkg syscall (darwin-amd64), const B28800 ideal-int
+pkg syscall (darwin-amd64), const B300 ideal-int
+pkg syscall (darwin-amd64), const B38400 ideal-int
+pkg syscall (darwin-amd64), const B4800 ideal-int
+pkg syscall (darwin-amd64), const B50 ideal-int
+pkg syscall (darwin-amd64), const B57600 ideal-int
+pkg syscall (darwin-amd64), const B600 ideal-int
+pkg syscall (darwin-amd64), const B7200 ideal-int
+pkg syscall (darwin-amd64), const B75 ideal-int
+pkg syscall (darwin-amd64), const B76800 ideal-int
+pkg syscall (darwin-amd64), const B9600 ideal-int
+pkg syscall (darwin-amd64), const BRKINT ideal-int
+pkg syscall (darwin-amd64), const CFLUSH ideal-int
+pkg syscall (darwin-amd64), const CLOCAL ideal-int
+pkg syscall (darwin-amd64), const CREAD ideal-int
+pkg syscall (darwin-amd64), const CS5 ideal-int
+pkg syscall (darwin-amd64), const CS6 ideal-int
+pkg syscall (darwin-amd64), const CS7 ideal-int
+pkg syscall (darwin-amd64), const CS8 ideal-int
+pkg syscall (darwin-amd64), const CSIZE ideal-int
+pkg syscall (darwin-amd64), const CSTART ideal-int
+pkg syscall (darwin-amd64), const CSTATUS ideal-int
+pkg syscall (darwin-amd64), const CSTOP ideal-int
+pkg syscall (darwin-amd64), const CSTOPB ideal-int
+pkg syscall (darwin-amd64), const CSUSP ideal-int
+pkg syscall (darwin-amd64), const FLUSHO ideal-int
+pkg syscall (darwin-amd64), const HUPCL ideal-int
+pkg syscall (darwin-amd64), const ICANON ideal-int
+pkg syscall (darwin-amd64), const ICRNL ideal-int
+pkg syscall (darwin-amd64), const IEXTEN ideal-int
+pkg syscall (darwin-amd64), const IGNBRK ideal-int
+pkg syscall (darwin-amd64), const IGNCR ideal-int
+pkg syscall (darwin-amd64), const IGNPAR ideal-int
+pkg syscall (darwin-amd64), const IMAXBEL ideal-int
+pkg syscall (darwin-amd64), const INLCR ideal-int
+pkg syscall (darwin-amd64), const INPCK ideal-int
+pkg syscall (darwin-amd64), const ISIG ideal-int
+pkg syscall (darwin-amd64), const ISTRIP ideal-int
+pkg syscall (darwin-amd64), const IUTF8 ideal-int
+pkg syscall (darwin-amd64), const IXANY ideal-int
+pkg syscall (darwin-amd64), const IXOFF ideal-int
+pkg syscall (darwin-amd64), const IXON ideal-int
+pkg syscall (darwin-amd64), const NOFLSH ideal-int
+pkg syscall (darwin-amd64), const OCRNL ideal-int
+pkg syscall (darwin-amd64), const OFDEL ideal-int
+pkg syscall (darwin-amd64), const OFILL ideal-int
+pkg syscall (darwin-amd64), const ONLCR ideal-int
+pkg syscall (darwin-amd64), const ONLRET ideal-int
+pkg syscall (darwin-amd64), const ONOCR ideal-int
+pkg syscall (darwin-amd64), const ONOEOT ideal-int
+pkg syscall (darwin-amd64), const OPOST ideal-int
+pkg syscall (darwin-amd64), const PARENB ideal-int
+pkg syscall (darwin-amd64), const PARMRK ideal-int
+pkg syscall (darwin-amd64), const PARODD ideal-int
+pkg syscall (darwin-amd64), const PENDIN ideal-int
+pkg syscall (darwin-amd64), const SizeofInet4Pktinfo ideal-int
+pkg syscall (darwin-amd64), const TCIFLUSH ideal-int
+pkg syscall (darwin-amd64), const TCIOFLUSH ideal-int
+pkg syscall (darwin-amd64), const TCOFLUSH ideal-int
+pkg syscall (darwin-amd64), const TCSAFLUSH ideal-int
+pkg syscall (darwin-amd64), const TOSTOP ideal-int
+pkg syscall (darwin-amd64), const VDISCARD ideal-int
+pkg syscall (darwin-amd64), const VDSUSP ideal-int
+pkg syscall (darwin-amd64), const VEOF ideal-int
+pkg syscall (darwin-amd64), const VEOL ideal-int
+pkg syscall (darwin-amd64), const VEOL2 ideal-int
+pkg syscall (darwin-amd64), const VERASE ideal-int
+pkg syscall (darwin-amd64), const VINTR ideal-int
+pkg syscall (darwin-amd64), const VKILL ideal-int
+pkg syscall (darwin-amd64), const VLNEXT ideal-int
+pkg syscall (darwin-amd64), const VMIN ideal-int
+pkg syscall (darwin-amd64), const VQUIT ideal-int
+pkg syscall (darwin-amd64), const VREPRINT ideal-int
+pkg syscall (darwin-amd64), const VSTART ideal-int
+pkg syscall (darwin-amd64), const VSTATUS ideal-int
+pkg syscall (darwin-amd64), const VSTOP ideal-int
+pkg syscall (darwin-amd64), const VSUSP ideal-int
+pkg syscall (darwin-amd64), const VT0 ideal-int
+pkg syscall (darwin-amd64), const VT1 ideal-int
+pkg syscall (darwin-amd64), const VTDLY ideal-int
+pkg syscall (darwin-amd64), const VTIME ideal-int
+pkg syscall (darwin-amd64), const VWERASE ideal-int
+pkg syscall (darwin-amd64), func Fchflags(int, int) error
+pkg syscall (darwin-amd64), func SlicePtrFromStrings([]string) ([]*uint8, error)
+pkg syscall (darwin-amd64), type Inet4Pktinfo struct
+pkg syscall (darwin-amd64), type Inet4Pktinfo struct, Addr [4]uint8
+pkg syscall (darwin-amd64), type Inet4Pktinfo struct, Ifindex uint32
+pkg syscall (darwin-amd64), type Inet4Pktinfo struct, Spec_dst [4]uint8
+pkg syscall (darwin-amd64), type Termios struct
+pkg syscall (darwin-amd64), type Termios struct, Cc [20]uint8
+pkg syscall (darwin-amd64), type Termios struct, Cflag uint64
+pkg syscall (darwin-amd64), type Termios struct, Iflag uint64
+pkg syscall (darwin-amd64), type Termios struct, Ispeed uint64
+pkg syscall (darwin-amd64), type Termios struct, Lflag uint64
+pkg syscall (darwin-amd64), type Termios struct, Oflag uint64
+pkg syscall (darwin-amd64), type Termios struct, Ospeed uint64
+pkg syscall (darwin-amd64), type Termios struct, Pad_cgo_0 [4]uint8
+pkg syscall (darwin-amd64-cgo), const B0 ideal-int
+pkg syscall (darwin-amd64-cgo), const B110 ideal-int
+pkg syscall (darwin-amd64-cgo), const B115200 ideal-int
+pkg syscall (darwin-amd64-cgo), const B1200 ideal-int
+pkg syscall (darwin-amd64-cgo), const B134 ideal-int
+pkg syscall (darwin-amd64-cgo), const B14400 ideal-int
+pkg syscall (darwin-amd64-cgo), const B150 ideal-int
+pkg syscall (darwin-amd64-cgo), const B1800 ideal-int
+pkg syscall (darwin-amd64-cgo), const B19200 ideal-int
+pkg syscall (darwin-amd64-cgo), const B200 ideal-int
+pkg syscall (darwin-amd64-cgo), const B230400 ideal-int
+pkg syscall (darwin-amd64-cgo), const B2400 ideal-int
+pkg syscall (darwin-amd64-cgo), const B28800 ideal-int
+pkg syscall (darwin-amd64-cgo), const B300 ideal-int
+pkg syscall (darwin-amd64-cgo), const B38400 ideal-int
+pkg syscall (darwin-amd64-cgo), const B4800 ideal-int
+pkg syscall (darwin-amd64-cgo), const B50 ideal-int
+pkg syscall (darwin-amd64-cgo), const B57600 ideal-int
+pkg syscall (darwin-amd64-cgo), const B600 ideal-int
+pkg syscall (darwin-amd64-cgo), const B7200 ideal-int
+pkg syscall (darwin-amd64-cgo), const B75 ideal-int
+pkg syscall (darwin-amd64-cgo), const B76800 ideal-int
+pkg syscall (darwin-amd64-cgo), const B9600 ideal-int
+pkg syscall (darwin-amd64-cgo), const BRKINT ideal-int
+pkg syscall (darwin-amd64-cgo), const CFLUSH ideal-int
+pkg syscall (darwin-amd64-cgo), const CLOCAL ideal-int
+pkg syscall (darwin-amd64-cgo), const CREAD ideal-int
+pkg syscall (darwin-amd64-cgo), const CS5 ideal-int
+pkg syscall (darwin-amd64-cgo), const CS6 ideal-int
+pkg syscall (darwin-amd64-cgo), const CS7 ideal-int
+pkg syscall (darwin-amd64-cgo), const CS8 ideal-int
+pkg syscall (darwin-amd64-cgo), const CSIZE ideal-int
+pkg syscall (darwin-amd64-cgo), const CSTART ideal-int
+pkg syscall (darwin-amd64-cgo), const CSTATUS ideal-int
+pkg syscall (darwin-amd64-cgo), const CSTOP ideal-int
+pkg syscall (darwin-amd64-cgo), const CSTOPB ideal-int
+pkg syscall (darwin-amd64-cgo), const CSUSP ideal-int
+pkg syscall (darwin-amd64-cgo), const FLUSHO ideal-int
+pkg syscall (darwin-amd64-cgo), const HUPCL ideal-int
+pkg syscall (darwin-amd64-cgo), const ICANON ideal-int
+pkg syscall (darwin-amd64-cgo), const ICRNL ideal-int
+pkg syscall (darwin-amd64-cgo), const IEXTEN ideal-int
+pkg syscall (darwin-amd64-cgo), const IGNBRK ideal-int
+pkg syscall (darwin-amd64-cgo), const IGNCR ideal-int
+pkg syscall (darwin-amd64-cgo), const IGNPAR ideal-int
+pkg syscall (darwin-amd64-cgo), const IMAXBEL ideal-int
+pkg syscall (darwin-amd64-cgo), const INLCR ideal-int
+pkg syscall (darwin-amd64-cgo), const INPCK ideal-int
+pkg syscall (darwin-amd64-cgo), const ISIG ideal-int
+pkg syscall (darwin-amd64-cgo), const ISTRIP ideal-int
+pkg syscall (darwin-amd64-cgo), const IUTF8 ideal-int
+pkg syscall (darwin-amd64-cgo), const IXANY ideal-int
+pkg syscall (darwin-amd64-cgo), const IXOFF ideal-int
+pkg syscall (darwin-amd64-cgo), const IXON ideal-int
+pkg syscall (darwin-amd64-cgo), const NOFLSH ideal-int
+pkg syscall (darwin-amd64-cgo), const OCRNL ideal-int
+pkg syscall (darwin-amd64-cgo), const OFDEL ideal-int
+pkg syscall (darwin-amd64-cgo), const OFILL ideal-int
+pkg syscall (darwin-amd64-cgo), const ONLCR ideal-int
+pkg syscall (darwin-amd64-cgo), const ONLRET ideal-int
+pkg syscall (darwin-amd64-cgo), const ONOCR ideal-int
+pkg syscall (darwin-amd64-cgo), const ONOEOT ideal-int
+pkg syscall (darwin-amd64-cgo), const OPOST ideal-int
+pkg syscall (darwin-amd64-cgo), const PARENB ideal-int
+pkg syscall (darwin-amd64-cgo), const PARMRK ideal-int
+pkg syscall (darwin-amd64-cgo), const PARODD ideal-int
+pkg syscall (darwin-amd64-cgo), const PENDIN ideal-int
+pkg syscall (darwin-amd64-cgo), const SizeofInet4Pktinfo ideal-int
+pkg syscall (darwin-amd64-cgo), const TCIFLUSH ideal-int
+pkg syscall (darwin-amd64-cgo), const TCIOFLUSH ideal-int
+pkg syscall (darwin-amd64-cgo), const TCOFLUSH ideal-int
+pkg syscall (darwin-amd64-cgo), const TCSAFLUSH ideal-int
+pkg syscall (darwin-amd64-cgo), const TOSTOP ideal-int
+pkg syscall (darwin-amd64-cgo), const VDISCARD ideal-int
+pkg syscall (darwin-amd64-cgo), const VDSUSP ideal-int
+pkg syscall (darwin-amd64-cgo), const VEOF ideal-int
+pkg syscall (darwin-amd64-cgo), const VEOL ideal-int
+pkg syscall (darwin-amd64-cgo), const VEOL2 ideal-int
+pkg syscall (darwin-amd64-cgo), const VERASE ideal-int
+pkg syscall (darwin-amd64-cgo), const VINTR ideal-int
+pkg syscall (darwin-amd64-cgo), const VKILL ideal-int
+pkg syscall (darwin-amd64-cgo), const VLNEXT ideal-int
+pkg syscall (darwin-amd64-cgo), const VMIN ideal-int
+pkg syscall (darwin-amd64-cgo), const VQUIT ideal-int
+pkg syscall (darwin-amd64-cgo), const VREPRINT ideal-int
+pkg syscall (darwin-amd64-cgo), const VSTART ideal-int
+pkg syscall (darwin-amd64-cgo), const VSTATUS ideal-int
+pkg syscall (darwin-amd64-cgo), const VSTOP ideal-int
+pkg syscall (darwin-amd64-cgo), const VSUSP ideal-int
+pkg syscall (darwin-amd64-cgo), const VT0 ideal-int
+pkg syscall (darwin-amd64-cgo), const VT1 ideal-int
+pkg syscall (darwin-amd64-cgo), const VTDLY ideal-int
+pkg syscall (darwin-amd64-cgo), const VTIME ideal-int
+pkg syscall (darwin-amd64-cgo), const VWERASE ideal-int
+pkg syscall (darwin-amd64-cgo), func Fchflags(int, int) error
+pkg syscall (darwin-amd64-cgo), func SlicePtrFromStrings([]string) ([]*uint8, error)
+pkg syscall (darwin-amd64-cgo), type Inet4Pktinfo struct
+pkg syscall (darwin-amd64-cgo), type Inet4Pktinfo struct, Addr [4]uint8
+pkg syscall (darwin-amd64-cgo), type Inet4Pktinfo struct, Ifindex uint32
+pkg syscall (darwin-amd64-cgo), type Inet4Pktinfo struct, Spec_dst [4]uint8
+pkg syscall (darwin-amd64-cgo), type Termios struct
+pkg syscall (darwin-amd64-cgo), type Termios struct, Cc [20]uint8
+pkg syscall (darwin-amd64-cgo), type Termios struct, Cflag uint64
+pkg syscall (darwin-amd64-cgo), type Termios struct, Iflag uint64
+pkg syscall (darwin-amd64-cgo), type Termios struct, Ispeed uint64
+pkg syscall (darwin-amd64-cgo), type Termios struct, Lflag uint64
+pkg syscall (darwin-amd64-cgo), type Termios struct, Oflag uint64
+pkg syscall (darwin-amd64-cgo), type Termios struct, Ospeed uint64
+pkg syscall (darwin-amd64-cgo), type Termios struct, Pad_cgo_0 [4]uint8
+pkg syscall (freebsd-386), const B0 ideal-int
+pkg syscall (freebsd-386), const B110 ideal-int
+pkg syscall (freebsd-386), const B115200 ideal-int
+pkg syscall (freebsd-386), const B1200 ideal-int
+pkg syscall (freebsd-386), const B134 ideal-int
+pkg syscall (freebsd-386), const B14400 ideal-int
+pkg syscall (freebsd-386), const B150 ideal-int
+pkg syscall (freebsd-386), const B1800 ideal-int
+pkg syscall (freebsd-386), const B19200 ideal-int
+pkg syscall (freebsd-386), const B200 ideal-int
+pkg syscall (freebsd-386), const B230400 ideal-int
+pkg syscall (freebsd-386), const B2400 ideal-int
+pkg syscall (freebsd-386), const B28800 ideal-int
+pkg syscall (freebsd-386), const B300 ideal-int
+pkg syscall (freebsd-386), const B38400 ideal-int
+pkg syscall (freebsd-386), const B460800 ideal-int
+pkg syscall (freebsd-386), const B4800 ideal-int
+pkg syscall (freebsd-386), const B50 ideal-int
+pkg syscall (freebsd-386), const B57600 ideal-int
+pkg syscall (freebsd-386), const B600 ideal-int
+pkg syscall (freebsd-386), const B7200 ideal-int
+pkg syscall (freebsd-386), const B75 ideal-int
+pkg syscall (freebsd-386), const B76800 ideal-int
+pkg syscall (freebsd-386), const B921600 ideal-int
+pkg syscall (freebsd-386), const B9600 ideal-int
+pkg syscall (freebsd-386), const BIOCGTSTAMP ideal-int
+pkg syscall (freebsd-386), const BIOCSTSTAMP ideal-int
+pkg syscall (freebsd-386), const BPF_T_BINTIME ideal-int
+pkg syscall (freebsd-386), const BPF_T_BINTIME_FAST ideal-int
+pkg syscall (freebsd-386), const BPF_T_BINTIME_MONOTONIC ideal-int
+pkg syscall (freebsd-386), const BPF_T_BINTIME_MONOTONIC_FAST ideal-int
+pkg syscall (freebsd-386), const BPF_T_FAST ideal-int
+pkg syscall (freebsd-386), const BPF_T_FLAG_MASK ideal-int
+pkg syscall (freebsd-386), const BPF_T_FORMAT_MASK ideal-int
+pkg syscall (freebsd-386), const BPF_T_MICROTIME ideal-int
+pkg syscall (freebsd-386), const BPF_T_MICROTIME_FAST ideal-int
+pkg syscall (freebsd-386), const BPF_T_MICROTIME_MONOTONIC ideal-int
+pkg syscall (freebsd-386), const BPF_T_MICROTIME_MONOTONIC_FAST ideal-int
+pkg syscall (freebsd-386), const BPF_T_MONOTONIC ideal-int
+pkg syscall (freebsd-386), const BPF_T_MONOTONIC_FAST ideal-int
+pkg syscall (freebsd-386), const BPF_T_NANOTIME ideal-int
+pkg syscall (freebsd-386), const BPF_T_NANOTIME_FAST ideal-int
+pkg syscall (freebsd-386), const BPF_T_NANOTIME_MONOTONIC ideal-int
+pkg syscall (freebsd-386), const BPF_T_NANOTIME_MONOTONIC_FAST ideal-int
+pkg syscall (freebsd-386), const BPF_T_NONE ideal-int
+pkg syscall (freebsd-386), const BPF_T_NORMAL ideal-int
+pkg syscall (freebsd-386), const BRKINT ideal-int
+pkg syscall (freebsd-386), const CFLUSH ideal-int
+pkg syscall (freebsd-386), const CLOCAL ideal-int
+pkg syscall (freebsd-386), const CREAD ideal-int
+pkg syscall (freebsd-386), const CS5 ideal-int
+pkg syscall (freebsd-386), const CS6 ideal-int
+pkg syscall (freebsd-386), const CS7 ideal-int
+pkg syscall (freebsd-386), const CS8 ideal-int
+pkg syscall (freebsd-386), const CSIZE ideal-int
+pkg syscall (freebsd-386), const CSTART ideal-int
+pkg syscall (freebsd-386), const CSTATUS ideal-int
+pkg syscall (freebsd-386), const CSTOP ideal-int
+pkg syscall (freebsd-386), const CSTOPB ideal-int
+pkg syscall (freebsd-386), const CSUSP ideal-int
+pkg syscall (freebsd-386), const DLT_AOS ideal-int
+pkg syscall (freebsd-386), const DLT_CAN_SOCKETCAN ideal-int
+pkg syscall (freebsd-386), const DLT_DBUS ideal-int
+pkg syscall (freebsd-386), const DLT_DECT ideal-int
+pkg syscall (freebsd-386), const DLT_DVB_CI ideal-int
+pkg syscall (freebsd-386), const DLT_FC_2 ideal-int
+pkg syscall (freebsd-386), const DLT_FC_2_WITH_FRAME_DELIMS ideal-int
+pkg syscall (freebsd-386), const DLT_GSMTAP_ABIS ideal-int
+pkg syscall (freebsd-386), const DLT_GSMTAP_UM ideal-int
+pkg syscall (freebsd-386), const DLT_IEEE802_15_4_NOFCS ideal-int
+pkg syscall (freebsd-386), const DLT_IPNET ideal-int
+pkg syscall (freebsd-386), const DLT_IPOIB ideal-int
+pkg syscall (freebsd-386), const DLT_IPV4 ideal-int
+pkg syscall (freebsd-386), const DLT_IPV6 ideal-int
+pkg syscall (freebsd-386), const DLT_JUNIPER_ATM_CEMIC ideal-int
+pkg syscall (freebsd-386), const DLT_JUNIPER_FIBRECHANNEL ideal-int
+pkg syscall (freebsd-386), const DLT_JUNIPER_SRX_E2E ideal-int
+pkg syscall (freebsd-386), const DLT_JUNIPER_VS ideal-int
+pkg syscall (freebsd-386), const DLT_LINUX_EVDEV ideal-int
+pkg syscall (freebsd-386), const DLT_MATCHING_MAX ideal-int
+pkg syscall (freebsd-386), const DLT_MATCHING_MIN ideal-int
+pkg syscall (freebsd-386), const DLT_MPLS ideal-int
+pkg syscall (freebsd-386), const DLT_MUX27010 ideal-int
+pkg syscall (freebsd-386), const DLT_NETANALYZER ideal-int
+pkg syscall (freebsd-386), const DLT_NETANALYZER_TRANSPARENT ideal-int
+pkg syscall (freebsd-386), const DLT_NFLOG ideal-int
+pkg syscall (freebsd-386), const DLT_STANAG_5066_D_PDU ideal-int
+pkg syscall (freebsd-386), const DLT_USB_LINUX_MMAPPED ideal-int
+pkg syscall (freebsd-386), const DLT_WIHART ideal-int
+pkg syscall (freebsd-386), const ECAPMODE Errno
+pkg syscall (freebsd-386), const FLUSHO ideal-int
+pkg syscall (freebsd-386), const HUPCL ideal-int
+pkg syscall (freebsd-386), const ICANON ideal-int
+pkg syscall (freebsd-386), const ICRNL ideal-int
+pkg syscall (freebsd-386), const IEXTEN ideal-int
+pkg syscall (freebsd-386), const IFAN_ARRIVAL ideal-int
+pkg syscall (freebsd-386), const IFAN_DEPARTURE ideal-int
+pkg syscall (freebsd-386), const IFF_CANTCONFIG ideal-int
+pkg syscall (freebsd-386), const IFT_INFINIBAND ideal-int
+pkg syscall (freebsd-386), const IGNBRK ideal-int
+pkg syscall (freebsd-386), const IGNCR ideal-int
+pkg syscall (freebsd-386), const IGNPAR ideal-int
+pkg syscall (freebsd-386), const IMAXBEL ideal-int
+pkg syscall (freebsd-386), const INLCR ideal-int
+pkg syscall (freebsd-386), const INPCK ideal-int
+pkg syscall (freebsd-386), const IN_RFC3021_MASK ideal-int
+pkg syscall (freebsd-386), const IPPROTO_MH ideal-int
+pkg syscall (freebsd-386), const IPPROTO_SEND ideal-int
+pkg syscall (freebsd-386), const IP_RECVTOS ideal-int
+pkg syscall (freebsd-386), const ISIG ideal-int
+pkg syscall (freebsd-386), const ISTRIP ideal-int
+pkg syscall (freebsd-386), const IXANY ideal-int
+pkg syscall (freebsd-386), const IXOFF ideal-int
+pkg syscall (freebsd-386), const IXON ideal-int
+pkg syscall (freebsd-386), const MADV_AUTOSYNC ideal-int
+pkg syscall (freebsd-386), const MADV_CORE ideal-int
+pkg syscall (freebsd-386), const MADV_DONTNEED ideal-int
+pkg syscall (freebsd-386), const MADV_FREE ideal-int
+pkg syscall (freebsd-386), const MADV_NOCORE ideal-int
+pkg syscall (freebsd-386), const MADV_NORMAL ideal-int
+pkg syscall (freebsd-386), const MADV_NOSYNC ideal-int
+pkg syscall (freebsd-386), const MADV_PROTECT ideal-int
+pkg syscall (freebsd-386), const MADV_RANDOM ideal-int
+pkg syscall (freebsd-386), const MADV_SEQUENTIAL ideal-int
+pkg syscall (freebsd-386), const MADV_WILLNEED ideal-int
+pkg syscall (freebsd-386), const MAP_ANON ideal-int
+pkg syscall (freebsd-386), const MAP_ANONYMOUS ideal-int
+pkg syscall (freebsd-386), const MAP_COPY ideal-int
+pkg syscall (freebsd-386), const MAP_FILE ideal-int
+pkg syscall (freebsd-386), const MAP_FIXED ideal-int
+pkg syscall (freebsd-386), const MAP_HASSEMAPHORE ideal-int
+pkg syscall (freebsd-386), const MAP_NOCORE ideal-int
+pkg syscall (freebsd-386), const MAP_NORESERVE ideal-int
+pkg syscall (freebsd-386), const MAP_NOSYNC ideal-int
+pkg syscall (freebsd-386), const MAP_PREFAULT_READ ideal-int
+pkg syscall (freebsd-386), const MAP_PRIVATE ideal-int
+pkg syscall (freebsd-386), const MAP_RENAME ideal-int
+pkg syscall (freebsd-386), const MAP_RESERVED0080 ideal-int
+pkg syscall (freebsd-386), const MAP_RESERVED0100 ideal-int
+pkg syscall (freebsd-386), const MAP_SHARED ideal-int
+pkg syscall (freebsd-386), const MAP_STACK ideal-int
+pkg syscall (freebsd-386), const MCL_CURRENT ideal-int
+pkg syscall (freebsd-386), const MCL_FUTURE ideal-int
+pkg syscall (freebsd-386), const MS_ASYNC ideal-int
+pkg syscall (freebsd-386), const MS_INVALIDATE ideal-int
+pkg syscall (freebsd-386), const MS_SYNC ideal-int
+pkg syscall (freebsd-386), const NET_RT_IFLISTL ideal-int
+pkg syscall (freebsd-386), const NOFLSH ideal-int
+pkg syscall (freebsd-386), const OCRNL ideal-int
+pkg syscall (freebsd-386), const ONLCR ideal-int
+pkg syscall (freebsd-386), const ONLRET ideal-int
+pkg syscall (freebsd-386), const ONOCR ideal-int
+pkg syscall (freebsd-386), const ONOEOT ideal-int
+pkg syscall (freebsd-386), const OPOST ideal-int
+pkg syscall (freebsd-386), const PARENB ideal-int
+pkg syscall (freebsd-386), const PARMRK ideal-int
+pkg syscall (freebsd-386), const PARODD ideal-int
+pkg syscall (freebsd-386), const PENDIN ideal-int
+pkg syscall (freebsd-386), const PROT_EXEC ideal-int
+pkg syscall (freebsd-386), const PROT_NONE ideal-int
+pkg syscall (freebsd-386), const PROT_READ ideal-int
+pkg syscall (freebsd-386), const PROT_WRITE ideal-int
+pkg syscall (freebsd-386), const RT_CACHING_CONTEXT ideal-int
+pkg syscall (freebsd-386), const RT_DEFAULT_FIB ideal-int
+pkg syscall (freebsd-386), const SIOCGIFFIB ideal-int
+pkg syscall (freebsd-386), const SIOCSIFFIB ideal-int
+pkg syscall (freebsd-386), const SO_PROTOCOL ideal-int
+pkg syscall (freebsd-386), const SO_PROTOTYPE ideal-int
+pkg syscall (freebsd-386), const SO_USER_COOKIE ideal-int
+pkg syscall (freebsd-386), const SYS_CLOCK_GETCPUCLOCKID2 ideal-int
+pkg syscall (freebsd-386), const SYS_WAIT6 ideal-int
+pkg syscall (freebsd-386), const SizeofIfAnnounceMsghdr ideal-int
+pkg syscall (freebsd-386), const TCIFLUSH ideal-int
+pkg syscall (freebsd-386), const TCIOFLUSH ideal-int
+pkg syscall (freebsd-386), const TCOFLUSH ideal-int
+pkg syscall (freebsd-386), const TCP_KEEPCNT ideal-int
+pkg syscall (freebsd-386), const TCP_KEEPIDLE ideal-int
+pkg syscall (freebsd-386), const TCP_KEEPINIT ideal-int
+pkg syscall (freebsd-386), const TCP_KEEPINTVL ideal-int
+pkg syscall (freebsd-386), const TCSAFLUSH ideal-int
+pkg syscall (freebsd-386), const TOSTOP ideal-int
+pkg syscall (freebsd-386), const VDISCARD ideal-int
+pkg syscall (freebsd-386), const VDSUSP ideal-int
+pkg syscall (freebsd-386), const VEOF ideal-int
+pkg syscall (freebsd-386), const VEOL ideal-int
+pkg syscall (freebsd-386), const VEOL2 ideal-int
+pkg syscall (freebsd-386), const VERASE ideal-int
+pkg syscall (freebsd-386), const VERASE2 ideal-int
+pkg syscall (freebsd-386), const VINTR ideal-int
+pkg syscall (freebsd-386), const VKILL ideal-int
+pkg syscall (freebsd-386), const VLNEXT ideal-int
+pkg syscall (freebsd-386), const VMIN ideal-int
+pkg syscall (freebsd-386), const VQUIT ideal-int
+pkg syscall (freebsd-386), const VREPRINT ideal-int
+pkg syscall (freebsd-386), const VSTART ideal-int
+pkg syscall (freebsd-386), const VSTATUS ideal-int
+pkg syscall (freebsd-386), const VSTOP ideal-int
+pkg syscall (freebsd-386), const VSUSP ideal-int
+pkg syscall (freebsd-386), const VTIME ideal-int
+pkg syscall (freebsd-386), const VWERASE ideal-int
+pkg syscall (freebsd-386), func Fchflags(int, int) error
+pkg syscall (freebsd-386), func SlicePtrFromStrings([]string) ([]*uint8, error)
+pkg syscall (freebsd-386), type IfAnnounceMsghdr struct
+pkg syscall (freebsd-386), type IfAnnounceMsghdr struct, Index uint16
+pkg syscall (freebsd-386), type IfAnnounceMsghdr struct, Msglen uint16
+pkg syscall (freebsd-386), type IfAnnounceMsghdr struct, Name [16]int8
+pkg syscall (freebsd-386), type IfAnnounceMsghdr struct, Type uint8
+pkg syscall (freebsd-386), type IfAnnounceMsghdr struct, Version uint8
+pkg syscall (freebsd-386), type IfAnnounceMsghdr struct, What uint16
+pkg syscall (freebsd-386), type InterfaceAnnounceMessage struct
+pkg syscall (freebsd-386), type InterfaceAnnounceMessage struct, Header IfAnnounceMsghdr
+pkg syscall (freebsd-amd64), const B0 ideal-int
+pkg syscall (freebsd-amd64), const B110 ideal-int
+pkg syscall (freebsd-amd64), const B115200 ideal-int
+pkg syscall (freebsd-amd64), const B1200 ideal-int
+pkg syscall (freebsd-amd64), const B134 ideal-int
+pkg syscall (freebsd-amd64), const B14400 ideal-int
+pkg syscall (freebsd-amd64), const B150 ideal-int
+pkg syscall (freebsd-amd64), const B1800 ideal-int
+pkg syscall (freebsd-amd64), const B19200 ideal-int
+pkg syscall (freebsd-amd64), const B200 ideal-int
+pkg syscall (freebsd-amd64), const B230400 ideal-int
+pkg syscall (freebsd-amd64), const B2400 ideal-int
+pkg syscall (freebsd-amd64), const B28800 ideal-int
+pkg syscall (freebsd-amd64), const B300 ideal-int
+pkg syscall (freebsd-amd64), const B38400 ideal-int
+pkg syscall (freebsd-amd64), const B460800 ideal-int
+pkg syscall (freebsd-amd64), const B4800 ideal-int
+pkg syscall (freebsd-amd64), const B50 ideal-int
+pkg syscall (freebsd-amd64), const B57600 ideal-int
+pkg syscall (freebsd-amd64), const B600 ideal-int
+pkg syscall (freebsd-amd64), const B7200 ideal-int
+pkg syscall (freebsd-amd64), const B75 ideal-int
+pkg syscall (freebsd-amd64), const B76800 ideal-int
+pkg syscall (freebsd-amd64), const B921600 ideal-int
+pkg syscall (freebsd-amd64), const B9600 ideal-int
+pkg syscall (freebsd-amd64), const BIOCGTSTAMP ideal-int
+pkg syscall (freebsd-amd64), const BIOCSTSTAMP ideal-int
+pkg syscall (freebsd-amd64), const BPF_T_BINTIME ideal-int
+pkg syscall (freebsd-amd64), const BPF_T_BINTIME_FAST ideal-int
+pkg syscall (freebsd-amd64), const BPF_T_BINTIME_MONOTONIC ideal-int
+pkg syscall (freebsd-amd64), const BPF_T_BINTIME_MONOTONIC_FAST ideal-int
+pkg syscall (freebsd-amd64), const BPF_T_FAST ideal-int
+pkg syscall (freebsd-amd64), const BPF_T_FLAG_MASK ideal-int
+pkg syscall (freebsd-amd64), const BPF_T_FORMAT_MASK ideal-int
+pkg syscall (freebsd-amd64), const BPF_T_MICROTIME ideal-int
+pkg syscall (freebsd-amd64), const BPF_T_MICROTIME_FAST ideal-int
+pkg syscall (freebsd-amd64), const BPF_T_MICROTIME_MONOTONIC ideal-int
+pkg syscall (freebsd-amd64), const BPF_T_MICROTIME_MONOTONIC_FAST ideal-int
+pkg syscall (freebsd-amd64), const BPF_T_MONOTONIC ideal-int
+pkg syscall (freebsd-amd64), const BPF_T_MONOTONIC_FAST ideal-int
+pkg syscall (freebsd-amd64), const BPF_T_NANOTIME ideal-int
+pkg syscall (freebsd-amd64), const BPF_T_NANOTIME_FAST ideal-int
+pkg syscall (freebsd-amd64), const BPF_T_NANOTIME_MONOTONIC ideal-int
+pkg syscall (freebsd-amd64), const BPF_T_NANOTIME_MONOTONIC_FAST ideal-int
+pkg syscall (freebsd-amd64), const BPF_T_NONE ideal-int
+pkg syscall (freebsd-amd64), const BPF_T_NORMAL ideal-int
+pkg syscall (freebsd-amd64), const BRKINT ideal-int
+pkg syscall (freebsd-amd64), const CFLUSH ideal-int
+pkg syscall (freebsd-amd64), const CLOCAL ideal-int
+pkg syscall (freebsd-amd64), const CREAD ideal-int
+pkg syscall (freebsd-amd64), const CS5 ideal-int
+pkg syscall (freebsd-amd64), const CS6 ideal-int
+pkg syscall (freebsd-amd64), const CS7 ideal-int
+pkg syscall (freebsd-amd64), const CS8 ideal-int
+pkg syscall (freebsd-amd64), const CSIZE ideal-int
+pkg syscall (freebsd-amd64), const CSTART ideal-int
+pkg syscall (freebsd-amd64), const CSTATUS ideal-int
+pkg syscall (freebsd-amd64), const CSTOP ideal-int
+pkg syscall (freebsd-amd64), const CSTOPB ideal-int
+pkg syscall (freebsd-amd64), const CSUSP ideal-int
+pkg syscall (freebsd-amd64), const DLT_AOS ideal-int
+pkg syscall (freebsd-amd64), const DLT_CAN_SOCKETCAN ideal-int
+pkg syscall (freebsd-amd64), const DLT_DBUS ideal-int
+pkg syscall (freebsd-amd64), const DLT_DECT ideal-int
+pkg syscall (freebsd-amd64), const DLT_DVB_CI ideal-int
+pkg syscall (freebsd-amd64), const DLT_FC_2 ideal-int
+pkg syscall (freebsd-amd64), const DLT_FC_2_WITH_FRAME_DELIMS ideal-int
+pkg syscall (freebsd-amd64), const DLT_GSMTAP_ABIS ideal-int
+pkg syscall (freebsd-amd64), const DLT_GSMTAP_UM ideal-int
+pkg syscall (freebsd-amd64), const DLT_IEEE802_15_4_NOFCS ideal-int
+pkg syscall (freebsd-amd64), const DLT_IPNET ideal-int
+pkg syscall (freebsd-amd64), const DLT_IPOIB ideal-int
+pkg syscall (freebsd-amd64), const DLT_IPV4 ideal-int
+pkg syscall (freebsd-amd64), const DLT_IPV6 ideal-int
+pkg syscall (freebsd-amd64), const DLT_JUNIPER_ATM_CEMIC ideal-int
+pkg syscall (freebsd-amd64), const DLT_JUNIPER_FIBRECHANNEL ideal-int
+pkg syscall (freebsd-amd64), const DLT_JUNIPER_SRX_E2E ideal-int
+pkg syscall (freebsd-amd64), const DLT_JUNIPER_VS ideal-int
+pkg syscall (freebsd-amd64), const DLT_LINUX_EVDEV ideal-int
+pkg syscall (freebsd-amd64), const DLT_MATCHING_MAX ideal-int
+pkg syscall (freebsd-amd64), const DLT_MATCHING_MIN ideal-int
+pkg syscall (freebsd-amd64), const DLT_MPLS ideal-int
+pkg syscall (freebsd-amd64), const DLT_MUX27010 ideal-int
+pkg syscall (freebsd-amd64), const DLT_NETANALYZER ideal-int
+pkg syscall (freebsd-amd64), const DLT_NETANALYZER_TRANSPARENT ideal-int
+pkg syscall (freebsd-amd64), const DLT_NFLOG ideal-int
+pkg syscall (freebsd-amd64), const DLT_STANAG_5066_D_PDU ideal-int
+pkg syscall (freebsd-amd64), const DLT_USB_LINUX_MMAPPED ideal-int
+pkg syscall (freebsd-amd64), const DLT_WIHART ideal-int
+pkg syscall (freebsd-amd64), const ECAPMODE Errno
+pkg syscall (freebsd-amd64), const FLUSHO ideal-int
+pkg syscall (freebsd-amd64), const HUPCL ideal-int
+pkg syscall (freebsd-amd64), const ICANON ideal-int
+pkg syscall (freebsd-amd64), const ICRNL ideal-int
+pkg syscall (freebsd-amd64), const IEXTEN ideal-int
+pkg syscall (freebsd-amd64), const IFAN_ARRIVAL ideal-int
+pkg syscall (freebsd-amd64), const IFAN_DEPARTURE ideal-int
+pkg syscall (freebsd-amd64), const IFF_CANTCONFIG ideal-int
+pkg syscall (freebsd-amd64), const IFT_INFINIBAND ideal-int
+pkg syscall (freebsd-amd64), const IGNBRK ideal-int
+pkg syscall (freebsd-amd64), const IGNCR ideal-int
+pkg syscall (freebsd-amd64), const IGNPAR ideal-int
+pkg syscall (freebsd-amd64), const IMAXBEL ideal-int
+pkg syscall (freebsd-amd64), const INLCR ideal-int
+pkg syscall (freebsd-amd64), const INPCK ideal-int
+pkg syscall (freebsd-amd64), const IN_RFC3021_MASK ideal-int
+pkg syscall (freebsd-amd64), const IPPROTO_MH ideal-int
+pkg syscall (freebsd-amd64), const IPPROTO_SEND ideal-int
+pkg syscall (freebsd-amd64), const IP_RECVTOS ideal-int
+pkg syscall (freebsd-amd64), const ISIG ideal-int
+pkg syscall (freebsd-amd64), const ISTRIP ideal-int
+pkg syscall (freebsd-amd64), const IXANY ideal-int
+pkg syscall (freebsd-amd64), const IXOFF ideal-int
+pkg syscall (freebsd-amd64), const IXON ideal-int
+pkg syscall (freebsd-amd64), const MADV_AUTOSYNC ideal-int
+pkg syscall (freebsd-amd64), const MADV_CORE ideal-int
+pkg syscall (freebsd-amd64), const MADV_DONTNEED ideal-int
+pkg syscall (freebsd-amd64), const MADV_FREE ideal-int
+pkg syscall (freebsd-amd64), const MADV_NOCORE ideal-int
+pkg syscall (freebsd-amd64), const MADV_NORMAL ideal-int
+pkg syscall (freebsd-amd64), const MADV_NOSYNC ideal-int
+pkg syscall (freebsd-amd64), const MADV_PROTECT ideal-int
+pkg syscall (freebsd-amd64), const MADV_RANDOM ideal-int
+pkg syscall (freebsd-amd64), const MADV_SEQUENTIAL ideal-int
+pkg syscall (freebsd-amd64), const MADV_WILLNEED ideal-int
+pkg syscall (freebsd-amd64), const MAP_ANON ideal-int
+pkg syscall (freebsd-amd64), const MAP_ANONYMOUS ideal-int
+pkg syscall (freebsd-amd64), const MAP_COPY ideal-int
+pkg syscall (freebsd-amd64), const MAP_FILE ideal-int
+pkg syscall (freebsd-amd64), const MAP_FIXED ideal-int
+pkg syscall (freebsd-amd64), const MAP_HASSEMAPHORE ideal-int
+pkg syscall (freebsd-amd64), const MAP_NOCORE ideal-int
+pkg syscall (freebsd-amd64), const MAP_NORESERVE ideal-int
+pkg syscall (freebsd-amd64), const MAP_NOSYNC ideal-int
+pkg syscall (freebsd-amd64), const MAP_PREFAULT_READ ideal-int
+pkg syscall (freebsd-amd64), const MAP_PRIVATE ideal-int
+pkg syscall (freebsd-amd64), const MAP_RENAME ideal-int
+pkg syscall (freebsd-amd64), const MAP_RESERVED0080 ideal-int
+pkg syscall (freebsd-amd64), const MAP_RESERVED0100 ideal-int
+pkg syscall (freebsd-amd64), const MAP_SHARED ideal-int
+pkg syscall (freebsd-amd64), const MAP_STACK ideal-int
+pkg syscall (freebsd-amd64), const MCL_CURRENT ideal-int
+pkg syscall (freebsd-amd64), const MCL_FUTURE ideal-int
+pkg syscall (freebsd-amd64), const MS_ASYNC ideal-int
+pkg syscall (freebsd-amd64), const MS_INVALIDATE ideal-int
+pkg syscall (freebsd-amd64), const MS_SYNC ideal-int
+pkg syscall (freebsd-amd64), const NET_RT_IFLISTL ideal-int
+pkg syscall (freebsd-amd64), const NOFLSH ideal-int
+pkg syscall (freebsd-amd64), const OCRNL ideal-int
+pkg syscall (freebsd-amd64), const ONLCR ideal-int
+pkg syscall (freebsd-amd64), const ONLRET ideal-int
+pkg syscall (freebsd-amd64), const ONOCR ideal-int
+pkg syscall (freebsd-amd64), const ONOEOT ideal-int
+pkg syscall (freebsd-amd64), const OPOST ideal-int
+pkg syscall (freebsd-amd64), const PARENB ideal-int
+pkg syscall (freebsd-amd64), const PARMRK ideal-int
+pkg syscall (freebsd-amd64), const PARODD ideal-int
+pkg syscall (freebsd-amd64), const PENDIN ideal-int
+pkg syscall (freebsd-amd64), const PROT_EXEC ideal-int
+pkg syscall (freebsd-amd64), const PROT_NONE ideal-int
+pkg syscall (freebsd-amd64), const PROT_READ ideal-int
+pkg syscall (freebsd-amd64), const PROT_WRITE ideal-int
+pkg syscall (freebsd-amd64), const RT_CACHING_CONTEXT ideal-int
+pkg syscall (freebsd-amd64), const RT_DEFAULT_FIB ideal-int
+pkg syscall (freebsd-amd64), const SIOCGIFFIB ideal-int
+pkg syscall (freebsd-amd64), const SIOCSIFFIB ideal-int
+pkg syscall (freebsd-amd64), const SO_PROTOCOL ideal-int
+pkg syscall (freebsd-amd64), const SO_PROTOTYPE ideal-int
+pkg syscall (freebsd-amd64), const SO_USER_COOKIE ideal-int
+pkg syscall (freebsd-amd64), const SYS_CLOCK_GETCPUCLOCKID2 ideal-int
+pkg syscall (freebsd-amd64), const SYS_WAIT6 ideal-int
+pkg syscall (freebsd-amd64), const SizeofIfAnnounceMsghdr ideal-int
+pkg syscall (freebsd-amd64), const TCIFLUSH ideal-int
+pkg syscall (freebsd-amd64), const TCIOFLUSH ideal-int
+pkg syscall (freebsd-amd64), const TCOFLUSH ideal-int
+pkg syscall (freebsd-amd64), const TCP_KEEPCNT ideal-int
+pkg syscall (freebsd-amd64), const TCP_KEEPIDLE ideal-int
+pkg syscall (freebsd-amd64), const TCP_KEEPINIT ideal-int
+pkg syscall (freebsd-amd64), const TCP_KEEPINTVL ideal-int
+pkg syscall (freebsd-amd64), const TCSAFLUSH ideal-int
+pkg syscall (freebsd-amd64), const TOSTOP ideal-int
+pkg syscall (freebsd-amd64), const VDISCARD ideal-int
+pkg syscall (freebsd-amd64), const VDSUSP ideal-int
+pkg syscall (freebsd-amd64), const VEOF ideal-int
+pkg syscall (freebsd-amd64), const VEOL ideal-int
+pkg syscall (freebsd-amd64), const VEOL2 ideal-int
+pkg syscall (freebsd-amd64), const VERASE ideal-int
+pkg syscall (freebsd-amd64), const VERASE2 ideal-int
+pkg syscall (freebsd-amd64), const VINTR ideal-int
+pkg syscall (freebsd-amd64), const VKILL ideal-int
+pkg syscall (freebsd-amd64), const VLNEXT ideal-int
+pkg syscall (freebsd-amd64), const VMIN ideal-int
+pkg syscall (freebsd-amd64), const VQUIT ideal-int
+pkg syscall (freebsd-amd64), const VREPRINT ideal-int
+pkg syscall (freebsd-amd64), const VSTART ideal-int
+pkg syscall (freebsd-amd64), const VSTATUS ideal-int
+pkg syscall (freebsd-amd64), const VSTOP ideal-int
+pkg syscall (freebsd-amd64), const VSUSP ideal-int
+pkg syscall (freebsd-amd64), const VTIME ideal-int
+pkg syscall (freebsd-amd64), const VWERASE ideal-int
+pkg syscall (freebsd-amd64), func Fchflags(int, int) error
+pkg syscall (freebsd-amd64), func SlicePtrFromStrings([]string) ([]*uint8, error)
+pkg syscall (freebsd-amd64), func Syscall9(uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr) (uintptr, uintptr, Errno)
+pkg syscall (freebsd-amd64), type IfAnnounceMsghdr struct
+pkg syscall (freebsd-amd64), type IfAnnounceMsghdr struct, Index uint16
+pkg syscall (freebsd-amd64), type IfAnnounceMsghdr struct, Msglen uint16
+pkg syscall (freebsd-amd64), type IfAnnounceMsghdr struct, Name [16]int8
+pkg syscall (freebsd-amd64), type IfAnnounceMsghdr struct, Type uint8
+pkg syscall (freebsd-amd64), type IfAnnounceMsghdr struct, Version uint8
+pkg syscall (freebsd-amd64), type IfAnnounceMsghdr struct, What uint16
+pkg syscall (freebsd-amd64), type InterfaceAnnounceMessage struct
+pkg syscall (freebsd-amd64), type InterfaceAnnounceMessage struct, Header IfAnnounceMsghdr
+pkg syscall (linux-386), const MSG_FASTOPEN ideal-int
+pkg syscall (linux-386), const RTNLGRP_IPV4_IFADDR ideal-int
+pkg syscall (linux-386), const RTNLGRP_IPV4_MROUTE ideal-int
+pkg syscall (linux-386), const RTNLGRP_IPV4_ROUTE ideal-int
+pkg syscall (linux-386), const RTNLGRP_IPV4_RULE ideal-int
+pkg syscall (linux-386), const RTNLGRP_IPV6_IFADDR ideal-int
+pkg syscall (linux-386), const RTNLGRP_IPV6_IFINFO ideal-int
+pkg syscall (linux-386), const RTNLGRP_IPV6_MROUTE ideal-int
+pkg syscall (linux-386), const RTNLGRP_IPV6_PREFIX ideal-int
+pkg syscall (linux-386), const RTNLGRP_IPV6_ROUTE ideal-int
+pkg syscall (linux-386), const RTNLGRP_IPV6_RULE ideal-int
+pkg syscall (linux-386), const RTNLGRP_LINK ideal-int
+pkg syscall (linux-386), const RTNLGRP_ND_USEROPT ideal-int
+pkg syscall (linux-386), const RTNLGRP_NEIGH ideal-int
+pkg syscall (linux-386), const RTNLGRP_NONE ideal-int
+pkg syscall (linux-386), const RTNLGRP_NOTIFY ideal-int
+pkg syscall (linux-386), const RTNLGRP_TC ideal-int
+pkg syscall (linux-386), const SizeofTCPInfo ideal-int
+pkg syscall (linux-386), func Accept4(int, int) (int, Sockaddr, error)
+pkg syscall (linux-386), func GetsockoptUcred(int, int, int) (*Ucred, error)
+pkg syscall (linux-386), func Getxattr(string, string, []uint8) (int, error)
+pkg syscall (linux-386), func Listxattr(string, []uint8) (int, error)
+pkg syscall (linux-386), func Pipe2([]int, int) error
+pkg syscall (linux-386), func PtraceSyscall(int, int) error
+pkg syscall (linux-386), func Removexattr(string, string) error
+pkg syscall (linux-386), func Setxattr(string, string, []uint8, int) error
+pkg syscall (linux-386), func SlicePtrFromStrings([]string) ([]*uint8, error)
+pkg syscall (linux-386), type SysProcAttr struct, Ctty int
+pkg syscall (linux-386), type TCPInfo struct
+pkg syscall (linux-386), type TCPInfo struct, Advmss uint32
+pkg syscall (linux-386), type TCPInfo struct, Ato uint32
+pkg syscall (linux-386), type TCPInfo struct, Backoff uint8
+pkg syscall (linux-386), type TCPInfo struct, Ca_state uint8
+pkg syscall (linux-386), type TCPInfo struct, Fackets uint32
+pkg syscall (linux-386), type TCPInfo struct, Last_ack_recv uint32
+pkg syscall (linux-386), type TCPInfo struct, Last_ack_sent uint32
+pkg syscall (linux-386), type TCPInfo struct, Last_data_recv uint32
+pkg syscall (linux-386), type TCPInfo struct, Last_data_sent uint32
+pkg syscall (linux-386), type TCPInfo struct, Lost uint32
+pkg syscall (linux-386), type TCPInfo struct, Options uint8
+pkg syscall (linux-386), type TCPInfo struct, Pad_cgo_0 [2]uint8
+pkg syscall (linux-386), type TCPInfo struct, Pmtu uint32
+pkg syscall (linux-386), type TCPInfo struct, Probes uint8
+pkg syscall (linux-386), type TCPInfo struct, Rcv_mss uint32
+pkg syscall (linux-386), type TCPInfo struct, Rcv_rtt uint32
+pkg syscall (linux-386), type TCPInfo struct, Rcv_space uint32
+pkg syscall (linux-386), type TCPInfo struct, Rcv_ssthresh uint32
+pkg syscall (linux-386), type TCPInfo struct, Reordering uint32
+pkg syscall (linux-386), type TCPInfo struct, Retrans uint32
+pkg syscall (linux-386), type TCPInfo struct, Retransmits uint8
+pkg syscall (linux-386), type TCPInfo struct, Rto uint32
+pkg syscall (linux-386), type TCPInfo struct, Rtt uint32
+pkg syscall (linux-386), type TCPInfo struct, Rttvar uint32
+pkg syscall (linux-386), type TCPInfo struct, Sacked uint32
+pkg syscall (linux-386), type TCPInfo struct, Snd_cwnd uint32
+pkg syscall (linux-386), type TCPInfo struct, Snd_mss uint32
+pkg syscall (linux-386), type TCPInfo struct, Snd_ssthresh uint32
+pkg syscall (linux-386), type TCPInfo struct, State uint8
+pkg syscall (linux-386), type TCPInfo struct, Total_retrans uint32
+pkg syscall (linux-386), type TCPInfo struct, Unacked uint32
+pkg syscall (linux-386-cgo), const MSG_FASTOPEN ideal-int
+pkg syscall (linux-386-cgo), const RTNLGRP_IPV4_IFADDR ideal-int
+pkg syscall (linux-386-cgo), const RTNLGRP_IPV4_MROUTE ideal-int
+pkg syscall (linux-386-cgo), const RTNLGRP_IPV4_ROUTE ideal-int
+pkg syscall (linux-386-cgo), const RTNLGRP_IPV4_RULE ideal-int
+pkg syscall (linux-386-cgo), const RTNLGRP_IPV6_IFADDR ideal-int
+pkg syscall (linux-386-cgo), const RTNLGRP_IPV6_IFINFO ideal-int
+pkg syscall (linux-386-cgo), const RTNLGRP_IPV6_MROUTE ideal-int
+pkg syscall (linux-386-cgo), const RTNLGRP_IPV6_PREFIX ideal-int
+pkg syscall (linux-386-cgo), const RTNLGRP_IPV6_ROUTE ideal-int
+pkg syscall (linux-386-cgo), const RTNLGRP_IPV6_RULE ideal-int
+pkg syscall (linux-386-cgo), const RTNLGRP_LINK ideal-int
+pkg syscall (linux-386-cgo), const RTNLGRP_ND_USEROPT ideal-int
+pkg syscall (linux-386-cgo), const RTNLGRP_NEIGH ideal-int
+pkg syscall (linux-386-cgo), const RTNLGRP_NONE ideal-int
+pkg syscall (linux-386-cgo), const RTNLGRP_NOTIFY ideal-int
+pkg syscall (linux-386-cgo), const RTNLGRP_TC ideal-int
+pkg syscall (linux-386-cgo), const SizeofTCPInfo ideal-int
+pkg syscall (linux-386-cgo), func Accept4(int, int) (int, Sockaddr, error)
+pkg syscall (linux-386-cgo), func GetsockoptUcred(int, int, int) (*Ucred, error)
+pkg syscall (linux-386-cgo), func Getxattr(string, string, []uint8) (int, error)
+pkg syscall (linux-386-cgo), func Listxattr(string, []uint8) (int, error)
+pkg syscall (linux-386-cgo), func Pipe2([]int, int) error
+pkg syscall (linux-386-cgo), func PtraceSyscall(int, int) error
+pkg syscall (linux-386-cgo), func Removexattr(string, string) error
+pkg syscall (linux-386-cgo), func Setxattr(string, string, []uint8, int) error
+pkg syscall (linux-386-cgo), func SlicePtrFromStrings([]string) ([]*uint8, error)
+pkg syscall (linux-386-cgo), type SysProcAttr struct, Ctty int
+pkg syscall (linux-386-cgo), type TCPInfo struct
+pkg syscall (linux-386-cgo), type TCPInfo struct, Advmss uint32
+pkg syscall (linux-386-cgo), type TCPInfo struct, Ato uint32
+pkg syscall (linux-386-cgo), type TCPInfo struct, Backoff uint8
+pkg syscall (linux-386-cgo), type TCPInfo struct, Ca_state uint8
+pkg syscall (linux-386-cgo), type TCPInfo struct, Fackets uint32
+pkg syscall (linux-386-cgo), type TCPInfo struct, Last_ack_recv uint32
+pkg syscall (linux-386-cgo), type TCPInfo struct, Last_ack_sent uint32
+pkg syscall (linux-386-cgo), type TCPInfo struct, Last_data_recv uint32
+pkg syscall (linux-386-cgo), type TCPInfo struct, Last_data_sent uint32
+pkg syscall (linux-386-cgo), type TCPInfo struct, Lost uint32
+pkg syscall (linux-386-cgo), type TCPInfo struct, Options uint8
+pkg syscall (linux-386-cgo), type TCPInfo struct, Pad_cgo_0 [2]uint8
+pkg syscall (linux-386-cgo), type TCPInfo struct, Pmtu uint32
+pkg syscall (linux-386-cgo), type TCPInfo struct, Probes uint8
+pkg syscall (linux-386-cgo), type TCPInfo struct, Rcv_mss uint32
+pkg syscall (linux-386-cgo), type TCPInfo struct, Rcv_rtt uint32
+pkg syscall (linux-386-cgo), type TCPInfo struct, Rcv_space uint32
+pkg syscall (linux-386-cgo), type TCPInfo struct, Rcv_ssthresh uint32
+pkg syscall (linux-386-cgo), type TCPInfo struct, Reordering uint32
+pkg syscall (linux-386-cgo), type TCPInfo struct, Retrans uint32
+pkg syscall (linux-386-cgo), type TCPInfo struct, Retransmits uint8
+pkg syscall (linux-386-cgo), type TCPInfo struct, Rto uint32
+pkg syscall (linux-386-cgo), type TCPInfo struct, Rtt uint32
+pkg syscall (linux-386-cgo), type TCPInfo struct, Rttvar uint32
+pkg syscall (linux-386-cgo), type TCPInfo struct, Sacked uint32
+pkg syscall (linux-386-cgo), type TCPInfo struct, Snd_cwnd uint32
+pkg syscall (linux-386-cgo), type TCPInfo struct, Snd_mss uint32
+pkg syscall (linux-386-cgo), type TCPInfo struct, Snd_ssthresh uint32
+pkg syscall (linux-386-cgo), type TCPInfo struct, State uint8
+pkg syscall (linux-386-cgo), type TCPInfo struct, Total_retrans uint32
+pkg syscall (linux-386-cgo), type TCPInfo struct, Unacked uint32
+pkg syscall (linux-amd64), const MSG_FASTOPEN ideal-int
+pkg syscall (linux-amd64), const RTNLGRP_IPV4_IFADDR ideal-int
+pkg syscall (linux-amd64), const RTNLGRP_IPV4_MROUTE ideal-int
+pkg syscall (linux-amd64), const RTNLGRP_IPV4_ROUTE ideal-int
+pkg syscall (linux-amd64), const RTNLGRP_IPV4_RULE ideal-int
+pkg syscall (linux-amd64), const RTNLGRP_IPV6_IFADDR ideal-int
+pkg syscall (linux-amd64), const RTNLGRP_IPV6_IFINFO ideal-int
+pkg syscall (linux-amd64), const RTNLGRP_IPV6_MROUTE ideal-int
+pkg syscall (linux-amd64), const RTNLGRP_IPV6_PREFIX ideal-int
+pkg syscall (linux-amd64), const RTNLGRP_IPV6_ROUTE ideal-int
+pkg syscall (linux-amd64), const RTNLGRP_IPV6_RULE ideal-int
+pkg syscall (linux-amd64), const RTNLGRP_LINK ideal-int
+pkg syscall (linux-amd64), const RTNLGRP_ND_USEROPT ideal-int
+pkg syscall (linux-amd64), const RTNLGRP_NEIGH ideal-int
+pkg syscall (linux-amd64), const RTNLGRP_NONE ideal-int
+pkg syscall (linux-amd64), const RTNLGRP_NOTIFY ideal-int
+pkg syscall (linux-amd64), const RTNLGRP_TC ideal-int
+pkg syscall (linux-amd64), const SizeofTCPInfo ideal-int
+pkg syscall (linux-amd64), func Accept4(int, int) (int, Sockaddr, error)
+pkg syscall (linux-amd64), func GetsockoptUcred(int, int, int) (*Ucred, error)
+pkg syscall (linux-amd64), func Getxattr(string, string, []uint8) (int, error)
+pkg syscall (linux-amd64), func Listxattr(string, []uint8) (int, error)
+pkg syscall (linux-amd64), func Pipe2([]int, int) error
+pkg syscall (linux-amd64), func PtraceSyscall(int, int) error
+pkg syscall (linux-amd64), func Removexattr(string, string) error
+pkg syscall (linux-amd64), func Setxattr(string, string, []uint8, int) error
+pkg syscall (linux-amd64), func SlicePtrFromStrings([]string) ([]*uint8, error)
+pkg syscall (linux-amd64), type SysProcAttr struct, Ctty int
+pkg syscall (linux-amd64), type TCPInfo struct
+pkg syscall (linux-amd64), type TCPInfo struct, Advmss uint32
+pkg syscall (linux-amd64), type TCPInfo struct, Ato uint32
+pkg syscall (linux-amd64), type TCPInfo struct, Backoff uint8
+pkg syscall (linux-amd64), type TCPInfo struct, Ca_state uint8
+pkg syscall (linux-amd64), type TCPInfo struct, Fackets uint32
+pkg syscall (linux-amd64), type TCPInfo struct, Last_ack_recv uint32
+pkg syscall (linux-amd64), type TCPInfo struct, Last_ack_sent uint32
+pkg syscall (linux-amd64), type TCPInfo struct, Last_data_recv uint32
+pkg syscall (linux-amd64), type TCPInfo struct, Last_data_sent uint32
+pkg syscall (linux-amd64), type TCPInfo struct, Lost uint32
+pkg syscall (linux-amd64), type TCPInfo struct, Options uint8
+pkg syscall (linux-amd64), type TCPInfo struct, Pad_cgo_0 [2]uint8
+pkg syscall (linux-amd64), type TCPInfo struct, Pmtu uint32
+pkg syscall (linux-amd64), type TCPInfo struct, Probes uint8
+pkg syscall (linux-amd64), type TCPInfo struct, Rcv_mss uint32
+pkg syscall (linux-amd64), type TCPInfo struct, Rcv_rtt uint32
+pkg syscall (linux-amd64), type TCPInfo struct, Rcv_space uint32
+pkg syscall (linux-amd64), type TCPInfo struct, Rcv_ssthresh uint32
+pkg syscall (linux-amd64), type TCPInfo struct, Reordering uint32
+pkg syscall (linux-amd64), type TCPInfo struct, Retrans uint32
+pkg syscall (linux-amd64), type TCPInfo struct, Retransmits uint8
+pkg syscall (linux-amd64), type TCPInfo struct, Rto uint32
+pkg syscall (linux-amd64), type TCPInfo struct, Rtt uint32
+pkg syscall (linux-amd64), type TCPInfo struct, Rttvar uint32
+pkg syscall (linux-amd64), type TCPInfo struct, Sacked uint32
+pkg syscall (linux-amd64), type TCPInfo struct, Snd_cwnd uint32
+pkg syscall (linux-amd64), type TCPInfo struct, Snd_mss uint32
+pkg syscall (linux-amd64), type TCPInfo struct, Snd_ssthresh uint32
+pkg syscall (linux-amd64), type TCPInfo struct, State uint8
+pkg syscall (linux-amd64), type TCPInfo struct, Total_retrans uint32
+pkg syscall (linux-amd64), type TCPInfo struct, Unacked uint32
+pkg syscall (linux-amd64-cgo), const MSG_FASTOPEN ideal-int
+pkg syscall (linux-amd64-cgo), const RTNLGRP_IPV4_IFADDR ideal-int
+pkg syscall (linux-amd64-cgo), const RTNLGRP_IPV4_MROUTE ideal-int
+pkg syscall (linux-amd64-cgo), const RTNLGRP_IPV4_ROUTE ideal-int
+pkg syscall (linux-amd64-cgo), const RTNLGRP_IPV4_RULE ideal-int
+pkg syscall (linux-amd64-cgo), const RTNLGRP_IPV6_IFADDR ideal-int
+pkg syscall (linux-amd64-cgo), const RTNLGRP_IPV6_IFINFO ideal-int
+pkg syscall (linux-amd64-cgo), const RTNLGRP_IPV6_MROUTE ideal-int
+pkg syscall (linux-amd64-cgo), const RTNLGRP_IPV6_PREFIX ideal-int
+pkg syscall (linux-amd64-cgo), const RTNLGRP_IPV6_ROUTE ideal-int
+pkg syscall (linux-amd64-cgo), const RTNLGRP_IPV6_RULE ideal-int
+pkg syscall (linux-amd64-cgo), const RTNLGRP_LINK ideal-int
+pkg syscall (linux-amd64-cgo), const RTNLGRP_ND_USEROPT ideal-int
+pkg syscall (linux-amd64-cgo), const RTNLGRP_NEIGH ideal-int
+pkg syscall (linux-amd64-cgo), const RTNLGRP_NONE ideal-int
+pkg syscall (linux-amd64-cgo), const RTNLGRP_NOTIFY ideal-int
+pkg syscall (linux-amd64-cgo), const RTNLGRP_TC ideal-int
+pkg syscall (linux-amd64-cgo), const SizeofTCPInfo ideal-int
+pkg syscall (linux-amd64-cgo), func Accept4(int, int) (int, Sockaddr, error)
+pkg syscall (linux-amd64-cgo), func GetsockoptUcred(int, int, int) (*Ucred, error)
+pkg syscall (linux-amd64-cgo), func Getxattr(string, string, []uint8) (int, error)
+pkg syscall (linux-amd64-cgo), func Listxattr(string, []uint8) (int, error)
+pkg syscall (linux-amd64-cgo), func Pipe2([]int, int) error
+pkg syscall (linux-amd64-cgo), func PtraceSyscall(int, int) error
+pkg syscall (linux-amd64-cgo), func Removexattr(string, string) error
+pkg syscall (linux-amd64-cgo), func Setxattr(string, string, []uint8, int) error
+pkg syscall (linux-amd64-cgo), func SlicePtrFromStrings([]string) ([]*uint8, error)
+pkg syscall (linux-amd64-cgo), type SysProcAttr struct, Ctty int
+pkg syscall (linux-amd64-cgo), type TCPInfo struct
+pkg syscall (linux-amd64-cgo), type TCPInfo struct, Advmss uint32
+pkg syscall (linux-amd64-cgo), type TCPInfo struct, Ato uint32
+pkg syscall (linux-amd64-cgo), type TCPInfo struct, Backoff uint8
+pkg syscall (linux-amd64-cgo), type TCPInfo struct, Ca_state uint8
+pkg syscall (linux-amd64-cgo), type TCPInfo struct, Fackets uint32
+pkg syscall (linux-amd64-cgo), type TCPInfo struct, Last_ack_recv uint32
+pkg syscall (linux-amd64-cgo), type TCPInfo struct, Last_ack_sent uint32
+pkg syscall (linux-amd64-cgo), type TCPInfo struct, Last_data_recv uint32
+pkg syscall (linux-amd64-cgo), type TCPInfo struct, Last_data_sent uint32
+pkg syscall (linux-amd64-cgo), type TCPInfo struct, Lost uint32
+pkg syscall (linux-amd64-cgo), type TCPInfo struct, Options uint8
+pkg syscall (linux-amd64-cgo), type TCPInfo struct, Pad_cgo_0 [2]uint8
+pkg syscall (linux-amd64-cgo), type TCPInfo struct, Pmtu uint32
+pkg syscall (linux-amd64-cgo), type TCPInfo struct, Probes uint8
+pkg syscall (linux-amd64-cgo), type TCPInfo struct, Rcv_mss uint32
+pkg syscall (linux-amd64-cgo), type TCPInfo struct, Rcv_rtt uint32
+pkg syscall (linux-amd64-cgo), type TCPInfo struct, Rcv_space uint32
+pkg syscall (linux-amd64-cgo), type TCPInfo struct, Rcv_ssthresh uint32
+pkg syscall (linux-amd64-cgo), type TCPInfo struct, Reordering uint32
+pkg syscall (linux-amd64-cgo), type TCPInfo struct, Retrans uint32
+pkg syscall (linux-amd64-cgo), type TCPInfo struct, Retransmits uint8
+pkg syscall (linux-amd64-cgo), type TCPInfo struct, Rto uint32
+pkg syscall (linux-amd64-cgo), type TCPInfo struct, Rtt uint32
+pkg syscall (linux-amd64-cgo), type TCPInfo struct, Rttvar uint32
+pkg syscall (linux-amd64-cgo), type TCPInfo struct, Sacked uint32
+pkg syscall (linux-amd64-cgo), type TCPInfo struct, Snd_cwnd uint32
+pkg syscall (linux-amd64-cgo), type TCPInfo struct, Snd_mss uint32
+pkg syscall (linux-amd64-cgo), type TCPInfo struct, Snd_ssthresh uint32
+pkg syscall (linux-amd64-cgo), type TCPInfo struct, State uint8
+pkg syscall (linux-amd64-cgo), type TCPInfo struct, Total_retrans uint32
+pkg syscall (linux-amd64-cgo), type TCPInfo struct, Unacked uint32
+pkg syscall (linux-arm), const MSG_FASTOPEN ideal-int
+pkg syscall (linux-arm), const RTNLGRP_IPV4_IFADDR ideal-int
+pkg syscall (linux-arm), const RTNLGRP_IPV4_MROUTE ideal-int
+pkg syscall (linux-arm), const RTNLGRP_IPV4_ROUTE ideal-int
+pkg syscall (linux-arm), const RTNLGRP_IPV4_RULE ideal-int
+pkg syscall (linux-arm), const RTNLGRP_IPV6_IFADDR ideal-int
+pkg syscall (linux-arm), const RTNLGRP_IPV6_IFINFO ideal-int
+pkg syscall (linux-arm), const RTNLGRP_IPV6_MROUTE ideal-int
+pkg syscall (linux-arm), const RTNLGRP_IPV6_PREFIX ideal-int
+pkg syscall (linux-arm), const RTNLGRP_IPV6_ROUTE ideal-int
+pkg syscall (linux-arm), const RTNLGRP_IPV6_RULE ideal-int
+pkg syscall (linux-arm), const RTNLGRP_LINK ideal-int
+pkg syscall (linux-arm), const RTNLGRP_ND_USEROPT ideal-int
+pkg syscall (linux-arm), const RTNLGRP_NEIGH ideal-int
+pkg syscall (linux-arm), const RTNLGRP_NONE ideal-int
+pkg syscall (linux-arm), const RTNLGRP_NOTIFY ideal-int
+pkg syscall (linux-arm), const RTNLGRP_TC ideal-int
+pkg syscall (linux-arm), const SizeofTCPInfo ideal-int
+pkg syscall (linux-arm), func Accept4(int, int) (int, Sockaddr, error)
+pkg syscall (linux-arm), func GetsockoptUcred(int, int, int) (*Ucred, error)
+pkg syscall (linux-arm), func Getxattr(string, string, []uint8) (int, error)
+pkg syscall (linux-arm), func Listxattr(string, []uint8) (int, error)
+pkg syscall (linux-arm), func Pipe2([]int, int) error
+pkg syscall (linux-arm), func PtraceSyscall(int, int) error
+pkg syscall (linux-arm), func Removexattr(string, string) error
+pkg syscall (linux-arm), func Setxattr(string, string, []uint8, int) error
+pkg syscall (linux-arm), func SlicePtrFromStrings([]string) ([]*uint8, error)
+pkg syscall (linux-arm), type SysProcAttr struct, Ctty int
+pkg syscall (linux-arm), type TCPInfo struct
+pkg syscall (linux-arm), type TCPInfo struct, Advmss uint32
+pkg syscall (linux-arm), type TCPInfo struct, Ato uint32
+pkg syscall (linux-arm), type TCPInfo struct, Backoff uint8
+pkg syscall (linux-arm), type TCPInfo struct, Ca_state uint8
+pkg syscall (linux-arm), type TCPInfo struct, Fackets uint32
+pkg syscall (linux-arm), type TCPInfo struct, Last_ack_recv uint32
+pkg syscall (linux-arm), type TCPInfo struct, Last_ack_sent uint32
+pkg syscall (linux-arm), type TCPInfo struct, Last_data_recv uint32
+pkg syscall (linux-arm), type TCPInfo struct, Last_data_sent uint32
+pkg syscall (linux-arm), type TCPInfo struct, Lost uint32
+pkg syscall (linux-arm), type TCPInfo struct, Options uint8
+pkg syscall (linux-arm), type TCPInfo struct, Pad_cgo_0 [2]uint8
+pkg syscall (linux-arm), type TCPInfo struct, Pmtu uint32
+pkg syscall (linux-arm), type TCPInfo struct, Probes uint8
+pkg syscall (linux-arm), type TCPInfo struct, Rcv_mss uint32
+pkg syscall (linux-arm), type TCPInfo struct, Rcv_rtt uint32
+pkg syscall (linux-arm), type TCPInfo struct, Rcv_space uint32
+pkg syscall (linux-arm), type TCPInfo struct, Rcv_ssthresh uint32
+pkg syscall (linux-arm), type TCPInfo struct, Reordering uint32
+pkg syscall (linux-arm), type TCPInfo struct, Retrans uint32
+pkg syscall (linux-arm), type TCPInfo struct, Retransmits uint8
+pkg syscall (linux-arm), type TCPInfo struct, Rto uint32
+pkg syscall (linux-arm), type TCPInfo struct, Rtt uint32
+pkg syscall (linux-arm), type TCPInfo struct, Rttvar uint32
+pkg syscall (linux-arm), type TCPInfo struct, Sacked uint32
+pkg syscall (linux-arm), type TCPInfo struct, Snd_cwnd uint32
+pkg syscall (linux-arm), type TCPInfo struct, Snd_mss uint32
+pkg syscall (linux-arm), type TCPInfo struct, Snd_ssthresh uint32
+pkg syscall (linux-arm), type TCPInfo struct, State uint8
+pkg syscall (linux-arm), type TCPInfo struct, Total_retrans uint32
+pkg syscall (linux-arm), type TCPInfo struct, Unacked uint32
+pkg syscall (windows-386), const AI_CANONNAME ideal-int
+pkg syscall (windows-386), const AI_NUMERICHOST ideal-int
+pkg syscall (windows-386), const AI_PASSIVE ideal-int
+pkg syscall (windows-386), const CREATE_NEW_PROCESS_GROUP ideal-int
+pkg syscall (windows-386), const CTRL_BREAK_EVENT ideal-int
+pkg syscall (windows-386), const CTRL_C_EVENT ideal-int
+pkg syscall (windows-386), const ERROR_NOT_FOUND Errno
+pkg syscall (windows-386), const IOC_IN ideal-int
+pkg syscall (windows-386), const IOC_INOUT ideal-int
+pkg syscall (windows-386), const IOC_OUT ideal-int
+pkg syscall (windows-386), const IOC_WS2 ideal-int
+pkg syscall (windows-386), const SIO_GET_EXTENSION_FUNCTION_POINTER ideal-int
+pkg syscall (windows-386), const SO_UPDATE_CONNECT_CONTEXT ideal-int
+pkg syscall (windows-386), func CancelIoEx(Handle, *Overlapped) error
+pkg syscall (windows-386), func ConnectEx(Handle, Sockaddr, *uint8, uint32, *uint32, *Overlapped) error
+pkg syscall (windows-386), func FreeAddrInfoW(*AddrinfoW)
+pkg syscall (windows-386), func GetAddrInfoW(*uint16, *uint16, *AddrinfoW, **AddrinfoW) error
+pkg syscall (windows-386), func GetConsoleMode(Handle, *uint32) error
+pkg syscall (windows-386), func Getsockopt(Handle, int32, int32, *uint8, *int32) error
+pkg syscall (windows-386), func LoadCancelIoEx() error
+pkg syscall (windows-386), func LoadConnectEx() error
+pkg syscall (windows-386), func LoadGetAddrInfo() error
+pkg syscall (windows-386), func ReadConsole(Handle, *uint16, uint32, *uint32, *uint8) error
+pkg syscall (windows-386), func UTF16FromString(string) ([]uint16, error)
+pkg syscall (windows-386), func UTF16PtrFromString(string) (*uint16, error)
+pkg syscall (windows-386), func WriteConsole(Handle, *uint16, uint32, *uint32, *uint8) error
+pkg syscall (windows-386), type AddrinfoW struct
+pkg syscall (windows-386), type AddrinfoW struct, Addr uintptr
+pkg syscall (windows-386), type AddrinfoW struct, Addrlen uintptr
+pkg syscall (windows-386), type AddrinfoW struct, Canonname *uint16
+pkg syscall (windows-386), type AddrinfoW struct, Family int32
+pkg syscall (windows-386), type AddrinfoW struct, Flags int32
+pkg syscall (windows-386), type AddrinfoW struct, Next *AddrinfoW
+pkg syscall (windows-386), type AddrinfoW struct, Protocol int32
+pkg syscall (windows-386), type AddrinfoW struct, Socktype int32
+pkg syscall (windows-386), type GUID struct
+pkg syscall (windows-386), type GUID struct, Data1 uint32
+pkg syscall (windows-386), type GUID struct, Data2 uint16
+pkg syscall (windows-386), type GUID struct, Data3 uint16
+pkg syscall (windows-386), type GUID struct, Data4 [8]uint8
+pkg syscall (windows-386), type RawSockaddrInet6 struct, Family uint16
+pkg syscall (windows-386), type SysProcAttr struct, CreationFlags uint32
+pkg syscall (windows-386), var WSAID_CONNECTEX GUID
+pkg syscall (windows-amd64), const AI_CANONNAME ideal-int
+pkg syscall (windows-amd64), const AI_NUMERICHOST ideal-int
+pkg syscall (windows-amd64), const AI_PASSIVE ideal-int
+pkg syscall (windows-amd64), const CREATE_NEW_PROCESS_GROUP ideal-int
+pkg syscall (windows-amd64), const CTRL_BREAK_EVENT ideal-int
+pkg syscall (windows-amd64), const CTRL_C_EVENT ideal-int
+pkg syscall (windows-amd64), const ERROR_NOT_FOUND Errno
+pkg syscall (windows-amd64), const IOC_IN ideal-int
+pkg syscall (windows-amd64), const IOC_INOUT ideal-int
+pkg syscall (windows-amd64), const IOC_OUT ideal-int
+pkg syscall (windows-amd64), const IOC_WS2 ideal-int
+pkg syscall (windows-amd64), const SIO_GET_EXTENSION_FUNCTION_POINTER ideal-int
+pkg syscall (windows-amd64), const SO_UPDATE_CONNECT_CONTEXT ideal-int
+pkg syscall (windows-amd64), func CancelIoEx(Handle, *Overlapped) error
+pkg syscall (windows-amd64), func ConnectEx(Handle, Sockaddr, *uint8, uint32, *uint32, *Overlapped) error
+pkg syscall (windows-amd64), func FreeAddrInfoW(*AddrinfoW)
+pkg syscall (windows-amd64), func GetAddrInfoW(*uint16, *uint16, *AddrinfoW, **AddrinfoW) error
+pkg syscall (windows-amd64), func GetConsoleMode(Handle, *uint32) error
+pkg syscall (windows-amd64), func Getsockopt(Handle, int32, int32, *uint8, *int32) error
+pkg syscall (windows-amd64), func LoadCancelIoEx() error
+pkg syscall (windows-amd64), func LoadConnectEx() error
+pkg syscall (windows-amd64), func LoadGetAddrInfo() error
+pkg syscall (windows-amd64), func ReadConsole(Handle, *uint16, uint32, *uint32, *uint8) error
+pkg syscall (windows-amd64), func UTF16FromString(string) ([]uint16, error)
+pkg syscall (windows-amd64), func UTF16PtrFromString(string) (*uint16, error)
+pkg syscall (windows-amd64), func WriteConsole(Handle, *uint16, uint32, *uint32, *uint8) error
+pkg syscall (windows-amd64), type AddrinfoW struct
+pkg syscall (windows-amd64), type AddrinfoW struct, Addr uintptr
+pkg syscall (windows-amd64), type AddrinfoW struct, Addrlen uintptr
+pkg syscall (windows-amd64), type AddrinfoW struct, Canonname *uint16
+pkg syscall (windows-amd64), type AddrinfoW struct, Family int32
+pkg syscall (windows-amd64), type AddrinfoW struct, Flags int32
+pkg syscall (windows-amd64), type AddrinfoW struct, Next *AddrinfoW
+pkg syscall (windows-amd64), type AddrinfoW struct, Protocol int32
+pkg syscall (windows-amd64), type AddrinfoW struct, Socktype int32
+pkg syscall (windows-amd64), type GUID struct
+pkg syscall (windows-amd64), type GUID struct, Data1 uint32
+pkg syscall (windows-amd64), type GUID struct, Data2 uint16
+pkg syscall (windows-amd64), type GUID struct, Data3 uint16
+pkg syscall (windows-amd64), type GUID struct, Data4 [8]uint8
+pkg syscall (windows-amd64), type RawSockaddrInet6 struct, Family uint16
+pkg syscall (windows-amd64), type SysProcAttr struct, CreationFlags uint32
+pkg syscall (windows-amd64), var WSAID_CONNECTEX GUID
+pkg syscall, func BytePtrFromString(string) (*uint8, error)
+pkg syscall, func ByteSliceFromString(string) ([]uint8, error)
+pkg syscall, func NsecToTimespec(int64) Timespec
+pkg syscall, func TimespecToNsec(Timespec) int64
+pkg syscall, func UtimesNano(string, []Timespec) error
+pkg syscall, type RawSockaddrInet6 struct
+pkg syscall, type RawSockaddrInet6 struct, Addr [16]uint8
+pkg syscall, type RawSockaddrInet6 struct, Flowinfo uint32
+pkg syscall, type RawSockaddrInet6 struct, Port uint16
+pkg syscall, type RawSockaddrInet6 struct, Scope_id uint32
+pkg testing, func AllocsPerRun(int, func()) float64
+pkg testing, func Verbose() bool
+pkg testing, method (*B) ReportAllocs()
+pkg testing, method (*B) Skip(...interface{})
+pkg testing, method (*B) SkipNow()
+pkg testing, method (*B) Skipf(string, ...interface{})
+pkg testing, method (*B) Skipped() bool
+pkg testing, method (*T) Skip(...interface{})
+pkg testing, method (*T) SkipNow()
+pkg testing, method (*T) Skipf(string, ...interface{})
+pkg testing, method (*T) Skipped() bool
+pkg testing, method (BenchmarkResult) AllocedBytesPerOp() int64
+pkg testing, method (BenchmarkResult) AllocsPerOp() int64
+pkg testing, method (BenchmarkResult) MemString() string
+pkg testing, type BenchmarkResult struct, MemAllocs uint64
+pkg testing, type BenchmarkResult struct, MemBytes uint64
+pkg text/template/parse, const NodeChain NodeType
+pkg text/template/parse, const NodeNil NodeType
+pkg text/template/parse, method (*ChainNode) Add(string)
+pkg text/template/parse, method (*ChainNode) Copy() Node
+pkg text/template/parse, method (*ChainNode) String() string
+pkg text/template/parse, method (*IdentifierNode) SetPos(Pos) *IdentifierNode
+pkg text/template/parse, method (*NilNode) Copy() Node
+pkg text/template/parse, method (*NilNode) String() string
+pkg text/template/parse, method (*NilNode) Type() NodeType
+pkg text/template/parse, method (*Tree) ErrorContext(Node) (string, string)
+pkg text/template/parse, method (ActionNode) Position() Pos
+pkg text/template/parse, method (BoolNode) Position() Pos
+pkg text/template/parse, method (BranchNode) Position() Pos
+pkg text/template/parse, method (ChainNode) Position() Pos
+pkg text/template/parse, method (ChainNode) Type() NodeType
+pkg text/template/parse, method (CommandNode) Position() Pos
+pkg text/template/parse, method (DotNode) Position() Pos
+pkg text/template/parse, method (FieldNode) Position() Pos
+pkg text/template/parse, method (IdentifierNode) Position() Pos
+pkg text/template/parse, method (IfNode) Position() Pos
+pkg text/template/parse, method (ListNode) Position() Pos
+pkg text/template/parse, method (NilNode) Position() Pos
+pkg text/template/parse, method (NumberNode) Position() Pos
+pkg text/template/parse, method (PipeNode) Position() Pos
+pkg text/template/parse, method (Pos) Position() Pos
+pkg text/template/parse, method (RangeNode) Position() Pos
+pkg text/template/parse, method (StringNode) Position() Pos
+pkg text/template/parse, method (TemplateNode) Position() Pos
+pkg text/template/parse, method (TextNode) Position() Pos
+pkg text/template/parse, method (VariableNode) Position() Pos
+pkg text/template/parse, method (WithNode) Position() Pos
+pkg text/template/parse, type ActionNode struct, embedded Pos
+pkg text/template/parse, type BoolNode struct, embedded Pos
+pkg text/template/parse, type BranchNode struct, embedded Pos
+pkg text/template/parse, type ChainNode struct
+pkg text/template/parse, type ChainNode struct, Field []string
+pkg text/template/parse, type ChainNode struct, Node Node
+pkg text/template/parse, type ChainNode struct, embedded NodeType
+pkg text/template/parse, type ChainNode struct, embedded Pos
+pkg text/template/parse, type CommandNode struct, embedded Pos
+pkg text/template/parse, type DotNode struct
+pkg text/template/parse, type DotNode struct, embedded Pos
+pkg text/template/parse, type FieldNode struct, embedded Pos
+pkg text/template/parse, type IdentifierNode struct, embedded Pos
+pkg text/template/parse, type ListNode struct, embedded Pos
+pkg text/template/parse, type NilNode struct
+pkg text/template/parse, type NilNode struct, embedded Pos
+pkg text/template/parse, type Node interface, Position() Pos
+pkg text/template/parse, type Node interface, unexported methods
+pkg text/template/parse, type NumberNode struct, embedded Pos
+pkg text/template/parse, type PipeNode struct, embedded Pos
+pkg text/template/parse, type Pos int
+pkg text/template/parse, type StringNode struct, embedded Pos
+pkg text/template/parse, type TemplateNode struct, embedded Pos
+pkg text/template/parse, type TextNode struct, embedded Pos
+pkg text/template/parse, type Tree struct, ParseName string
+pkg text/template/parse, type VariableNode struct, embedded Pos
+pkg time, func ParseInLocation(string, string, *Location) (Time, error)
+pkg time, method (*Timer) Reset(Duration) bool
+pkg time, method (Time) Round(Duration) Time
+pkg time, method (Time) Truncate(Duration) Time
+pkg time, method (Time) YearDay() int
+pkg unicode, type RangeTable struct, LatinOffset int
+pkg unicode, var Chakma *RangeTable
+pkg unicode, var Meroitic_Cursive *RangeTable
+pkg unicode, var Meroitic_Hieroglyphs *RangeTable
+pkg unicode, var Miao *RangeTable
+pkg unicode, var Sharada *RangeTable
+pkg unicode, var Sora_Sompeng *RangeTable
+pkg unicode, var Takri *RangeTable
+pkg unicode/utf8, func ValidRune(int32) bool
diff --git a/api/next.txt b/api/next.txt
index 2aaca2f7a..e69de29bb 100644
--- a/api/next.txt
+++ b/api/next.txt
@@ -1,1766 +0,0 @@
-pkg archive/tar, const TypeGNULongLink ideal-char
-pkg archive/tar, const TypeGNULongName ideal-char
-pkg archive/tar, func FileInfoHeader(os.FileInfo, string) (*Header, error)
-pkg archive/tar, method (*Header) FileInfo() os.FileInfo
-pkg archive/zip, type FileHeader struct, CompressedSize64 uint64
-pkg archive/zip, type FileHeader struct, UncompressedSize64 uint64
-pkg bufio, const MaxScanTokenSize ideal-int
-pkg bufio, func NewScanner(io.Reader) *Scanner
-pkg bufio, func ScanBytes([]uint8, bool) (int, []uint8, error)
-pkg bufio, func ScanLines([]uint8, bool) (int, []uint8, error)
-pkg bufio, func ScanRunes([]uint8, bool) (int, []uint8, error)
-pkg bufio, func ScanWords([]uint8, bool) (int, []uint8, error)
-pkg bufio, method (*Reader) WriteTo(io.Writer) (int64, error)
-pkg bufio, method (*Scanner) Bytes() []uint8
-pkg bufio, method (*Scanner) Err() error
-pkg bufio, method (*Scanner) Scan() bool
-pkg bufio, method (*Scanner) Split(SplitFunc)
-pkg bufio, method (*Scanner) Text() string
-pkg bufio, method (*Writer) ReadFrom(io.Reader) (int64, error)
-pkg bufio, method (ReadWriter) ReadFrom(io.Reader) (int64, error)
-pkg bufio, method (ReadWriter) WriteTo(io.Writer) (int64, error)
-pkg bufio, type Scanner struct
-pkg bufio, type SplitFunc func([]uint8, bool) (int, []uint8, error)
-pkg bufio, var ErrAdvanceTooFar error
-pkg bufio, var ErrNegativeAdvance error
-pkg bufio, var ErrTooLong error
-pkg bytes, func TrimPrefix([]uint8, []uint8) []uint8
-pkg bytes, func TrimSuffix([]uint8, []uint8) []uint8
-pkg bytes, method (*Buffer) Grow(int)
-pkg bytes, method (*Reader) WriteTo(io.Writer) (int64, error)
-pkg compress/gzip, method (*Writer) Flush() error
-pkg crypto/hmac, func Equal([]uint8, []uint8) bool
-pkg crypto/tls, const TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA uint16
-pkg crypto/tls, const TLS_RSA_WITH_AES_256_CBC_SHA uint16
-pkg crypto/tls, type Config struct, PreferServerCipherSuites bool
-pkg crypto/tls, type Config struct, SessionTicketKey [32]uint8
-pkg crypto/tls, type Config struct, SessionTicketsDisabled bool
-pkg crypto/tls, type ConnectionState struct, DidResume bool
-pkg crypto/x509, const ECDSA PublicKeyAlgorithm
-pkg crypto/x509, const ECDSAWithSHA1 SignatureAlgorithm
-pkg crypto/x509, const ECDSAWithSHA256 SignatureAlgorithm
-pkg crypto/x509, const ECDSAWithSHA384 SignatureAlgorithm
-pkg crypto/x509, const ECDSAWithSHA512 SignatureAlgorithm
-pkg crypto/x509, const ExtKeyUsageIPSECEndSystem ExtKeyUsage
-pkg crypto/x509, const ExtKeyUsageIPSECTunnel ExtKeyUsage
-pkg crypto/x509, const ExtKeyUsageIPSECUser ExtKeyUsage
-pkg crypto/x509, const ExtKeyUsageMicrosoftServerGatedCrypto ExtKeyUsage
-pkg crypto/x509, const ExtKeyUsageNetscapeServerGatedCrypto ExtKeyUsage
-pkg crypto/x509, const IncompatibleUsage InvalidReason
-pkg crypto/x509, const PEMCipher3DES PEMCipher
-pkg crypto/x509, const PEMCipherAES128 PEMCipher
-pkg crypto/x509, const PEMCipherAES192 PEMCipher
-pkg crypto/x509, const PEMCipherAES256 PEMCipher
-pkg crypto/x509, const PEMCipherDES PEMCipher
-pkg crypto/x509, func DecryptPEMBlock(*pem.Block, []uint8) ([]uint8, error)
-pkg crypto/x509, func EncryptPEMBlock(io.Reader, string, []uint8, []uint8, PEMCipher) (*pem.Block, error)
-pkg crypto/x509, func IsEncryptedPEMBlock(*pem.Block) bool
-pkg crypto/x509, func ParseECPrivateKey([]uint8) (*ecdsa.PrivateKey, error)
-pkg crypto/x509, method (SystemRootsError) Error() string
-pkg crypto/x509, type Certificate struct, IPAddresses []net.IP
-pkg crypto/x509, type PEMCipher int
-pkg crypto/x509, type SystemRootsError struct
-pkg crypto/x509, type VerifyOptions struct, KeyUsages []ExtKeyUsage
-pkg crypto/x509, var IncorrectPasswordError error
-pkg database/sql, method (*DB) Ping() error
-pkg database/sql, method (*DB) SetMaxIdleConns(int)
-pkg database/sql/driver, type Queryer interface { Query }
-pkg database/sql/driver, type Queryer interface, Query(string, []Value) (Rows, error)
-pkg debug/elf, method (*File) DynString(DynTag) ([]string, error)
-pkg debug/elf, type FileHeader struct, Entry uint64
-pkg debug/pe, const COFFSymbolSize ideal-int
-pkg debug/pe, type COFFSymbol struct
-pkg debug/pe, type COFFSymbol struct, Name [8]uint8
-pkg debug/pe, type COFFSymbol struct, NumberOfAuxSymbols uint8
-pkg debug/pe, type COFFSymbol struct, SectionNumber int16
-pkg debug/pe, type COFFSymbol struct, StorageClass uint8
-pkg debug/pe, type COFFSymbol struct, Type uint16
-pkg debug/pe, type COFFSymbol struct, Value uint32
-pkg debug/pe, type File struct, Symbols []*Symbol
-pkg debug/pe, type Symbol struct
-pkg debug/pe, type Symbol struct, Name string
-pkg debug/pe, type Symbol struct, SectionNumber int16
-pkg debug/pe, type Symbol struct, StorageClass uint8
-pkg debug/pe, type Symbol struct, Type uint16
-pkg debug/pe, type Symbol struct, Value uint32
-pkg encoding/csv, method (*Writer) Error() error
-pkg encoding/json, method (*Decoder) Buffered() io.Reader
-pkg encoding/json, method (*Decoder) UseNumber()
-pkg encoding/json, method (Number) Float64() (float64, error)
-pkg encoding/json, method (Number) Int64() (int64, error)
-pkg encoding/json, method (Number) String() string
-pkg encoding/json, type Number string
-pkg encoding/xml, func EscapeText(io.Writer, []uint8) error
-pkg encoding/xml, method (*Encoder) Indent(string, string)
-pkg encoding/xml, type Decoder struct, DefaultSpace string
-pkg go/ast, func NewCommentMap(*token.FileSet, Node, []*CommentGroup) CommentMap
-pkg go/ast, method (CommentMap) Comments() []*CommentGroup
-pkg go/ast, method (CommentMap) Filter(Node) CommentMap
-pkg go/ast, method (CommentMap) String() string
-pkg go/ast, method (CommentMap) Update(Node, Node) Node
-pkg go/ast, type ChanType struct, Arrow token.Pos
-pkg go/ast, type CommentMap map[Node][]*CommentGroup
-pkg go/build, type Context struct, InstallSuffix string
-pkg go/build, type Context struct, ReleaseTags []string
-pkg go/build, type Package struct, IgnoredGoFiles []string
-pkg go/build, type Package struct, SwigCXXFiles []string
-pkg go/build, type Package struct, SwigFiles []string
-pkg go/doc, type Example struct, EmptyOutput bool
-pkg go/doc, type Example struct, Order int
-pkg go/doc, type Example struct, Play *ast.File
-pkg go/doc, type Note struct
-pkg go/doc, type Note struct, Body string
-pkg go/doc, type Note struct, End token.Pos
-pkg go/doc, type Note struct, Pos token.Pos
-pkg go/doc, type Note struct, UID string
-pkg go/doc, type Package struct, Notes map[string][]*Note
-pkg go/doc, var IllegalPrefixes []string
-pkg go/format, func Node(io.Writer, *token.FileSet, interface{}) error
-pkg go/format, func Source([]uint8) ([]uint8, error)
-pkg go/parser, const AllErrors Mode
-pkg go/printer, type Config struct, Indent int
-pkg image, const YCbCrSubsampleRatio440 YCbCrSubsampleRatio
-pkg io, type ByteWriter interface { WriteByte }
-pkg io, type ByteWriter interface, WriteByte(uint8) error
-pkg log/syslog (darwin-386), const LOG_AUTH Priority
-pkg log/syslog (darwin-386), const LOG_AUTHPRIV Priority
-pkg log/syslog (darwin-386), const LOG_CRON Priority
-pkg log/syslog (darwin-386), const LOG_DAEMON Priority
-pkg log/syslog (darwin-386), const LOG_FTP Priority
-pkg log/syslog (darwin-386), const LOG_KERN Priority
-pkg log/syslog (darwin-386), const LOG_LOCAL0 Priority
-pkg log/syslog (darwin-386), const LOG_LOCAL1 Priority
-pkg log/syslog (darwin-386), const LOG_LOCAL2 Priority
-pkg log/syslog (darwin-386), const LOG_LOCAL3 Priority
-pkg log/syslog (darwin-386), const LOG_LOCAL4 Priority
-pkg log/syslog (darwin-386), const LOG_LOCAL5 Priority
-pkg log/syslog (darwin-386), const LOG_LOCAL6 Priority
-pkg log/syslog (darwin-386), const LOG_LOCAL7 Priority
-pkg log/syslog (darwin-386), const LOG_LPR Priority
-pkg log/syslog (darwin-386), const LOG_MAIL Priority
-pkg log/syslog (darwin-386), const LOG_NEWS Priority
-pkg log/syslog (darwin-386), const LOG_SYSLOG Priority
-pkg log/syslog (darwin-386), const LOG_USER Priority
-pkg log/syslog (darwin-386), const LOG_UUCP Priority
-pkg log/syslog (darwin-386-cgo), const LOG_AUTH Priority
-pkg log/syslog (darwin-386-cgo), const LOG_AUTHPRIV Priority
-pkg log/syslog (darwin-386-cgo), const LOG_CRON Priority
-pkg log/syslog (darwin-386-cgo), const LOG_DAEMON Priority
-pkg log/syslog (darwin-386-cgo), const LOG_FTP Priority
-pkg log/syslog (darwin-386-cgo), const LOG_KERN Priority
-pkg log/syslog (darwin-386-cgo), const LOG_LOCAL0 Priority
-pkg log/syslog (darwin-386-cgo), const LOG_LOCAL1 Priority
-pkg log/syslog (darwin-386-cgo), const LOG_LOCAL2 Priority
-pkg log/syslog (darwin-386-cgo), const LOG_LOCAL3 Priority
-pkg log/syslog (darwin-386-cgo), const LOG_LOCAL4 Priority
-pkg log/syslog (darwin-386-cgo), const LOG_LOCAL5 Priority
-pkg log/syslog (darwin-386-cgo), const LOG_LOCAL6 Priority
-pkg log/syslog (darwin-386-cgo), const LOG_LOCAL7 Priority
-pkg log/syslog (darwin-386-cgo), const LOG_LPR Priority
-pkg log/syslog (darwin-386-cgo), const LOG_MAIL Priority
-pkg log/syslog (darwin-386-cgo), const LOG_NEWS Priority
-pkg log/syslog (darwin-386-cgo), const LOG_SYSLOG Priority
-pkg log/syslog (darwin-386-cgo), const LOG_USER Priority
-pkg log/syslog (darwin-386-cgo), const LOG_UUCP Priority
-pkg log/syslog (darwin-amd64), const LOG_AUTH Priority
-pkg log/syslog (darwin-amd64), const LOG_AUTHPRIV Priority
-pkg log/syslog (darwin-amd64), const LOG_CRON Priority
-pkg log/syslog (darwin-amd64), const LOG_DAEMON Priority
-pkg log/syslog (darwin-amd64), const LOG_FTP Priority
-pkg log/syslog (darwin-amd64), const LOG_KERN Priority
-pkg log/syslog (darwin-amd64), const LOG_LOCAL0 Priority
-pkg log/syslog (darwin-amd64), const LOG_LOCAL1 Priority
-pkg log/syslog (darwin-amd64), const LOG_LOCAL2 Priority
-pkg log/syslog (darwin-amd64), const LOG_LOCAL3 Priority
-pkg log/syslog (darwin-amd64), const LOG_LOCAL4 Priority
-pkg log/syslog (darwin-amd64), const LOG_LOCAL5 Priority
-pkg log/syslog (darwin-amd64), const LOG_LOCAL6 Priority
-pkg log/syslog (darwin-amd64), const LOG_LOCAL7 Priority
-pkg log/syslog (darwin-amd64), const LOG_LPR Priority
-pkg log/syslog (darwin-amd64), const LOG_MAIL Priority
-pkg log/syslog (darwin-amd64), const LOG_NEWS Priority
-pkg log/syslog (darwin-amd64), const LOG_SYSLOG Priority
-pkg log/syslog (darwin-amd64), const LOG_USER Priority
-pkg log/syslog (darwin-amd64), const LOG_UUCP Priority
-pkg log/syslog (darwin-amd64-cgo), const LOG_AUTH Priority
-pkg log/syslog (darwin-amd64-cgo), const LOG_AUTHPRIV Priority
-pkg log/syslog (darwin-amd64-cgo), const LOG_CRON Priority
-pkg log/syslog (darwin-amd64-cgo), const LOG_DAEMON Priority
-pkg log/syslog (darwin-amd64-cgo), const LOG_FTP Priority
-pkg log/syslog (darwin-amd64-cgo), const LOG_KERN Priority
-pkg log/syslog (darwin-amd64-cgo), const LOG_LOCAL0 Priority
-pkg log/syslog (darwin-amd64-cgo), const LOG_LOCAL1 Priority
-pkg log/syslog (darwin-amd64-cgo), const LOG_LOCAL2 Priority
-pkg log/syslog (darwin-amd64-cgo), const LOG_LOCAL3 Priority
-pkg log/syslog (darwin-amd64-cgo), const LOG_LOCAL4 Priority
-pkg log/syslog (darwin-amd64-cgo), const LOG_LOCAL5 Priority
-pkg log/syslog (darwin-amd64-cgo), const LOG_LOCAL6 Priority
-pkg log/syslog (darwin-amd64-cgo), const LOG_LOCAL7 Priority
-pkg log/syslog (darwin-amd64-cgo), const LOG_LPR Priority
-pkg log/syslog (darwin-amd64-cgo), const LOG_MAIL Priority
-pkg log/syslog (darwin-amd64-cgo), const LOG_NEWS Priority
-pkg log/syslog (darwin-amd64-cgo), const LOG_SYSLOG Priority
-pkg log/syslog (darwin-amd64-cgo), const LOG_USER Priority
-pkg log/syslog (darwin-amd64-cgo), const LOG_UUCP Priority
-pkg log/syslog (freebsd-386), const LOG_AUTH Priority
-pkg log/syslog (freebsd-386), const LOG_AUTHPRIV Priority
-pkg log/syslog (freebsd-386), const LOG_CRON Priority
-pkg log/syslog (freebsd-386), const LOG_DAEMON Priority
-pkg log/syslog (freebsd-386), const LOG_FTP Priority
-pkg log/syslog (freebsd-386), const LOG_KERN Priority
-pkg log/syslog (freebsd-386), const LOG_LOCAL0 Priority
-pkg log/syslog (freebsd-386), const LOG_LOCAL1 Priority
-pkg log/syslog (freebsd-386), const LOG_LOCAL2 Priority
-pkg log/syslog (freebsd-386), const LOG_LOCAL3 Priority
-pkg log/syslog (freebsd-386), const LOG_LOCAL4 Priority
-pkg log/syslog (freebsd-386), const LOG_LOCAL5 Priority
-pkg log/syslog (freebsd-386), const LOG_LOCAL6 Priority
-pkg log/syslog (freebsd-386), const LOG_LOCAL7 Priority
-pkg log/syslog (freebsd-386), const LOG_LPR Priority
-pkg log/syslog (freebsd-386), const LOG_MAIL Priority
-pkg log/syslog (freebsd-386), const LOG_NEWS Priority
-pkg log/syslog (freebsd-386), const LOG_SYSLOG Priority
-pkg log/syslog (freebsd-386), const LOG_USER Priority
-pkg log/syslog (freebsd-386), const LOG_UUCP Priority
-pkg log/syslog (freebsd-amd64), const LOG_AUTH Priority
-pkg log/syslog (freebsd-amd64), const LOG_AUTHPRIV Priority
-pkg log/syslog (freebsd-amd64), const LOG_CRON Priority
-pkg log/syslog (freebsd-amd64), const LOG_DAEMON Priority
-pkg log/syslog (freebsd-amd64), const LOG_FTP Priority
-pkg log/syslog (freebsd-amd64), const LOG_KERN Priority
-pkg log/syslog (freebsd-amd64), const LOG_LOCAL0 Priority
-pkg log/syslog (freebsd-amd64), const LOG_LOCAL1 Priority
-pkg log/syslog (freebsd-amd64), const LOG_LOCAL2 Priority
-pkg log/syslog (freebsd-amd64), const LOG_LOCAL3 Priority
-pkg log/syslog (freebsd-amd64), const LOG_LOCAL4 Priority
-pkg log/syslog (freebsd-amd64), const LOG_LOCAL5 Priority
-pkg log/syslog (freebsd-amd64), const LOG_LOCAL6 Priority
-pkg log/syslog (freebsd-amd64), const LOG_LOCAL7 Priority
-pkg log/syslog (freebsd-amd64), const LOG_LPR Priority
-pkg log/syslog (freebsd-amd64), const LOG_MAIL Priority
-pkg log/syslog (freebsd-amd64), const LOG_NEWS Priority
-pkg log/syslog (freebsd-amd64), const LOG_SYSLOG Priority
-pkg log/syslog (freebsd-amd64), const LOG_USER Priority
-pkg log/syslog (freebsd-amd64), const LOG_UUCP Priority
-pkg log/syslog (linux-386), const LOG_AUTH Priority
-pkg log/syslog (linux-386), const LOG_AUTHPRIV Priority
-pkg log/syslog (linux-386), const LOG_CRON Priority
-pkg log/syslog (linux-386), const LOG_DAEMON Priority
-pkg log/syslog (linux-386), const LOG_FTP Priority
-pkg log/syslog (linux-386), const LOG_KERN Priority
-pkg log/syslog (linux-386), const LOG_LOCAL0 Priority
-pkg log/syslog (linux-386), const LOG_LOCAL1 Priority
-pkg log/syslog (linux-386), const LOG_LOCAL2 Priority
-pkg log/syslog (linux-386), const LOG_LOCAL3 Priority
-pkg log/syslog (linux-386), const LOG_LOCAL4 Priority
-pkg log/syslog (linux-386), const LOG_LOCAL5 Priority
-pkg log/syslog (linux-386), const LOG_LOCAL6 Priority
-pkg log/syslog (linux-386), const LOG_LOCAL7 Priority
-pkg log/syslog (linux-386), const LOG_LPR Priority
-pkg log/syslog (linux-386), const LOG_MAIL Priority
-pkg log/syslog (linux-386), const LOG_NEWS Priority
-pkg log/syslog (linux-386), const LOG_SYSLOG Priority
-pkg log/syslog (linux-386), const LOG_USER Priority
-pkg log/syslog (linux-386), const LOG_UUCP Priority
-pkg log/syslog (linux-386-cgo), const LOG_AUTH Priority
-pkg log/syslog (linux-386-cgo), const LOG_AUTHPRIV Priority
-pkg log/syslog (linux-386-cgo), const LOG_CRON Priority
-pkg log/syslog (linux-386-cgo), const LOG_DAEMON Priority
-pkg log/syslog (linux-386-cgo), const LOG_FTP Priority
-pkg log/syslog (linux-386-cgo), const LOG_KERN Priority
-pkg log/syslog (linux-386-cgo), const LOG_LOCAL0 Priority
-pkg log/syslog (linux-386-cgo), const LOG_LOCAL1 Priority
-pkg log/syslog (linux-386-cgo), const LOG_LOCAL2 Priority
-pkg log/syslog (linux-386-cgo), const LOG_LOCAL3 Priority
-pkg log/syslog (linux-386-cgo), const LOG_LOCAL4 Priority
-pkg log/syslog (linux-386-cgo), const LOG_LOCAL5 Priority
-pkg log/syslog (linux-386-cgo), const LOG_LOCAL6 Priority
-pkg log/syslog (linux-386-cgo), const LOG_LOCAL7 Priority
-pkg log/syslog (linux-386-cgo), const LOG_LPR Priority
-pkg log/syslog (linux-386-cgo), const LOG_MAIL Priority
-pkg log/syslog (linux-386-cgo), const LOG_NEWS Priority
-pkg log/syslog (linux-386-cgo), const LOG_SYSLOG Priority
-pkg log/syslog (linux-386-cgo), const LOG_USER Priority
-pkg log/syslog (linux-386-cgo), const LOG_UUCP Priority
-pkg log/syslog (linux-amd64), const LOG_AUTH Priority
-pkg log/syslog (linux-amd64), const LOG_AUTHPRIV Priority
-pkg log/syslog (linux-amd64), const LOG_CRON Priority
-pkg log/syslog (linux-amd64), const LOG_DAEMON Priority
-pkg log/syslog (linux-amd64), const LOG_FTP Priority
-pkg log/syslog (linux-amd64), const LOG_KERN Priority
-pkg log/syslog (linux-amd64), const LOG_LOCAL0 Priority
-pkg log/syslog (linux-amd64), const LOG_LOCAL1 Priority
-pkg log/syslog (linux-amd64), const LOG_LOCAL2 Priority
-pkg log/syslog (linux-amd64), const LOG_LOCAL3 Priority
-pkg log/syslog (linux-amd64), const LOG_LOCAL4 Priority
-pkg log/syslog (linux-amd64), const LOG_LOCAL5 Priority
-pkg log/syslog (linux-amd64), const LOG_LOCAL6 Priority
-pkg log/syslog (linux-amd64), const LOG_LOCAL7 Priority
-pkg log/syslog (linux-amd64), const LOG_LPR Priority
-pkg log/syslog (linux-amd64), const LOG_MAIL Priority
-pkg log/syslog (linux-amd64), const LOG_NEWS Priority
-pkg log/syslog (linux-amd64), const LOG_SYSLOG Priority
-pkg log/syslog (linux-amd64), const LOG_USER Priority
-pkg log/syslog (linux-amd64), const LOG_UUCP Priority
-pkg log/syslog (linux-amd64-cgo), const LOG_AUTH Priority
-pkg log/syslog (linux-amd64-cgo), const LOG_AUTHPRIV Priority
-pkg log/syslog (linux-amd64-cgo), const LOG_CRON Priority
-pkg log/syslog (linux-amd64-cgo), const LOG_DAEMON Priority
-pkg log/syslog (linux-amd64-cgo), const LOG_FTP Priority
-pkg log/syslog (linux-amd64-cgo), const LOG_KERN Priority
-pkg log/syslog (linux-amd64-cgo), const LOG_LOCAL0 Priority
-pkg log/syslog (linux-amd64-cgo), const LOG_LOCAL1 Priority
-pkg log/syslog (linux-amd64-cgo), const LOG_LOCAL2 Priority
-pkg log/syslog (linux-amd64-cgo), const LOG_LOCAL3 Priority
-pkg log/syslog (linux-amd64-cgo), const LOG_LOCAL4 Priority
-pkg log/syslog (linux-amd64-cgo), const LOG_LOCAL5 Priority
-pkg log/syslog (linux-amd64-cgo), const LOG_LOCAL6 Priority
-pkg log/syslog (linux-amd64-cgo), const LOG_LOCAL7 Priority
-pkg log/syslog (linux-amd64-cgo), const LOG_LPR Priority
-pkg log/syslog (linux-amd64-cgo), const LOG_MAIL Priority
-pkg log/syslog (linux-amd64-cgo), const LOG_NEWS Priority
-pkg log/syslog (linux-amd64-cgo), const LOG_SYSLOG Priority
-pkg log/syslog (linux-amd64-cgo), const LOG_USER Priority
-pkg log/syslog (linux-amd64-cgo), const LOG_UUCP Priority
-pkg log/syslog (linux-arm), const LOG_AUTH Priority
-pkg log/syslog (linux-arm), const LOG_AUTHPRIV Priority
-pkg log/syslog (linux-arm), const LOG_CRON Priority
-pkg log/syslog (linux-arm), const LOG_DAEMON Priority
-pkg log/syslog (linux-arm), const LOG_FTP Priority
-pkg log/syslog (linux-arm), const LOG_KERN Priority
-pkg log/syslog (linux-arm), const LOG_LOCAL0 Priority
-pkg log/syslog (linux-arm), const LOG_LOCAL1 Priority
-pkg log/syslog (linux-arm), const LOG_LOCAL2 Priority
-pkg log/syslog (linux-arm), const LOG_LOCAL3 Priority
-pkg log/syslog (linux-arm), const LOG_LOCAL4 Priority
-pkg log/syslog (linux-arm), const LOG_LOCAL5 Priority
-pkg log/syslog (linux-arm), const LOG_LOCAL6 Priority
-pkg log/syslog (linux-arm), const LOG_LOCAL7 Priority
-pkg log/syslog (linux-arm), const LOG_LPR Priority
-pkg log/syslog (linux-arm), const LOG_MAIL Priority
-pkg log/syslog (linux-arm), const LOG_NEWS Priority
-pkg log/syslog (linux-arm), const LOG_SYSLOG Priority
-pkg log/syslog (linux-arm), const LOG_USER Priority
-pkg log/syslog (linux-arm), const LOG_UUCP Priority
-pkg math/big, method (*Int) MarshalJSON() ([]uint8, error)
-pkg math/big, method (*Int) SetUint64(uint64) *Int
-pkg math/big, method (*Int) Uint64() uint64
-pkg math/big, method (*Int) UnmarshalJSON([]uint8) error
-pkg math/big, method (*Rat) Float64() (float64, bool)
-pkg math/big, method (*Rat) SetFloat64(float64) *Rat
-pkg mime/multipart, method (*Writer) SetBoundary(string) error
-pkg net, func ListenUnixgram(string, *UnixAddr) (*UnixConn, error)
-pkg net, func LookupNS(string) ([]*NS, error)
-pkg net, method (*Dialer) Dial(string, string) (Conn, error)
-pkg net, method (*IPConn) ReadMsgIP([]uint8, []uint8) (int, int, int, *IPAddr, error)
-pkg net, method (*IPConn) WriteMsgIP([]uint8, []uint8, *IPAddr) (int, int, error)
-pkg net, method (*UDPConn) ReadMsgUDP([]uint8, []uint8) (int, int, int, *UDPAddr, error)
-pkg net, method (*UDPConn) WriteMsgUDP([]uint8, []uint8, *UDPAddr) (int, int, error)
-pkg net, method (*UnixConn) CloseRead() error
-pkg net, method (*UnixConn) CloseWrite() error
-pkg net, type Dialer struct
-pkg net, type Dialer struct, Deadline time.Time
-pkg net, type Dialer struct, LocalAddr Addr
-pkg net, type Dialer struct, Timeout time.Duration
-pkg net, type IPAddr struct, Zone string
-pkg net, type NS struct
-pkg net, type NS struct, Host string
-pkg net, type TCPAddr struct, Zone string
-pkg net, type UDPAddr struct, Zone string
-pkg net/http, func ParseTime(string) (time.Time, error)
-pkg net/http, method (*Request) PostFormValue(string) string
-pkg net/http, method (*ServeMux) Handler(*Request) (Handler, string)
-pkg net/http, method (*Transport) CancelRequest(*Request)
-pkg net/http, type CloseNotifier interface { CloseNotify }
-pkg net/http, type CloseNotifier interface, CloseNotify() <-chan bool
-pkg net/http, type Request struct, PostForm url.Values
-pkg net/http, type Server struct, TLSNextProto map[string]func(*Server, *tls.Conn, Handler)
-pkg net/http, type Transport struct, ResponseHeaderTimeout time.Duration
-pkg net/http/cookiejar, func New(*Options) (*Jar, error)
-pkg net/http/cookiejar, method (*Jar) Cookies(*url.URL) []*http.Cookie
-pkg net/http/cookiejar, method (*Jar) SetCookies(*url.URL, []*http.Cookie)
-pkg net/http/cookiejar, type Jar struct
-pkg net/http/cookiejar, type Options struct
-pkg net/http/cookiejar, type Options struct, PublicSuffixList PublicSuffixList
-pkg net/http/cookiejar, type PublicSuffixList interface { PublicSuffix, String }
-pkg net/http/cookiejar, type PublicSuffixList interface, PublicSuffix(string) string
-pkg net/http/cookiejar, type PublicSuffixList interface, String() string
-pkg net/mail, func ParseAddress(string) (*Address, error)
-pkg net/mail, func ParseAddressList(string) ([]*Address, error)
-pkg net/smtp, method (*Client) Hello(string) error
-pkg net/textproto, func TrimBytes([]uint8) []uint8
-pkg net/textproto, func TrimString(string) string
-pkg os, method (FileMode) IsRegular() bool
-pkg os/signal, func Stop(chan<- os.Signal)
-pkg reflect, const SelectDefault SelectDir
-pkg reflect, const SelectRecv SelectDir
-pkg reflect, const SelectSend SelectDir
-pkg reflect, func ChanOf(ChanDir, Type) Type
-pkg reflect, func MakeFunc(Type, func([]Value) []Value) Value
-pkg reflect, func MapOf(Type, Type) Type
-pkg reflect, func Select([]SelectCase) (int, Value, bool)
-pkg reflect, func SliceOf(Type) Type
-pkg reflect, method (Value) Convert(Type) Value
-pkg reflect, type SelectCase struct
-pkg reflect, type SelectCase struct, Chan Value
-pkg reflect, type SelectCase struct, Dir SelectDir
-pkg reflect, type SelectCase struct, Send Value
-pkg reflect, type SelectDir int
-pkg reflect, type Type interface, ConvertibleTo(Type) bool
-pkg regexp, method (*Regexp) Longest()
-pkg regexp, method (*Regexp) Split(string, int) []string
-pkg regexp/syntax, const ErrUnexpectedParen ErrorCode
-pkg runtime, func BlockProfile([]BlockProfileRecord) (int, bool)
-pkg runtime, func SetBlockProfileRate(int)
-pkg runtime, method (*BlockProfileRecord) Stack() []uintptr
-pkg runtime, type BlockProfileRecord struct
-pkg runtime, type BlockProfileRecord struct, Count int64
-pkg runtime, type BlockProfileRecord struct, Cycles int64
-pkg runtime, type BlockProfileRecord struct, embedded StackRecord
-pkg runtime/debug, func FreeOSMemory()
-pkg runtime/debug, func ReadGCStats(*GCStats)
-pkg runtime/debug, func SetGCPercent(int) int
-pkg runtime/debug, type GCStats struct
-pkg runtime/debug, type GCStats struct, LastGC time.Time
-pkg runtime/debug, type GCStats struct, NumGC int64
-pkg runtime/debug, type GCStats struct, Pause []time.Duration
-pkg runtime/debug, type GCStats struct, PauseQuantiles []time.Duration
-pkg runtime/debug, type GCStats struct, PauseTotal time.Duration
-pkg sort, func Reverse(Interface) Interface
-pkg strings, func TrimPrefix(string, string) string
-pkg strings, func TrimSuffix(string, string) string
-pkg strings, method (*Reader) WriteTo(io.Writer) (int64, error)
-pkg syscall (darwin-386), const B0 ideal-int
-pkg syscall (darwin-386), const B110 ideal-int
-pkg syscall (darwin-386), const B115200 ideal-int
-pkg syscall (darwin-386), const B1200 ideal-int
-pkg syscall (darwin-386), const B134 ideal-int
-pkg syscall (darwin-386), const B14400 ideal-int
-pkg syscall (darwin-386), const B150 ideal-int
-pkg syscall (darwin-386), const B1800 ideal-int
-pkg syscall (darwin-386), const B19200 ideal-int
-pkg syscall (darwin-386), const B200 ideal-int
-pkg syscall (darwin-386), const B230400 ideal-int
-pkg syscall (darwin-386), const B2400 ideal-int
-pkg syscall (darwin-386), const B28800 ideal-int
-pkg syscall (darwin-386), const B300 ideal-int
-pkg syscall (darwin-386), const B38400 ideal-int
-pkg syscall (darwin-386), const B4800 ideal-int
-pkg syscall (darwin-386), const B50 ideal-int
-pkg syscall (darwin-386), const B57600 ideal-int
-pkg syscall (darwin-386), const B600 ideal-int
-pkg syscall (darwin-386), const B7200 ideal-int
-pkg syscall (darwin-386), const B75 ideal-int
-pkg syscall (darwin-386), const B76800 ideal-int
-pkg syscall (darwin-386), const B9600 ideal-int
-pkg syscall (darwin-386), const BRKINT ideal-int
-pkg syscall (darwin-386), const CFLUSH ideal-int
-pkg syscall (darwin-386), const CLOCAL ideal-int
-pkg syscall (darwin-386), const CREAD ideal-int
-pkg syscall (darwin-386), const CS5 ideal-int
-pkg syscall (darwin-386), const CS6 ideal-int
-pkg syscall (darwin-386), const CS7 ideal-int
-pkg syscall (darwin-386), const CS8 ideal-int
-pkg syscall (darwin-386), const CSIZE ideal-int
-pkg syscall (darwin-386), const CSTART ideal-int
-pkg syscall (darwin-386), const CSTATUS ideal-int
-pkg syscall (darwin-386), const CSTOP ideal-int
-pkg syscall (darwin-386), const CSTOPB ideal-int
-pkg syscall (darwin-386), const CSUSP ideal-int
-pkg syscall (darwin-386), const FLUSHO ideal-int
-pkg syscall (darwin-386), const HUPCL ideal-int
-pkg syscall (darwin-386), const ICANON ideal-int
-pkg syscall (darwin-386), const ICRNL ideal-int
-pkg syscall (darwin-386), const IEXTEN ideal-int
-pkg syscall (darwin-386), const IGNBRK ideal-int
-pkg syscall (darwin-386), const IGNCR ideal-int
-pkg syscall (darwin-386), const IGNPAR ideal-int
-pkg syscall (darwin-386), const IMAXBEL ideal-int
-pkg syscall (darwin-386), const INLCR ideal-int
-pkg syscall (darwin-386), const INPCK ideal-int
-pkg syscall (darwin-386), const ISIG ideal-int
-pkg syscall (darwin-386), const ISTRIP ideal-int
-pkg syscall (darwin-386), const IUTF8 ideal-int
-pkg syscall (darwin-386), const IXANY ideal-int
-pkg syscall (darwin-386), const IXOFF ideal-int
-pkg syscall (darwin-386), const IXON ideal-int
-pkg syscall (darwin-386), const NOFLSH ideal-int
-pkg syscall (darwin-386), const OCRNL ideal-int
-pkg syscall (darwin-386), const OFDEL ideal-int
-pkg syscall (darwin-386), const OFILL ideal-int
-pkg syscall (darwin-386), const ONLCR ideal-int
-pkg syscall (darwin-386), const ONLRET ideal-int
-pkg syscall (darwin-386), const ONOCR ideal-int
-pkg syscall (darwin-386), const ONOEOT ideal-int
-pkg syscall (darwin-386), const OPOST ideal-int
-pkg syscall (darwin-386), const PARENB ideal-int
-pkg syscall (darwin-386), const PARMRK ideal-int
-pkg syscall (darwin-386), const PARODD ideal-int
-pkg syscall (darwin-386), const PENDIN ideal-int
-pkg syscall (darwin-386), const SizeofInet4Pktinfo ideal-int
-pkg syscall (darwin-386), const TCIFLUSH ideal-int
-pkg syscall (darwin-386), const TCIOFLUSH ideal-int
-pkg syscall (darwin-386), const TCOFLUSH ideal-int
-pkg syscall (darwin-386), const TCSAFLUSH ideal-int
-pkg syscall (darwin-386), const TOSTOP ideal-int
-pkg syscall (darwin-386), const VDISCARD ideal-int
-pkg syscall (darwin-386), const VDSUSP ideal-int
-pkg syscall (darwin-386), const VEOF ideal-int
-pkg syscall (darwin-386), const VEOL ideal-int
-pkg syscall (darwin-386), const VEOL2 ideal-int
-pkg syscall (darwin-386), const VERASE ideal-int
-pkg syscall (darwin-386), const VINTR ideal-int
-pkg syscall (darwin-386), const VKILL ideal-int
-pkg syscall (darwin-386), const VLNEXT ideal-int
-pkg syscall (darwin-386), const VMIN ideal-int
-pkg syscall (darwin-386), const VQUIT ideal-int
-pkg syscall (darwin-386), const VREPRINT ideal-int
-pkg syscall (darwin-386), const VSTART ideal-int
-pkg syscall (darwin-386), const VSTATUS ideal-int
-pkg syscall (darwin-386), const VSTOP ideal-int
-pkg syscall (darwin-386), const VSUSP ideal-int
-pkg syscall (darwin-386), const VT0 ideal-int
-pkg syscall (darwin-386), const VT1 ideal-int
-pkg syscall (darwin-386), const VTDLY ideal-int
-pkg syscall (darwin-386), const VTIME ideal-int
-pkg syscall (darwin-386), const VWERASE ideal-int
-pkg syscall (darwin-386), func SlicePtrFromStrings([]string) ([]*uint8, error)
-pkg syscall (darwin-386), type Inet4Pktinfo struct
-pkg syscall (darwin-386), type Inet4Pktinfo struct, Addr [4]uint8
-pkg syscall (darwin-386), type Inet4Pktinfo struct, Ifindex uint32
-pkg syscall (darwin-386), type Inet4Pktinfo struct, Spec_dst [4]uint8
-pkg syscall (darwin-386), type Termios struct
-pkg syscall (darwin-386), type Termios struct, Cc [20]uint8
-pkg syscall (darwin-386), type Termios struct, Cflag uint32
-pkg syscall (darwin-386), type Termios struct, Iflag uint32
-pkg syscall (darwin-386), type Termios struct, Ispeed uint32
-pkg syscall (darwin-386), type Termios struct, Lflag uint32
-pkg syscall (darwin-386), type Termios struct, Oflag uint32
-pkg syscall (darwin-386), type Termios struct, Ospeed uint32
-pkg syscall (darwin-386-cgo), const B0 ideal-int
-pkg syscall (darwin-386-cgo), const B110 ideal-int
-pkg syscall (darwin-386-cgo), const B115200 ideal-int
-pkg syscall (darwin-386-cgo), const B1200 ideal-int
-pkg syscall (darwin-386-cgo), const B134 ideal-int
-pkg syscall (darwin-386-cgo), const B14400 ideal-int
-pkg syscall (darwin-386-cgo), const B150 ideal-int
-pkg syscall (darwin-386-cgo), const B1800 ideal-int
-pkg syscall (darwin-386-cgo), const B19200 ideal-int
-pkg syscall (darwin-386-cgo), const B200 ideal-int
-pkg syscall (darwin-386-cgo), const B230400 ideal-int
-pkg syscall (darwin-386-cgo), const B2400 ideal-int
-pkg syscall (darwin-386-cgo), const B28800 ideal-int
-pkg syscall (darwin-386-cgo), const B300 ideal-int
-pkg syscall (darwin-386-cgo), const B38400 ideal-int
-pkg syscall (darwin-386-cgo), const B4800 ideal-int
-pkg syscall (darwin-386-cgo), const B50 ideal-int
-pkg syscall (darwin-386-cgo), const B57600 ideal-int
-pkg syscall (darwin-386-cgo), const B600 ideal-int
-pkg syscall (darwin-386-cgo), const B7200 ideal-int
-pkg syscall (darwin-386-cgo), const B75 ideal-int
-pkg syscall (darwin-386-cgo), const B76800 ideal-int
-pkg syscall (darwin-386-cgo), const B9600 ideal-int
-pkg syscall (darwin-386-cgo), const BRKINT ideal-int
-pkg syscall (darwin-386-cgo), const CFLUSH ideal-int
-pkg syscall (darwin-386-cgo), const CLOCAL ideal-int
-pkg syscall (darwin-386-cgo), const CREAD ideal-int
-pkg syscall (darwin-386-cgo), const CS5 ideal-int
-pkg syscall (darwin-386-cgo), const CS6 ideal-int
-pkg syscall (darwin-386-cgo), const CS7 ideal-int
-pkg syscall (darwin-386-cgo), const CS8 ideal-int
-pkg syscall (darwin-386-cgo), const CSIZE ideal-int
-pkg syscall (darwin-386-cgo), const CSTART ideal-int
-pkg syscall (darwin-386-cgo), const CSTATUS ideal-int
-pkg syscall (darwin-386-cgo), const CSTOP ideal-int
-pkg syscall (darwin-386-cgo), const CSTOPB ideal-int
-pkg syscall (darwin-386-cgo), const CSUSP ideal-int
-pkg syscall (darwin-386-cgo), const FLUSHO ideal-int
-pkg syscall (darwin-386-cgo), const HUPCL ideal-int
-pkg syscall (darwin-386-cgo), const ICANON ideal-int
-pkg syscall (darwin-386-cgo), const ICRNL ideal-int
-pkg syscall (darwin-386-cgo), const IEXTEN ideal-int
-pkg syscall (darwin-386-cgo), const IGNBRK ideal-int
-pkg syscall (darwin-386-cgo), const IGNCR ideal-int
-pkg syscall (darwin-386-cgo), const IGNPAR ideal-int
-pkg syscall (darwin-386-cgo), const IMAXBEL ideal-int
-pkg syscall (darwin-386-cgo), const INLCR ideal-int
-pkg syscall (darwin-386-cgo), const INPCK ideal-int
-pkg syscall (darwin-386-cgo), const ISIG ideal-int
-pkg syscall (darwin-386-cgo), const ISTRIP ideal-int
-pkg syscall (darwin-386-cgo), const IUTF8 ideal-int
-pkg syscall (darwin-386-cgo), const IXANY ideal-int
-pkg syscall (darwin-386-cgo), const IXOFF ideal-int
-pkg syscall (darwin-386-cgo), const IXON ideal-int
-pkg syscall (darwin-386-cgo), const NOFLSH ideal-int
-pkg syscall (darwin-386-cgo), const OCRNL ideal-int
-pkg syscall (darwin-386-cgo), const OFDEL ideal-int
-pkg syscall (darwin-386-cgo), const OFILL ideal-int
-pkg syscall (darwin-386-cgo), const ONLCR ideal-int
-pkg syscall (darwin-386-cgo), const ONLRET ideal-int
-pkg syscall (darwin-386-cgo), const ONOCR ideal-int
-pkg syscall (darwin-386-cgo), const ONOEOT ideal-int
-pkg syscall (darwin-386-cgo), const OPOST ideal-int
-pkg syscall (darwin-386-cgo), const PARENB ideal-int
-pkg syscall (darwin-386-cgo), const PARMRK ideal-int
-pkg syscall (darwin-386-cgo), const PARODD ideal-int
-pkg syscall (darwin-386-cgo), const PENDIN ideal-int
-pkg syscall (darwin-386-cgo), const SizeofInet4Pktinfo ideal-int
-pkg syscall (darwin-386-cgo), const TCIFLUSH ideal-int
-pkg syscall (darwin-386-cgo), const TCIOFLUSH ideal-int
-pkg syscall (darwin-386-cgo), const TCOFLUSH ideal-int
-pkg syscall (darwin-386-cgo), const TCSAFLUSH ideal-int
-pkg syscall (darwin-386-cgo), const TOSTOP ideal-int
-pkg syscall (darwin-386-cgo), const VDISCARD ideal-int
-pkg syscall (darwin-386-cgo), const VDSUSP ideal-int
-pkg syscall (darwin-386-cgo), const VEOF ideal-int
-pkg syscall (darwin-386-cgo), const VEOL ideal-int
-pkg syscall (darwin-386-cgo), const VEOL2 ideal-int
-pkg syscall (darwin-386-cgo), const VERASE ideal-int
-pkg syscall (darwin-386-cgo), const VINTR ideal-int
-pkg syscall (darwin-386-cgo), const VKILL ideal-int
-pkg syscall (darwin-386-cgo), const VLNEXT ideal-int
-pkg syscall (darwin-386-cgo), const VMIN ideal-int
-pkg syscall (darwin-386-cgo), const VQUIT ideal-int
-pkg syscall (darwin-386-cgo), const VREPRINT ideal-int
-pkg syscall (darwin-386-cgo), const VSTART ideal-int
-pkg syscall (darwin-386-cgo), const VSTATUS ideal-int
-pkg syscall (darwin-386-cgo), const VSTOP ideal-int
-pkg syscall (darwin-386-cgo), const VSUSP ideal-int
-pkg syscall (darwin-386-cgo), const VT0 ideal-int
-pkg syscall (darwin-386-cgo), const VT1 ideal-int
-pkg syscall (darwin-386-cgo), const VTDLY ideal-int
-pkg syscall (darwin-386-cgo), const VTIME ideal-int
-pkg syscall (darwin-386-cgo), const VWERASE ideal-int
-pkg syscall (darwin-386-cgo), func SlicePtrFromStrings([]string) ([]*uint8, error)
-pkg syscall (darwin-386-cgo), type Inet4Pktinfo struct
-pkg syscall (darwin-386-cgo), type Inet4Pktinfo struct, Addr [4]uint8
-pkg syscall (darwin-386-cgo), type Inet4Pktinfo struct, Ifindex uint32
-pkg syscall (darwin-386-cgo), type Inet4Pktinfo struct, Spec_dst [4]uint8
-pkg syscall (darwin-386-cgo), type Termios struct
-pkg syscall (darwin-386-cgo), type Termios struct, Cc [20]uint8
-pkg syscall (darwin-386-cgo), type Termios struct, Cflag uint32
-pkg syscall (darwin-386-cgo), type Termios struct, Iflag uint32
-pkg syscall (darwin-386-cgo), type Termios struct, Ispeed uint32
-pkg syscall (darwin-386-cgo), type Termios struct, Lflag uint32
-pkg syscall (darwin-386-cgo), type Termios struct, Oflag uint32
-pkg syscall (darwin-386-cgo), type Termios struct, Ospeed uint32
-pkg syscall (darwin-amd64), const B0 ideal-int
-pkg syscall (darwin-amd64), const B110 ideal-int
-pkg syscall (darwin-amd64), const B115200 ideal-int
-pkg syscall (darwin-amd64), const B1200 ideal-int
-pkg syscall (darwin-amd64), const B134 ideal-int
-pkg syscall (darwin-amd64), const B14400 ideal-int
-pkg syscall (darwin-amd64), const B150 ideal-int
-pkg syscall (darwin-amd64), const B1800 ideal-int
-pkg syscall (darwin-amd64), const B19200 ideal-int
-pkg syscall (darwin-amd64), const B200 ideal-int
-pkg syscall (darwin-amd64), const B230400 ideal-int
-pkg syscall (darwin-amd64), const B2400 ideal-int
-pkg syscall (darwin-amd64), const B28800 ideal-int
-pkg syscall (darwin-amd64), const B300 ideal-int
-pkg syscall (darwin-amd64), const B38400 ideal-int
-pkg syscall (darwin-amd64), const B4800 ideal-int
-pkg syscall (darwin-amd64), const B50 ideal-int
-pkg syscall (darwin-amd64), const B57600 ideal-int
-pkg syscall (darwin-amd64), const B600 ideal-int
-pkg syscall (darwin-amd64), const B7200 ideal-int
-pkg syscall (darwin-amd64), const B75 ideal-int
-pkg syscall (darwin-amd64), const B76800 ideal-int
-pkg syscall (darwin-amd64), const B9600 ideal-int
-pkg syscall (darwin-amd64), const BRKINT ideal-int
-pkg syscall (darwin-amd64), const CFLUSH ideal-int
-pkg syscall (darwin-amd64), const CLOCAL ideal-int
-pkg syscall (darwin-amd64), const CREAD ideal-int
-pkg syscall (darwin-amd64), const CS5 ideal-int
-pkg syscall (darwin-amd64), const CS6 ideal-int
-pkg syscall (darwin-amd64), const CS7 ideal-int
-pkg syscall (darwin-amd64), const CS8 ideal-int
-pkg syscall (darwin-amd64), const CSIZE ideal-int
-pkg syscall (darwin-amd64), const CSTART ideal-int
-pkg syscall (darwin-amd64), const CSTATUS ideal-int
-pkg syscall (darwin-amd64), const CSTOP ideal-int
-pkg syscall (darwin-amd64), const CSTOPB ideal-int
-pkg syscall (darwin-amd64), const CSUSP ideal-int
-pkg syscall (darwin-amd64), const FLUSHO ideal-int
-pkg syscall (darwin-amd64), const HUPCL ideal-int
-pkg syscall (darwin-amd64), const ICANON ideal-int
-pkg syscall (darwin-amd64), const ICRNL ideal-int
-pkg syscall (darwin-amd64), const IEXTEN ideal-int
-pkg syscall (darwin-amd64), const IGNBRK ideal-int
-pkg syscall (darwin-amd64), const IGNCR ideal-int
-pkg syscall (darwin-amd64), const IGNPAR ideal-int
-pkg syscall (darwin-amd64), const IMAXBEL ideal-int
-pkg syscall (darwin-amd64), const INLCR ideal-int
-pkg syscall (darwin-amd64), const INPCK ideal-int
-pkg syscall (darwin-amd64), const ISIG ideal-int
-pkg syscall (darwin-amd64), const ISTRIP ideal-int
-pkg syscall (darwin-amd64), const IUTF8 ideal-int
-pkg syscall (darwin-amd64), const IXANY ideal-int
-pkg syscall (darwin-amd64), const IXOFF ideal-int
-pkg syscall (darwin-amd64), const IXON ideal-int
-pkg syscall (darwin-amd64), const NOFLSH ideal-int
-pkg syscall (darwin-amd64), const OCRNL ideal-int
-pkg syscall (darwin-amd64), const OFDEL ideal-int
-pkg syscall (darwin-amd64), const OFILL ideal-int
-pkg syscall (darwin-amd64), const ONLCR ideal-int
-pkg syscall (darwin-amd64), const ONLRET ideal-int
-pkg syscall (darwin-amd64), const ONOCR ideal-int
-pkg syscall (darwin-amd64), const ONOEOT ideal-int
-pkg syscall (darwin-amd64), const OPOST ideal-int
-pkg syscall (darwin-amd64), const PARENB ideal-int
-pkg syscall (darwin-amd64), const PARMRK ideal-int
-pkg syscall (darwin-amd64), const PARODD ideal-int
-pkg syscall (darwin-amd64), const PENDIN ideal-int
-pkg syscall (darwin-amd64), const SizeofInet4Pktinfo ideal-int
-pkg syscall (darwin-amd64), const TCIFLUSH ideal-int
-pkg syscall (darwin-amd64), const TCIOFLUSH ideal-int
-pkg syscall (darwin-amd64), const TCOFLUSH ideal-int
-pkg syscall (darwin-amd64), const TCSAFLUSH ideal-int
-pkg syscall (darwin-amd64), const TOSTOP ideal-int
-pkg syscall (darwin-amd64), const VDISCARD ideal-int
-pkg syscall (darwin-amd64), const VDSUSP ideal-int
-pkg syscall (darwin-amd64), const VEOF ideal-int
-pkg syscall (darwin-amd64), const VEOL ideal-int
-pkg syscall (darwin-amd64), const VEOL2 ideal-int
-pkg syscall (darwin-amd64), const VERASE ideal-int
-pkg syscall (darwin-amd64), const VINTR ideal-int
-pkg syscall (darwin-amd64), const VKILL ideal-int
-pkg syscall (darwin-amd64), const VLNEXT ideal-int
-pkg syscall (darwin-amd64), const VMIN ideal-int
-pkg syscall (darwin-amd64), const VQUIT ideal-int
-pkg syscall (darwin-amd64), const VREPRINT ideal-int
-pkg syscall (darwin-amd64), const VSTART ideal-int
-pkg syscall (darwin-amd64), const VSTATUS ideal-int
-pkg syscall (darwin-amd64), const VSTOP ideal-int
-pkg syscall (darwin-amd64), const VSUSP ideal-int
-pkg syscall (darwin-amd64), const VT0 ideal-int
-pkg syscall (darwin-amd64), const VT1 ideal-int
-pkg syscall (darwin-amd64), const VTDLY ideal-int
-pkg syscall (darwin-amd64), const VTIME ideal-int
-pkg syscall (darwin-amd64), const VWERASE ideal-int
-pkg syscall (darwin-amd64), func SlicePtrFromStrings([]string) ([]*uint8, error)
-pkg syscall (darwin-amd64), type Inet4Pktinfo struct
-pkg syscall (darwin-amd64), type Inet4Pktinfo struct, Addr [4]uint8
-pkg syscall (darwin-amd64), type Inet4Pktinfo struct, Ifindex uint32
-pkg syscall (darwin-amd64), type Inet4Pktinfo struct, Spec_dst [4]uint8
-pkg syscall (darwin-amd64), type Termios struct
-pkg syscall (darwin-amd64), type Termios struct, Cc [20]uint8
-pkg syscall (darwin-amd64), type Termios struct, Cflag uint64
-pkg syscall (darwin-amd64), type Termios struct, Iflag uint64
-pkg syscall (darwin-amd64), type Termios struct, Ispeed uint64
-pkg syscall (darwin-amd64), type Termios struct, Lflag uint64
-pkg syscall (darwin-amd64), type Termios struct, Oflag uint64
-pkg syscall (darwin-amd64), type Termios struct, Ospeed uint64
-pkg syscall (darwin-amd64), type Termios struct, Pad_cgo_0 [4]uint8
-pkg syscall (darwin-amd64-cgo), const B0 ideal-int
-pkg syscall (darwin-amd64-cgo), const B110 ideal-int
-pkg syscall (darwin-amd64-cgo), const B115200 ideal-int
-pkg syscall (darwin-amd64-cgo), const B1200 ideal-int
-pkg syscall (darwin-amd64-cgo), const B134 ideal-int
-pkg syscall (darwin-amd64-cgo), const B14400 ideal-int
-pkg syscall (darwin-amd64-cgo), const B150 ideal-int
-pkg syscall (darwin-amd64-cgo), const B1800 ideal-int
-pkg syscall (darwin-amd64-cgo), const B19200 ideal-int
-pkg syscall (darwin-amd64-cgo), const B200 ideal-int
-pkg syscall (darwin-amd64-cgo), const B230400 ideal-int
-pkg syscall (darwin-amd64-cgo), const B2400 ideal-int
-pkg syscall (darwin-amd64-cgo), const B28800 ideal-int
-pkg syscall (darwin-amd64-cgo), const B300 ideal-int
-pkg syscall (darwin-amd64-cgo), const B38400 ideal-int
-pkg syscall (darwin-amd64-cgo), const B4800 ideal-int
-pkg syscall (darwin-amd64-cgo), const B50 ideal-int
-pkg syscall (darwin-amd64-cgo), const B57600 ideal-int
-pkg syscall (darwin-amd64-cgo), const B600 ideal-int
-pkg syscall (darwin-amd64-cgo), const B7200 ideal-int
-pkg syscall (darwin-amd64-cgo), const B75 ideal-int
-pkg syscall (darwin-amd64-cgo), const B76800 ideal-int
-pkg syscall (darwin-amd64-cgo), const B9600 ideal-int
-pkg syscall (darwin-amd64-cgo), const BRKINT ideal-int
-pkg syscall (darwin-amd64-cgo), const CFLUSH ideal-int
-pkg syscall (darwin-amd64-cgo), const CLOCAL ideal-int
-pkg syscall (darwin-amd64-cgo), const CREAD ideal-int
-pkg syscall (darwin-amd64-cgo), const CS5 ideal-int
-pkg syscall (darwin-amd64-cgo), const CS6 ideal-int
-pkg syscall (darwin-amd64-cgo), const CS7 ideal-int
-pkg syscall (darwin-amd64-cgo), const CS8 ideal-int
-pkg syscall (darwin-amd64-cgo), const CSIZE ideal-int
-pkg syscall (darwin-amd64-cgo), const CSTART ideal-int
-pkg syscall (darwin-amd64-cgo), const CSTATUS ideal-int
-pkg syscall (darwin-amd64-cgo), const CSTOP ideal-int
-pkg syscall (darwin-amd64-cgo), const CSTOPB ideal-int
-pkg syscall (darwin-amd64-cgo), const CSUSP ideal-int
-pkg syscall (darwin-amd64-cgo), const FLUSHO ideal-int
-pkg syscall (darwin-amd64-cgo), const HUPCL ideal-int
-pkg syscall (darwin-amd64-cgo), const ICANON ideal-int
-pkg syscall (darwin-amd64-cgo), const ICRNL ideal-int
-pkg syscall (darwin-amd64-cgo), const IEXTEN ideal-int
-pkg syscall (darwin-amd64-cgo), const IGNBRK ideal-int
-pkg syscall (darwin-amd64-cgo), const IGNCR ideal-int
-pkg syscall (darwin-amd64-cgo), const IGNPAR ideal-int
-pkg syscall (darwin-amd64-cgo), const IMAXBEL ideal-int
-pkg syscall (darwin-amd64-cgo), const INLCR ideal-int
-pkg syscall (darwin-amd64-cgo), const INPCK ideal-int
-pkg syscall (darwin-amd64-cgo), const ISIG ideal-int
-pkg syscall (darwin-amd64-cgo), const ISTRIP ideal-int
-pkg syscall (darwin-amd64-cgo), const IUTF8 ideal-int
-pkg syscall (darwin-amd64-cgo), const IXANY ideal-int
-pkg syscall (darwin-amd64-cgo), const IXOFF ideal-int
-pkg syscall (darwin-amd64-cgo), const IXON ideal-int
-pkg syscall (darwin-amd64-cgo), const NOFLSH ideal-int
-pkg syscall (darwin-amd64-cgo), const OCRNL ideal-int
-pkg syscall (darwin-amd64-cgo), const OFDEL ideal-int
-pkg syscall (darwin-amd64-cgo), const OFILL ideal-int
-pkg syscall (darwin-amd64-cgo), const ONLCR ideal-int
-pkg syscall (darwin-amd64-cgo), const ONLRET ideal-int
-pkg syscall (darwin-amd64-cgo), const ONOCR ideal-int
-pkg syscall (darwin-amd64-cgo), const ONOEOT ideal-int
-pkg syscall (darwin-amd64-cgo), const OPOST ideal-int
-pkg syscall (darwin-amd64-cgo), const PARENB ideal-int
-pkg syscall (darwin-amd64-cgo), const PARMRK ideal-int
-pkg syscall (darwin-amd64-cgo), const PARODD ideal-int
-pkg syscall (darwin-amd64-cgo), const PENDIN ideal-int
-pkg syscall (darwin-amd64-cgo), const SizeofInet4Pktinfo ideal-int
-pkg syscall (darwin-amd64-cgo), const TCIFLUSH ideal-int
-pkg syscall (darwin-amd64-cgo), const TCIOFLUSH ideal-int
-pkg syscall (darwin-amd64-cgo), const TCOFLUSH ideal-int
-pkg syscall (darwin-amd64-cgo), const TCSAFLUSH ideal-int
-pkg syscall (darwin-amd64-cgo), const TOSTOP ideal-int
-pkg syscall (darwin-amd64-cgo), const VDISCARD ideal-int
-pkg syscall (darwin-amd64-cgo), const VDSUSP ideal-int
-pkg syscall (darwin-amd64-cgo), const VEOF ideal-int
-pkg syscall (darwin-amd64-cgo), const VEOL ideal-int
-pkg syscall (darwin-amd64-cgo), const VEOL2 ideal-int
-pkg syscall (darwin-amd64-cgo), const VERASE ideal-int
-pkg syscall (darwin-amd64-cgo), const VINTR ideal-int
-pkg syscall (darwin-amd64-cgo), const VKILL ideal-int
-pkg syscall (darwin-amd64-cgo), const VLNEXT ideal-int
-pkg syscall (darwin-amd64-cgo), const VMIN ideal-int
-pkg syscall (darwin-amd64-cgo), const VQUIT ideal-int
-pkg syscall (darwin-amd64-cgo), const VREPRINT ideal-int
-pkg syscall (darwin-amd64-cgo), const VSTART ideal-int
-pkg syscall (darwin-amd64-cgo), const VSTATUS ideal-int
-pkg syscall (darwin-amd64-cgo), const VSTOP ideal-int
-pkg syscall (darwin-amd64-cgo), const VSUSP ideal-int
-pkg syscall (darwin-amd64-cgo), const VT0 ideal-int
-pkg syscall (darwin-amd64-cgo), const VT1 ideal-int
-pkg syscall (darwin-amd64-cgo), const VTDLY ideal-int
-pkg syscall (darwin-amd64-cgo), const VTIME ideal-int
-pkg syscall (darwin-amd64-cgo), const VWERASE ideal-int
-pkg syscall (darwin-amd64-cgo), func SlicePtrFromStrings([]string) ([]*uint8, error)
-pkg syscall (darwin-amd64-cgo), type Inet4Pktinfo struct
-pkg syscall (darwin-amd64-cgo), type Inet4Pktinfo struct, Addr [4]uint8
-pkg syscall (darwin-amd64-cgo), type Inet4Pktinfo struct, Ifindex uint32
-pkg syscall (darwin-amd64-cgo), type Inet4Pktinfo struct, Spec_dst [4]uint8
-pkg syscall (darwin-amd64-cgo), type Termios struct
-pkg syscall (darwin-amd64-cgo), type Termios struct, Cc [20]uint8
-pkg syscall (darwin-amd64-cgo), type Termios struct, Cflag uint64
-pkg syscall (darwin-amd64-cgo), type Termios struct, Iflag uint64
-pkg syscall (darwin-amd64-cgo), type Termios struct, Ispeed uint64
-pkg syscall (darwin-amd64-cgo), type Termios struct, Lflag uint64
-pkg syscall (darwin-amd64-cgo), type Termios struct, Oflag uint64
-pkg syscall (darwin-amd64-cgo), type Termios struct, Ospeed uint64
-pkg syscall (darwin-amd64-cgo), type Termios struct, Pad_cgo_0 [4]uint8
-pkg syscall (freebsd-386), const B0 ideal-int
-pkg syscall (freebsd-386), const B110 ideal-int
-pkg syscall (freebsd-386), const B115200 ideal-int
-pkg syscall (freebsd-386), const B1200 ideal-int
-pkg syscall (freebsd-386), const B134 ideal-int
-pkg syscall (freebsd-386), const B14400 ideal-int
-pkg syscall (freebsd-386), const B150 ideal-int
-pkg syscall (freebsd-386), const B1800 ideal-int
-pkg syscall (freebsd-386), const B19200 ideal-int
-pkg syscall (freebsd-386), const B200 ideal-int
-pkg syscall (freebsd-386), const B230400 ideal-int
-pkg syscall (freebsd-386), const B2400 ideal-int
-pkg syscall (freebsd-386), const B28800 ideal-int
-pkg syscall (freebsd-386), const B300 ideal-int
-pkg syscall (freebsd-386), const B38400 ideal-int
-pkg syscall (freebsd-386), const B460800 ideal-int
-pkg syscall (freebsd-386), const B4800 ideal-int
-pkg syscall (freebsd-386), const B50 ideal-int
-pkg syscall (freebsd-386), const B57600 ideal-int
-pkg syscall (freebsd-386), const B600 ideal-int
-pkg syscall (freebsd-386), const B7200 ideal-int
-pkg syscall (freebsd-386), const B75 ideal-int
-pkg syscall (freebsd-386), const B76800 ideal-int
-pkg syscall (freebsd-386), const B921600 ideal-int
-pkg syscall (freebsd-386), const B9600 ideal-int
-pkg syscall (freebsd-386), const BIOCGTSTAMP ideal-int
-pkg syscall (freebsd-386), const BIOCSTSTAMP ideal-int
-pkg syscall (freebsd-386), const BPF_T_BINTIME ideal-int
-pkg syscall (freebsd-386), const BPF_T_BINTIME_FAST ideal-int
-pkg syscall (freebsd-386), const BPF_T_BINTIME_MONOTONIC ideal-int
-pkg syscall (freebsd-386), const BPF_T_BINTIME_MONOTONIC_FAST ideal-int
-pkg syscall (freebsd-386), const BPF_T_FAST ideal-int
-pkg syscall (freebsd-386), const BPF_T_FLAG_MASK ideal-int
-pkg syscall (freebsd-386), const BPF_T_FORMAT_MASK ideal-int
-pkg syscall (freebsd-386), const BPF_T_MICROTIME ideal-int
-pkg syscall (freebsd-386), const BPF_T_MICROTIME_FAST ideal-int
-pkg syscall (freebsd-386), const BPF_T_MICROTIME_MONOTONIC ideal-int
-pkg syscall (freebsd-386), const BPF_T_MICROTIME_MONOTONIC_FAST ideal-int
-pkg syscall (freebsd-386), const BPF_T_MONOTONIC ideal-int
-pkg syscall (freebsd-386), const BPF_T_MONOTONIC_FAST ideal-int
-pkg syscall (freebsd-386), const BPF_T_NANOTIME ideal-int
-pkg syscall (freebsd-386), const BPF_T_NANOTIME_FAST ideal-int
-pkg syscall (freebsd-386), const BPF_T_NANOTIME_MONOTONIC ideal-int
-pkg syscall (freebsd-386), const BPF_T_NANOTIME_MONOTONIC_FAST ideal-int
-pkg syscall (freebsd-386), const BPF_T_NONE ideal-int
-pkg syscall (freebsd-386), const BPF_T_NORMAL ideal-int
-pkg syscall (freebsd-386), const BRKINT ideal-int
-pkg syscall (freebsd-386), const CFLUSH ideal-int
-pkg syscall (freebsd-386), const CLOCAL ideal-int
-pkg syscall (freebsd-386), const CREAD ideal-int
-pkg syscall (freebsd-386), const CS5 ideal-int
-pkg syscall (freebsd-386), const CS6 ideal-int
-pkg syscall (freebsd-386), const CS7 ideal-int
-pkg syscall (freebsd-386), const CS8 ideal-int
-pkg syscall (freebsd-386), const CSIZE ideal-int
-pkg syscall (freebsd-386), const CSTART ideal-int
-pkg syscall (freebsd-386), const CSTATUS ideal-int
-pkg syscall (freebsd-386), const CSTOP ideal-int
-pkg syscall (freebsd-386), const CSTOPB ideal-int
-pkg syscall (freebsd-386), const CSUSP ideal-int
-pkg syscall (freebsd-386), const DLT_AOS ideal-int
-pkg syscall (freebsd-386), const DLT_CAN_SOCKETCAN ideal-int
-pkg syscall (freebsd-386), const DLT_DBUS ideal-int
-pkg syscall (freebsd-386), const DLT_DECT ideal-int
-pkg syscall (freebsd-386), const DLT_DVB_CI ideal-int
-pkg syscall (freebsd-386), const DLT_FC_2 ideal-int
-pkg syscall (freebsd-386), const DLT_FC_2_WITH_FRAME_DELIMS ideal-int
-pkg syscall (freebsd-386), const DLT_GSMTAP_ABIS ideal-int
-pkg syscall (freebsd-386), const DLT_GSMTAP_UM ideal-int
-pkg syscall (freebsd-386), const DLT_IEEE802_15_4_NOFCS ideal-int
-pkg syscall (freebsd-386), const DLT_IPNET ideal-int
-pkg syscall (freebsd-386), const DLT_IPOIB ideal-int
-pkg syscall (freebsd-386), const DLT_IPV4 ideal-int
-pkg syscall (freebsd-386), const DLT_IPV6 ideal-int
-pkg syscall (freebsd-386), const DLT_JUNIPER_ATM_CEMIC ideal-int
-pkg syscall (freebsd-386), const DLT_JUNIPER_FIBRECHANNEL ideal-int
-pkg syscall (freebsd-386), const DLT_JUNIPER_SRX_E2E ideal-int
-pkg syscall (freebsd-386), const DLT_JUNIPER_VS ideal-int
-pkg syscall (freebsd-386), const DLT_LINUX_EVDEV ideal-int
-pkg syscall (freebsd-386), const DLT_MATCHING_MAX ideal-int
-pkg syscall (freebsd-386), const DLT_MATCHING_MIN ideal-int
-pkg syscall (freebsd-386), const DLT_MPLS ideal-int
-pkg syscall (freebsd-386), const DLT_MUX27010 ideal-int
-pkg syscall (freebsd-386), const DLT_NETANALYZER ideal-int
-pkg syscall (freebsd-386), const DLT_NETANALYZER_TRANSPARENT ideal-int
-pkg syscall (freebsd-386), const DLT_NFLOG ideal-int
-pkg syscall (freebsd-386), const DLT_STANAG_5066_D_PDU ideal-int
-pkg syscall (freebsd-386), const DLT_USB_LINUX_MMAPPED ideal-int
-pkg syscall (freebsd-386), const DLT_WIHART ideal-int
-pkg syscall (freebsd-386), const ECAPMODE Errno
-pkg syscall (freebsd-386), const FLUSHO ideal-int
-pkg syscall (freebsd-386), const HUPCL ideal-int
-pkg syscall (freebsd-386), const ICANON ideal-int
-pkg syscall (freebsd-386), const ICRNL ideal-int
-pkg syscall (freebsd-386), const IEXTEN ideal-int
-pkg syscall (freebsd-386), const IFAN_ARRIVAL ideal-int
-pkg syscall (freebsd-386), const IFAN_DEPARTURE ideal-int
-pkg syscall (freebsd-386), const IFF_CANTCONFIG ideal-int
-pkg syscall (freebsd-386), const IFT_INFINIBAND ideal-int
-pkg syscall (freebsd-386), const IGNBRK ideal-int
-pkg syscall (freebsd-386), const IGNCR ideal-int
-pkg syscall (freebsd-386), const IGNPAR ideal-int
-pkg syscall (freebsd-386), const IMAXBEL ideal-int
-pkg syscall (freebsd-386), const INLCR ideal-int
-pkg syscall (freebsd-386), const INPCK ideal-int
-pkg syscall (freebsd-386), const IN_RFC3021_MASK ideal-int
-pkg syscall (freebsd-386), const IPPROTO_MH ideal-int
-pkg syscall (freebsd-386), const IPPROTO_SEND ideal-int
-pkg syscall (freebsd-386), const IP_RECVTOS ideal-int
-pkg syscall (freebsd-386), const ISIG ideal-int
-pkg syscall (freebsd-386), const ISTRIP ideal-int
-pkg syscall (freebsd-386), const IXANY ideal-int
-pkg syscall (freebsd-386), const IXOFF ideal-int
-pkg syscall (freebsd-386), const IXON ideal-int
-pkg syscall (freebsd-386), const MADV_AUTOSYNC ideal-int
-pkg syscall (freebsd-386), const MADV_CORE ideal-int
-pkg syscall (freebsd-386), const MADV_DONTNEED ideal-int
-pkg syscall (freebsd-386), const MADV_FREE ideal-int
-pkg syscall (freebsd-386), const MADV_NOCORE ideal-int
-pkg syscall (freebsd-386), const MADV_NORMAL ideal-int
-pkg syscall (freebsd-386), const MADV_NOSYNC ideal-int
-pkg syscall (freebsd-386), const MADV_PROTECT ideal-int
-pkg syscall (freebsd-386), const MADV_RANDOM ideal-int
-pkg syscall (freebsd-386), const MADV_SEQUENTIAL ideal-int
-pkg syscall (freebsd-386), const MADV_WILLNEED ideal-int
-pkg syscall (freebsd-386), const MAP_ANON ideal-int
-pkg syscall (freebsd-386), const MAP_ANONYMOUS ideal-int
-pkg syscall (freebsd-386), const MAP_COPY ideal-int
-pkg syscall (freebsd-386), const MAP_FILE ideal-int
-pkg syscall (freebsd-386), const MAP_FIXED ideal-int
-pkg syscall (freebsd-386), const MAP_HASSEMAPHORE ideal-int
-pkg syscall (freebsd-386), const MAP_NOCORE ideal-int
-pkg syscall (freebsd-386), const MAP_NORESERVE ideal-int
-pkg syscall (freebsd-386), const MAP_NOSYNC ideal-int
-pkg syscall (freebsd-386), const MAP_PREFAULT_READ ideal-int
-pkg syscall (freebsd-386), const MAP_PRIVATE ideal-int
-pkg syscall (freebsd-386), const MAP_RENAME ideal-int
-pkg syscall (freebsd-386), const MAP_RESERVED0080 ideal-int
-pkg syscall (freebsd-386), const MAP_RESERVED0100 ideal-int
-pkg syscall (freebsd-386), const MAP_SHARED ideal-int
-pkg syscall (freebsd-386), const MAP_STACK ideal-int
-pkg syscall (freebsd-386), const MCL_CURRENT ideal-int
-pkg syscall (freebsd-386), const MCL_FUTURE ideal-int
-pkg syscall (freebsd-386), const MS_ASYNC ideal-int
-pkg syscall (freebsd-386), const MS_INVALIDATE ideal-int
-pkg syscall (freebsd-386), const MS_SYNC ideal-int
-pkg syscall (freebsd-386), const NET_RT_IFLISTL ideal-int
-pkg syscall (freebsd-386), const NOFLSH ideal-int
-pkg syscall (freebsd-386), const OCRNL ideal-int
-pkg syscall (freebsd-386), const ONLCR ideal-int
-pkg syscall (freebsd-386), const ONLRET ideal-int
-pkg syscall (freebsd-386), const ONOCR ideal-int
-pkg syscall (freebsd-386), const ONOEOT ideal-int
-pkg syscall (freebsd-386), const OPOST ideal-int
-pkg syscall (freebsd-386), const PARENB ideal-int
-pkg syscall (freebsd-386), const PARMRK ideal-int
-pkg syscall (freebsd-386), const PARODD ideal-int
-pkg syscall (freebsd-386), const PENDIN ideal-int
-pkg syscall (freebsd-386), const PROT_EXEC ideal-int
-pkg syscall (freebsd-386), const PROT_NONE ideal-int
-pkg syscall (freebsd-386), const PROT_READ ideal-int
-pkg syscall (freebsd-386), const PROT_WRITE ideal-int
-pkg syscall (freebsd-386), const RT_CACHING_CONTEXT ideal-int
-pkg syscall (freebsd-386), const RT_DEFAULT_FIB ideal-int
-pkg syscall (freebsd-386), const SIOCGIFFIB ideal-int
-pkg syscall (freebsd-386), const SIOCSIFFIB ideal-int
-pkg syscall (freebsd-386), const SO_PROTOCOL ideal-int
-pkg syscall (freebsd-386), const SO_PROTOTYPE ideal-int
-pkg syscall (freebsd-386), const SO_USER_COOKIE ideal-int
-pkg syscall (freebsd-386), const SYS_CLOCK_GETCPUCLOCKID2 ideal-int
-pkg syscall (freebsd-386), const SYS_WAIT6 ideal-int
-pkg syscall (freebsd-386), const SizeofIfAnnounceMsghdr ideal-int
-pkg syscall (freebsd-386), const TCIFLUSH ideal-int
-pkg syscall (freebsd-386), const TCIOFLUSH ideal-int
-pkg syscall (freebsd-386), const TCOFLUSH ideal-int
-pkg syscall (freebsd-386), const TCP_KEEPCNT ideal-int
-pkg syscall (freebsd-386), const TCP_KEEPIDLE ideal-int
-pkg syscall (freebsd-386), const TCP_KEEPINIT ideal-int
-pkg syscall (freebsd-386), const TCP_KEEPINTVL ideal-int
-pkg syscall (freebsd-386), const TCSAFLUSH ideal-int
-pkg syscall (freebsd-386), const TOSTOP ideal-int
-pkg syscall (freebsd-386), const VDISCARD ideal-int
-pkg syscall (freebsd-386), const VDSUSP ideal-int
-pkg syscall (freebsd-386), const VEOF ideal-int
-pkg syscall (freebsd-386), const VEOL ideal-int
-pkg syscall (freebsd-386), const VEOL2 ideal-int
-pkg syscall (freebsd-386), const VERASE ideal-int
-pkg syscall (freebsd-386), const VERASE2 ideal-int
-pkg syscall (freebsd-386), const VINTR ideal-int
-pkg syscall (freebsd-386), const VKILL ideal-int
-pkg syscall (freebsd-386), const VLNEXT ideal-int
-pkg syscall (freebsd-386), const VMIN ideal-int
-pkg syscall (freebsd-386), const VQUIT ideal-int
-pkg syscall (freebsd-386), const VREPRINT ideal-int
-pkg syscall (freebsd-386), const VSTART ideal-int
-pkg syscall (freebsd-386), const VSTATUS ideal-int
-pkg syscall (freebsd-386), const VSTOP ideal-int
-pkg syscall (freebsd-386), const VSUSP ideal-int
-pkg syscall (freebsd-386), const VTIME ideal-int
-pkg syscall (freebsd-386), const VWERASE ideal-int
-pkg syscall (freebsd-386), func SlicePtrFromStrings([]string) ([]*uint8, error)
-pkg syscall (freebsd-386), type IfAnnounceMsghdr struct
-pkg syscall (freebsd-386), type IfAnnounceMsghdr struct, Index uint16
-pkg syscall (freebsd-386), type IfAnnounceMsghdr struct, Msglen uint16
-pkg syscall (freebsd-386), type IfAnnounceMsghdr struct, Name [16]int8
-pkg syscall (freebsd-386), type IfAnnounceMsghdr struct, Type uint8
-pkg syscall (freebsd-386), type IfAnnounceMsghdr struct, Version uint8
-pkg syscall (freebsd-386), type IfAnnounceMsghdr struct, What uint16
-pkg syscall (freebsd-386), type InterfaceAnnounceMessage struct
-pkg syscall (freebsd-386), type InterfaceAnnounceMessage struct, Header IfAnnounceMsghdr
-pkg syscall (freebsd-amd64), const B0 ideal-int
-pkg syscall (freebsd-amd64), const B110 ideal-int
-pkg syscall (freebsd-amd64), const B115200 ideal-int
-pkg syscall (freebsd-amd64), const B1200 ideal-int
-pkg syscall (freebsd-amd64), const B134 ideal-int
-pkg syscall (freebsd-amd64), const B14400 ideal-int
-pkg syscall (freebsd-amd64), const B150 ideal-int
-pkg syscall (freebsd-amd64), const B1800 ideal-int
-pkg syscall (freebsd-amd64), const B19200 ideal-int
-pkg syscall (freebsd-amd64), const B200 ideal-int
-pkg syscall (freebsd-amd64), const B230400 ideal-int
-pkg syscall (freebsd-amd64), const B2400 ideal-int
-pkg syscall (freebsd-amd64), const B28800 ideal-int
-pkg syscall (freebsd-amd64), const B300 ideal-int
-pkg syscall (freebsd-amd64), const B38400 ideal-int
-pkg syscall (freebsd-amd64), const B460800 ideal-int
-pkg syscall (freebsd-amd64), const B4800 ideal-int
-pkg syscall (freebsd-amd64), const B50 ideal-int
-pkg syscall (freebsd-amd64), const B57600 ideal-int
-pkg syscall (freebsd-amd64), const B600 ideal-int
-pkg syscall (freebsd-amd64), const B7200 ideal-int
-pkg syscall (freebsd-amd64), const B75 ideal-int
-pkg syscall (freebsd-amd64), const B76800 ideal-int
-pkg syscall (freebsd-amd64), const B921600 ideal-int
-pkg syscall (freebsd-amd64), const B9600 ideal-int
-pkg syscall (freebsd-amd64), const BIOCGTSTAMP ideal-int
-pkg syscall (freebsd-amd64), const BIOCSTSTAMP ideal-int
-pkg syscall (freebsd-amd64), const BPF_T_BINTIME ideal-int
-pkg syscall (freebsd-amd64), const BPF_T_BINTIME_FAST ideal-int
-pkg syscall (freebsd-amd64), const BPF_T_BINTIME_MONOTONIC ideal-int
-pkg syscall (freebsd-amd64), const BPF_T_BINTIME_MONOTONIC_FAST ideal-int
-pkg syscall (freebsd-amd64), const BPF_T_FAST ideal-int
-pkg syscall (freebsd-amd64), const BPF_T_FLAG_MASK ideal-int
-pkg syscall (freebsd-amd64), const BPF_T_FORMAT_MASK ideal-int
-pkg syscall (freebsd-amd64), const BPF_T_MICROTIME ideal-int
-pkg syscall (freebsd-amd64), const BPF_T_MICROTIME_FAST ideal-int
-pkg syscall (freebsd-amd64), const BPF_T_MICROTIME_MONOTONIC ideal-int
-pkg syscall (freebsd-amd64), const BPF_T_MICROTIME_MONOTONIC_FAST ideal-int
-pkg syscall (freebsd-amd64), const BPF_T_MONOTONIC ideal-int
-pkg syscall (freebsd-amd64), const BPF_T_MONOTONIC_FAST ideal-int
-pkg syscall (freebsd-amd64), const BPF_T_NANOTIME ideal-int
-pkg syscall (freebsd-amd64), const BPF_T_NANOTIME_FAST ideal-int
-pkg syscall (freebsd-amd64), const BPF_T_NANOTIME_MONOTONIC ideal-int
-pkg syscall (freebsd-amd64), const BPF_T_NANOTIME_MONOTONIC_FAST ideal-int
-pkg syscall (freebsd-amd64), const BPF_T_NONE ideal-int
-pkg syscall (freebsd-amd64), const BPF_T_NORMAL ideal-int
-pkg syscall (freebsd-amd64), const BRKINT ideal-int
-pkg syscall (freebsd-amd64), const CFLUSH ideal-int
-pkg syscall (freebsd-amd64), const CLOCAL ideal-int
-pkg syscall (freebsd-amd64), const CREAD ideal-int
-pkg syscall (freebsd-amd64), const CS5 ideal-int
-pkg syscall (freebsd-amd64), const CS6 ideal-int
-pkg syscall (freebsd-amd64), const CS7 ideal-int
-pkg syscall (freebsd-amd64), const CS8 ideal-int
-pkg syscall (freebsd-amd64), const CSIZE ideal-int
-pkg syscall (freebsd-amd64), const CSTART ideal-int
-pkg syscall (freebsd-amd64), const CSTATUS ideal-int
-pkg syscall (freebsd-amd64), const CSTOP ideal-int
-pkg syscall (freebsd-amd64), const CSTOPB ideal-int
-pkg syscall (freebsd-amd64), const CSUSP ideal-int
-pkg syscall (freebsd-amd64), const DLT_AOS ideal-int
-pkg syscall (freebsd-amd64), const DLT_CAN_SOCKETCAN ideal-int
-pkg syscall (freebsd-amd64), const DLT_DBUS ideal-int
-pkg syscall (freebsd-amd64), const DLT_DECT ideal-int
-pkg syscall (freebsd-amd64), const DLT_DVB_CI ideal-int
-pkg syscall (freebsd-amd64), const DLT_FC_2 ideal-int
-pkg syscall (freebsd-amd64), const DLT_FC_2_WITH_FRAME_DELIMS ideal-int
-pkg syscall (freebsd-amd64), const DLT_GSMTAP_ABIS ideal-int
-pkg syscall (freebsd-amd64), const DLT_GSMTAP_UM ideal-int
-pkg syscall (freebsd-amd64), const DLT_IEEE802_15_4_NOFCS ideal-int
-pkg syscall (freebsd-amd64), const DLT_IPNET ideal-int
-pkg syscall (freebsd-amd64), const DLT_IPOIB ideal-int
-pkg syscall (freebsd-amd64), const DLT_IPV4 ideal-int
-pkg syscall (freebsd-amd64), const DLT_IPV6 ideal-int
-pkg syscall (freebsd-amd64), const DLT_JUNIPER_ATM_CEMIC ideal-int
-pkg syscall (freebsd-amd64), const DLT_JUNIPER_FIBRECHANNEL ideal-int
-pkg syscall (freebsd-amd64), const DLT_JUNIPER_SRX_E2E ideal-int
-pkg syscall (freebsd-amd64), const DLT_JUNIPER_VS ideal-int
-pkg syscall (freebsd-amd64), const DLT_LINUX_EVDEV ideal-int
-pkg syscall (freebsd-amd64), const DLT_MATCHING_MAX ideal-int
-pkg syscall (freebsd-amd64), const DLT_MATCHING_MIN ideal-int
-pkg syscall (freebsd-amd64), const DLT_MPLS ideal-int
-pkg syscall (freebsd-amd64), const DLT_MUX27010 ideal-int
-pkg syscall (freebsd-amd64), const DLT_NETANALYZER ideal-int
-pkg syscall (freebsd-amd64), const DLT_NETANALYZER_TRANSPARENT ideal-int
-pkg syscall (freebsd-amd64), const DLT_NFLOG ideal-int
-pkg syscall (freebsd-amd64), const DLT_STANAG_5066_D_PDU ideal-int
-pkg syscall (freebsd-amd64), const DLT_USB_LINUX_MMAPPED ideal-int
-pkg syscall (freebsd-amd64), const DLT_WIHART ideal-int
-pkg syscall (freebsd-amd64), const ECAPMODE Errno
-pkg syscall (freebsd-amd64), const FLUSHO ideal-int
-pkg syscall (freebsd-amd64), const HUPCL ideal-int
-pkg syscall (freebsd-amd64), const ICANON ideal-int
-pkg syscall (freebsd-amd64), const ICRNL ideal-int
-pkg syscall (freebsd-amd64), const IEXTEN ideal-int
-pkg syscall (freebsd-amd64), const IFAN_ARRIVAL ideal-int
-pkg syscall (freebsd-amd64), const IFAN_DEPARTURE ideal-int
-pkg syscall (freebsd-amd64), const IFF_CANTCONFIG ideal-int
-pkg syscall (freebsd-amd64), const IFT_INFINIBAND ideal-int
-pkg syscall (freebsd-amd64), const IGNBRK ideal-int
-pkg syscall (freebsd-amd64), const IGNCR ideal-int
-pkg syscall (freebsd-amd64), const IGNPAR ideal-int
-pkg syscall (freebsd-amd64), const IMAXBEL ideal-int
-pkg syscall (freebsd-amd64), const INLCR ideal-int
-pkg syscall (freebsd-amd64), const INPCK ideal-int
-pkg syscall (freebsd-amd64), const IN_RFC3021_MASK ideal-int
-pkg syscall (freebsd-amd64), const IPPROTO_MH ideal-int
-pkg syscall (freebsd-amd64), const IPPROTO_SEND ideal-int
-pkg syscall (freebsd-amd64), const IP_RECVTOS ideal-int
-pkg syscall (freebsd-amd64), const ISIG ideal-int
-pkg syscall (freebsd-amd64), const ISTRIP ideal-int
-pkg syscall (freebsd-amd64), const IXANY ideal-int
-pkg syscall (freebsd-amd64), const IXOFF ideal-int
-pkg syscall (freebsd-amd64), const IXON ideal-int
-pkg syscall (freebsd-amd64), const MADV_AUTOSYNC ideal-int
-pkg syscall (freebsd-amd64), const MADV_CORE ideal-int
-pkg syscall (freebsd-amd64), const MADV_DONTNEED ideal-int
-pkg syscall (freebsd-amd64), const MADV_FREE ideal-int
-pkg syscall (freebsd-amd64), const MADV_NOCORE ideal-int
-pkg syscall (freebsd-amd64), const MADV_NORMAL ideal-int
-pkg syscall (freebsd-amd64), const MADV_NOSYNC ideal-int
-pkg syscall (freebsd-amd64), const MADV_PROTECT ideal-int
-pkg syscall (freebsd-amd64), const MADV_RANDOM ideal-int
-pkg syscall (freebsd-amd64), const MADV_SEQUENTIAL ideal-int
-pkg syscall (freebsd-amd64), const MADV_WILLNEED ideal-int
-pkg syscall (freebsd-amd64), const MAP_ANON ideal-int
-pkg syscall (freebsd-amd64), const MAP_ANONYMOUS ideal-int
-pkg syscall (freebsd-amd64), const MAP_COPY ideal-int
-pkg syscall (freebsd-amd64), const MAP_FILE ideal-int
-pkg syscall (freebsd-amd64), const MAP_FIXED ideal-int
-pkg syscall (freebsd-amd64), const MAP_HASSEMAPHORE ideal-int
-pkg syscall (freebsd-amd64), const MAP_NOCORE ideal-int
-pkg syscall (freebsd-amd64), const MAP_NORESERVE ideal-int
-pkg syscall (freebsd-amd64), const MAP_NOSYNC ideal-int
-pkg syscall (freebsd-amd64), const MAP_PREFAULT_READ ideal-int
-pkg syscall (freebsd-amd64), const MAP_PRIVATE ideal-int
-pkg syscall (freebsd-amd64), const MAP_RENAME ideal-int
-pkg syscall (freebsd-amd64), const MAP_RESERVED0080 ideal-int
-pkg syscall (freebsd-amd64), const MAP_RESERVED0100 ideal-int
-pkg syscall (freebsd-amd64), const MAP_SHARED ideal-int
-pkg syscall (freebsd-amd64), const MAP_STACK ideal-int
-pkg syscall (freebsd-amd64), const MCL_CURRENT ideal-int
-pkg syscall (freebsd-amd64), const MCL_FUTURE ideal-int
-pkg syscall (freebsd-amd64), const MS_ASYNC ideal-int
-pkg syscall (freebsd-amd64), const MS_INVALIDATE ideal-int
-pkg syscall (freebsd-amd64), const MS_SYNC ideal-int
-pkg syscall (freebsd-amd64), const NET_RT_IFLISTL ideal-int
-pkg syscall (freebsd-amd64), const NOFLSH ideal-int
-pkg syscall (freebsd-amd64), const OCRNL ideal-int
-pkg syscall (freebsd-amd64), const ONLCR ideal-int
-pkg syscall (freebsd-amd64), const ONLRET ideal-int
-pkg syscall (freebsd-amd64), const ONOCR ideal-int
-pkg syscall (freebsd-amd64), const ONOEOT ideal-int
-pkg syscall (freebsd-amd64), const OPOST ideal-int
-pkg syscall (freebsd-amd64), const PARENB ideal-int
-pkg syscall (freebsd-amd64), const PARMRK ideal-int
-pkg syscall (freebsd-amd64), const PARODD ideal-int
-pkg syscall (freebsd-amd64), const PENDIN ideal-int
-pkg syscall (freebsd-amd64), const PROT_EXEC ideal-int
-pkg syscall (freebsd-amd64), const PROT_NONE ideal-int
-pkg syscall (freebsd-amd64), const PROT_READ ideal-int
-pkg syscall (freebsd-amd64), const PROT_WRITE ideal-int
-pkg syscall (freebsd-amd64), const RT_CACHING_CONTEXT ideal-int
-pkg syscall (freebsd-amd64), const RT_DEFAULT_FIB ideal-int
-pkg syscall (freebsd-amd64), const SIOCGIFFIB ideal-int
-pkg syscall (freebsd-amd64), const SIOCSIFFIB ideal-int
-pkg syscall (freebsd-amd64), const SO_PROTOCOL ideal-int
-pkg syscall (freebsd-amd64), const SO_PROTOTYPE ideal-int
-pkg syscall (freebsd-amd64), const SO_USER_COOKIE ideal-int
-pkg syscall (freebsd-amd64), const SYS_CLOCK_GETCPUCLOCKID2 ideal-int
-pkg syscall (freebsd-amd64), const SYS_WAIT6 ideal-int
-pkg syscall (freebsd-amd64), const SizeofIfAnnounceMsghdr ideal-int
-pkg syscall (freebsd-amd64), const TCIFLUSH ideal-int
-pkg syscall (freebsd-amd64), const TCIOFLUSH ideal-int
-pkg syscall (freebsd-amd64), const TCOFLUSH ideal-int
-pkg syscall (freebsd-amd64), const TCP_KEEPCNT ideal-int
-pkg syscall (freebsd-amd64), const TCP_KEEPIDLE ideal-int
-pkg syscall (freebsd-amd64), const TCP_KEEPINIT ideal-int
-pkg syscall (freebsd-amd64), const TCP_KEEPINTVL ideal-int
-pkg syscall (freebsd-amd64), const TCSAFLUSH ideal-int
-pkg syscall (freebsd-amd64), const TOSTOP ideal-int
-pkg syscall (freebsd-amd64), const VDISCARD ideal-int
-pkg syscall (freebsd-amd64), const VDSUSP ideal-int
-pkg syscall (freebsd-amd64), const VEOF ideal-int
-pkg syscall (freebsd-amd64), const VEOL ideal-int
-pkg syscall (freebsd-amd64), const VEOL2 ideal-int
-pkg syscall (freebsd-amd64), const VERASE ideal-int
-pkg syscall (freebsd-amd64), const VERASE2 ideal-int
-pkg syscall (freebsd-amd64), const VINTR ideal-int
-pkg syscall (freebsd-amd64), const VKILL ideal-int
-pkg syscall (freebsd-amd64), const VLNEXT ideal-int
-pkg syscall (freebsd-amd64), const VMIN ideal-int
-pkg syscall (freebsd-amd64), const VQUIT ideal-int
-pkg syscall (freebsd-amd64), const VREPRINT ideal-int
-pkg syscall (freebsd-amd64), const VSTART ideal-int
-pkg syscall (freebsd-amd64), const VSTATUS ideal-int
-pkg syscall (freebsd-amd64), const VSTOP ideal-int
-pkg syscall (freebsd-amd64), const VSUSP ideal-int
-pkg syscall (freebsd-amd64), const VTIME ideal-int
-pkg syscall (freebsd-amd64), const VWERASE ideal-int
-pkg syscall (freebsd-amd64), func SlicePtrFromStrings([]string) ([]*uint8, error)
-pkg syscall (freebsd-amd64), func Syscall9(uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr, uintptr) (uintptr, uintptr, Errno)
-pkg syscall (freebsd-amd64), type IfAnnounceMsghdr struct
-pkg syscall (freebsd-amd64), type IfAnnounceMsghdr struct, Index uint16
-pkg syscall (freebsd-amd64), type IfAnnounceMsghdr struct, Msglen uint16
-pkg syscall (freebsd-amd64), type IfAnnounceMsghdr struct, Name [16]int8
-pkg syscall (freebsd-amd64), type IfAnnounceMsghdr struct, Type uint8
-pkg syscall (freebsd-amd64), type IfAnnounceMsghdr struct, Version uint8
-pkg syscall (freebsd-amd64), type IfAnnounceMsghdr struct, What uint16
-pkg syscall (freebsd-amd64), type InterfaceAnnounceMessage struct
-pkg syscall (freebsd-amd64), type InterfaceAnnounceMessage struct, Header IfAnnounceMsghdr
-pkg syscall (linux-386), const MSG_FASTOPEN ideal-int
-pkg syscall (linux-386), const RTNLGRP_IPV4_IFADDR ideal-int
-pkg syscall (linux-386), const RTNLGRP_IPV4_MROUTE ideal-int
-pkg syscall (linux-386), const RTNLGRP_IPV4_ROUTE ideal-int
-pkg syscall (linux-386), const RTNLGRP_IPV4_RULE ideal-int
-pkg syscall (linux-386), const RTNLGRP_IPV6_IFADDR ideal-int
-pkg syscall (linux-386), const RTNLGRP_IPV6_IFINFO ideal-int
-pkg syscall (linux-386), const RTNLGRP_IPV6_MROUTE ideal-int
-pkg syscall (linux-386), const RTNLGRP_IPV6_PREFIX ideal-int
-pkg syscall (linux-386), const RTNLGRP_IPV6_ROUTE ideal-int
-pkg syscall (linux-386), const RTNLGRP_IPV6_RULE ideal-int
-pkg syscall (linux-386), const RTNLGRP_LINK ideal-int
-pkg syscall (linux-386), const RTNLGRP_ND_USEROPT ideal-int
-pkg syscall (linux-386), const RTNLGRP_NEIGH ideal-int
-pkg syscall (linux-386), const RTNLGRP_NONE ideal-int
-pkg syscall (linux-386), const RTNLGRP_NOTIFY ideal-int
-pkg syscall (linux-386), const RTNLGRP_TC ideal-int
-pkg syscall (linux-386), const SizeofTCPInfo ideal-int
-pkg syscall (linux-386), func Accept4(int, int) (int, Sockaddr, error)
-pkg syscall (linux-386), func GetsockoptUcred(int, int, int) (*Ucred, error)
-pkg syscall (linux-386), func Getxattr(string, string, []uint8) (int, error)
-pkg syscall (linux-386), func Listxattr(string, []uint8) (int, error)
-pkg syscall (linux-386), func Pipe2([]int, int) error
-pkg syscall (linux-386), func PtraceSyscall(int, int) error
-pkg syscall (linux-386), func Removexattr(string, string) error
-pkg syscall (linux-386), func Setxattr(string, string, []uint8, int) error
-pkg syscall (linux-386), func SlicePtrFromStrings([]string) ([]*uint8, error)
-pkg syscall (linux-386), type SysProcAttr struct, Ctty int
-pkg syscall (linux-386), type TCPInfo struct
-pkg syscall (linux-386), type TCPInfo struct, Advmss uint32
-pkg syscall (linux-386), type TCPInfo struct, Ato uint32
-pkg syscall (linux-386), type TCPInfo struct, Backoff uint8
-pkg syscall (linux-386), type TCPInfo struct, Ca_state uint8
-pkg syscall (linux-386), type TCPInfo struct, Fackets uint32
-pkg syscall (linux-386), type TCPInfo struct, Last_ack_recv uint32
-pkg syscall (linux-386), type TCPInfo struct, Last_ack_sent uint32
-pkg syscall (linux-386), type TCPInfo struct, Last_data_recv uint32
-pkg syscall (linux-386), type TCPInfo struct, Last_data_sent uint32
-pkg syscall (linux-386), type TCPInfo struct, Lost uint32
-pkg syscall (linux-386), type TCPInfo struct, Options uint8
-pkg syscall (linux-386), type TCPInfo struct, Pad_cgo_0 [2]uint8
-pkg syscall (linux-386), type TCPInfo struct, Pmtu uint32
-pkg syscall (linux-386), type TCPInfo struct, Probes uint8
-pkg syscall (linux-386), type TCPInfo struct, Rcv_mss uint32
-pkg syscall (linux-386), type TCPInfo struct, Rcv_rtt uint32
-pkg syscall (linux-386), type TCPInfo struct, Rcv_space uint32
-pkg syscall (linux-386), type TCPInfo struct, Rcv_ssthresh uint32
-pkg syscall (linux-386), type TCPInfo struct, Reordering uint32
-pkg syscall (linux-386), type TCPInfo struct, Retrans uint32
-pkg syscall (linux-386), type TCPInfo struct, Retransmits uint8
-pkg syscall (linux-386), type TCPInfo struct, Rto uint32
-pkg syscall (linux-386), type TCPInfo struct, Rtt uint32
-pkg syscall (linux-386), type TCPInfo struct, Rttvar uint32
-pkg syscall (linux-386), type TCPInfo struct, Sacked uint32
-pkg syscall (linux-386), type TCPInfo struct, Snd_cwnd uint32
-pkg syscall (linux-386), type TCPInfo struct, Snd_mss uint32
-pkg syscall (linux-386), type TCPInfo struct, Snd_ssthresh uint32
-pkg syscall (linux-386), type TCPInfo struct, State uint8
-pkg syscall (linux-386), type TCPInfo struct, Total_retrans uint32
-pkg syscall (linux-386), type TCPInfo struct, Unacked uint32
-pkg syscall (linux-386-cgo), const MSG_FASTOPEN ideal-int
-pkg syscall (linux-386-cgo), const RTNLGRP_IPV4_IFADDR ideal-int
-pkg syscall (linux-386-cgo), const RTNLGRP_IPV4_MROUTE ideal-int
-pkg syscall (linux-386-cgo), const RTNLGRP_IPV4_ROUTE ideal-int
-pkg syscall (linux-386-cgo), const RTNLGRP_IPV4_RULE ideal-int
-pkg syscall (linux-386-cgo), const RTNLGRP_IPV6_IFADDR ideal-int
-pkg syscall (linux-386-cgo), const RTNLGRP_IPV6_IFINFO ideal-int
-pkg syscall (linux-386-cgo), const RTNLGRP_IPV6_MROUTE ideal-int
-pkg syscall (linux-386-cgo), const RTNLGRP_IPV6_PREFIX ideal-int
-pkg syscall (linux-386-cgo), const RTNLGRP_IPV6_ROUTE ideal-int
-pkg syscall (linux-386-cgo), const RTNLGRP_IPV6_RULE ideal-int
-pkg syscall (linux-386-cgo), const RTNLGRP_LINK ideal-int
-pkg syscall (linux-386-cgo), const RTNLGRP_ND_USEROPT ideal-int
-pkg syscall (linux-386-cgo), const RTNLGRP_NEIGH ideal-int
-pkg syscall (linux-386-cgo), const RTNLGRP_NONE ideal-int
-pkg syscall (linux-386-cgo), const RTNLGRP_NOTIFY ideal-int
-pkg syscall (linux-386-cgo), const RTNLGRP_TC ideal-int
-pkg syscall (linux-386-cgo), const SizeofTCPInfo ideal-int
-pkg syscall (linux-386-cgo), func Accept4(int, int) (int, Sockaddr, error)
-pkg syscall (linux-386-cgo), func GetsockoptUcred(int, int, int) (*Ucred, error)
-pkg syscall (linux-386-cgo), func Getxattr(string, string, []uint8) (int, error)
-pkg syscall (linux-386-cgo), func Listxattr(string, []uint8) (int, error)
-pkg syscall (linux-386-cgo), func Pipe2([]int, int) error
-pkg syscall (linux-386-cgo), func PtraceSyscall(int, int) error
-pkg syscall (linux-386-cgo), func Removexattr(string, string) error
-pkg syscall (linux-386-cgo), func Setxattr(string, string, []uint8, int) error
-pkg syscall (linux-386-cgo), func SlicePtrFromStrings([]string) ([]*uint8, error)
-pkg syscall (linux-386-cgo), type SysProcAttr struct, Ctty int
-pkg syscall (linux-386-cgo), type TCPInfo struct
-pkg syscall (linux-386-cgo), type TCPInfo struct, Advmss uint32
-pkg syscall (linux-386-cgo), type TCPInfo struct, Ato uint32
-pkg syscall (linux-386-cgo), type TCPInfo struct, Backoff uint8
-pkg syscall (linux-386-cgo), type TCPInfo struct, Ca_state uint8
-pkg syscall (linux-386-cgo), type TCPInfo struct, Fackets uint32
-pkg syscall (linux-386-cgo), type TCPInfo struct, Last_ack_recv uint32
-pkg syscall (linux-386-cgo), type TCPInfo struct, Last_ack_sent uint32
-pkg syscall (linux-386-cgo), type TCPInfo struct, Last_data_recv uint32
-pkg syscall (linux-386-cgo), type TCPInfo struct, Last_data_sent uint32
-pkg syscall (linux-386-cgo), type TCPInfo struct, Lost uint32
-pkg syscall (linux-386-cgo), type TCPInfo struct, Options uint8
-pkg syscall (linux-386-cgo), type TCPInfo struct, Pad_cgo_0 [2]uint8
-pkg syscall (linux-386-cgo), type TCPInfo struct, Pmtu uint32
-pkg syscall (linux-386-cgo), type TCPInfo struct, Probes uint8
-pkg syscall (linux-386-cgo), type TCPInfo struct, Rcv_mss uint32
-pkg syscall (linux-386-cgo), type TCPInfo struct, Rcv_rtt uint32
-pkg syscall (linux-386-cgo), type TCPInfo struct, Rcv_space uint32
-pkg syscall (linux-386-cgo), type TCPInfo struct, Rcv_ssthresh uint32
-pkg syscall (linux-386-cgo), type TCPInfo struct, Reordering uint32
-pkg syscall (linux-386-cgo), type TCPInfo struct, Retrans uint32
-pkg syscall (linux-386-cgo), type TCPInfo struct, Retransmits uint8
-pkg syscall (linux-386-cgo), type TCPInfo struct, Rto uint32
-pkg syscall (linux-386-cgo), type TCPInfo struct, Rtt uint32
-pkg syscall (linux-386-cgo), type TCPInfo struct, Rttvar uint32
-pkg syscall (linux-386-cgo), type TCPInfo struct, Sacked uint32
-pkg syscall (linux-386-cgo), type TCPInfo struct, Snd_cwnd uint32
-pkg syscall (linux-386-cgo), type TCPInfo struct, Snd_mss uint32
-pkg syscall (linux-386-cgo), type TCPInfo struct, Snd_ssthresh uint32
-pkg syscall (linux-386-cgo), type TCPInfo struct, State uint8
-pkg syscall (linux-386-cgo), type TCPInfo struct, Total_retrans uint32
-pkg syscall (linux-386-cgo), type TCPInfo struct, Unacked uint32
-pkg syscall (linux-amd64), const MSG_FASTOPEN ideal-int
-pkg syscall (linux-amd64), const RTNLGRP_IPV4_IFADDR ideal-int
-pkg syscall (linux-amd64), const RTNLGRP_IPV4_MROUTE ideal-int
-pkg syscall (linux-amd64), const RTNLGRP_IPV4_ROUTE ideal-int
-pkg syscall (linux-amd64), const RTNLGRP_IPV4_RULE ideal-int
-pkg syscall (linux-amd64), const RTNLGRP_IPV6_IFADDR ideal-int
-pkg syscall (linux-amd64), const RTNLGRP_IPV6_IFINFO ideal-int
-pkg syscall (linux-amd64), const RTNLGRP_IPV6_MROUTE ideal-int
-pkg syscall (linux-amd64), const RTNLGRP_IPV6_PREFIX ideal-int
-pkg syscall (linux-amd64), const RTNLGRP_IPV6_ROUTE ideal-int
-pkg syscall (linux-amd64), const RTNLGRP_IPV6_RULE ideal-int
-pkg syscall (linux-amd64), const RTNLGRP_LINK ideal-int
-pkg syscall (linux-amd64), const RTNLGRP_ND_USEROPT ideal-int
-pkg syscall (linux-amd64), const RTNLGRP_NEIGH ideal-int
-pkg syscall (linux-amd64), const RTNLGRP_NONE ideal-int
-pkg syscall (linux-amd64), const RTNLGRP_NOTIFY ideal-int
-pkg syscall (linux-amd64), const RTNLGRP_TC ideal-int
-pkg syscall (linux-amd64), const SizeofTCPInfo ideal-int
-pkg syscall (linux-amd64), func Accept4(int, int) (int, Sockaddr, error)
-pkg syscall (linux-amd64), func GetsockoptUcred(int, int, int) (*Ucred, error)
-pkg syscall (linux-amd64), func Getxattr(string, string, []uint8) (int, error)
-pkg syscall (linux-amd64), func Listxattr(string, []uint8) (int, error)
-pkg syscall (linux-amd64), func Pipe2([]int, int) error
-pkg syscall (linux-amd64), func PtraceSyscall(int, int) error
-pkg syscall (linux-amd64), func Removexattr(string, string) error
-pkg syscall (linux-amd64), func Setxattr(string, string, []uint8, int) error
-pkg syscall (linux-amd64), func SlicePtrFromStrings([]string) ([]*uint8, error)
-pkg syscall (linux-amd64), type SysProcAttr struct, Ctty int
-pkg syscall (linux-amd64), type TCPInfo struct
-pkg syscall (linux-amd64), type TCPInfo struct, Advmss uint32
-pkg syscall (linux-amd64), type TCPInfo struct, Ato uint32
-pkg syscall (linux-amd64), type TCPInfo struct, Backoff uint8
-pkg syscall (linux-amd64), type TCPInfo struct, Ca_state uint8
-pkg syscall (linux-amd64), type TCPInfo struct, Fackets uint32
-pkg syscall (linux-amd64), type TCPInfo struct, Last_ack_recv uint32
-pkg syscall (linux-amd64), type TCPInfo struct, Last_ack_sent uint32
-pkg syscall (linux-amd64), type TCPInfo struct, Last_data_recv uint32
-pkg syscall (linux-amd64), type TCPInfo struct, Last_data_sent uint32
-pkg syscall (linux-amd64), type TCPInfo struct, Lost uint32
-pkg syscall (linux-amd64), type TCPInfo struct, Options uint8
-pkg syscall (linux-amd64), type TCPInfo struct, Pad_cgo_0 [2]uint8
-pkg syscall (linux-amd64), type TCPInfo struct, Pmtu uint32
-pkg syscall (linux-amd64), type TCPInfo struct, Probes uint8
-pkg syscall (linux-amd64), type TCPInfo struct, Rcv_mss uint32
-pkg syscall (linux-amd64), type TCPInfo struct, Rcv_rtt uint32
-pkg syscall (linux-amd64), type TCPInfo struct, Rcv_space uint32
-pkg syscall (linux-amd64), type TCPInfo struct, Rcv_ssthresh uint32
-pkg syscall (linux-amd64), type TCPInfo struct, Reordering uint32
-pkg syscall (linux-amd64), type TCPInfo struct, Retrans uint32
-pkg syscall (linux-amd64), type TCPInfo struct, Retransmits uint8
-pkg syscall (linux-amd64), type TCPInfo struct, Rto uint32
-pkg syscall (linux-amd64), type TCPInfo struct, Rtt uint32
-pkg syscall (linux-amd64), type TCPInfo struct, Rttvar uint32
-pkg syscall (linux-amd64), type TCPInfo struct, Sacked uint32
-pkg syscall (linux-amd64), type TCPInfo struct, Snd_cwnd uint32
-pkg syscall (linux-amd64), type TCPInfo struct, Snd_mss uint32
-pkg syscall (linux-amd64), type TCPInfo struct, Snd_ssthresh uint32
-pkg syscall (linux-amd64), type TCPInfo struct, State uint8
-pkg syscall (linux-amd64), type TCPInfo struct, Total_retrans uint32
-pkg syscall (linux-amd64), type TCPInfo struct, Unacked uint32
-pkg syscall (linux-amd64-cgo), const MSG_FASTOPEN ideal-int
-pkg syscall (linux-amd64-cgo), const RTNLGRP_IPV4_IFADDR ideal-int
-pkg syscall (linux-amd64-cgo), const RTNLGRP_IPV4_MROUTE ideal-int
-pkg syscall (linux-amd64-cgo), const RTNLGRP_IPV4_ROUTE ideal-int
-pkg syscall (linux-amd64-cgo), const RTNLGRP_IPV4_RULE ideal-int
-pkg syscall (linux-amd64-cgo), const RTNLGRP_IPV6_IFADDR ideal-int
-pkg syscall (linux-amd64-cgo), const RTNLGRP_IPV6_IFINFO ideal-int
-pkg syscall (linux-amd64-cgo), const RTNLGRP_IPV6_MROUTE ideal-int
-pkg syscall (linux-amd64-cgo), const RTNLGRP_IPV6_PREFIX ideal-int
-pkg syscall (linux-amd64-cgo), const RTNLGRP_IPV6_ROUTE ideal-int
-pkg syscall (linux-amd64-cgo), const RTNLGRP_IPV6_RULE ideal-int
-pkg syscall (linux-amd64-cgo), const RTNLGRP_LINK ideal-int
-pkg syscall (linux-amd64-cgo), const RTNLGRP_ND_USEROPT ideal-int
-pkg syscall (linux-amd64-cgo), const RTNLGRP_NEIGH ideal-int
-pkg syscall (linux-amd64-cgo), const RTNLGRP_NONE ideal-int
-pkg syscall (linux-amd64-cgo), const RTNLGRP_NOTIFY ideal-int
-pkg syscall (linux-amd64-cgo), const RTNLGRP_TC ideal-int
-pkg syscall (linux-amd64-cgo), const SizeofTCPInfo ideal-int
-pkg syscall (linux-amd64-cgo), func Accept4(int, int) (int, Sockaddr, error)
-pkg syscall (linux-amd64-cgo), func GetsockoptUcred(int, int, int) (*Ucred, error)
-pkg syscall (linux-amd64-cgo), func Getxattr(string, string, []uint8) (int, error)
-pkg syscall (linux-amd64-cgo), func Listxattr(string, []uint8) (int, error)
-pkg syscall (linux-amd64-cgo), func Pipe2([]int, int) error
-pkg syscall (linux-amd64-cgo), func PtraceSyscall(int, int) error
-pkg syscall (linux-amd64-cgo), func Removexattr(string, string) error
-pkg syscall (linux-amd64-cgo), func Setxattr(string, string, []uint8, int) error
-pkg syscall (linux-amd64-cgo), func SlicePtrFromStrings([]string) ([]*uint8, error)
-pkg syscall (linux-amd64-cgo), type SysProcAttr struct, Ctty int
-pkg syscall (linux-amd64-cgo), type TCPInfo struct
-pkg syscall (linux-amd64-cgo), type TCPInfo struct, Advmss uint32
-pkg syscall (linux-amd64-cgo), type TCPInfo struct, Ato uint32
-pkg syscall (linux-amd64-cgo), type TCPInfo struct, Backoff uint8
-pkg syscall (linux-amd64-cgo), type TCPInfo struct, Ca_state uint8
-pkg syscall (linux-amd64-cgo), type TCPInfo struct, Fackets uint32
-pkg syscall (linux-amd64-cgo), type TCPInfo struct, Last_ack_recv uint32
-pkg syscall (linux-amd64-cgo), type TCPInfo struct, Last_ack_sent uint32
-pkg syscall (linux-amd64-cgo), type TCPInfo struct, Last_data_recv uint32
-pkg syscall (linux-amd64-cgo), type TCPInfo struct, Last_data_sent uint32
-pkg syscall (linux-amd64-cgo), type TCPInfo struct, Lost uint32
-pkg syscall (linux-amd64-cgo), type TCPInfo struct, Options uint8
-pkg syscall (linux-amd64-cgo), type TCPInfo struct, Pad_cgo_0 [2]uint8
-pkg syscall (linux-amd64-cgo), type TCPInfo struct, Pmtu uint32
-pkg syscall (linux-amd64-cgo), type TCPInfo struct, Probes uint8
-pkg syscall (linux-amd64-cgo), type TCPInfo struct, Rcv_mss uint32
-pkg syscall (linux-amd64-cgo), type TCPInfo struct, Rcv_rtt uint32
-pkg syscall (linux-amd64-cgo), type TCPInfo struct, Rcv_space uint32
-pkg syscall (linux-amd64-cgo), type TCPInfo struct, Rcv_ssthresh uint32
-pkg syscall (linux-amd64-cgo), type TCPInfo struct, Reordering uint32
-pkg syscall (linux-amd64-cgo), type TCPInfo struct, Retrans uint32
-pkg syscall (linux-amd64-cgo), type TCPInfo struct, Retransmits uint8
-pkg syscall (linux-amd64-cgo), type TCPInfo struct, Rto uint32
-pkg syscall (linux-amd64-cgo), type TCPInfo struct, Rtt uint32
-pkg syscall (linux-amd64-cgo), type TCPInfo struct, Rttvar uint32
-pkg syscall (linux-amd64-cgo), type TCPInfo struct, Sacked uint32
-pkg syscall (linux-amd64-cgo), type TCPInfo struct, Snd_cwnd uint32
-pkg syscall (linux-amd64-cgo), type TCPInfo struct, Snd_mss uint32
-pkg syscall (linux-amd64-cgo), type TCPInfo struct, Snd_ssthresh uint32
-pkg syscall (linux-amd64-cgo), type TCPInfo struct, State uint8
-pkg syscall (linux-amd64-cgo), type TCPInfo struct, Total_retrans uint32
-pkg syscall (linux-amd64-cgo), type TCPInfo struct, Unacked uint32
-pkg syscall (linux-arm), const MSG_FASTOPEN ideal-int
-pkg syscall (linux-arm), const RTNLGRP_IPV4_IFADDR ideal-int
-pkg syscall (linux-arm), const RTNLGRP_IPV4_MROUTE ideal-int
-pkg syscall (linux-arm), const RTNLGRP_IPV4_ROUTE ideal-int
-pkg syscall (linux-arm), const RTNLGRP_IPV4_RULE ideal-int
-pkg syscall (linux-arm), const RTNLGRP_IPV6_IFADDR ideal-int
-pkg syscall (linux-arm), const RTNLGRP_IPV6_IFINFO ideal-int
-pkg syscall (linux-arm), const RTNLGRP_IPV6_MROUTE ideal-int
-pkg syscall (linux-arm), const RTNLGRP_IPV6_PREFIX ideal-int
-pkg syscall (linux-arm), const RTNLGRP_IPV6_ROUTE ideal-int
-pkg syscall (linux-arm), const RTNLGRP_IPV6_RULE ideal-int
-pkg syscall (linux-arm), const RTNLGRP_LINK ideal-int
-pkg syscall (linux-arm), const RTNLGRP_ND_USEROPT ideal-int
-pkg syscall (linux-arm), const RTNLGRP_NEIGH ideal-int
-pkg syscall (linux-arm), const RTNLGRP_NONE ideal-int
-pkg syscall (linux-arm), const RTNLGRP_NOTIFY ideal-int
-pkg syscall (linux-arm), const RTNLGRP_TC ideal-int
-pkg syscall (linux-arm), const SizeofTCPInfo ideal-int
-pkg syscall (linux-arm), func Accept4(int, int) (int, Sockaddr, error)
-pkg syscall (linux-arm), func GetsockoptUcred(int, int, int) (*Ucred, error)
-pkg syscall (linux-arm), func Getxattr(string, string, []uint8) (int, error)
-pkg syscall (linux-arm), func Listxattr(string, []uint8) (int, error)
-pkg syscall (linux-arm), func Pipe2([]int, int) error
-pkg syscall (linux-arm), func PtraceSyscall(int, int) error
-pkg syscall (linux-arm), func Removexattr(string, string) error
-pkg syscall (linux-arm), func Setxattr(string, string, []uint8, int) error
-pkg syscall (linux-arm), func SlicePtrFromStrings([]string) ([]*uint8, error)
-pkg syscall (linux-arm), type SysProcAttr struct, Ctty int
-pkg syscall (linux-arm), type TCPInfo struct
-pkg syscall (linux-arm), type TCPInfo struct, Advmss uint32
-pkg syscall (linux-arm), type TCPInfo struct, Ato uint32
-pkg syscall (linux-arm), type TCPInfo struct, Backoff uint8
-pkg syscall (linux-arm), type TCPInfo struct, Ca_state uint8
-pkg syscall (linux-arm), type TCPInfo struct, Fackets uint32
-pkg syscall (linux-arm), type TCPInfo struct, Last_ack_recv uint32
-pkg syscall (linux-arm), type TCPInfo struct, Last_ack_sent uint32
-pkg syscall (linux-arm), type TCPInfo struct, Last_data_recv uint32
-pkg syscall (linux-arm), type TCPInfo struct, Last_data_sent uint32
-pkg syscall (linux-arm), type TCPInfo struct, Lost uint32
-pkg syscall (linux-arm), type TCPInfo struct, Options uint8
-pkg syscall (linux-arm), type TCPInfo struct, Pad_cgo_0 [2]uint8
-pkg syscall (linux-arm), type TCPInfo struct, Pmtu uint32
-pkg syscall (linux-arm), type TCPInfo struct, Probes uint8
-pkg syscall (linux-arm), type TCPInfo struct, Rcv_mss uint32
-pkg syscall (linux-arm), type TCPInfo struct, Rcv_rtt uint32
-pkg syscall (linux-arm), type TCPInfo struct, Rcv_space uint32
-pkg syscall (linux-arm), type TCPInfo struct, Rcv_ssthresh uint32
-pkg syscall (linux-arm), type TCPInfo struct, Reordering uint32
-pkg syscall (linux-arm), type TCPInfo struct, Retrans uint32
-pkg syscall (linux-arm), type TCPInfo struct, Retransmits uint8
-pkg syscall (linux-arm), type TCPInfo struct, Rto uint32
-pkg syscall (linux-arm), type TCPInfo struct, Rtt uint32
-pkg syscall (linux-arm), type TCPInfo struct, Rttvar uint32
-pkg syscall (linux-arm), type TCPInfo struct, Sacked uint32
-pkg syscall (linux-arm), type TCPInfo struct, Snd_cwnd uint32
-pkg syscall (linux-arm), type TCPInfo struct, Snd_mss uint32
-pkg syscall (linux-arm), type TCPInfo struct, Snd_ssthresh uint32
-pkg syscall (linux-arm), type TCPInfo struct, State uint8
-pkg syscall (linux-arm), type TCPInfo struct, Total_retrans uint32
-pkg syscall (linux-arm), type TCPInfo struct, Unacked uint32
-pkg syscall (windows-386), const AI_CANONNAME ideal-int
-pkg syscall (windows-386), const AI_NUMERICHOST ideal-int
-pkg syscall (windows-386), const AI_PASSIVE ideal-int
-pkg syscall (windows-386), const CREATE_NEW_PROCESS_GROUP ideal-int
-pkg syscall (windows-386), const CTRL_BREAK_EVENT ideal-int
-pkg syscall (windows-386), const CTRL_C_EVENT ideal-int
-pkg syscall (windows-386), const ERROR_NOT_FOUND Errno
-pkg syscall (windows-386), const IOC_IN ideal-int
-pkg syscall (windows-386), const IOC_INOUT ideal-int
-pkg syscall (windows-386), const IOC_OUT ideal-int
-pkg syscall (windows-386), const IOC_WS2 ideal-int
-pkg syscall (windows-386), const SIO_GET_EXTENSION_FUNCTION_POINTER ideal-int
-pkg syscall (windows-386), const SO_UPDATE_CONNECT_CONTEXT ideal-int
-pkg syscall (windows-386), func CancelIoEx(Handle, *Overlapped) error
-pkg syscall (windows-386), func ConnectEx(Handle, Sockaddr, *uint8, uint32, *uint32, *Overlapped) error
-pkg syscall (windows-386), func FreeAddrInfoW(*AddrinfoW)
-pkg syscall (windows-386), func GetAddrInfoW(*uint16, *uint16, *AddrinfoW, **AddrinfoW) error
-pkg syscall (windows-386), func GetConsoleMode(Handle, *uint32) error
-pkg syscall (windows-386), func Getsockopt(Handle, int32, int32, *uint8, *int32) error
-pkg syscall (windows-386), func LoadCancelIoEx() error
-pkg syscall (windows-386), func LoadConnectEx() error
-pkg syscall (windows-386), func LoadGetAddrInfo() error
-pkg syscall (windows-386), func ReadConsole(Handle, *uint16, uint32, *uint32, *uint8) error
-pkg syscall (windows-386), func UTF16FromString(string) ([]uint16, error)
-pkg syscall (windows-386), func UTF16PtrFromString(string) (*uint16, error)
-pkg syscall (windows-386), func WriteConsole(Handle, *uint16, uint32, *uint32, *uint8) error
-pkg syscall (windows-386), type AddrinfoW struct
-pkg syscall (windows-386), type AddrinfoW struct, Addr uintptr
-pkg syscall (windows-386), type AddrinfoW struct, Addrlen uintptr
-pkg syscall (windows-386), type AddrinfoW struct, Canonname *uint16
-pkg syscall (windows-386), type AddrinfoW struct, Family int32
-pkg syscall (windows-386), type AddrinfoW struct, Flags int32
-pkg syscall (windows-386), type AddrinfoW struct, Next *AddrinfoW
-pkg syscall (windows-386), type AddrinfoW struct, Protocol int32
-pkg syscall (windows-386), type AddrinfoW struct, Socktype int32
-pkg syscall (windows-386), type GUID struct
-pkg syscall (windows-386), type GUID struct, Data1 uint32
-pkg syscall (windows-386), type GUID struct, Data2 uint16
-pkg syscall (windows-386), type GUID struct, Data3 uint16
-pkg syscall (windows-386), type GUID struct, Data4 [8]uint8
-pkg syscall (windows-386), type RawSockaddrInet6 struct, Family uint16
-pkg syscall (windows-386), type SysProcAttr struct, CreationFlags uint32
-pkg syscall (windows-386), var WSAID_CONNECTEX GUID
-pkg syscall (windows-amd64), const AI_CANONNAME ideal-int
-pkg syscall (windows-amd64), const AI_NUMERICHOST ideal-int
-pkg syscall (windows-amd64), const AI_PASSIVE ideal-int
-pkg syscall (windows-amd64), const CREATE_NEW_PROCESS_GROUP ideal-int
-pkg syscall (windows-amd64), const CTRL_BREAK_EVENT ideal-int
-pkg syscall (windows-amd64), const CTRL_C_EVENT ideal-int
-pkg syscall (windows-amd64), const ERROR_NOT_FOUND Errno
-pkg syscall (windows-amd64), const IOC_IN ideal-int
-pkg syscall (windows-amd64), const IOC_INOUT ideal-int
-pkg syscall (windows-amd64), const IOC_OUT ideal-int
-pkg syscall (windows-amd64), const IOC_WS2 ideal-int
-pkg syscall (windows-amd64), const SIO_GET_EXTENSION_FUNCTION_POINTER ideal-int
-pkg syscall (windows-amd64), const SO_UPDATE_CONNECT_CONTEXT ideal-int
-pkg syscall (windows-amd64), func CancelIoEx(Handle, *Overlapped) error
-pkg syscall (windows-amd64), func ConnectEx(Handle, Sockaddr, *uint8, uint32, *uint32, *Overlapped) error
-pkg syscall (windows-amd64), func FreeAddrInfoW(*AddrinfoW)
-pkg syscall (windows-amd64), func GetAddrInfoW(*uint16, *uint16, *AddrinfoW, **AddrinfoW) error
-pkg syscall (windows-amd64), func GetConsoleMode(Handle, *uint32) error
-pkg syscall (windows-amd64), func Getsockopt(Handle, int32, int32, *uint8, *int32) error
-pkg syscall (windows-amd64), func LoadCancelIoEx() error
-pkg syscall (windows-amd64), func LoadConnectEx() error
-pkg syscall (windows-amd64), func LoadGetAddrInfo() error
-pkg syscall (windows-amd64), func ReadConsole(Handle, *uint16, uint32, *uint32, *uint8) error
-pkg syscall (windows-amd64), func UTF16FromString(string) ([]uint16, error)
-pkg syscall (windows-amd64), func UTF16PtrFromString(string) (*uint16, error)
-pkg syscall (windows-amd64), func WriteConsole(Handle, *uint16, uint32, *uint32, *uint8) error
-pkg syscall (windows-amd64), type AddrinfoW struct
-pkg syscall (windows-amd64), type AddrinfoW struct, Addr uintptr
-pkg syscall (windows-amd64), type AddrinfoW struct, Addrlen uintptr
-pkg syscall (windows-amd64), type AddrinfoW struct, Canonname *uint16
-pkg syscall (windows-amd64), type AddrinfoW struct, Family int32
-pkg syscall (windows-amd64), type AddrinfoW struct, Flags int32
-pkg syscall (windows-amd64), type AddrinfoW struct, Next *AddrinfoW
-pkg syscall (windows-amd64), type AddrinfoW struct, Protocol int32
-pkg syscall (windows-amd64), type AddrinfoW struct, Socktype int32
-pkg syscall (windows-amd64), type GUID struct
-pkg syscall (windows-amd64), type GUID struct, Data1 uint32
-pkg syscall (windows-amd64), type GUID struct, Data2 uint16
-pkg syscall (windows-amd64), type GUID struct, Data3 uint16
-pkg syscall (windows-amd64), type GUID struct, Data4 [8]uint8
-pkg syscall (windows-amd64), type RawSockaddrInet6 struct, Family uint16
-pkg syscall (windows-amd64), type SysProcAttr struct, CreationFlags uint32
-pkg syscall (windows-amd64), var WSAID_CONNECTEX GUID
-pkg syscall, func BytePtrFromString(string) (*uint8, error)
-pkg syscall, func ByteSliceFromString(string) ([]uint8, error)
-pkg syscall, func NsecToTimespec(int64) Timespec
-pkg syscall, func TimespecToNsec(Timespec) int64
-pkg syscall, func UtimesNano(string, []Timespec) error
-pkg syscall, type RawSockaddrInet6 struct
-pkg syscall, type RawSockaddrInet6 struct, Addr [16]uint8
-pkg syscall, type RawSockaddrInet6 struct, Flowinfo uint32
-pkg syscall, type RawSockaddrInet6 struct, Port uint16
-pkg syscall, type RawSockaddrInet6 struct, Scope_id uint32
-pkg testing, func AllocsPerRun(int, func()) float64
-pkg testing, func Verbose() bool
-pkg testing, method (*B) ReportAllocs()
-pkg testing, method (*B) Skip(...interface{})
-pkg testing, method (*B) SkipNow()
-pkg testing, method (*B) Skipf(string, ...interface{})
-pkg testing, method (*B) Skipped() bool
-pkg testing, method (*T) Skip(...interface{})
-pkg testing, method (*T) SkipNow()
-pkg testing, method (*T) Skipf(string, ...interface{})
-pkg testing, method (*T) Skipped() bool
-pkg testing, method (BenchmarkResult) AllocedBytesPerOp() int64
-pkg testing, method (BenchmarkResult) AllocsPerOp() int64
-pkg testing, method (BenchmarkResult) MemString() string
-pkg testing, type BenchmarkResult struct, MemAllocs uint64
-pkg testing, type BenchmarkResult struct, MemBytes uint64
-pkg text/template/parse, const NodeChain NodeType
-pkg text/template/parse, const NodeNil NodeType
-pkg text/template/parse, method (*ChainNode) Add(string)
-pkg text/template/parse, method (*ChainNode) Copy() Node
-pkg text/template/parse, method (*ChainNode) String() string
-pkg text/template/parse, method (*IdentifierNode) SetPos(Pos) *IdentifierNode
-pkg text/template/parse, method (*NilNode) Copy() Node
-pkg text/template/parse, method (*NilNode) String() string
-pkg text/template/parse, method (*NilNode) Type() NodeType
-pkg text/template/parse, method (*Tree) ErrorContext(Node) (string, string)
-pkg text/template/parse, method (ActionNode) Position() Pos
-pkg text/template/parse, method (BoolNode) Position() Pos
-pkg text/template/parse, method (BranchNode) Position() Pos
-pkg text/template/parse, method (ChainNode) Position() Pos
-pkg text/template/parse, method (ChainNode) Type() NodeType
-pkg text/template/parse, method (CommandNode) Position() Pos
-pkg text/template/parse, method (DotNode) Position() Pos
-pkg text/template/parse, method (FieldNode) Position() Pos
-pkg text/template/parse, method (IdentifierNode) Position() Pos
-pkg text/template/parse, method (IfNode) Position() Pos
-pkg text/template/parse, method (ListNode) Position() Pos
-pkg text/template/parse, method (NilNode) Position() Pos
-pkg text/template/parse, method (NumberNode) Position() Pos
-pkg text/template/parse, method (PipeNode) Position() Pos
-pkg text/template/parse, method (Pos) Position() Pos
-pkg text/template/parse, method (RangeNode) Position() Pos
-pkg text/template/parse, method (StringNode) Position() Pos
-pkg text/template/parse, method (TemplateNode) Position() Pos
-pkg text/template/parse, method (TextNode) Position() Pos
-pkg text/template/parse, method (VariableNode) Position() Pos
-pkg text/template/parse, method (WithNode) Position() Pos
-pkg text/template/parse, type ActionNode struct, embedded Pos
-pkg text/template/parse, type BoolNode struct, embedded Pos
-pkg text/template/parse, type BranchNode struct, embedded Pos
-pkg text/template/parse, type ChainNode struct
-pkg text/template/parse, type ChainNode struct, Field []string
-pkg text/template/parse, type ChainNode struct, Node Node
-pkg text/template/parse, type ChainNode struct, embedded NodeType
-pkg text/template/parse, type ChainNode struct, embedded Pos
-pkg text/template/parse, type CommandNode struct, embedded Pos
-pkg text/template/parse, type DotNode struct
-pkg text/template/parse, type DotNode struct, embedded Pos
-pkg text/template/parse, type FieldNode struct, embedded Pos
-pkg text/template/parse, type IdentifierNode struct, embedded Pos
-pkg text/template/parse, type ListNode struct, embedded Pos
-pkg text/template/parse, type NilNode struct
-pkg text/template/parse, type NilNode struct, embedded Pos
-pkg text/template/parse, type Node interface, Position() Pos
-pkg text/template/parse, type Node interface, unexported methods
-pkg text/template/parse, type NumberNode struct, embedded Pos
-pkg text/template/parse, type PipeNode struct, embedded Pos
-pkg text/template/parse, type Pos int
-pkg text/template/parse, type StringNode struct, embedded Pos
-pkg text/template/parse, type TemplateNode struct, embedded Pos
-pkg text/template/parse, type TextNode struct, embedded Pos
-pkg text/template/parse, type Tree struct, ParseName string
-pkg text/template/parse, type VariableNode struct, embedded Pos
-pkg time, func ParseInLocation(string, string, *Location) (Time, error)
-pkg time, method (*Timer) Reset(Duration) bool
-pkg time, method (Time) Round(Duration) Time
-pkg time, method (Time) Truncate(Duration) Time
-pkg time, method (Time) YearDay() int
-pkg unicode, type RangeTable struct, LatinOffset int
-pkg unicode, var Chakma *RangeTable
-pkg unicode, var Meroitic_Cursive *RangeTable
-pkg unicode, var Meroitic_Hieroglyphs *RangeTable
-pkg unicode, var Miao *RangeTable
-pkg unicode, var Sharada *RangeTable
-pkg unicode, var Sora_Sompeng *RangeTable
-pkg unicode, var Takri *RangeTable
-pkg unicode/utf8, func ValidRune(int32) bool
diff --git a/doc/articles/godoc_documenting_go_code.html b/doc/articles/godoc_documenting_go_code.html
index 96ae7451d..3f4e3228c 100644
--- a/doc/articles/godoc_documenting_go_code.html
+++ b/doc/articles/godoc_documenting_go_code.html
@@ -83,11 +83,14 @@ godoc's output, with one notable exception. Top-level comments that begin with
the word <code>"BUG(who)"</code> are recognized as known bugs, and included in
the "Bugs" section of the package documentation. The "who" part should be the
user name of someone who could provide more information. For example, this is a
-known issue from the <a href="/pkg/bytes/#pkg-bugs"><code>bytes</code></a> package:
+known issue from the <a href="/pkg/sync/atomic/#pkg-note-BUG"><code>sync/atomic</code></a> package:
</p>
<pre>
-// BUG(r): The rule Title uses for word boundaries does not handle Unicode punctuation properly.
+// BUG(rsc): On x86-32, the 64-bit functions use instructions
+// unavailable before the Pentium MMX. On both ARM and x86-32, it is the
+// caller's responsibility to arrange for 64-bit alignment of 64-bit
+// words accessed atomically.
</pre>
<p>
diff --git a/doc/articles/image_package.html b/doc/articles/image_package.html
index ebe92a1ca..39a93ccda 100644
--- a/doc/articles/image_package.html
+++ b/doc/articles/image_package.html
@@ -130,7 +130,7 @@ much easier to type.
A <code>Rectangle</code> is inclusive at the top-left and exclusive at the
bottom-right. For a <code>Point p</code> and a <code>Rectangle r</code>,
<code>p.In(r)</code> if and only if
-<code>r.Min.X &lt;= p.X &amp;&amp; p.X &lt; r.Max.X</code>, and similarly for <code>Y</code>. This is analagous to how
+<code>r.Min.X &lt;= p.X &amp;&amp; p.X &lt; r.Max.X</code>, and similarly for <code>Y</code>. This is analogous to how
a slice <code>s[i0:i1]</code> is inclusive at the low end and exclusive at the
high end. (Unlike arrays and slices, a <code>Rectangle</code> often has a
non-zero origin.)
@@ -236,7 +236,7 @@ more complicated, to access these struct type's <code>Pix</code> field directly.
The slice-based <code>Image</code> implementations also provide a
<code>SubImage</code> method, which returns an <code>Image</code> backed by the
same array. Modifying the pixels of a sub-image will affect the pixels of the
-original image, analagous to how modifying the contents of a sub-slice
+original image, analogous to how modifying the contents of a sub-slice
<code>s[i0:i1]</code> will affect the contents of the original slice
<code>s</code>.
</p>
diff --git a/doc/articles/race_detector.html b/doc/articles/race_detector.html
index 30458ef0d..2d36f616e 100644
--- a/doc/articles/race_detector.html
+++ b/doc/articles/race_detector.html
@@ -34,7 +34,7 @@ func main() {
<h2 id="Usage">Usage</h2>
<p>
-To help diangose such bugs, Go includes a built-in data race detector.
+To help diagnose such bugs, Go includes a built-in data race detector.
To use it, add the <code>-race</code> flag to the go command:
</p>
@@ -142,7 +142,7 @@ $ GORACE="log_path=/tmp/race/report strip_path_prefix=/my/go/sources/" go test -
<p>
When you build with <code>-race</code> flag, the <code>go</code> command defines additional
-<a href="/pkg/go/build/#Build_Constraints">build tag</a> <code>race</code>.
+<a href="/pkg/go/build/#hdr-Build_Constraints">build tag</a> <code>race</code>.
You can use the tag to exclude some code and tests when running the race detector.
Some examples:
</p>
diff --git a/doc/code.html b/doc/code.html
index 2d63d4dc9..f64dd6a2a 100644
--- a/doc/code.html
+++ b/doc/code.html
@@ -76,11 +76,11 @@ src/
oauth_test.go # test source
github.com/nf/
streak/
- .git/ # git repository metadata
+ .git/ # git repository metadata
oauth.go # command source
streak.go # command source
todo/
- .git/ # git repository metadata
+ .git/ # git repository metadata
task/
task.go # package source
todo.go # command source
@@ -471,7 +471,7 @@ func TestSqrt(t *testing.T) {
const in, out = 4, 2
if x := Sqrt(in); x != out {
t.Errorf("Sqrt(%v) = %v, want %v", in, x, out)
- }
+ }
}
</pre>
@@ -528,7 +528,7 @@ fetch and behaves the same as <code>go install</code>.)
<p>
After issuing the above <code>go get</code> command, the workspace directory
-tree should now now look like this:
+tree should now look like this:
</p>
<pre>
diff --git a/doc/codewalk/urlpoll.go b/doc/codewalk/urlpoll.go
index e716c7e6c..1fb99581f 100644
--- a/doc/codewalk/urlpoll.go
+++ b/doc/codewalk/urlpoll.go
@@ -76,7 +76,7 @@ func (r *Resource) Poll() string {
return resp.Status
}
-// Sleep sleeps for an appropriate interval (dependant on error state)
+// Sleep sleeps for an appropriate interval (dependent on error state)
// before sending the Resource to done.
func (r *Resource) Sleep(done chan<- *Resource) {
time.Sleep(pollInterval + errTimeout*time.Duration(r.errCount))
diff --git a/doc/devel/weekly.html b/doc/devel/weekly.html
index f8d3ec6dd..c22064258 100644
--- a/doc/devel/weekly.html
+++ b/doc/devel/weekly.html
@@ -2035,7 +2035,7 @@ Other changes:
* spec: define order of multiple assignment.
* syscall/windows: dll function load and calling changes (thanks Alex Brainman).
* syscall: add #ifdefs to fix the manual corrections in ztypes_linux_arm.go (thanks Dave Cheney),
- adjust Mount to accomodate stricter FS implementations.
+ adjust Mount to accommodate stricter FS implementations.
* testing: fix time reported for failing tests.
* utf8: add Valid and ValidString.
* websocket: tweak hybi ReadHandshake to support Firefox (thanks Luca Greco).
@@ -4362,7 +4362,7 @@ The print/println bootstrapping functions now write to standard error.
To write to standard output, use fmt.Print[ln].
A new tool, govet, has been added to the Go distribution. Govet is a static
-checker for Go programs. At the moment, and for the forseeable future,
+checker for Go programs. At the moment, and for the foreseeable future,
it only checks arguments to print calls.
The cgo tool for writing Go bindings for C code has changed so that it no
diff --git a/doc/docs.html b/doc/docs.html
index 3112381c2..2dcab5d51 100644
--- a/doc/docs.html
+++ b/doc/docs.html
@@ -82,6 +82,12 @@ Answers to common questions about Go.
A guide for updating your code to work with Go 1.
</p>
+<h3 id="go1.1notes"><a href="/doc/go1.1.html">Go 1.1 Release Notes</a></h3>
+<p>
+A list of significant changes in Go 1.1, with instructions for updating your
+code where necessary.
+</p>
+
<h3 id="go1compat"><a href="/doc/go1compat.html">Go 1 and the Future of Go Programs</a></h3>
<p>
What Go 1 defines and the backwards-compatibility guarantees one can expect as
diff --git a/doc/effective_go.html b/doc/effective_go.html
index a1e13c0f6..1b3168683 100644
--- a/doc/effective_go.html
+++ b/doc/effective_go.html
@@ -403,8 +403,10 @@ if owner != user {
<p>
By convention, one-method interfaces are named by
-the method name plus the -er suffix: <code>Reader</code>,
-<code>Writer</code>, <code>Formatter</code> etc.
+the method name plus an -er suffix or similar modification
+to construct an agent noun: <code>Reader</code>,
+<code>Writer</code>, <code>Formatter</code>,
+<code>CloseNotifier</code> etc.
</p>
<p>
@@ -1570,7 +1572,7 @@ _, present := timeZone[tz]
<p>
To delete a map entry, use the <code>delete</code>
built-in function, whose arguments are the map and the key to be deleted.
-It's safe to do this this even if the key is already absent
+It's safe to do this even if the key is already absent
from the map.
</p>
<pre>
@@ -1805,7 +1807,7 @@ is different from our custom <code>Append</code> function above.
Schematically, it's like this:
</p>
<pre>
-func append(slice []<i>T</i>, elements...<i>T</i>) []<i>T</i>
+func append(slice []<i>T</i>, elements ...<i>T</i>) []<i>T</i>
</pre>
<p>
where <i>T</i> is a placeholder for any given type. You can't
@@ -2555,7 +2557,7 @@ if _, ok := val.(json.Marshaler); ok {
<p>
One place this situation arises is when it is necessary to guarantee within the package implementing the type that
-it it actually satisfies the interface.
+it actually satisfies the interface.
If a type—for example,
<code><a href="/pkg/encoding/json/#RawMessage">json.RawMessage</a></code>—needs
a custom its JSON representation, it should implement
@@ -2947,7 +2949,7 @@ func Serve(queue chan *Request) {
go func() {
process(req)
sem &lt;- 1
- }
+ }()
}
}</pre>
@@ -3414,7 +3416,7 @@ func Compile(str string) (regexp *Regexp, err error) {
<p>
If <code>doParse</code> panics, the recovery block will set the
return value to <code>nil</code>&mdash;deferred functions can modify
-named return values. It then will then check, in the assignment
+named return values. It will then check, in the assignment
to <code>err</code>, that the problem was a parse error by asserting
that it has the local type <code>Error</code>.
If it does not, the type assertion will fail, causing a run-time error
diff --git a/doc/gccgo_contribute.html b/doc/gccgo_contribute.html
index 4d268e02c..b2a0b651c 100644
--- a/doc/gccgo_contribute.html
+++ b/doc/gccgo_contribute.html
@@ -84,7 +84,7 @@ To run the gccgo test suite, run <code>make check-go</code> in your
build directory. This will run various tests
under <code>gcc/testsuite/go.*</code> and will also run
the <code>libgo</code> testsuite. This copy of the tests from the
-main Go repository is run using the DejaGNU script found in
+main Go repository is run using the DejaGNU script found
in <code>gcc/testsuite/go.test/go-test.exp</code>.
</p>
diff --git a/doc/go1.1.html b/doc/go1.1.html
index fac922910..6256ae201 100644
--- a/doc/go1.1.html
+++ b/doc/go1.1.html
@@ -215,7 +215,7 @@ i := int(int32(x))
<h3 id="heap">Heap size on 64-bit architectures</h3>
<p>
-On 64-bit architectures only, the maximum heap size has been enlarged substantially,
+On 64-bit architectures, the maximum heap size has been enlarged substantially,
from a few gigabytes to several tens of gigabytes.
(The exact details depend on the system and may change.)
</p>
@@ -272,10 +272,10 @@ values.
</p>
<p>
-The Unicode byte order marks U+FFFE and U+FEFF, encoded in UTF-8, are now permitted as the first
+The Unicode byte order mark U+FEFF, encoded in UTF-8, is now permitted as the first
character of a Go source file.
-Even though their appearance in the byte-order-free UTF-8 encoding is clearly unnecessary,
-some editors add them as a kind of "magic number" identifying a UTF-8 encoded file.
+Even though its appearance in the byte-order-free UTF-8 encoding is clearly unnecessary,
+some editors add the mark as a kind of "magic number" identifying a UTF-8 encoded file.
</p>
<p>
@@ -288,8 +288,9 @@ The byte-order-mark change is strictly backward-compatible.
<h3 id="race">Race detector</h3>
<p>
-A major addition to the tools is a <em>race detector</em>, a way to find
-bugs in programs caused by problems like concurrent changes to the same variable.
+A major addition to the tools is a <em>race detector</em>, a way to
+find bugs in programs caused by concurrent access of the same
+variable, where at least one of the accesses is a write.
This new facility is built into the <code>go</code> tool.
For now, it is only available on Linux, Mac OS X, and Windows systems with
64-bit x86 processors.
@@ -301,7 +302,8 @@ The race detector is documented in <a href="/doc/articles/race_detector.html">a
<h3 id="gc_asm">The gc assemblers</h3>
<p>
-Due to the change of the <a href="#int"><code>int</code></a> to 64 bits and some other changes,
+Due to the change of the <a href="#int"><code>int</code></a> to 64 bits and
+a new internal <a href="http://golang.org/s/go11func">representation of functions</a>,
the arrangement of function arguments on the stack has changed in the gc tool chain.
Functions written in assembly will need to be revised at least
to adjust frame pointer offsets.
@@ -336,7 +338,7 @@ can't load package: package foo/quxx: cannot find package "foo/quxx" in any of:
Second, the <code>go get</code> command no longer allows <code>$GOROOT</code>
as the default destination when downloading package source.
To use the <code>go get</code>
-command, a valid <code>$GOPATH</code> is now required.
+command, a <a href="/doc/code.html#GOPATH">valid <code>$GOPATH</code></a> is now required.
</p>
<pre>
@@ -358,7 +360,8 @@ package code.google.com/p/foo/quxx: cannot download, $GOPATH must not be set to
<h3 id="gotest">Changes to the go test command</h3>
<p>
-The <code>go test</code> command no longer deletes the binary when run with profiling enabled,
+The <a href="/cmd/go/#hdr-Test_packages"><code>go test</code></a>
+command no longer deletes the binary when run with profiling enabled,
to make it easier to analyze the profile.
The implementation sets the <code>-c</code> flag automatically, so after running,
</p>
@@ -372,7 +375,8 @@ the file <code>mypackage.test</code> will be left in the directory where <code>g
</p>
<p>
-The <code>go test</code> command can now generate profiling information
+The <a href="/cmd/go/#hdr-Test_packages"><code>go test</code></a>
+command can now generate profiling information
that reports where goroutines are blocked, that is,
where they tend to stall waiting for an event such as a channel communication.
The information is presented as a
@@ -394,15 +398,31 @@ To update pre-Go 1 code to Go 1.1, use a Go 1.0 tool chain
to convert the code to Go 1.0 first.
</p>
-<h3 id="gorun">Changes to the go run command</h3>
+<h3 id="tags">Build constraints</h3>
<p>
-The <code>go run</code> command now runs all files in the current working
-directory if no file arguments are listed. Also, the <code>go run</code>
-command now returns an error if test files are provided on the command line. In
-this sense, "<code>go run</code>" replaces "<code>go run *.go</code>".
+The "<code>go1.1</code>" tag has been added to the list of default
+<a href="/pkg/go/build/#hdr-Build_Constraints">build constraints</a>.
+This permits packages to take advantage of the new features in Go 1.1 while
+remaining compatible with earlier versions of Go.
</p>
+<p>
+To build a file only with Go 1.1 and above, add this build constraint:
+</p>
+
+<pre>
+// +build go1.1
+</pre>
+
+<p>
+To build a file only with Go 1.0.x, use the converse constraint:
+</p>
+
+<pre>
+// +build !go1.1
+</pre>
+
<h3 id="platforms">Additional platforms</h3>
<p>
@@ -674,6 +694,36 @@ The old package <code>exp/norm</code> has also been moved, but to a new reposito
be developed.
</p>
+<h3 id="new_packages">New packages</h3>
+
+<p>
+There are three new packages.
+</p>
+
+<ul>
+<li>
+The <a href="/pkg/go/format/"><code>go/format</code></a> package provides
+a convenient way for a program to access the formatting capabilities of the
+<a href="/cmd/go/#hdr-Run_gofmt_on_package_sources"><code>go fmt</code></a> command.
+It has two functions,
+<a href="/pkg/go/format/#Node"><code>Node</code></a> to format a Go parser
+<a href="/pkg/go/ast/#Node"><code>Node</code></a>,
+and
+<a href="/pkg/go/format/#Source"><code>Source</code></a>
+to reformat arbitrary Go source code into the standard format as provided by the
+<a href="/cmd/go/#hdr-Run_gofmt_on_package_sources"><code>go fmt</code></a> command.
+</li>
+
+<li>
+The <a href="/pkg/net/http/cookiejar/"><code>net/http/cookiejar</code></a> package provides the basics for managing HTTP cookies.
+</li>
+
+<li>
+The <a href="/pkg/runtime/race/"><code>runtime/race</code></a> package provides low-level facilities for data race detection.
+It is internal to the race detector and does not otherwise export any user-visible functionality.
+</li>
+</ul>
+
<h3 id="minor_library_changes">Minor changes to the library</h3>
<p>
@@ -777,17 +827,6 @@ command can filter or present according to the value of the <code>-notes</code>
</li>
<li>
-A new package, <a href="/pkg/go/format/"><code>go/format</code></a>, provides
-a convenient way for a program to access the formatting capabilities of <code>gofmt</code>.
-It has two functions,
-<a href="/pkg/go/format/#Node"><code>Node</code></a> to format a Go parser
-<a href="/pkg/go/ast/#Node"><code>Node</code></a>,
-and
-<a href="/pkg/go/format/#Source"><code>Source</code></a>
-to format arbitrary Go source code.
-</li>
-
-<li>
The undocumented and only partially implemented "noescape" feature of the
<a href="/pkg/html/template/"><code>html/template</code></a>
package has been removed; programs that depend on it will break.
@@ -802,6 +841,8 @@ reads progressive JPEG files and handles a few more subsampling configurations.
The <a href="/pkg/io/"><code>io</code></a> package now exports the
<a href="/pkg/io/#ByteWriter"><code>io.ByteWriter</code></a> interface to capture the common
functionality of writing a byte at a time.
+It also exports a new error, <a href="/pkg/io/#ErrNoProgress"><code>ErrNoProgress</code></a>,
+used to indicate a <code>Read</code> implementation is looping without delivering data.
</li>
<li>
@@ -811,7 +852,7 @@ for OS-specific logging features.
<li>
The <a href="/pkg/math/big/"><code>math/big</code></a> package's
-<a href="/pkg/math/big/#Int"><code>Int</code></a> type now has
+<a href="/pkg/math/big/#Int"><code>Int</code></a> type
now has methods
<a href="/pkg/math/big/#Int.MarshalJSON"><code>MarshalJSON</code></a>
and
@@ -837,6 +878,9 @@ has a new method for its
<a href="/pkg/mime/multipart/#Writer"><code>Writer</code></a>,
<a href="/pkg/mime/multipart/#Writer.SetBoundary"><code>SetBoundary</code></a>,
to define the boundary separator used to package the output.
+The <a href="/pkg/mime/multipart/#Reader"><code>Reader</code></a> also now
+transparently decodes any <code>quoted-printable</code> parts and removes
+the <code>Content-Transfer-Encoding</code> header when doing so.
</li>
<li>
@@ -903,7 +947,7 @@ matching the existing methods of <a href="/pkg/net/#TCPConn"><code>TCPConn</code
The <a href="/pkg/net/http/"><code>net/http</code></a> package includes several new additions.
<a href="/pkg/net/http/#ParseTime"><code>ParseTime</code></a> parses a time string, trying
several common HTTP time formats.
-The <a href="/pkg/net/http/#Request.PostFormValue">PostFormValue</a> method of
+The <a href="/pkg/net/http/#Request.PostFormValue"><code>PostFormValue</code></a> method of
<a href="/pkg/net/http/#Request"><code>Request</code></a> is like
<a href="/pkg/net/http/#Request.FormValue"><code>FormValue</code></a> but ignores URL parameters.
The <a href="/pkg/net/http/#CloseNotifier"><code>CloseNotifier</code></a> interface provides a mechanism
@@ -919,10 +963,6 @@ being fully consumed.
</li>
<li>
-The new <a href="/pkg/net/http/cookiejar/"><code>net/http/cookiejar</code></a> package provides the basics for managing HTTP cookies.
-</li>
-
-<li>
The <a href="/pkg/net/mail/"><code>net/mail</code></a> package has two new functions,
<a href="/pkg/net/mail/#ParseAddress"><code>ParseAddress</code></a> and
<a href="/pkg/net/mail/#ParseAddressList"><code>ParseAddressList</code></a>,
@@ -998,7 +1038,15 @@ type now implements the
</li>
<li>
-The <a href="/pkg/syscall/"><code>syscall</code></a> package has received many updates to make it more inclusive of constants and system calls for each supported operating system.
+The <a href="/pkg/syscall/"><code>syscall</code></a> package's
+<a href="/pkg/syscall/#Fchflags"><code>Fchflags</code></a> function on various BSDs
+(including Darwin) has changed signature.
+It now takes an int as the first parameter instead of a string.
+Since this API change fixes a bug, it is permitted by the Go 1 compatibility rules.
+</li>
+<li>
+The <a href="/pkg/syscall/"><code>syscall</code></a> package also has received many updates
+to make it more inclusive of constants and system calls for each supported operating system.
</li>
<li>
diff --git a/doc/go1.html b/doc/go1.html
index 491fd7bf7..2687827c0 100644
--- a/doc/go1.html
+++ b/doc/go1.html
@@ -998,9 +998,9 @@ Running <code>go</code> <code>fix</code> will perform the needed changes.
<p>
In Go 1, the
<a href="/pkg/crypto/x509/#CreateCertificate"><code>CreateCertificate</code></a>
-and
-<a href="/pkg/crypto/x509/#CreateCRL"><code>CreateCRL</code></a>
-functions in <code>crypto/x509</code> have been altered to take an
+function and
+<a href="/pkg/crypto/x509/#Certificate.CreateCRL"><code>CreateCRL</code></a>
+method in <code>crypto/x509</code> have been altered to take an
<code>interface{}</code> where they previously took a <code>*rsa.PublicKey</code>
or <code>*rsa.PrivateKey</code>. This will allow other public key algorithms
to be implemented in the future.
@@ -1183,7 +1183,7 @@ if set to <a href="/pkg/go/doc/#AllDecls"><code>AllDecls</code></a>, all declara
(not just exported ones) are considered.
The function <code>NewFileDoc</code> was removed, and the function
<code>CommentText</code> has become the method
-<a href="/pkg/go/ast/#Text"><code>Text</code></a> of
+<a href="/pkg/go/ast/#CommentGroup.Text"><code>Text</code></a> of
<a href="/pkg/go/ast/#CommentGroup"><code>ast.CommentGroup</code></a>.
</p>
@@ -1497,7 +1497,7 @@ to test common error properties, plus a few new error values
with more Go-like names, such as
<a href="/pkg/os/#ErrPermission"><code>ErrPermission</code></a>
and
-<a href="/pkg/os/#ErrNoEnv"><code>ErrNoEnv</code></a>.
+<a href="/pkg/os/#ErrNotExist"><code>ErrNotExist</code></a>.
</p>
<p>
diff --git a/doc/go_faq.html b/doc/go_faq.html
index 63ad66c51..62a564b6b 100644
--- a/doc/go_faq.html
+++ b/doc/go_faq.html
@@ -454,6 +454,34 @@ as when hosting an untrusted program, the implementation could interlock
map access.
</p>
+<h3 id="language_changes">
+Will you accept my language change?</h3>
+
+<p>
+People often suggest improvements to the language—the
+<a href="http://groups.google.com/group/golang-nuts">mailing list</a>
+contains a rich history of such discussions—but very few of these changes have
+been accepted.
+</p>
+
+<p>
+Although Go is an open source project, the language and libraries are protected
+by a <a href="/doc/go1compat.html">compatibility promise</a> that prevents
+changes that break existing programs.
+If your proposal violates the Go 1 specification we cannot even entertain the
+idea, regardless of its merit.
+A future major release of Go may be incompatible with Go 1, but we're not ready
+to start talking about what that might be.
+</p>
+
+<p>
+Even if your proposal is compatible with the Go 1 spec, it may be
+not be in the spirit of Go's design goals.
+The article <i><a href="http://talks.golang.org/2012/splash.article">Go
+at Google: Language Design in the Service of Software Engineering</a></i>
+explains Go's origins and the motivation behind its design.
+</p>
+
<h2 id="types">Types</h2>
<h3 id="Is_Go_an_object-oriented_language">
diff --git a/doc/go_spec.html b/doc/go_spec.html
index 214d1c0ac..3938ba3e6 100644
--- a/doc/go_spec.html
+++ b/doc/go_spec.html
@@ -1,6 +1,6 @@
<!--{
"Title": "The Go Programming Language Specification",
- "Subtitle": "Version of April 3, 2013",
+ "Subtitle": "Version of May 8, 2013",
"Path": "/ref/spec"
}-->
@@ -103,6 +103,7 @@ compiler may disallow the NUL character (U+0000) in the source text.
Implementation restriction: For compatibility with other tools, a
compiler may ignore a UTF-8-encoded byte order mark
(U+FEFF) if it is the first Unicode code point in the source text.
+A byte order mark may be disallowed anywhere else in the source.
</p>
<h3 id="Characters">Characters</h3>
@@ -3834,7 +3835,7 @@ const Θ float64 = 3/2 // Θ == 1.0 (type float64, 3/2 is integer divisio
const Π float64 = 3/2. // Π == 1.5 (type float64, 3/2. is float division)
const d = 1 &lt;&lt; 3.0 // d == 8 (untyped integer constant)
const e = 1.0 &lt;&lt; 3 // e == 8 (untyped integer constant)
-const f = int32(1) &lt;&lt; 33 // f == 0 (type int32)
+const f = int32(1) &lt;&lt; 33 // illegal (constant 8589934592 overflows int32)
const g = float64(2) &gt;&gt; 1 // illegal (float64(2) is a typed floating-point constant)
const h = "foo" &gt; "bar" // h == true (untyped boolean constant)
const j = true // j == true (untyped boolean constant)
diff --git a/doc/install.html b/doc/install.html
index f2e21b441..b66781942 100644
--- a/doc/install.html
+++ b/doc/install.html
@@ -166,7 +166,7 @@ the <code>GOROOT</code> environment variable to your chosen path.
</p>
<p>
-Add the <code>bin</code> subdirectory of your Go root (for example, <code>c:\Go\bin</code>) to to your <code>PATH</code> environment variable.
+Add the <code>bin</code> subdirectory of your Go root (for example, <code>c:\Go\bin</code>) to your <code>PATH</code> environment variable.
</p>
<h4 id="windows_msi">MSI installer (experimental)</h4>
diff --git a/doc/reference.html b/doc/reference.html
index 795c5e00e..241d75a43 100644
--- a/doc/reference.html
+++ b/doc/reference.html
@@ -43,7 +43,7 @@ same variable in a different goroutine.
These packages are part of the Go Project but outside the main Go tree.
They are developed under looser <a href="/doc/go1compat.html">compatibility
requirements</a> than the Go core.
-Install them with "<code><a href="/cmd/go/#Download_and_install_packages_and_dependencies">go get</a></code>".
+Install them with "<code><a href="/cmd/go/#hdr-Download_and_install_packages_and_dependencies">go get</a></code>".
</p>
<ul>
@@ -51,6 +51,10 @@ Install them with "<code><a href="/cmd/go/#Download_and_install_packages_and_dep
<li><a href="http://code.google.com/p/go/source/browse?repo=crypto"><code>code.google.com/p/go.crypto</code></a> [<a href="http://godoc.org/code.google.com/p/go.crypto">docs</a>]
<li><a href="http://code.google.com/p/go/source/browse?repo=image"><code>code.google.com/p/go.image</code></a> [<a href="http://godoc.org/code.google.com/p/go.image">docs</a>]
<li><a href="http://code.google.com/p/go/source/browse?repo=net"><code>code.google.com/p/go.net</code></a> [<a href="http://godoc.org/code.google.com/p/go.net">docs</a>]
+<li><a href="http://code.google.com/p/go/source/browse?repo=text"><code>code.google.com/p/go.text</code></a> [<a href="http://godoc.org/code.google.com/p/go.text">docs</a>]
+<li><a href="http://code.google.com/p/go/source/browse?repo=exp"><code>code.google.com/p/go.exp</code></a> [<a href="http://godoc.org/code.google.com/p/go.exp">docs</a>]
+<li><a href="http://code.google.com/p/go/source/browse?repo=talks"><code>code.google.com/p/go.talks</code></a> [<a href="http://godoc.org/code.google.com/p/go.talks">docs</a>]
+<li><a href="http://code.google.com/p/go/source/browse?repo=blog"><code>code.google.com/p/go.blog</code></a> [<a href="http://godoc.org/code.google.com/p/go.blog">docs</a>]
</ul>
<p>
diff --git a/doc/root.html b/doc/root.html
index 34915c025..81792671b 100644
--- a/doc/root.html
+++ b/doc/root.html
@@ -84,41 +84,38 @@ Linux, Mac OS X, Windows, and more.
<div style="clear: both;"></div>
-<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
-google.load("feeds", "1");
+
+function readableTime(t) {
+ var m = ["January", "February", "March", "April", "May", "June", "July",
+ "August", "September", "October", "November", "December"];
+ var p = t.substring(0, t.indexOf("T")).split("-");
+ var d = new Date(p[0], p[1]-1, p[2]);
+ return d.getDate() + " " + m[d.getMonth()] + " " + d.getFullYear();
+}
function feedLoaded(result) {
- if (result.error) {
- console.log(result.error);
- return;
- }
var blog = document.getElementById("blog");
var read = blog.getElementsByClassName("read")[0];
- for (var i = 0; i < result.feed.entries.length && i < 2; i++) {
- var entry = result.feed.entries[i];
+ for (var i = 0; i < result.length && i < 2; i++) {
+ var entry = result[i];
var title = document.createElement("a");
title.className = "title";
- title.href = entry.link;
- title.innerHTML = entry.title;
+ title.href = entry.Link;
+ title.innerHTML = entry.Title;
blog.insertBefore(title, read);
var extract = document.createElement("div");
extract.className = "extract";
- extract.innerHTML = entry.contentSnippet;
+ extract.innerHTML = entry.Summary;
blog.insertBefore(extract, read);
var when = document.createElement("div");
when.className = "when";
- var pub = entry.publishedDate.split(" ").slice(1,3).join(" ");
- when.innerHTML = "Published " + pub
+ when.innerHTML = "Published " + readableTime(entry.Time);
blog.insertBefore(when, read);
}
}
-function init() {
- // Load blog feed.
- var feed = new google.feeds.Feed("http://blog.golang.org/feeds/posts/default");
- feed.load(feedLoaded);
-
+$(function() {
// Set up playground.
playground({
"codeEl": "#learn .code",
@@ -128,7 +125,11 @@ function init() {
"shareRedirect": "http://play.golang.org/p/",
"toysEl": "#learn .toys select"
});
-}
-google.setOnLoadCallback(init);
+ // Load blog feed.
+ $('<script/>').attr('text', 'text/javascript')
+ .attr('src', 'http://blog.golang.org/.json?jsonp=feedLoaded')
+ .appendTo('body');
+});
+
</script>
diff --git a/lib/codereview/codereview.cfg b/lib/codereview/codereview.cfg
deleted file mode 100644
index 93b55c0a3..000000000
--- a/lib/codereview/codereview.cfg
+++ /dev/null
@@ -1 +0,0 @@
-defaultcc: golang-dev@googlegroups.com
diff --git a/lib/codereview/codereview.py b/lib/codereview/codereview.py
deleted file mode 100644
index f839263c5..000000000
--- a/lib/codereview/codereview.py
+++ /dev/null
@@ -1,3553 +0,0 @@
-# coding=utf-8
-# (The line above is necessary so that I can use 世界 in the
-# *comment* below without Python getting all bent out of shape.)
-
-# Copyright 2007-2009 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-'''Mercurial interface to codereview.appspot.com.
-
-To configure, set the following options in
-your repository's .hg/hgrc file.
-
- [extensions]
- codereview = /path/to/codereview.py
-
- [codereview]
- server = codereview.appspot.com
-
-The server should be running Rietveld; see http://code.google.com/p/rietveld/.
-
-In addition to the new commands, this extension introduces
-the file pattern syntax @nnnnnn, where nnnnnn is a change list
-number, to mean the files included in that change list, which
-must be associated with the current client.
-
-For example, if change 123456 contains the files x.go and y.go,
-"hg diff @123456" is equivalent to"hg diff x.go y.go".
-'''
-
-import sys
-
-if __name__ == "__main__":
- print >>sys.stderr, "This is a Mercurial extension and should not be invoked directly."
- sys.exit(2)
-
-# We require Python 2.6 for the json package.
-if sys.version < '2.6':
- print >>sys.stderr, "The codereview extension requires Python 2.6 or newer."
- print >>sys.stderr, "You are running Python " + sys.version
- sys.exit(2)
-
-import json
-import os
-import re
-import stat
-import subprocess
-import threading
-import time
-
-from mercurial import commands as hg_commands
-from mercurial import util as hg_util
-
-defaultcc = None
-codereview_disabled = None
-real_rollback = None
-releaseBranch = None
-server = "codereview.appspot.com"
-server_url_base = None
-
-#######################################################################
-# Normally I would split this into multiple files, but it simplifies
-# import path headaches to keep it all in one file. Sorry.
-# The different parts of the file are separated by banners like this one.
-
-#######################################################################
-# Helpers
-
-def RelativePath(path, cwd):
- n = len(cwd)
- if path.startswith(cwd) and path[n] == '/':
- return path[n+1:]
- return path
-
-def Sub(l1, l2):
- return [l for l in l1 if l not in l2]
-
-def Add(l1, l2):
- l = l1 + Sub(l2, l1)
- l.sort()
- return l
-
-def Intersect(l1, l2):
- return [l for l in l1 if l in l2]
-
-#######################################################################
-# RE: UNICODE STRING HANDLING
-#
-# Python distinguishes between the str (string of bytes)
-# and unicode (string of code points) types. Most operations
-# work on either one just fine, but some (like regexp matching)
-# require unicode, and others (like write) require str.
-#
-# As befits the language, Python hides the distinction between
-# unicode and str by converting between them silently, but
-# *only* if all the bytes/code points involved are 7-bit ASCII.
-# This means that if you're not careful, your program works
-# fine on "hello, world" and fails on "hello, 世界". And of course,
-# the obvious way to be careful - use static types - is unavailable.
-# So the only way is trial and error to find where to put explicit
-# conversions.
-#
-# Because more functions do implicit conversion to str (string of bytes)
-# than do implicit conversion to unicode (string of code points),
-# the convention in this module is to represent all text as str,
-# converting to unicode only when calling a unicode-only function
-# and then converting back to str as soon as possible.
-
-def typecheck(s, t):
- if type(s) != t:
- raise hg_util.Abort("type check failed: %s has type %s != %s" % (repr(s), type(s), t))
-
-# If we have to pass unicode instead of str, ustr does that conversion clearly.
-def ustr(s):
- typecheck(s, str)
- return s.decode("utf-8")
-
-# Even with those, Mercurial still sometimes turns unicode into str
-# and then tries to use it as ascii. Change Mercurial's default.
-def set_mercurial_encoding_to_utf8():
- from mercurial import encoding
- encoding.encoding = 'utf-8'
-
-set_mercurial_encoding_to_utf8()
-
-# Even with those we still run into problems.
-# I tried to do things by the book but could not convince
-# Mercurial to let me check in a change with UTF-8 in the
-# CL description or author field, no matter how many conversions
-# between str and unicode I inserted and despite changing the
-# default encoding. I'm tired of this game, so set the default
-# encoding for all of Python to 'utf-8', not 'ascii'.
-def default_to_utf8():
- import sys
- stdout, __stdout__ = sys.stdout, sys.__stdout__
- reload(sys) # site.py deleted setdefaultencoding; get it back
- sys.stdout, sys.__stdout__ = stdout, __stdout__
- sys.setdefaultencoding('utf-8')
-
-default_to_utf8()
-
-#######################################################################
-# Status printer for long-running commands
-
-global_status = None
-
-def set_status(s):
- if verbosity > 0:
- print >>sys.stderr, time.asctime(), s
- global global_status
- global_status = s
-
-class StatusThread(threading.Thread):
- def __init__(self):
- threading.Thread.__init__(self)
- def run(self):
- # pause a reasonable amount of time before
- # starting to display status messages, so that
- # most hg commands won't ever see them.
- time.sleep(30)
-
- # now show status every 15 seconds
- while True:
- time.sleep(15 - time.time() % 15)
- s = global_status
- if s is None:
- continue
- if s == "":
- s = "(unknown status)"
- print >>sys.stderr, time.asctime(), s
-
-def start_status_thread():
- t = StatusThread()
- t.setDaemon(True) # allowed to exit if t is still running
- t.start()
-
-#######################################################################
-# Change list parsing.
-#
-# Change lists are stored in .hg/codereview/cl.nnnnnn
-# where nnnnnn is the number assigned by the code review server.
-# Most data about a change list is stored on the code review server
-# too: the description, reviewer, and cc list are all stored there.
-# The only thing in the cl.nnnnnn file is the list of relevant files.
-# Also, the existence of the cl.nnnnnn file marks this repository
-# as the one where the change list lives.
-
-emptydiff = """Index: ~rietveld~placeholder~
-===================================================================
-diff --git a/~rietveld~placeholder~ b/~rietveld~placeholder~
-new file mode 100644
-"""
-
-class CL(object):
- def __init__(self, name):
- typecheck(name, str)
- self.name = name
- self.desc = ''
- self.files = []
- self.reviewer = []
- self.cc = []
- self.url = ''
- self.local = False
- self.web = False
- self.copied_from = None # None means current user
- self.mailed = False
- self.private = False
- self.lgtm = []
-
- def DiskText(self):
- cl = self
- s = ""
- if cl.copied_from:
- s += "Author: " + cl.copied_from + "\n\n"
- if cl.private:
- s += "Private: " + str(self.private) + "\n"
- s += "Mailed: " + str(self.mailed) + "\n"
- s += "Description:\n"
- s += Indent(cl.desc, "\t")
- s += "Files:\n"
- for f in cl.files:
- s += "\t" + f + "\n"
- typecheck(s, str)
- return s
-
- def EditorText(self):
- cl = self
- s = _change_prolog
- s += "\n"
- if cl.copied_from:
- s += "Author: " + cl.copied_from + "\n"
- if cl.url != '':
- s += 'URL: ' + cl.url + ' # cannot edit\n\n'
- if cl.private:
- s += "Private: True\n"
- s += "Reviewer: " + JoinComma(cl.reviewer) + "\n"
- s += "CC: " + JoinComma(cl.cc) + "\n"
- s += "\n"
- s += "Description:\n"
- if cl.desc == '':
- s += "\t<enter description here>\n"
- else:
- s += Indent(cl.desc, "\t")
- s += "\n"
- if cl.local or cl.name == "new":
- s += "Files:\n"
- for f in cl.files:
- s += "\t" + f + "\n"
- s += "\n"
- typecheck(s, str)
- return s
-
- def PendingText(self, quick=False):
- cl = self
- s = cl.name + ":" + "\n"
- s += Indent(cl.desc, "\t")
- s += "\n"
- if cl.copied_from:
- s += "\tAuthor: " + cl.copied_from + "\n"
- if not quick:
- s += "\tReviewer: " + JoinComma(cl.reviewer) + "\n"
- for (who, line) in cl.lgtm:
- s += "\t\t" + who + ": " + line + "\n"
- s += "\tCC: " + JoinComma(cl.cc) + "\n"
- s += "\tFiles:\n"
- for f in cl.files:
- s += "\t\t" + f + "\n"
- typecheck(s, str)
- return s
-
- def Flush(self, ui, repo):
- if self.name == "new":
- self.Upload(ui, repo, gofmt_just_warn=True, creating=True)
- dir = CodeReviewDir(ui, repo)
- path = dir + '/cl.' + self.name
- f = open(path+'!', "w")
- f.write(self.DiskText())
- f.close()
- if sys.platform == "win32" and os.path.isfile(path):
- os.remove(path)
- os.rename(path+'!', path)
- if self.web and not self.copied_from:
- EditDesc(self.name, desc=self.desc,
- reviewers=JoinComma(self.reviewer), cc=JoinComma(self.cc),
- private=self.private)
-
- def Delete(self, ui, repo):
- dir = CodeReviewDir(ui, repo)
- os.unlink(dir + "/cl." + self.name)
-
- def Subject(self):
- s = line1(self.desc)
- if len(s) > 60:
- s = s[0:55] + "..."
- if self.name != "new":
- s = "code review %s: %s" % (self.name, s)
- typecheck(s, str)
- return s
-
- def Upload(self, ui, repo, send_mail=False, gofmt=True, gofmt_just_warn=False, creating=False, quiet=False):
- if not self.files and not creating:
- ui.warn("no files in change list\n")
- if ui.configbool("codereview", "force_gofmt", True) and gofmt:
- CheckFormat(ui, repo, self.files, just_warn=gofmt_just_warn)
- set_status("uploading CL metadata + diffs")
- os.chdir(repo.root)
- form_fields = [
- ("content_upload", "1"),
- ("reviewers", JoinComma(self.reviewer)),
- ("cc", JoinComma(self.cc)),
- ("description", self.desc),
- ("base_hashes", ""),
- ]
-
- if self.name != "new":
- form_fields.append(("issue", self.name))
- vcs = None
- # We do not include files when creating the issue,
- # because we want the patch sets to record the repository
- # and base revision they are diffs against. We use the patch
- # set message for that purpose, but there is no message with
- # the first patch set. Instead the message gets used as the
- # new CL's overall subject. So omit the diffs when creating
- # and then we'll run an immediate upload.
- # This has the effect that every CL begins with an empty "Patch set 1".
- if self.files and not creating:
- vcs = MercurialVCS(upload_options, ui, repo)
- data = vcs.GenerateDiff(self.files)
- files = vcs.GetBaseFiles(data)
- if len(data) > MAX_UPLOAD_SIZE:
- uploaded_diff_file = []
- form_fields.append(("separate_patches", "1"))
- else:
- uploaded_diff_file = [("data", "data.diff", data)]
- else:
- uploaded_diff_file = [("data", "data.diff", emptydiff)]
-
- if vcs and self.name != "new":
- form_fields.append(("subject", "diff -r " + vcs.base_rev + " " + ui.expandpath("default")))
- else:
- # First upload sets the subject for the CL itself.
- form_fields.append(("subject", self.Subject()))
- ctype, body = EncodeMultipartFormData(form_fields, uploaded_diff_file)
- response_body = MySend("/upload", body, content_type=ctype)
- patchset = None
- msg = response_body
- lines = msg.splitlines()
- if len(lines) >= 2:
- msg = lines[0]
- patchset = lines[1].strip()
- patches = [x.split(" ", 1) for x in lines[2:]]
- if response_body.startswith("Issue updated.") and quiet:
- pass
- else:
- ui.status(msg + "\n")
- set_status("uploaded CL metadata + diffs")
- if not response_body.startswith("Issue created.") and not response_body.startswith("Issue updated."):
- raise hg_util.Abort("failed to update issue: " + response_body)
- issue = msg[msg.rfind("/")+1:]
- self.name = issue
- if not self.url:
- self.url = server_url_base + self.name
- if not uploaded_diff_file:
- set_status("uploading patches")
- patches = UploadSeparatePatches(issue, rpc, patchset, data, upload_options)
- if vcs:
- set_status("uploading base files")
- vcs.UploadBaseFiles(issue, rpc, patches, patchset, upload_options, files)
- if send_mail:
- set_status("sending mail")
- MySend("/" + issue + "/mail", payload="")
- self.web = True
- set_status("flushing changes to disk")
- self.Flush(ui, repo)
- return
-
- def Mail(self, ui, repo):
- pmsg = "Hello " + JoinComma(self.reviewer)
- if self.cc:
- pmsg += " (cc: %s)" % (', '.join(self.cc),)
- pmsg += ",\n"
- pmsg += "\n"
- repourl = ui.expandpath("default")
- if not self.mailed:
- pmsg += "I'd like you to review this change to\n" + repourl + "\n"
- else:
- pmsg += "Please take another look.\n"
- typecheck(pmsg, str)
- PostMessage(ui, self.name, pmsg, subject=self.Subject())
- self.mailed = True
- self.Flush(ui, repo)
-
-def GoodCLName(name):
- typecheck(name, str)
- return re.match("^[0-9]+$", name)
-
-def ParseCL(text, name):
- typecheck(text, str)
- typecheck(name, str)
- sname = None
- lineno = 0
- sections = {
- 'Author': '',
- 'Description': '',
- 'Files': '',
- 'URL': '',
- 'Reviewer': '',
- 'CC': '',
- 'Mailed': '',
- 'Private': '',
- }
- for line in text.split('\n'):
- lineno += 1
- line = line.rstrip()
- if line != '' and line[0] == '#':
- continue
- if line == '' or line[0] == ' ' or line[0] == '\t':
- if sname == None and line != '':
- return None, lineno, 'text outside section'
- if sname != None:
- sections[sname] += line + '\n'
- continue
- p = line.find(':')
- if p >= 0:
- s, val = line[:p].strip(), line[p+1:].strip()
- if s in sections:
- sname = s
- if val != '':
- sections[sname] += val + '\n'
- continue
- return None, lineno, 'malformed section header'
-
- for k in sections:
- sections[k] = StripCommon(sections[k]).rstrip()
-
- cl = CL(name)
- if sections['Author']:
- cl.copied_from = sections['Author']
- cl.desc = sections['Description']
- for line in sections['Files'].split('\n'):
- i = line.find('#')
- if i >= 0:
- line = line[0:i].rstrip()
- line = line.strip()
- if line == '':
- continue
- cl.files.append(line)
- cl.reviewer = SplitCommaSpace(sections['Reviewer'])
- cl.cc = SplitCommaSpace(sections['CC'])
- cl.url = sections['URL']
- if sections['Mailed'] != 'False':
- # Odd default, but avoids spurious mailings when
- # reading old CLs that do not have a Mailed: line.
- # CLs created with this update will always have
- # Mailed: False on disk.
- cl.mailed = True
- if sections['Private'] in ('True', 'true', 'Yes', 'yes'):
- cl.private = True
- if cl.desc == '<enter description here>':
- cl.desc = ''
- return cl, 0, ''
-
-def SplitCommaSpace(s):
- typecheck(s, str)
- s = s.strip()
- if s == "":
- return []
- return re.split(", *", s)
-
-def CutDomain(s):
- typecheck(s, str)
- i = s.find('@')
- if i >= 0:
- s = s[0:i]
- return s
-
-def JoinComma(l):
- for s in l:
- typecheck(s, str)
- return ", ".join(l)
-
-def ExceptionDetail():
- s = str(sys.exc_info()[0])
- if s.startswith("<type '") and s.endswith("'>"):
- s = s[7:-2]
- elif s.startswith("<class '") and s.endswith("'>"):
- s = s[8:-2]
- arg = str(sys.exc_info()[1])
- if len(arg) > 0:
- s += ": " + arg
- return s
-
-def IsLocalCL(ui, repo, name):
- return GoodCLName(name) and os.access(CodeReviewDir(ui, repo) + "/cl." + name, 0)
-
-# Load CL from disk and/or the web.
-def LoadCL(ui, repo, name, web=True):
- typecheck(name, str)
- set_status("loading CL " + name)
- if not GoodCLName(name):
- return None, "invalid CL name"
- dir = CodeReviewDir(ui, repo)
- path = dir + "cl." + name
- if os.access(path, 0):
- ff = open(path)
- text = ff.read()
- ff.close()
- cl, lineno, err = ParseCL(text, name)
- if err != "":
- return None, "malformed CL data: "+err
- cl.local = True
- else:
- cl = CL(name)
- if web:
- set_status("getting issue metadata from web")
- d = JSONGet(ui, "/api/" + name + "?messages=true")
- set_status(None)
- if d is None:
- return None, "cannot load CL %s from server" % (name,)
- if 'owner_email' not in d or 'issue' not in d or str(d['issue']) != name:
- return None, "malformed response loading CL data from code review server"
- cl.dict = d
- cl.reviewer = d.get('reviewers', [])
- cl.cc = d.get('cc', [])
- if cl.local and cl.copied_from and cl.desc:
- # local copy of CL written by someone else
- # and we saved a description. use that one,
- # so that committers can edit the description
- # before doing hg submit.
- pass
- else:
- cl.desc = d.get('description', "")
- cl.url = server_url_base + name
- cl.web = True
- cl.private = d.get('private', False) != False
- cl.lgtm = []
- for m in d.get('messages', []):
- if m.get('approval', False) == True or m.get('disapproval', False) == True:
- who = re.sub('@.*', '', m.get('sender', ''))
- text = re.sub("\n(.|\n)*", '', m.get('text', ''))
- cl.lgtm.append((who, text))
-
- set_status("loaded CL " + name)
- return cl, ''
-
-class LoadCLThread(threading.Thread):
- def __init__(self, ui, repo, dir, f, web):
- threading.Thread.__init__(self)
- self.ui = ui
- self.repo = repo
- self.dir = dir
- self.f = f
- self.web = web
- self.cl = None
- def run(self):
- cl, err = LoadCL(self.ui, self.repo, self.f[3:], web=self.web)
- if err != '':
- self.ui.warn("loading "+self.dir+self.f+": " + err + "\n")
- return
- self.cl = cl
-
-# Load all the CLs from this repository.
-def LoadAllCL(ui, repo, web=True):
- dir = CodeReviewDir(ui, repo)
- m = {}
- files = [f for f in os.listdir(dir) if f.startswith('cl.')]
- if not files:
- return m
- active = []
- first = True
- for f in files:
- t = LoadCLThread(ui, repo, dir, f, web)
- t.start()
- if web and first:
- # first request: wait in case it needs to authenticate
- # otherwise we get lots of user/password prompts
- # running in parallel.
- t.join()
- if t.cl:
- m[t.cl.name] = t.cl
- first = False
- else:
- active.append(t)
- for t in active:
- t.join()
- if t.cl:
- m[t.cl.name] = t.cl
- return m
-
-# Find repository root. On error, ui.warn and return None
-def RepoDir(ui, repo):
- url = repo.url();
- if not url.startswith('file:'):
- ui.warn("repository %s is not in local file system\n" % (url,))
- return None
- url = url[5:]
- if url.endswith('/'):
- url = url[:-1]
- typecheck(url, str)
- return url
-
-# Find (or make) code review directory. On error, ui.warn and return None
-def CodeReviewDir(ui, repo):
- dir = RepoDir(ui, repo)
- if dir == None:
- return None
- dir += '/.hg/codereview/'
- if not os.path.isdir(dir):
- try:
- os.mkdir(dir, 0700)
- except:
- ui.warn('cannot mkdir %s: %s\n' % (dir, ExceptionDetail()))
- return None
- typecheck(dir, str)
- return dir
-
-# Turn leading tabs into spaces, so that the common white space
-# prefix doesn't get confused when people's editors write out
-# some lines with spaces, some with tabs. Only a heuristic
-# (some editors don't use 8 spaces either) but a useful one.
-def TabsToSpaces(line):
- i = 0
- while i < len(line) and line[i] == '\t':
- i += 1
- return ' '*(8*i) + line[i:]
-
-# Strip maximal common leading white space prefix from text
-def StripCommon(text):
- typecheck(text, str)
- ws = None
- for line in text.split('\n'):
- line = line.rstrip()
- if line == '':
- continue
- line = TabsToSpaces(line)
- white = line[:len(line)-len(line.lstrip())]
- if ws == None:
- ws = white
- else:
- common = ''
- for i in range(min(len(white), len(ws))+1):
- if white[0:i] == ws[0:i]:
- common = white[0:i]
- ws = common
- if ws == '':
- break
- if ws == None:
- return text
- t = ''
- for line in text.split('\n'):
- line = line.rstrip()
- line = TabsToSpaces(line)
- if line.startswith(ws):
- line = line[len(ws):]
- if line == '' and t == '':
- continue
- t += line + '\n'
- while len(t) >= 2 and t[-2:] == '\n\n':
- t = t[:-1]
- typecheck(t, str)
- return t
-
-# Indent text with indent.
-def Indent(text, indent):
- typecheck(text, str)
- typecheck(indent, str)
- t = ''
- for line in text.split('\n'):
- t += indent + line + '\n'
- typecheck(t, str)
- return t
-
-# Return the first line of l
-def line1(text):
- typecheck(text, str)
- return text.split('\n')[0]
-
-_change_prolog = """# Change list.
-# Lines beginning with # are ignored.
-# Multi-line values should be indented.
-"""
-
-desc_re = '^(.+: |(tag )?(release|weekly)\.|fix build|undo CL)'
-
-desc_msg = '''Your CL description appears not to use the standard form.
-
-The first line of your change description is conventionally a
-one-line summary of the change, prefixed by the primary affected package,
-and is used as the subject for code review mail; the rest of the description
-elaborates.
-
-Examples:
-
- encoding/rot13: new package
-
- math: add IsInf, IsNaN
-
- net: fix cname in LookupHost
-
- unicode: update to Unicode 5.0.2
-
-'''
-
-def promptyesno(ui, msg):
- return ui.promptchoice(msg, ["&yes", "&no"], 0) == 0
-
-def promptremove(ui, repo, f):
- if promptyesno(ui, "hg remove %s (y/n)?" % (f,)):
- if hg_commands.remove(ui, repo, 'path:'+f) != 0:
- ui.warn("error removing %s" % (f,))
-
-def promptadd(ui, repo, f):
- if promptyesno(ui, "hg add %s (y/n)?" % (f,)):
- if hg_commands.add(ui, repo, 'path:'+f) != 0:
- ui.warn("error adding %s" % (f,))
-
-def EditCL(ui, repo, cl):
- set_status(None) # do not show status
- s = cl.EditorText()
- while True:
- s = ui.edit(s, ui.username())
-
- # We can't trust Mercurial + Python not to die before making the change,
- # so, by popular demand, just scribble the most recent CL edit into
- # $(hg root)/last-change so that if Mercurial does die, people
- # can look there for their work.
- try:
- f = open(repo.root+"/last-change", "w")
- f.write(s)
- f.close()
- except:
- pass
-
- clx, line, err = ParseCL(s, cl.name)
- if err != '':
- if not promptyesno(ui, "error parsing change list: line %d: %s\nre-edit (y/n)?" % (line, err)):
- return "change list not modified"
- continue
-
- # Check description.
- if clx.desc == '':
- if promptyesno(ui, "change list should have a description\nre-edit (y/n)?"):
- continue
- elif re.search('<enter reason for undo>', clx.desc):
- if promptyesno(ui, "change list description omits reason for undo\nre-edit (y/n)?"):
- continue
- elif not re.match(desc_re, clx.desc.split('\n')[0]):
- if promptyesno(ui, desc_msg + "re-edit (y/n)?"):
- continue
-
- # Check file list for files that need to be hg added or hg removed
- # or simply aren't understood.
- pats = ['path:'+f for f in clx.files]
- changed = hg_matchPattern(ui, repo, *pats, modified=True, added=True, removed=True)
- deleted = hg_matchPattern(ui, repo, *pats, deleted=True)
- unknown = hg_matchPattern(ui, repo, *pats, unknown=True)
- ignored = hg_matchPattern(ui, repo, *pats, ignored=True)
- clean = hg_matchPattern(ui, repo, *pats, clean=True)
- files = []
- for f in clx.files:
- if f in changed:
- files.append(f)
- continue
- if f in deleted:
- promptremove(ui, repo, f)
- files.append(f)
- continue
- if f in unknown:
- promptadd(ui, repo, f)
- files.append(f)
- continue
- if f in ignored:
- ui.warn("error: %s is excluded by .hgignore; omitting\n" % (f,))
- continue
- if f in clean:
- ui.warn("warning: %s is listed in the CL but unchanged\n" % (f,))
- files.append(f)
- continue
- p = repo.root + '/' + f
- if os.path.isfile(p):
- ui.warn("warning: %s is a file but not known to hg\n" % (f,))
- files.append(f)
- continue
- if os.path.isdir(p):
- ui.warn("error: %s is a directory, not a file; omitting\n" % (f,))
- continue
- ui.warn("error: %s does not exist; omitting\n" % (f,))
- clx.files = files
-
- cl.desc = clx.desc
- cl.reviewer = clx.reviewer
- cl.cc = clx.cc
- cl.files = clx.files
- cl.private = clx.private
- break
- return ""
-
-# For use by submit, etc. (NOT by change)
-# Get change list number or list of files from command line.
-# If files are given, make a new change list.
-def CommandLineCL(ui, repo, pats, opts, op="verb", defaultcc=None):
- if len(pats) > 0 and GoodCLName(pats[0]):
- if len(pats) != 1:
- return None, "cannot specify change number and file names"
- if opts.get('message'):
- return None, "cannot use -m with existing CL"
- cl, err = LoadCL(ui, repo, pats[0], web=True)
- if err != "":
- return None, err
- else:
- cl = CL("new")
- cl.local = True
- cl.files = ChangedFiles(ui, repo, pats, taken=Taken(ui, repo))
- if not cl.files:
- return None, "no files changed (use hg %s <number> to use existing CL)" % op
- if opts.get('reviewer'):
- cl.reviewer = Add(cl.reviewer, SplitCommaSpace(opts.get('reviewer')))
- if opts.get('cc'):
- cl.cc = Add(cl.cc, SplitCommaSpace(opts.get('cc')))
- if defaultcc:
- cl.cc = Add(cl.cc, defaultcc)
- if cl.name == "new":
- if opts.get('message'):
- cl.desc = opts.get('message')
- else:
- err = EditCL(ui, repo, cl)
- if err != '':
- return None, err
- return cl, ""
-
-#######################################################################
-# Change list file management
-
-# Return list of changed files in repository that match pats.
-# The patterns came from the command line, so we warn
-# if they have no effect or cannot be understood.
-def ChangedFiles(ui, repo, pats, taken=None):
- taken = taken or {}
- # Run each pattern separately so that we can warn about
- # patterns that didn't do anything useful.
- for p in pats:
- for f in hg_matchPattern(ui, repo, p, unknown=True):
- promptadd(ui, repo, f)
- for f in hg_matchPattern(ui, repo, p, removed=True):
- promptremove(ui, repo, f)
- files = hg_matchPattern(ui, repo, p, modified=True, added=True, removed=True)
- for f in files:
- if f in taken:
- ui.warn("warning: %s already in CL %s\n" % (f, taken[f].name))
- if not files:
- ui.warn("warning: %s did not match any modified files\n" % (p,))
-
- # Again, all at once (eliminates duplicates)
- l = hg_matchPattern(ui, repo, *pats, modified=True, added=True, removed=True)
- l.sort()
- if taken:
- l = Sub(l, taken.keys())
- return l
-
-# Return list of changed files in repository that match pats and still exist.
-def ChangedExistingFiles(ui, repo, pats, opts):
- l = hg_matchPattern(ui, repo, *pats, modified=True, added=True)
- l.sort()
- return l
-
-# Return list of files claimed by existing CLs
-def Taken(ui, repo):
- all = LoadAllCL(ui, repo, web=False)
- taken = {}
- for _, cl in all.items():
- for f in cl.files:
- taken[f] = cl
- return taken
-
-# Return list of changed files that are not claimed by other CLs
-def DefaultFiles(ui, repo, pats):
- return ChangedFiles(ui, repo, pats, taken=Taken(ui, repo))
-
-#######################################################################
-# File format checking.
-
-def CheckFormat(ui, repo, files, just_warn=False):
- set_status("running gofmt")
- CheckGofmt(ui, repo, files, just_warn)
- CheckTabfmt(ui, repo, files, just_warn)
-
-# Check that gofmt run on the list of files does not change them
-def CheckGofmt(ui, repo, files, just_warn):
- files = gofmt_required(files)
- if not files:
- return
- cwd = os.getcwd()
- files = [RelativePath(repo.root + '/' + f, cwd) for f in files]
- files = [f for f in files if os.access(f, 0)]
- if not files:
- return
- try:
- cmd = subprocess.Popen(["gofmt", "-l"] + files, shell=False, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=sys.platform != "win32")
- cmd.stdin.close()
- except:
- raise hg_util.Abort("gofmt: " + ExceptionDetail())
- data = cmd.stdout.read()
- errors = cmd.stderr.read()
- cmd.wait()
- set_status("done with gofmt")
- if len(errors) > 0:
- ui.warn("gofmt errors:\n" + errors.rstrip() + "\n")
- return
- if len(data) > 0:
- msg = "gofmt needs to format these files (run hg gofmt):\n" + Indent(data, "\t").rstrip()
- if just_warn:
- ui.warn("warning: " + msg + "\n")
- else:
- raise hg_util.Abort(msg)
- return
-
-# Check that *.[chys] files indent using tabs.
-def CheckTabfmt(ui, repo, files, just_warn):
- files = [f for f in files if f.startswith('src/') and re.search(r"\.[chys]$", f) and not re.search(r"\.tab\.[ch]$", f)]
- if not files:
- return
- cwd = os.getcwd()
- files = [RelativePath(repo.root + '/' + f, cwd) for f in files]
- files = [f for f in files if os.access(f, 0)]
- badfiles = []
- for f in files:
- try:
- for line in open(f, 'r'):
- # Four leading spaces is enough to complain about,
- # except that some Plan 9 code uses four spaces as the label indent,
- # so allow that.
- if line.startswith(' ') and not re.match(' [A-Za-z0-9_]+:', line):
- badfiles.append(f)
- break
- except:
- # ignore cannot open file, etc.
- pass
- if len(badfiles) > 0:
- msg = "these files use spaces for indentation (use tabs instead):\n\t" + "\n\t".join(badfiles)
- if just_warn:
- ui.warn("warning: " + msg + "\n")
- else:
- raise hg_util.Abort(msg)
- return
-
-#######################################################################
-# CONTRIBUTORS file parsing
-
-contributorsCache = None
-contributorsURL = None
-
-def ReadContributors(ui, repo):
- global contributorsCache
- if contributorsCache is not None:
- return contributorsCache
-
- try:
- if contributorsURL is not None:
- opening = contributorsURL
- f = urllib2.urlopen(contributorsURL)
- else:
- opening = repo.root + '/CONTRIBUTORS'
- f = open(repo.root + '/CONTRIBUTORS', 'r')
- except:
- ui.write("warning: cannot open %s: %s\n" % (opening, ExceptionDetail()))
- return
-
- contributors = {}
- for line in f:
- # CONTRIBUTORS is a list of lines like:
- # Person <email>
- # Person <email> <alt-email>
- # The first email address is the one used in commit logs.
- if line.startswith('#'):
- continue
- m = re.match(r"([^<>]+\S)\s+(<[^<>\s]+>)((\s+<[^<>\s]+>)*)\s*$", line)
- if m:
- name = m.group(1)
- email = m.group(2)[1:-1]
- contributors[email.lower()] = (name, email)
- for extra in m.group(3).split():
- contributors[extra[1:-1].lower()] = (name, email)
-
- contributorsCache = contributors
- return contributors
-
-def CheckContributor(ui, repo, user=None):
- set_status("checking CONTRIBUTORS file")
- user, userline = FindContributor(ui, repo, user, warn=False)
- if not userline:
- raise hg_util.Abort("cannot find %s in CONTRIBUTORS" % (user,))
- return userline
-
-def FindContributor(ui, repo, user=None, warn=True):
- if not user:
- user = ui.config("ui", "username")
- if not user:
- raise hg_util.Abort("[ui] username is not configured in .hgrc")
- user = user.lower()
- m = re.match(r".*<(.*)>", user)
- if m:
- user = m.group(1)
-
- contributors = ReadContributors(ui, repo)
- if user not in contributors:
- if warn:
- ui.warn("warning: cannot find %s in CONTRIBUTORS\n" % (user,))
- return user, None
-
- user, email = contributors[user]
- return email, "%s <%s>" % (user, email)
-
-#######################################################################
-# Mercurial helper functions.
-# Read http://mercurial.selenic.com/wiki/MercurialApi before writing any of these.
-# We use the ui.pushbuffer/ui.popbuffer + hg_commands.xxx tricks for all interaction
-# with Mercurial. It has proved the most stable as they make changes.
-
-hgversion = hg_util.version()
-
-# We require Mercurial 1.9 and suggest Mercurial 2.0.
-# The details of the scmutil package changed then,
-# so allowing earlier versions would require extra band-aids below.
-# Ubuntu 11.10 ships with Mercurial 1.9.1 as the default version.
-hg_required = "1.9"
-hg_suggested = "2.0"
-
-old_message = """
-
-The code review extension requires Mercurial """+hg_required+""" or newer.
-You are using Mercurial """+hgversion+""".
-
-To install a new Mercurial, visit http://mercurial.selenic.com/downloads/.
-"""
-
-linux_message = """
-You may need to clear your current Mercurial installation by running:
-
- sudo apt-get remove mercurial mercurial-common
- sudo rm -rf /etc/mercurial
-"""
-
-if hgversion < hg_required:
- msg = old_message
- if os.access("/etc/mercurial", 0):
- msg += linux_message
- raise hg_util.Abort(msg)
-
-from mercurial.hg import clean as hg_clean
-from mercurial import cmdutil as hg_cmdutil
-from mercurial import error as hg_error
-from mercurial import match as hg_match
-from mercurial import node as hg_node
-
-class uiwrap(object):
- def __init__(self, ui):
- self.ui = ui
- ui.pushbuffer()
- self.oldQuiet = ui.quiet
- ui.quiet = True
- self.oldVerbose = ui.verbose
- ui.verbose = False
- def output(self):
- ui = self.ui
- ui.quiet = self.oldQuiet
- ui.verbose = self.oldVerbose
- return ui.popbuffer()
-
-def to_slash(path):
- if sys.platform == "win32":
- return path.replace('\\', '/')
- return path
-
-def hg_matchPattern(ui, repo, *pats, **opts):
- w = uiwrap(ui)
- hg_commands.status(ui, repo, *pats, **opts)
- text = w.output()
- ret = []
- prefix = to_slash(os.path.realpath(repo.root))+'/'
- for line in text.split('\n'):
- f = line.split()
- if len(f) > 1:
- if len(pats) > 0:
- # Given patterns, Mercurial shows relative to cwd
- p = to_slash(os.path.realpath(f[1]))
- if not p.startswith(prefix):
- print >>sys.stderr, "File %s not in repo root %s.\n" % (p, prefix)
- else:
- ret.append(p[len(prefix):])
- else:
- # Without patterns, Mercurial shows relative to root (what we want)
- ret.append(to_slash(f[1]))
- return ret
-
-def hg_heads(ui, repo):
- w = uiwrap(ui)
- hg_commands.heads(ui, repo)
- return w.output()
-
-noise = [
- "",
- "resolving manifests",
- "searching for changes",
- "couldn't find merge tool hgmerge",
- "adding changesets",
- "adding manifests",
- "adding file changes",
- "all local heads known remotely",
-]
-
-def isNoise(line):
- line = str(line)
- for x in noise:
- if line == x:
- return True
- return False
-
-def hg_incoming(ui, repo):
- w = uiwrap(ui)
- ret = hg_commands.incoming(ui, repo, force=False, bundle="")
- if ret and ret != 1:
- raise hg_util.Abort(ret)
- return w.output()
-
-def hg_log(ui, repo, **opts):
- for k in ['date', 'keyword', 'rev', 'user']:
- if not opts.has_key(k):
- opts[k] = ""
- w = uiwrap(ui)
- ret = hg_commands.log(ui, repo, **opts)
- if ret:
- raise hg_util.Abort(ret)
- return w.output()
-
-def hg_outgoing(ui, repo, **opts):
- w = uiwrap(ui)
- ret = hg_commands.outgoing(ui, repo, **opts)
- if ret and ret != 1:
- raise hg_util.Abort(ret)
- return w.output()
-
-def hg_pull(ui, repo, **opts):
- w = uiwrap(ui)
- ui.quiet = False
- ui.verbose = True # for file list
- err = hg_commands.pull(ui, repo, **opts)
- for line in w.output().split('\n'):
- if isNoise(line):
- continue
- if line.startswith('moving '):
- line = 'mv ' + line[len('moving '):]
- if line.startswith('getting ') and line.find(' to ') >= 0:
- line = 'mv ' + line[len('getting '):]
- if line.startswith('getting '):
- line = '+ ' + line[len('getting '):]
- if line.startswith('removing '):
- line = '- ' + line[len('removing '):]
- ui.write(line + '\n')
- return err
-
-def hg_push(ui, repo, **opts):
- w = uiwrap(ui)
- ui.quiet = False
- ui.verbose = True
- err = hg_commands.push(ui, repo, **opts)
- for line in w.output().split('\n'):
- if not isNoise(line):
- ui.write(line + '\n')
- return err
-
-def hg_commit(ui, repo, *pats, **opts):
- return hg_commands.commit(ui, repo, *pats, **opts)
-
-#######################################################################
-# Mercurial precommit hook to disable commit except through this interface.
-
-commit_okay = False
-
-def precommithook(ui, repo, **opts):
- if commit_okay:
- return False # False means okay.
- ui.write("\ncodereview extension enabled; use mail, upload, or submit instead of commit\n\n")
- return True
-
-#######################################################################
-# @clnumber file pattern support
-
-# We replace scmutil.match with the MatchAt wrapper to add the @clnumber pattern.
-
-match_repo = None
-match_ui = None
-match_orig = None
-
-def InstallMatch(ui, repo):
- global match_repo
- global match_ui
- global match_orig
-
- match_ui = ui
- match_repo = repo
-
- from mercurial import scmutil
- match_orig = scmutil.match
- scmutil.match = MatchAt
-
-def MatchAt(ctx, pats=None, opts=None, globbed=False, default='relpath'):
- taken = []
- files = []
- pats = pats or []
- opts = opts or {}
-
- for p in pats:
- if p.startswith('@'):
- taken.append(p)
- clname = p[1:]
- if clname == "default":
- files = DefaultFiles(match_ui, match_repo, [])
- else:
- if not GoodCLName(clname):
- raise hg_util.Abort("invalid CL name " + clname)
- cl, err = LoadCL(match_repo.ui, match_repo, clname, web=False)
- if err != '':
- raise hg_util.Abort("loading CL " + clname + ": " + err)
- if not cl.files:
- raise hg_util.Abort("no files in CL " + clname)
- files = Add(files, cl.files)
- pats = Sub(pats, taken) + ['path:'+f for f in files]
-
- # work-around for http://selenic.com/hg/rev/785bbc8634f8
- if not hasattr(ctx, 'match'):
- ctx = ctx[None]
- return match_orig(ctx, pats=pats, opts=opts, globbed=globbed, default=default)
-
-#######################################################################
-# Commands added by code review extension.
-
-def hgcommand(f):
- return f
-
-#######################################################################
-# hg change
-
-@hgcommand
-def change(ui, repo, *pats, **opts):
- """create, edit or delete a change list
-
- Create, edit or delete a change list.
- A change list is a group of files to be reviewed and submitted together,
- plus a textual description of the change.
- Change lists are referred to by simple alphanumeric names.
-
- Changes must be reviewed before they can be submitted.
-
- In the absence of options, the change command opens the
- change list for editing in the default editor.
-
- Deleting a change with the -d or -D flag does not affect
- the contents of the files listed in that change. To revert
- the files listed in a change, use
-
- hg revert @123456
-
- before running hg change -d 123456.
- """
-
- if codereview_disabled:
- raise hg_util.Abort(codereview_disabled)
-
- dirty = {}
- if len(pats) > 0 and GoodCLName(pats[0]):
- name = pats[0]
- if len(pats) != 1:
- raise hg_util.Abort("cannot specify CL name and file patterns")
- pats = pats[1:]
- cl, err = LoadCL(ui, repo, name, web=True)
- if err != '':
- raise hg_util.Abort(err)
- if not cl.local and (opts["stdin"] or not opts["stdout"]):
- raise hg_util.Abort("cannot change non-local CL " + name)
- else:
- name = "new"
- cl = CL("new")
- if repo[None].branch() != "default":
- raise hg_util.Abort("cannot create CL outside default branch; switch with 'hg update default'")
- dirty[cl] = True
- files = ChangedFiles(ui, repo, pats, taken=Taken(ui, repo))
-
- if opts["delete"] or opts["deletelocal"]:
- if opts["delete"] and opts["deletelocal"]:
- raise hg_util.Abort("cannot use -d and -D together")
- flag = "-d"
- if opts["deletelocal"]:
- flag = "-D"
- if name == "new":
- raise hg_util.Abort("cannot use "+flag+" with file patterns")
- if opts["stdin"] or opts["stdout"]:
- raise hg_util.Abort("cannot use "+flag+" with -i or -o")
- if not cl.local:
- raise hg_util.Abort("cannot change non-local CL " + name)
- if opts["delete"]:
- if cl.copied_from:
- raise hg_util.Abort("original author must delete CL; hg change -D will remove locally")
- PostMessage(ui, cl.name, "*** Abandoned ***", send_mail=cl.mailed)
- EditDesc(cl.name, closed=True, private=cl.private)
- cl.Delete(ui, repo)
- return
-
- if opts["stdin"]:
- s = sys.stdin.read()
- clx, line, err = ParseCL(s, name)
- if err != '':
- raise hg_util.Abort("error parsing change list: line %d: %s" % (line, err))
- if clx.desc is not None:
- cl.desc = clx.desc;
- dirty[cl] = True
- if clx.reviewer is not None:
- cl.reviewer = clx.reviewer
- dirty[cl] = True
- if clx.cc is not None:
- cl.cc = clx.cc
- dirty[cl] = True
- if clx.files is not None:
- cl.files = clx.files
- dirty[cl] = True
- if clx.private != cl.private:
- cl.private = clx.private
- dirty[cl] = True
-
- if not opts["stdin"] and not opts["stdout"]:
- if name == "new":
- cl.files = files
- err = EditCL(ui, repo, cl)
- if err != "":
- raise hg_util.Abort(err)
- dirty[cl] = True
-
- for d, _ in dirty.items():
- name = d.name
- d.Flush(ui, repo)
- if name == "new":
- d.Upload(ui, repo, quiet=True)
-
- if opts["stdout"]:
- ui.write(cl.EditorText())
- elif opts["pending"]:
- ui.write(cl.PendingText())
- elif name == "new":
- if ui.quiet:
- ui.write(cl.name)
- else:
- ui.write("CL created: " + cl.url + "\n")
- return
-
-#######################################################################
-# hg code-login (broken?)
-
-@hgcommand
-def code_login(ui, repo, **opts):
- """log in to code review server
-
- Logs in to the code review server, saving a cookie in
- a file in your home directory.
- """
- if codereview_disabled:
- raise hg_util.Abort(codereview_disabled)
-
- MySend(None)
-
-#######################################################################
-# hg clpatch / undo / release-apply / download
-# All concerned with applying or unapplying patches to the repository.
-
-@hgcommand
-def clpatch(ui, repo, clname, **opts):
- """import a patch from the code review server
-
- Imports a patch from the code review server into the local client.
- If the local client has already modified any of the files that the
- patch modifies, this command will refuse to apply the patch.
-
- Submitting an imported patch will keep the original author's
- name as the Author: line but add your own name to a Committer: line.
- """
- if repo[None].branch() != "default":
- raise hg_util.Abort("cannot run hg clpatch outside default branch")
- err = clpatch_or_undo(ui, repo, clname, opts, mode="clpatch")
- if err:
- raise hg_util.Abort(err)
-
-@hgcommand
-def undo(ui, repo, clname, **opts):
- """undo the effect of a CL
-
- Creates a new CL that undoes an earlier CL.
- After creating the CL, opens the CL text for editing so that
- you can add the reason for the undo to the description.
- """
- if repo[None].branch() != "default":
- raise hg_util.Abort("cannot run hg undo outside default branch")
- err = clpatch_or_undo(ui, repo, clname, opts, mode="undo")
- if err:
- raise hg_util.Abort(err)
-
-@hgcommand
-def release_apply(ui, repo, clname, **opts):
- """apply a CL to the release branch
-
- Creates a new CL copying a previously committed change
- from the main branch to the release branch.
- The current client must either be clean or already be in
- the release branch.
-
- The release branch must be created by starting with a
- clean client, disabling the code review plugin, and running:
-
- hg update weekly.YYYY-MM-DD
- hg branch release-branch.rNN
- hg commit -m 'create release-branch.rNN'
- hg push --new-branch
-
- Then re-enable the code review plugin.
-
- People can test the release branch by running
-
- hg update release-branch.rNN
-
- in a clean client. To return to the normal tree,
-
- hg update default
-
- Move changes since the weekly into the release branch
- using hg release-apply followed by the usual code review
- process and hg submit.
-
- When it comes time to tag the release, record the
- final long-form tag of the release-branch.rNN
- in the *default* branch's .hgtags file. That is, run
-
- hg update default
-
- and then edit .hgtags as you would for a weekly.
-
- """
- c = repo[None]
- if not releaseBranch:
- raise hg_util.Abort("no active release branches")
- if c.branch() != releaseBranch:
- if c.modified() or c.added() or c.removed():
- raise hg_util.Abort("uncommitted local changes - cannot switch branches")
- err = hg_clean(repo, releaseBranch)
- if err:
- raise hg_util.Abort(err)
- try:
- err = clpatch_or_undo(ui, repo, clname, opts, mode="backport")
- if err:
- raise hg_util.Abort(err)
- except Exception, e:
- hg_clean(repo, "default")
- raise e
-
-def rev2clname(rev):
- # Extract CL name from revision description.
- # The last line in the description that is a codereview URL is the real one.
- # Earlier lines might be part of the user-written description.
- all = re.findall('(?m)^https?://codereview.appspot.com/([0-9]+)$', rev.description())
- if len(all) > 0:
- return all[-1]
- return ""
-
-undoHeader = """undo CL %s / %s
-
-<enter reason for undo>
-
-««« original CL description
-"""
-
-undoFooter = """
-»»»
-"""
-
-backportHeader = """[%s] %s
-
-««« CL %s / %s
-"""
-
-backportFooter = """
-»»»
-"""
-
-# Implementation of clpatch/undo.
-def clpatch_or_undo(ui, repo, clname, opts, mode):
- if codereview_disabled:
- return codereview_disabled
-
- if mode == "undo" or mode == "backport":
- # Find revision in Mercurial repository.
- # Assume CL number is 7+ decimal digits.
- # Otherwise is either change log sequence number (fewer decimal digits),
- # hexadecimal hash, or tag name.
- # Mercurial will fall over long before the change log
- # sequence numbers get to be 7 digits long.
- if re.match('^[0-9]{7,}$', clname):
- found = False
- for r in hg_log(ui, repo, keyword="codereview.appspot.com/"+clname, limit=100, template="{node}\n").split():
- rev = repo[r]
- # Last line with a code review URL is the actual review URL.
- # Earlier ones might be part of the CL description.
- n = rev2clname(rev)
- if n == clname:
- found = True
- break
- if not found:
- return "cannot find CL %s in local repository" % clname
- else:
- rev = repo[clname]
- if not rev:
- return "unknown revision %s" % clname
- clname = rev2clname(rev)
- if clname == "":
- return "cannot find CL name in revision description"
-
- # Create fresh CL and start with patch that would reverse the change.
- vers = hg_node.short(rev.node())
- cl = CL("new")
- desc = str(rev.description())
- if mode == "undo":
- cl.desc = (undoHeader % (clname, vers)) + desc + undoFooter
- else:
- cl.desc = (backportHeader % (releaseBranch, line1(desc), clname, vers)) + desc + undoFooter
- v1 = vers
- v0 = hg_node.short(rev.parents()[0].node())
- if mode == "undo":
- arg = v1 + ":" + v0
- else:
- vers = v0
- arg = v0 + ":" + v1
- patch = RunShell(["hg", "diff", "--git", "-r", arg])
-
- else: # clpatch
- cl, vers, patch, err = DownloadCL(ui, repo, clname)
- if err != "":
- return err
- if patch == emptydiff:
- return "codereview issue %s has no diff" % clname
-
- # find current hg version (hg identify)
- ctx = repo[None]
- parents = ctx.parents()
- id = '+'.join([hg_node.short(p.node()) for p in parents])
-
- # if version does not match the patch version,
- # try to update the patch line numbers.
- if vers != "" and id != vers:
- # "vers in repo" gives the wrong answer
- # on some versions of Mercurial. Instead, do the actual
- # lookup and catch the exception.
- try:
- repo[vers].description()
- except:
- return "local repository is out of date; sync to get %s" % (vers)
- patch1, err = portPatch(repo, patch, vers, id)
- if err != "":
- if not opts["ignore_hgapplydiff_failure"]:
- return "codereview issue %s is out of date: %s (%s->%s)" % (clname, err, vers, id)
- else:
- patch = patch1
- argv = ["hgapplydiff"]
- if opts["no_incoming"] or mode == "backport":
- argv += ["--checksync=false"]
- try:
- cmd = subprocess.Popen(argv, shell=False, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=None, close_fds=sys.platform != "win32")
- except:
- return "hgapplydiff: " + ExceptionDetail() + "\nInstall hgapplydiff with:\n$ go get code.google.com/p/go.codereview/cmd/hgapplydiff\n"
-
- out, err = cmd.communicate(patch)
- if cmd.returncode != 0 and not opts["ignore_hgapplydiff_failure"]:
- return "hgapplydiff failed"
- cl.local = True
- cl.files = out.strip().split()
- if not cl.files and not opts["ignore_hgapplydiff_failure"]:
- return "codereview issue %s has no changed files" % clname
- files = ChangedFiles(ui, repo, [])
- extra = Sub(cl.files, files)
- if extra:
- ui.warn("warning: these files were listed in the patch but not changed:\n\t" + "\n\t".join(extra) + "\n")
- cl.Flush(ui, repo)
- if mode == "undo":
- err = EditCL(ui, repo, cl)
- if err != "":
- return "CL created, but error editing: " + err
- cl.Flush(ui, repo)
- else:
- ui.write(cl.PendingText() + "\n")
-
-# portPatch rewrites patch from being a patch against
-# oldver to being a patch against newver.
-def portPatch(repo, patch, oldver, newver):
- lines = patch.splitlines(True) # True = keep \n
- delta = None
- for i in range(len(lines)):
- line = lines[i]
- if line.startswith('--- a/'):
- file = line[6:-1]
- delta = fileDeltas(repo, file, oldver, newver)
- if not delta or not line.startswith('@@ '):
- continue
- # @@ -x,y +z,w @@ means the patch chunk replaces
- # the original file's line numbers x up to x+y with the
- # line numbers z up to z+w in the new file.
- # Find the delta from x in the original to the same
- # line in the current version and add that delta to both
- # x and z.
- m = re.match('@@ -([0-9]+),([0-9]+) \+([0-9]+),([0-9]+) @@', line)
- if not m:
- return None, "error parsing patch line numbers"
- n1, len1, n2, len2 = int(m.group(1)), int(m.group(2)), int(m.group(3)), int(m.group(4))
- d, err = lineDelta(delta, n1, len1)
- if err != "":
- return "", err
- n1 += d
- n2 += d
- lines[i] = "@@ -%d,%d +%d,%d @@\n" % (n1, len1, n2, len2)
-
- newpatch = ''.join(lines)
- return newpatch, ""
-
-# fileDelta returns the line number deltas for the given file's
-# changes from oldver to newver.
-# The deltas are a list of (n, len, newdelta) triples that say
-# lines [n, n+len) were modified, and after that range the
-# line numbers are +newdelta from what they were before.
-def fileDeltas(repo, file, oldver, newver):
- cmd = ["hg", "diff", "--git", "-r", oldver + ":" + newver, "path:" + file]
- data = RunShell(cmd, silent_ok=True)
- deltas = []
- for line in data.splitlines():
- m = re.match('@@ -([0-9]+),([0-9]+) \+([0-9]+),([0-9]+) @@', line)
- if not m:
- continue
- n1, len1, n2, len2 = int(m.group(1)), int(m.group(2)), int(m.group(3)), int(m.group(4))
- deltas.append((n1, len1, n2+len2-(n1+len1)))
- return deltas
-
-# lineDelta finds the appropriate line number delta to apply to the lines [n, n+len).
-# It returns an error if those lines were rewritten by the patch.
-def lineDelta(deltas, n, len):
- d = 0
- for (old, oldlen, newdelta) in deltas:
- if old >= n+len:
- break
- if old+len > n:
- return 0, "patch and recent changes conflict"
- d = newdelta
- return d, ""
-
-@hgcommand
-def download(ui, repo, clname, **opts):
- """download a change from the code review server
-
- Download prints a description of the given change list
- followed by its diff, downloaded from the code review server.
- """
- if codereview_disabled:
- raise hg_util.Abort(codereview_disabled)
-
- cl, vers, patch, err = DownloadCL(ui, repo, clname)
- if err != "":
- return err
- ui.write(cl.EditorText() + "\n")
- ui.write(patch + "\n")
- return
-
-#######################################################################
-# hg file
-
-@hgcommand
-def file(ui, repo, clname, pat, *pats, **opts):
- """assign files to or remove files from a change list
-
- Assign files to or (with -d) remove files from a change list.
-
- The -d option only removes files from the change list.
- It does not edit them or remove them from the repository.
- """
- if codereview_disabled:
- raise hg_util.Abort(codereview_disabled)
-
- pats = tuple([pat] + list(pats))
- if not GoodCLName(clname):
- return "invalid CL name " + clname
-
- dirty = {}
- cl, err = LoadCL(ui, repo, clname, web=False)
- if err != '':
- return err
- if not cl.local:
- return "cannot change non-local CL " + clname
-
- files = ChangedFiles(ui, repo, pats)
-
- if opts["delete"]:
- oldfiles = Intersect(files, cl.files)
- if oldfiles:
- if not ui.quiet:
- ui.status("# Removing files from CL. To undo:\n")
- ui.status("# cd %s\n" % (repo.root))
- for f in oldfiles:
- ui.status("# hg file %s %s\n" % (cl.name, f))
- cl.files = Sub(cl.files, oldfiles)
- cl.Flush(ui, repo)
- else:
- ui.status("no such files in CL")
- return
-
- if not files:
- return "no such modified files"
-
- files = Sub(files, cl.files)
- taken = Taken(ui, repo)
- warned = False
- for f in files:
- if f in taken:
- if not warned and not ui.quiet:
- ui.status("# Taking files from other CLs. To undo:\n")
- ui.status("# cd %s\n" % (repo.root))
- warned = True
- ocl = taken[f]
- if not ui.quiet:
- ui.status("# hg file %s %s\n" % (ocl.name, f))
- if ocl not in dirty:
- ocl.files = Sub(ocl.files, files)
- dirty[ocl] = True
- cl.files = Add(cl.files, files)
- dirty[cl] = True
- for d, _ in dirty.items():
- d.Flush(ui, repo)
- return
-
-#######################################################################
-# hg gofmt
-
-@hgcommand
-def gofmt(ui, repo, *pats, **opts):
- """apply gofmt to modified files
-
- Applies gofmt to the modified files in the repository that match
- the given patterns.
- """
- if codereview_disabled:
- raise hg_util.Abort(codereview_disabled)
-
- files = ChangedExistingFiles(ui, repo, pats, opts)
- files = gofmt_required(files)
- if not files:
- ui.status("no modified go files\n")
- return
- cwd = os.getcwd()
- files = [RelativePath(repo.root + '/' + f, cwd) for f in files]
- try:
- cmd = ["gofmt", "-l"]
- if not opts["list"]:
- cmd += ["-w"]
- if subprocess.call(cmd + files) != 0:
- raise hg_util.Abort("gofmt did not exit cleanly")
- except hg_error.Abort, e:
- raise
- except:
- raise hg_util.Abort("gofmt: " + ExceptionDetail())
- return
-
-def gofmt_required(files):
- return [f for f in files if (not f.startswith('test/') or f.startswith('test/bench/')) and f.endswith('.go')]
-
-#######################################################################
-# hg mail
-
-@hgcommand
-def mail(ui, repo, *pats, **opts):
- """mail a change for review
-
- Uploads a patch to the code review server and then sends mail
- to the reviewer and CC list asking for a review.
- """
- if codereview_disabled:
- raise hg_util.Abort(codereview_disabled)
-
- cl, err = CommandLineCL(ui, repo, pats, opts, op="mail", defaultcc=defaultcc)
- if err != "":
- raise hg_util.Abort(err)
- cl.Upload(ui, repo, gofmt_just_warn=True)
- if not cl.reviewer:
- # If no reviewer is listed, assign the review to defaultcc.
- # This makes sure that it appears in the
- # codereview.appspot.com/user/defaultcc
- # page, so that it doesn't get dropped on the floor.
- if not defaultcc:
- raise hg_util.Abort("no reviewers listed in CL")
- cl.cc = Sub(cl.cc, defaultcc)
- cl.reviewer = defaultcc
- cl.Flush(ui, repo)
-
- if cl.files == []:
- raise hg_util.Abort("no changed files, not sending mail")
-
- cl.Mail(ui, repo)
-
-#######################################################################
-# hg p / hg pq / hg ps / hg pending
-
-@hgcommand
-def ps(ui, repo, *pats, **opts):
- """alias for hg p --short
- """
- opts['short'] = True
- return pending(ui, repo, *pats, **opts)
-
-@hgcommand
-def pq(ui, repo, *pats, **opts):
- """alias for hg p --quick
- """
- opts['quick'] = True
- return pending(ui, repo, *pats, **opts)
-
-@hgcommand
-def pending(ui, repo, *pats, **opts):
- """show pending changes
-
- Lists pending changes followed by a list of unassigned but modified files.
- """
- if codereview_disabled:
- raise hg_util.Abort(codereview_disabled)
-
- quick = opts.get('quick', False)
- short = opts.get('short', False)
- m = LoadAllCL(ui, repo, web=not quick and not short)
- names = m.keys()
- names.sort()
- for name in names:
- cl = m[name]
- if short:
- ui.write(name + "\t" + line1(cl.desc) + "\n")
- else:
- ui.write(cl.PendingText(quick=quick) + "\n")
-
- if short:
- return 0
- files = DefaultFiles(ui, repo, [])
- if len(files) > 0:
- s = "Changed files not in any CL:\n"
- for f in files:
- s += "\t" + f + "\n"
- ui.write(s)
-
-#######################################################################
-# hg submit
-
-def need_sync():
- raise hg_util.Abort("local repository out of date; must sync before submit")
-
-@hgcommand
-def submit(ui, repo, *pats, **opts):
- """submit change to remote repository
-
- Submits change to remote repository.
- Bails out if the local repository is not in sync with the remote one.
- """
- if codereview_disabled:
- raise hg_util.Abort(codereview_disabled)
-
- # We already called this on startup but sometimes Mercurial forgets.
- set_mercurial_encoding_to_utf8()
-
- if not opts["no_incoming"] and hg_incoming(ui, repo):
- need_sync()
-
- cl, err = CommandLineCL(ui, repo, pats, opts, op="submit", defaultcc=defaultcc)
- if err != "":
- raise hg_util.Abort(err)
-
- user = None
- if cl.copied_from:
- user = cl.copied_from
- userline = CheckContributor(ui, repo, user)
- typecheck(userline, str)
-
- about = ""
- if cl.reviewer:
- about += "R=" + JoinComma([CutDomain(s) for s in cl.reviewer]) + "\n"
- if opts.get('tbr'):
- tbr = SplitCommaSpace(opts.get('tbr'))
- cl.reviewer = Add(cl.reviewer, tbr)
- about += "TBR=" + JoinComma([CutDomain(s) for s in tbr]) + "\n"
- if cl.cc:
- about += "CC=" + JoinComma([CutDomain(s) for s in cl.cc]) + "\n"
-
- if not cl.reviewer:
- raise hg_util.Abort("no reviewers listed in CL")
-
- if not cl.local:
- raise hg_util.Abort("cannot submit non-local CL")
-
- # upload, to sync current patch and also get change number if CL is new.
- if not cl.copied_from:
- cl.Upload(ui, repo, gofmt_just_warn=True)
-
- # check gofmt for real; allowed upload to warn in order to save CL.
- cl.Flush(ui, repo)
- CheckFormat(ui, repo, cl.files)
-
- about += "%s%s\n" % (server_url_base, cl.name)
-
- if cl.copied_from:
- about += "\nCommitter: " + CheckContributor(ui, repo, None) + "\n"
- typecheck(about, str)
-
- if not cl.mailed and not cl.copied_from: # in case this is TBR
- cl.Mail(ui, repo)
-
- # submit changes locally
- message = cl.desc.rstrip() + "\n\n" + about
- typecheck(message, str)
-
- set_status("pushing " + cl.name + " to remote server")
-
- if hg_outgoing(ui, repo):
- raise hg_util.Abort("local repository corrupt or out-of-phase with remote: found outgoing changes")
-
- old_heads = len(hg_heads(ui, repo).split())
-
- global commit_okay
- commit_okay = True
- ret = hg_commit(ui, repo, *['path:'+f for f in cl.files], message=message, user=userline)
- commit_okay = False
- if ret:
- raise hg_util.Abort("nothing changed")
- node = repo["-1"].node()
- # push to remote; if it fails for any reason, roll back
- try:
- new_heads = len(hg_heads(ui, repo).split())
- if old_heads != new_heads and not (old_heads == 0 and new_heads == 1):
- # Created new head, so we weren't up to date.
- need_sync()
-
- # Push changes to remote. If it works, we're committed. If not, roll back.
- try:
- if hg_push(ui, repo):
- raise hg_util.Abort("push error")
- except hg_error.Abort, e:
- if e.message.find("push creates new heads") >= 0:
- # Remote repository had changes we missed.
- need_sync()
- raise
- except:
- real_rollback()
- raise
-
- # We're committed. Upload final patch, close review, add commit message.
- changeURL = hg_node.short(node)
- url = ui.expandpath("default")
- m = re.match("(^https?://([^@/]+@)?([^.]+)\.googlecode\.com/hg/?)" + "|" +
- "(^https?://([^@/]+@)?code\.google\.com/p/([^/.]+)(\.[^./]+)?/?)", url)
- if m:
- if m.group(1): # prj.googlecode.com/hg/ case
- changeURL = "https://code.google.com/p/%s/source/detail?r=%s" % (m.group(3), changeURL)
- elif m.group(4) and m.group(7): # code.google.com/p/prj.subrepo/ case
- changeURL = "https://code.google.com/p/%s/source/detail?r=%s&repo=%s" % (m.group(6), changeURL, m.group(7)[1:])
- elif m.group(4): # code.google.com/p/prj/ case
- changeURL = "https://code.google.com/p/%s/source/detail?r=%s" % (m.group(6), changeURL)
- else:
- print >>sys.stderr, "URL: ", url
- else:
- print >>sys.stderr, "URL: ", url
- pmsg = "*** Submitted as " + changeURL + " ***\n\n" + message
-
- # When posting, move reviewers to CC line,
- # so that the issue stops showing up in their "My Issues" page.
- PostMessage(ui, cl.name, pmsg, reviewers="", cc=JoinComma(cl.reviewer+cl.cc))
-
- if not cl.copied_from:
- EditDesc(cl.name, closed=True, private=cl.private)
- cl.Delete(ui, repo)
-
- c = repo[None]
- if c.branch() == releaseBranch and not c.modified() and not c.added() and not c.removed():
- ui.write("switching from %s to default branch.\n" % releaseBranch)
- err = hg_clean(repo, "default")
- if err:
- return err
- return 0
-
-#######################################################################
-# hg sync
-
-@hgcommand
-def sync(ui, repo, **opts):
- """synchronize with remote repository
-
- Incorporates recent changes from the remote repository
- into the local repository.
- """
- if codereview_disabled:
- raise hg_util.Abort(codereview_disabled)
-
- if not opts["local"]:
- err = hg_pull(ui, repo, update=True)
- if err:
- return err
- sync_changes(ui, repo)
-
-def sync_changes(ui, repo):
- # Look through recent change log descriptions to find
- # potential references to http://.*/our-CL-number.
- # Double-check them by looking at the Rietveld log.
- for rev in hg_log(ui, repo, limit=100, template="{node}\n").split():
- desc = repo[rev].description().strip()
- for clname in re.findall('(?m)^https?://(?:[^\n]+)/([0-9]+)$', desc):
- if IsLocalCL(ui, repo, clname) and IsRietveldSubmitted(ui, clname, repo[rev].hex()):
- ui.warn("CL %s submitted as %s; closing\n" % (clname, repo[rev]))
- cl, err = LoadCL(ui, repo, clname, web=False)
- if err != "":
- ui.warn("loading CL %s: %s\n" % (clname, err))
- continue
- if not cl.copied_from:
- EditDesc(cl.name, closed=True, private=cl.private)
- cl.Delete(ui, repo)
-
- # Remove files that are not modified from the CLs in which they appear.
- all = LoadAllCL(ui, repo, web=False)
- changed = ChangedFiles(ui, repo, [])
- for cl in all.values():
- extra = Sub(cl.files, changed)
- if extra:
- ui.warn("Removing unmodified files from CL %s:\n" % (cl.name,))
- for f in extra:
- ui.warn("\t%s\n" % (f,))
- cl.files = Sub(cl.files, extra)
- cl.Flush(ui, repo)
- if not cl.files:
- if not cl.copied_from:
- ui.warn("CL %s has no files; delete (abandon) with hg change -d %s\n" % (cl.name, cl.name))
- else:
- ui.warn("CL %s has no files; delete locally with hg change -D %s\n" % (cl.name, cl.name))
- return 0
-
-#######################################################################
-# hg upload
-
-@hgcommand
-def upload(ui, repo, name, **opts):
- """upload diffs to the code review server
-
- Uploads the current modifications for a given change to the server.
- """
- if codereview_disabled:
- raise hg_util.Abort(codereview_disabled)
-
- repo.ui.quiet = True
- cl, err = LoadCL(ui, repo, name, web=True)
- if err != "":
- raise hg_util.Abort(err)
- if not cl.local:
- raise hg_util.Abort("cannot upload non-local change")
- cl.Upload(ui, repo)
- print "%s%s\n" % (server_url_base, cl.name)
- return 0
-
-#######################################################################
-# Table of commands, supplied to Mercurial for installation.
-
-review_opts = [
- ('r', 'reviewer', '', 'add reviewer'),
- ('', 'cc', '', 'add cc'),
- ('', 'tbr', '', 'add future reviewer'),
- ('m', 'message', '', 'change description (for new change)'),
-]
-
-cmdtable = {
- # The ^ means to show this command in the help text that
- # is printed when running hg with no arguments.
- "^change": (
- change,
- [
- ('d', 'delete', None, 'delete existing change list'),
- ('D', 'deletelocal', None, 'delete locally, but do not change CL on server'),
- ('i', 'stdin', None, 'read change list from standard input'),
- ('o', 'stdout', None, 'print change list to standard output'),
- ('p', 'pending', None, 'print pending summary to standard output'),
- ],
- "[-d | -D] [-i] [-o] change# or FILE ..."
- ),
- "^clpatch": (
- clpatch,
- [
- ('', 'ignore_hgapplydiff_failure', None, 'create CL metadata even if hgapplydiff fails'),
- ('', 'no_incoming', None, 'disable check for incoming changes'),
- ],
- "change#"
- ),
- # Would prefer to call this codereview-login, but then
- # hg help codereview prints the help for this command
- # instead of the help for the extension.
- "code-login": (
- code_login,
- [],
- "",
- ),
- "^download": (
- download,
- [],
- "change#"
- ),
- "^file": (
- file,
- [
- ('d', 'delete', None, 'delete files from change list (but not repository)'),
- ],
- "[-d] change# FILE ..."
- ),
- "^gofmt": (
- gofmt,
- [
- ('l', 'list', None, 'list files that would change, but do not edit them'),
- ],
- "FILE ..."
- ),
- "^pending|p": (
- pending,
- [
- ('s', 'short', False, 'show short result form'),
- ('', 'quick', False, 'do not consult codereview server'),
- ],
- "[FILE ...]"
- ),
- "^ps": (
- ps,
- [],
- "[FILE ...]"
- ),
- "^pq": (
- pq,
- [],
- "[FILE ...]"
- ),
- "^mail": (
- mail,
- review_opts + [
- ] + hg_commands.walkopts,
- "[-r reviewer] [--cc cc] [change# | file ...]"
- ),
- "^release-apply": (
- release_apply,
- [
- ('', 'ignore_hgapplydiff_failure', None, 'create CL metadata even if hgapplydiff fails'),
- ('', 'no_incoming', None, 'disable check for incoming changes'),
- ],
- "change#"
- ),
- # TODO: release-start, release-tag, weekly-tag
- "^submit": (
- submit,
- review_opts + [
- ('', 'no_incoming', None, 'disable initial incoming check (for testing)'),
- ] + hg_commands.walkopts + hg_commands.commitopts + hg_commands.commitopts2,
- "[-r reviewer] [--cc cc] [change# | file ...]"
- ),
- "^sync": (
- sync,
- [
- ('', 'local', None, 'do not pull changes from remote repository')
- ],
- "[--local]",
- ),
- "^undo": (
- undo,
- [
- ('', 'ignore_hgapplydiff_failure', None, 'create CL metadata even if hgapplydiff fails'),
- ('', 'no_incoming', None, 'disable check for incoming changes'),
- ],
- "change#"
- ),
- "^upload": (
- upload,
- [],
- "change#"
- ),
-}
-
-#######################################################################
-# Mercurial extension initialization
-
-def norollback(*pats, **opts):
- """(disabled when using this extension)"""
- raise hg_util.Abort("codereview extension enabled; use undo instead of rollback")
-
-codereview_init = False
-
-def reposetup(ui, repo):
- global codereview_disabled
- global defaultcc
-
- # reposetup gets called both for the local repository
- # and also for any repository we are pulling or pushing to.
- # Only initialize the first time.
- global codereview_init
- if codereview_init:
- return
- codereview_init = True
- start_status_thread()
-
- # Read repository-specific options from lib/codereview/codereview.cfg or codereview.cfg.
- root = ''
- try:
- root = repo.root
- except:
- # Yes, repo might not have root; see issue 959.
- codereview_disabled = 'codereview disabled: repository has no root'
- return
-
- repo_config_path = ''
- p1 = root + '/lib/codereview/codereview.cfg'
- p2 = root + '/codereview.cfg'
- if os.access(p1, os.F_OK):
- repo_config_path = p1
- else:
- repo_config_path = p2
- try:
- f = open(repo_config_path)
- for line in f:
- if line.startswith('defaultcc:'):
- defaultcc = SplitCommaSpace(line[len('defaultcc:'):])
- if line.startswith('contributors:'):
- global contributorsURL
- contributorsURL = line[len('contributors:'):].strip()
- except:
- codereview_disabled = 'codereview disabled: cannot open ' + repo_config_path
- return
-
- remote = ui.config("paths", "default", "")
- if remote.find("://") < 0:
- raise hg_util.Abort("codereview: default path '%s' is not a URL" % (remote,))
-
- InstallMatch(ui, repo)
- RietveldSetup(ui, repo)
-
- # Disable the Mercurial commands that might change the repository.
- # Only commands in this extension are supposed to do that.
- ui.setconfig("hooks", "precommit.codereview", precommithook)
-
- # Rollback removes an existing commit. Don't do that either.
- global real_rollback
- real_rollback = repo.rollback
- repo.rollback = norollback
-
-
-#######################################################################
-# Wrappers around upload.py for interacting with Rietveld
-
-from HTMLParser import HTMLParser
-
-# HTML form parser
-class FormParser(HTMLParser):
- def __init__(self):
- self.map = {}
- self.curtag = None
- self.curdata = None
- HTMLParser.__init__(self)
- def handle_starttag(self, tag, attrs):
- if tag == "input":
- key = None
- value = ''
- for a in attrs:
- if a[0] == 'name':
- key = a[1]
- if a[0] == 'value':
- value = a[1]
- if key is not None:
- self.map[key] = value
- if tag == "textarea":
- key = None
- for a in attrs:
- if a[0] == 'name':
- key = a[1]
- if key is not None:
- self.curtag = key
- self.curdata = ''
- def handle_endtag(self, tag):
- if tag == "textarea" and self.curtag is not None:
- self.map[self.curtag] = self.curdata
- self.curtag = None
- self.curdata = None
- def handle_charref(self, name):
- self.handle_data(unichr(int(name)))
- def handle_entityref(self, name):
- import htmlentitydefs
- if name in htmlentitydefs.entitydefs:
- self.handle_data(htmlentitydefs.entitydefs[name])
- else:
- self.handle_data("&" + name + ";")
- def handle_data(self, data):
- if self.curdata is not None:
- self.curdata += data
-
-def JSONGet(ui, path):
- try:
- data = MySend(path, force_auth=False)
- typecheck(data, str)
- d = fix_json(json.loads(data))
- except:
- ui.warn("JSONGet %s: %s\n" % (path, ExceptionDetail()))
- return None
- return d
-
-# Clean up json parser output to match our expectations:
-# * all strings are UTF-8-encoded str, not unicode.
-# * missing fields are missing, not None,
-# so that d.get("foo", defaultvalue) works.
-def fix_json(x):
- if type(x) in [str, int, float, bool, type(None)]:
- pass
- elif type(x) is unicode:
- x = x.encode("utf-8")
- elif type(x) is list:
- for i in range(len(x)):
- x[i] = fix_json(x[i])
- elif type(x) is dict:
- todel = []
- for k in x:
- if x[k] is None:
- todel.append(k)
- else:
- x[k] = fix_json(x[k])
- for k in todel:
- del x[k]
- else:
- raise hg_util.Abort("unknown type " + str(type(x)) + " in fix_json")
- if type(x) is str:
- x = x.replace('\r\n', '\n')
- return x
-
-def IsRietveldSubmitted(ui, clname, hex):
- dict = JSONGet(ui, "/api/" + clname + "?messages=true")
- if dict is None:
- return False
- for msg in dict.get("messages", []):
- text = msg.get("text", "")
- m = re.match('\*\*\* Submitted as [^*]*?([0-9a-f]+) \*\*\*', text)
- if m is not None and len(m.group(1)) >= 8 and hex.startswith(m.group(1)):
- return True
- return False
-
-def IsRietveldMailed(cl):
- for msg in cl.dict.get("messages", []):
- if msg.get("text", "").find("I'd like you to review this change") >= 0:
- return True
- return False
-
-def DownloadCL(ui, repo, clname):
- set_status("downloading CL " + clname)
- cl, err = LoadCL(ui, repo, clname, web=True)
- if err != "":
- return None, None, None, "error loading CL %s: %s" % (clname, err)
-
- # Find most recent diff
- diffs = cl.dict.get("patchsets", [])
- if not diffs:
- return None, None, None, "CL has no patch sets"
- patchid = diffs[-1]
-
- patchset = JSONGet(ui, "/api/" + clname + "/" + str(patchid))
- if patchset is None:
- return None, None, None, "error loading CL patchset %s/%d" % (clname, patchid)
- if patchset.get("patchset", 0) != patchid:
- return None, None, None, "malformed patchset information"
-
- vers = ""
- msg = patchset.get("message", "").split()
- if len(msg) >= 3 and msg[0] == "diff" and msg[1] == "-r":
- vers = msg[2]
- diff = "/download/issue" + clname + "_" + str(patchid) + ".diff"
-
- diffdata = MySend(diff, force_auth=False)
-
- # Print warning if email is not in CONTRIBUTORS file.
- email = cl.dict.get("owner_email", "")
- if not email:
- return None, None, None, "cannot find owner for %s" % (clname)
- him = FindContributor(ui, repo, email)
- me = FindContributor(ui, repo, None)
- if him == me:
- cl.mailed = IsRietveldMailed(cl)
- else:
- cl.copied_from = email
-
- return cl, vers, diffdata, ""
-
-def MySend(request_path, payload=None,
- content_type="application/octet-stream",
- timeout=None, force_auth=True,
- **kwargs):
- """Run MySend1 maybe twice, because Rietveld is unreliable."""
- try:
- return MySend1(request_path, payload, content_type, timeout, force_auth, **kwargs)
- except Exception, e:
- if type(e) != urllib2.HTTPError or e.code != 500: # only retry on HTTP 500 error
- raise
- print >>sys.stderr, "Loading "+request_path+": "+ExceptionDetail()+"; trying again in 2 seconds."
- time.sleep(2)
- return MySend1(request_path, payload, content_type, timeout, force_auth, **kwargs)
-
-# Like upload.py Send but only authenticates when the
-# redirect is to www.google.com/accounts. This keeps
-# unnecessary redirects from happening during testing.
-def MySend1(request_path, payload=None,
- content_type="application/octet-stream",
- timeout=None, force_auth=True,
- **kwargs):
- """Sends an RPC and returns the response.
-
- Args:
- request_path: The path to send the request to, eg /api/appversion/create.
- payload: The body of the request, or None to send an empty request.
- content_type: The Content-Type header to use.
- timeout: timeout in seconds; default None i.e. no timeout.
- (Note: for large requests on OS X, the timeout doesn't work right.)
- kwargs: Any keyword arguments are converted into query string parameters.
-
- Returns:
- The response body, as a string.
- """
- # TODO: Don't require authentication. Let the server say
- # whether it is necessary.
- global rpc
- if rpc == None:
- rpc = GetRpcServer(upload_options)
- self = rpc
- if not self.authenticated and force_auth:
- self._Authenticate()
- if request_path is None:
- return
- if timeout is None:
- timeout = 30 # seconds
-
- old_timeout = socket.getdefaulttimeout()
- socket.setdefaulttimeout(timeout)
- try:
- tries = 0
- while True:
- tries += 1
- args = dict(kwargs)
- url = "https://%s%s" % (self.host, request_path)
- if args:
- url += "?" + urllib.urlencode(args)
- req = self._CreateRequest(url=url, data=payload)
- req.add_header("Content-Type", content_type)
- try:
- f = self.opener.open(req)
- response = f.read()
- f.close()
- # Translate \r\n into \n, because Rietveld doesn't.
- response = response.replace('\r\n', '\n')
- # who knows what urllib will give us
- if type(response) == unicode:
- response = response.encode("utf-8")
- typecheck(response, str)
- return response
- except urllib2.HTTPError, e:
- if tries > 3:
- raise
- elif e.code == 401:
- self._Authenticate()
- elif e.code == 302:
- loc = e.info()["location"]
- if not loc.startswith('https://www.google.com/a') or loc.find('/ServiceLogin') < 0:
- return ''
- self._Authenticate()
- else:
- raise
- finally:
- socket.setdefaulttimeout(old_timeout)
-
-def GetForm(url):
- f = FormParser()
- f.feed(ustr(MySend(url))) # f.feed wants unicode
- f.close()
- # convert back to utf-8 to restore sanity
- m = {}
- for k,v in f.map.items():
- m[k.encode("utf-8")] = v.replace("\r\n", "\n").encode("utf-8")
- return m
-
-def EditDesc(issue, subject=None, desc=None, reviewers=None, cc=None, closed=False, private=False):
- set_status("uploading change to description")
- form_fields = GetForm("/" + issue + "/edit")
- if subject is not None:
- form_fields['subject'] = subject
- if desc is not None:
- form_fields['description'] = desc
- if reviewers is not None:
- form_fields['reviewers'] = reviewers
- if cc is not None:
- form_fields['cc'] = cc
- if closed:
- form_fields['closed'] = "checked"
- if private:
- form_fields['private'] = "checked"
- ctype, body = EncodeMultipartFormData(form_fields.items(), [])
- response = MySend("/" + issue + "/edit", body, content_type=ctype)
- if response != "":
- print >>sys.stderr, "Error editing description:\n" + "Sent form: \n", form_fields, "\n", response
- sys.exit(2)
-
-def PostMessage(ui, issue, message, reviewers=None, cc=None, send_mail=True, subject=None):
- set_status("uploading message")
- form_fields = GetForm("/" + issue + "/publish")
- if reviewers is not None:
- form_fields['reviewers'] = reviewers
- if cc is not None:
- form_fields['cc'] = cc
- if send_mail:
- form_fields['send_mail'] = "checked"
- else:
- del form_fields['send_mail']
- if subject is not None:
- form_fields['subject'] = subject
- form_fields['message'] = message
-
- form_fields['message_only'] = '1' # Don't include draft comments
- if reviewers is not None or cc is not None:
- form_fields['message_only'] = '' # Must set '' in order to override cc/reviewer
- ctype = "applications/x-www-form-urlencoded"
- body = urllib.urlencode(form_fields)
- response = MySend("/" + issue + "/publish", body, content_type=ctype)
- if response != "":
- print response
- sys.exit(2)
-
-class opt(object):
- pass
-
-def RietveldSetup(ui, repo):
- global force_google_account
- global rpc
- global server
- global server_url_base
- global upload_options
- global verbosity
-
- if not ui.verbose:
- verbosity = 0
-
- # Config options.
- x = ui.config("codereview", "server")
- if x is not None:
- server = x
-
- # TODO(rsc): Take from ui.username?
- email = None
- x = ui.config("codereview", "email")
- if x is not None:
- email = x
-
- server_url_base = "https://" + server + "/"
-
- testing = ui.config("codereview", "testing")
- force_google_account = ui.configbool("codereview", "force_google_account", False)
-
- upload_options = opt()
- upload_options.email = email
- upload_options.host = None
- upload_options.verbose = 0
- upload_options.description = None
- upload_options.description_file = None
- upload_options.reviewers = None
- upload_options.cc = None
- upload_options.message = None
- upload_options.issue = None
- upload_options.download_base = False
- upload_options.revision = None
- upload_options.send_mail = False
- upload_options.vcs = None
- upload_options.server = server
- upload_options.save_cookies = True
-
- if testing:
- upload_options.save_cookies = False
- upload_options.email = "test@example.com"
-
- rpc = None
-
- global releaseBranch
- tags = repo.branchtags().keys()
- if 'release-branch.go10' in tags:
- # NOTE(rsc): This tags.sort is going to get the wrong
- # answer when comparing release-branch.go9 with
- # release-branch.go10. It will be a while before we care.
- raise hg_util.Abort('tags.sort needs to be fixed for release-branch.go10')
- tags.sort()
- for t in tags:
- if t.startswith('release-branch.go'):
- releaseBranch = t
-
-#######################################################################
-# http://codereview.appspot.com/static/upload.py, heavily edited.
-
-#!/usr/bin/env python
-#
-# Copyright 2007 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Tool for uploading diffs from a version control system to the codereview app.
-
-Usage summary: upload.py [options] [-- diff_options]
-
-Diff options are passed to the diff command of the underlying system.
-
-Supported version control systems:
- Git
- Mercurial
- Subversion
-
-It is important for Git/Mercurial users to specify a tree/node/branch to diff
-against by using the '--rev' option.
-"""
-# This code is derived from appcfg.py in the App Engine SDK (open source),
-# and from ASPN recipe #146306.
-
-import cookielib
-import getpass
-import logging
-import mimetypes
-import optparse
-import os
-import re
-import socket
-import subprocess
-import sys
-import urllib
-import urllib2
-import urlparse
-
-# The md5 module was deprecated in Python 2.5.
-try:
- from hashlib import md5
-except ImportError:
- from md5 import md5
-
-try:
- import readline
-except ImportError:
- pass
-
-# The logging verbosity:
-# 0: Errors only.
-# 1: Status messages.
-# 2: Info logs.
-# 3: Debug logs.
-verbosity = 1
-
-# Max size of patch or base file.
-MAX_UPLOAD_SIZE = 900 * 1024
-
-# whitelist for non-binary filetypes which do not start with "text/"
-# .mm (Objective-C) shows up as application/x-freemind on my Linux box.
-TEXT_MIMETYPES = [
- 'application/javascript',
- 'application/x-javascript',
- 'application/x-freemind'
-]
-
-def GetEmail(prompt):
- """Prompts the user for their email address and returns it.
-
- The last used email address is saved to a file and offered up as a suggestion
- to the user. If the user presses enter without typing in anything the last
- used email address is used. If the user enters a new address, it is saved
- for next time we prompt.
-
- """
- last_email_file_name = os.path.expanduser("~/.last_codereview_email_address")
- last_email = ""
- if os.path.exists(last_email_file_name):
- try:
- last_email_file = open(last_email_file_name, "r")
- last_email = last_email_file.readline().strip("\n")
- last_email_file.close()
- prompt += " [%s]" % last_email
- except IOError, e:
- pass
- email = raw_input(prompt + ": ").strip()
- if email:
- try:
- last_email_file = open(last_email_file_name, "w")
- last_email_file.write(email)
- last_email_file.close()
- except IOError, e:
- pass
- else:
- email = last_email
- return email
-
-
-def StatusUpdate(msg):
- """Print a status message to stdout.
-
- If 'verbosity' is greater than 0, print the message.
-
- Args:
- msg: The string to print.
- """
- if verbosity > 0:
- print msg
-
-
-def ErrorExit(msg):
- """Print an error message to stderr and exit."""
- print >>sys.stderr, msg
- sys.exit(1)
-
-
-class ClientLoginError(urllib2.HTTPError):
- """Raised to indicate there was an error authenticating with ClientLogin."""
-
- def __init__(self, url, code, msg, headers, args):
- urllib2.HTTPError.__init__(self, url, code, msg, headers, None)
- self.args = args
- # .reason is now a read-only property based on .msg
- # this means we ignore 'msg', but that seems to work fine.
- self.msg = args["Error"]
-
-
-class AbstractRpcServer(object):
- """Provides a common interface for a simple RPC server."""
-
- def __init__(self, host, auth_function, host_override=None, extra_headers={}, save_cookies=False):
- """Creates a new HttpRpcServer.
-
- Args:
- host: The host to send requests to.
- auth_function: A function that takes no arguments and returns an
- (email, password) tuple when called. Will be called if authentication
- is required.
- host_override: The host header to send to the server (defaults to host).
- extra_headers: A dict of extra headers to append to every request.
- save_cookies: If True, save the authentication cookies to local disk.
- If False, use an in-memory cookiejar instead. Subclasses must
- implement this functionality. Defaults to False.
- """
- self.host = host
- self.host_override = host_override
- self.auth_function = auth_function
- self.authenticated = False
- self.extra_headers = extra_headers
- self.save_cookies = save_cookies
- self.opener = self._GetOpener()
- if self.host_override:
- logging.info("Server: %s; Host: %s", self.host, self.host_override)
- else:
- logging.info("Server: %s", self.host)
-
- def _GetOpener(self):
- """Returns an OpenerDirector for making HTTP requests.
-
- Returns:
- A urllib2.OpenerDirector object.
- """
- raise NotImplementedError()
-
- def _CreateRequest(self, url, data=None):
- """Creates a new urllib request."""
- logging.debug("Creating request for: '%s' with payload:\n%s", url, data)
- req = urllib2.Request(url, data=data)
- if self.host_override:
- req.add_header("Host", self.host_override)
- for key, value in self.extra_headers.iteritems():
- req.add_header(key, value)
- return req
-
- def _GetAuthToken(self, email, password):
- """Uses ClientLogin to authenticate the user, returning an auth token.
-
- Args:
- email: The user's email address
- password: The user's password
-
- Raises:
- ClientLoginError: If there was an error authenticating with ClientLogin.
- HTTPError: If there was some other form of HTTP error.
-
- Returns:
- The authentication token returned by ClientLogin.
- """
- account_type = "GOOGLE"
- if self.host.endswith(".google.com") and not force_google_account:
- # Needed for use inside Google.
- account_type = "HOSTED"
- req = self._CreateRequest(
- url="https://www.google.com/accounts/ClientLogin",
- data=urllib.urlencode({
- "Email": email,
- "Passwd": password,
- "service": "ah",
- "source": "rietveld-codereview-upload",
- "accountType": account_type,
- }),
- )
- try:
- response = self.opener.open(req)
- response_body = response.read()
- response_dict = dict(x.split("=") for x in response_body.split("\n") if x)
- return response_dict["Auth"]
- except urllib2.HTTPError, e:
- if e.code == 403:
- body = e.read()
- response_dict = dict(x.split("=", 1) for x in body.split("\n") if x)
- raise ClientLoginError(req.get_full_url(), e.code, e.msg, e.headers, response_dict)
- else:
- raise
-
- def _GetAuthCookie(self, auth_token):
- """Fetches authentication cookies for an authentication token.
-
- Args:
- auth_token: The authentication token returned by ClientLogin.
-
- Raises:
- HTTPError: If there was an error fetching the authentication cookies.
- """
- # This is a dummy value to allow us to identify when we're successful.
- continue_location = "http://localhost/"
- args = {"continue": continue_location, "auth": auth_token}
- req = self._CreateRequest("https://%s/_ah/login?%s" % (self.host, urllib.urlencode(args)))
- try:
- response = self.opener.open(req)
- except urllib2.HTTPError, e:
- response = e
- if (response.code != 302 or
- response.info()["location"] != continue_location):
- raise urllib2.HTTPError(req.get_full_url(), response.code, response.msg, response.headers, response.fp)
- self.authenticated = True
-
- def _Authenticate(self):
- """Authenticates the user.
-
- The authentication process works as follows:
- 1) We get a username and password from the user
- 2) We use ClientLogin to obtain an AUTH token for the user
- (see http://code.google.com/apis/accounts/AuthForInstalledApps.html).
- 3) We pass the auth token to /_ah/login on the server to obtain an
- authentication cookie. If login was successful, it tries to redirect
- us to the URL we provided.
-
- If we attempt to access the upload API without first obtaining an
- authentication cookie, it returns a 401 response (or a 302) and
- directs us to authenticate ourselves with ClientLogin.
- """
- for i in range(3):
- credentials = self.auth_function()
- try:
- auth_token = self._GetAuthToken(credentials[0], credentials[1])
- except ClientLoginError, e:
- if e.msg == "BadAuthentication":
- print >>sys.stderr, "Invalid username or password."
- continue
- if e.msg == "CaptchaRequired":
- print >>sys.stderr, (
- "Please go to\n"
- "https://www.google.com/accounts/DisplayUnlockCaptcha\n"
- "and verify you are a human. Then try again.")
- break
- if e.msg == "NotVerified":
- print >>sys.stderr, "Account not verified."
- break
- if e.msg == "TermsNotAgreed":
- print >>sys.stderr, "User has not agreed to TOS."
- break
- if e.msg == "AccountDeleted":
- print >>sys.stderr, "The user account has been deleted."
- break
- if e.msg == "AccountDisabled":
- print >>sys.stderr, "The user account has been disabled."
- break
- if e.msg == "ServiceDisabled":
- print >>sys.stderr, "The user's access to the service has been disabled."
- break
- if e.msg == "ServiceUnavailable":
- print >>sys.stderr, "The service is not available; try again later."
- break
- raise
- self._GetAuthCookie(auth_token)
- return
-
- def Send(self, request_path, payload=None,
- content_type="application/octet-stream",
- timeout=None,
- **kwargs):
- """Sends an RPC and returns the response.
-
- Args:
- request_path: The path to send the request to, eg /api/appversion/create.
- payload: The body of the request, or None to send an empty request.
- content_type: The Content-Type header to use.
- timeout: timeout in seconds; default None i.e. no timeout.
- (Note: for large requests on OS X, the timeout doesn't work right.)
- kwargs: Any keyword arguments are converted into query string parameters.
-
- Returns:
- The response body, as a string.
- """
- # TODO: Don't require authentication. Let the server say
- # whether it is necessary.
- if not self.authenticated:
- self._Authenticate()
-
- old_timeout = socket.getdefaulttimeout()
- socket.setdefaulttimeout(timeout)
- try:
- tries = 0
- while True:
- tries += 1
- args = dict(kwargs)
- url = "https://%s%s" % (self.host, request_path)
- if args:
- url += "?" + urllib.urlencode(args)
- req = self._CreateRequest(url=url, data=payload)
- req.add_header("Content-Type", content_type)
- try:
- f = self.opener.open(req)
- response = f.read()
- f.close()
- return response
- except urllib2.HTTPError, e:
- if tries > 3:
- raise
- elif e.code == 401 or e.code == 302:
- self._Authenticate()
- else:
- raise
- finally:
- socket.setdefaulttimeout(old_timeout)
-
-
-class HttpRpcServer(AbstractRpcServer):
- """Provides a simplified RPC-style interface for HTTP requests."""
-
- def _Authenticate(self):
- """Save the cookie jar after authentication."""
- super(HttpRpcServer, self)._Authenticate()
- if self.save_cookies:
- StatusUpdate("Saving authentication cookies to %s" % self.cookie_file)
- self.cookie_jar.save()
-
- def _GetOpener(self):
- """Returns an OpenerDirector that supports cookies and ignores redirects.
-
- Returns:
- A urllib2.OpenerDirector object.
- """
- opener = urllib2.OpenerDirector()
- opener.add_handler(urllib2.ProxyHandler())
- opener.add_handler(urllib2.UnknownHandler())
- opener.add_handler(urllib2.HTTPHandler())
- opener.add_handler(urllib2.HTTPDefaultErrorHandler())
- opener.add_handler(urllib2.HTTPSHandler())
- opener.add_handler(urllib2.HTTPErrorProcessor())
- if self.save_cookies:
- self.cookie_file = os.path.expanduser("~/.codereview_upload_cookies_" + server)
- self.cookie_jar = cookielib.MozillaCookieJar(self.cookie_file)
- if os.path.exists(self.cookie_file):
- try:
- self.cookie_jar.load()
- self.authenticated = True
- StatusUpdate("Loaded authentication cookies from %s" % self.cookie_file)
- except (cookielib.LoadError, IOError):
- # Failed to load cookies - just ignore them.
- pass
- else:
- # Create an empty cookie file with mode 600
- fd = os.open(self.cookie_file, os.O_CREAT, 0600)
- os.close(fd)
- # Always chmod the cookie file
- os.chmod(self.cookie_file, 0600)
- else:
- # Don't save cookies across runs of update.py.
- self.cookie_jar = cookielib.CookieJar()
- opener.add_handler(urllib2.HTTPCookieProcessor(self.cookie_jar))
- return opener
-
-
-def GetRpcServer(options):
- """Returns an instance of an AbstractRpcServer.
-
- Returns:
- A new AbstractRpcServer, on which RPC calls can be made.
- """
-
- rpc_server_class = HttpRpcServer
-
- def GetUserCredentials():
- """Prompts the user for a username and password."""
- # Disable status prints so they don't obscure the password prompt.
- global global_status
- st = global_status
- global_status = None
-
- email = options.email
- if email is None:
- email = GetEmail("Email (login for uploading to %s)" % options.server)
- password = getpass.getpass("Password for %s: " % email)
-
- # Put status back.
- global_status = st
- return (email, password)
-
- # If this is the dev_appserver, use fake authentication.
- host = (options.host or options.server).lower()
- if host == "localhost" or host.startswith("localhost:"):
- email = options.email
- if email is None:
- email = "test@example.com"
- logging.info("Using debug user %s. Override with --email" % email)
- server = rpc_server_class(
- options.server,
- lambda: (email, "password"),
- host_override=options.host,
- extra_headers={"Cookie": 'dev_appserver_login="%s:False"' % email},
- save_cookies=options.save_cookies)
- # Don't try to talk to ClientLogin.
- server.authenticated = True
- return server
-
- return rpc_server_class(options.server, GetUserCredentials,
- host_override=options.host, save_cookies=options.save_cookies)
-
-
-def EncodeMultipartFormData(fields, files):
- """Encode form fields for multipart/form-data.
-
- Args:
- fields: A sequence of (name, value) elements for regular form fields.
- files: A sequence of (name, filename, value) elements for data to be
- uploaded as files.
- Returns:
- (content_type, body) ready for httplib.HTTP instance.
-
- Source:
- http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/146306
- """
- BOUNDARY = '-M-A-G-I-C---B-O-U-N-D-A-R-Y-'
- CRLF = '\r\n'
- lines = []
- for (key, value) in fields:
- typecheck(key, str)
- typecheck(value, str)
- lines.append('--' + BOUNDARY)
- lines.append('Content-Disposition: form-data; name="%s"' % key)
- lines.append('')
- lines.append(value)
- for (key, filename, value) in files:
- typecheck(key, str)
- typecheck(filename, str)
- typecheck(value, str)
- lines.append('--' + BOUNDARY)
- lines.append('Content-Disposition: form-data; name="%s"; filename="%s"' % (key, filename))
- lines.append('Content-Type: %s' % GetContentType(filename))
- lines.append('')
- lines.append(value)
- lines.append('--' + BOUNDARY + '--')
- lines.append('')
- body = CRLF.join(lines)
- content_type = 'multipart/form-data; boundary=%s' % BOUNDARY
- return content_type, body
-
-
-def GetContentType(filename):
- """Helper to guess the content-type from the filename."""
- return mimetypes.guess_type(filename)[0] or 'application/octet-stream'
-
-
-# Use a shell for subcommands on Windows to get a PATH search.
-use_shell = sys.platform.startswith("win")
-
-def RunShellWithReturnCode(command, print_output=False,
- universal_newlines=True, env=os.environ):
- """Executes a command and returns the output from stdout and the return code.
-
- Args:
- command: Command to execute.
- print_output: If True, the output is printed to stdout.
- If False, both stdout and stderr are ignored.
- universal_newlines: Use universal_newlines flag (default: True).
-
- Returns:
- Tuple (output, return code)
- """
- logging.info("Running %s", command)
- p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
- shell=use_shell, universal_newlines=universal_newlines, env=env)
- if print_output:
- output_array = []
- while True:
- line = p.stdout.readline()
- if not line:
- break
- print line.strip("\n")
- output_array.append(line)
- output = "".join(output_array)
- else:
- output = p.stdout.read()
- p.wait()
- errout = p.stderr.read()
- if print_output and errout:
- print >>sys.stderr, errout
- p.stdout.close()
- p.stderr.close()
- return output, p.returncode
-
-
-def RunShell(command, silent_ok=False, universal_newlines=True,
- print_output=False, env=os.environ):
- data, retcode = RunShellWithReturnCode(command, print_output, universal_newlines, env)
- if retcode:
- ErrorExit("Got error status from %s:\n%s" % (command, data))
- if not silent_ok and not data:
- ErrorExit("No output from %s" % command)
- return data
-
-
-class VersionControlSystem(object):
- """Abstract base class providing an interface to the VCS."""
-
- def __init__(self, options):
- """Constructor.
-
- Args:
- options: Command line options.
- """
- self.options = options
-
- def GenerateDiff(self, args):
- """Return the current diff as a string.
-
- Args:
- args: Extra arguments to pass to the diff command.
- """
- raise NotImplementedError(
- "abstract method -- subclass %s must override" % self.__class__)
-
- def GetUnknownFiles(self):
- """Return a list of files unknown to the VCS."""
- raise NotImplementedError(
- "abstract method -- subclass %s must override" % self.__class__)
-
- def CheckForUnknownFiles(self):
- """Show an "are you sure?" prompt if there are unknown files."""
- unknown_files = self.GetUnknownFiles()
- if unknown_files:
- print "The following files are not added to version control:"
- for line in unknown_files:
- print line
- prompt = "Are you sure to continue?(y/N) "
- answer = raw_input(prompt).strip()
- if answer != "y":
- ErrorExit("User aborted")
-
- def GetBaseFile(self, filename):
- """Get the content of the upstream version of a file.
-
- Returns:
- A tuple (base_content, new_content, is_binary, status)
- base_content: The contents of the base file.
- new_content: For text files, this is empty. For binary files, this is
- the contents of the new file, since the diff output won't contain
- information to reconstruct the current file.
- is_binary: True iff the file is binary.
- status: The status of the file.
- """
-
- raise NotImplementedError(
- "abstract method -- subclass %s must override" % self.__class__)
-
-
- def GetBaseFiles(self, diff):
- """Helper that calls GetBase file for each file in the patch.
-
- Returns:
- A dictionary that maps from filename to GetBaseFile's tuple. Filenames
- are retrieved based on lines that start with "Index:" or
- "Property changes on:".
- """
- files = {}
- for line in diff.splitlines(True):
- if line.startswith('Index:') or line.startswith('Property changes on:'):
- unused, filename = line.split(':', 1)
- # On Windows if a file has property changes its filename uses '\'
- # instead of '/'.
- filename = to_slash(filename.strip())
- files[filename] = self.GetBaseFile(filename)
- return files
-
-
- def UploadBaseFiles(self, issue, rpc_server, patch_list, patchset, options,
- files):
- """Uploads the base files (and if necessary, the current ones as well)."""
-
- def UploadFile(filename, file_id, content, is_binary, status, is_base):
- """Uploads a file to the server."""
- set_status("uploading " + filename)
- file_too_large = False
- if is_base:
- type = "base"
- else:
- type = "current"
- if len(content) > MAX_UPLOAD_SIZE:
- print ("Not uploading the %s file for %s because it's too large." %
- (type, filename))
- file_too_large = True
- content = ""
- checksum = md5(content).hexdigest()
- if options.verbose > 0 and not file_too_large:
- print "Uploading %s file for %s" % (type, filename)
- url = "/%d/upload_content/%d/%d" % (int(issue), int(patchset), file_id)
- form_fields = [
- ("filename", filename),
- ("status", status),
- ("checksum", checksum),
- ("is_binary", str(is_binary)),
- ("is_current", str(not is_base)),
- ]
- if file_too_large:
- form_fields.append(("file_too_large", "1"))
- if options.email:
- form_fields.append(("user", options.email))
- ctype, body = EncodeMultipartFormData(form_fields, [("data", filename, content)])
- response_body = rpc_server.Send(url, body, content_type=ctype)
- if not response_body.startswith("OK"):
- StatusUpdate(" --> %s" % response_body)
- sys.exit(1)
-
- # Don't want to spawn too many threads, nor do we want to
- # hit Rietveld too hard, or it will start serving 500 errors.
- # When 8 works, it's no better than 4, and sometimes 8 is
- # too many for Rietveld to handle.
- MAX_PARALLEL_UPLOADS = 4
-
- sema = threading.BoundedSemaphore(MAX_PARALLEL_UPLOADS)
- upload_threads = []
- finished_upload_threads = []
-
- class UploadFileThread(threading.Thread):
- def __init__(self, args):
- threading.Thread.__init__(self)
- self.args = args
- def run(self):
- UploadFile(*self.args)
- finished_upload_threads.append(self)
- sema.release()
-
- def StartUploadFile(*args):
- sema.acquire()
- while len(finished_upload_threads) > 0:
- t = finished_upload_threads.pop()
- upload_threads.remove(t)
- t.join()
- t = UploadFileThread(args)
- upload_threads.append(t)
- t.start()
-
- def WaitForUploads():
- for t in upload_threads:
- t.join()
-
- patches = dict()
- [patches.setdefault(v, k) for k, v in patch_list]
- for filename in patches.keys():
- base_content, new_content, is_binary, status = files[filename]
- file_id_str = patches.get(filename)
- if file_id_str.find("nobase") != -1:
- base_content = None
- file_id_str = file_id_str[file_id_str.rfind("_") + 1:]
- file_id = int(file_id_str)
- if base_content != None:
- StartUploadFile(filename, file_id, base_content, is_binary, status, True)
- if new_content != None:
- StartUploadFile(filename, file_id, new_content, is_binary, status, False)
- WaitForUploads()
-
- def IsImage(self, filename):
- """Returns true if the filename has an image extension."""
- mimetype = mimetypes.guess_type(filename)[0]
- if not mimetype:
- return False
- return mimetype.startswith("image/")
-
- def IsBinary(self, filename):
- """Returns true if the guessed mimetyped isnt't in text group."""
- mimetype = mimetypes.guess_type(filename)[0]
- if not mimetype:
- return False # e.g. README, "real" binaries usually have an extension
- # special case for text files which don't start with text/
- if mimetype in TEXT_MIMETYPES:
- return False
- return not mimetype.startswith("text/")
-
-
-class FakeMercurialUI(object):
- def __init__(self):
- self.quiet = True
- self.output = ''
-
- def write(self, *args, **opts):
- self.output += ' '.join(args)
- def copy(self):
- return self
- def status(self, *args, **opts):
- pass
-
- def formatter(self, topic, opts):
- from mercurial.formatter import plainformatter
- return plainformatter(self, topic, opts)
-
- def readconfig(self, *args, **opts):
- pass
- def expandpath(self, *args, **opts):
- return global_ui.expandpath(*args, **opts)
- def configitems(self, *args, **opts):
- return global_ui.configitems(*args, **opts)
- def config(self, *args, **opts):
- return global_ui.config(*args, **opts)
-
-use_hg_shell = False # set to True to shell out to hg always; slower
-
-class MercurialVCS(VersionControlSystem):
- """Implementation of the VersionControlSystem interface for Mercurial."""
-
- def __init__(self, options, ui, repo):
- super(MercurialVCS, self).__init__(options)
- self.ui = ui
- self.repo = repo
- self.status = None
- # Absolute path to repository (we can be in a subdir)
- self.repo_dir = os.path.normpath(repo.root)
- # Compute the subdir
- cwd = os.path.normpath(os.getcwd())
- assert cwd.startswith(self.repo_dir)
- self.subdir = cwd[len(self.repo_dir):].lstrip(r"\/")
- if self.options.revision:
- self.base_rev = self.options.revision
- else:
- mqparent, err = RunShellWithReturnCode(['hg', 'log', '--rev', 'qparent', '--template={node}'])
- if not err and mqparent != "":
- self.base_rev = mqparent
- else:
- out = RunShell(["hg", "parents", "-q"], silent_ok=True).strip()
- if not out:
- # No revisions; use 0 to mean a repository with nothing.
- out = "0:0"
- self.base_rev = out.split(':')[1].strip()
- def _GetRelPath(self, filename):
- """Get relative path of a file according to the current directory,
- given its logical path in the repo."""
- assert filename.startswith(self.subdir), (filename, self.subdir)
- return filename[len(self.subdir):].lstrip(r"\/")
-
- def GenerateDiff(self, extra_args):
- # If no file specified, restrict to the current subdir
- extra_args = extra_args or ["."]
- cmd = ["hg", "diff", "--git", "-r", self.base_rev] + extra_args
- data = RunShell(cmd, silent_ok=True)
- svndiff = []
- filecount = 0
- for line in data.splitlines():
- m = re.match("diff --git a/(\S+) b/(\S+)", line)
- if m:
- # Modify line to make it look like as it comes from svn diff.
- # With this modification no changes on the server side are required
- # to make upload.py work with Mercurial repos.
- # NOTE: for proper handling of moved/copied files, we have to use
- # the second filename.
- filename = m.group(2)
- svndiff.append("Index: %s" % filename)
- svndiff.append("=" * 67)
- filecount += 1
- logging.info(line)
- else:
- svndiff.append(line)
- if not filecount:
- ErrorExit("No valid patches found in output from hg diff")
- return "\n".join(svndiff) + "\n"
-
- def GetUnknownFiles(self):
- """Return a list of files unknown to the VCS."""
- args = []
- status = RunShell(["hg", "status", "--rev", self.base_rev, "-u", "."],
- silent_ok=True)
- unknown_files = []
- for line in status.splitlines():
- st, fn = line.split(" ", 1)
- if st == "?":
- unknown_files.append(fn)
- return unknown_files
-
- def get_hg_status(self, rev, path):
- # We'd like to use 'hg status -C path', but that is buggy
- # (see http://mercurial.selenic.com/bts/issue3023).
- # Instead, run 'hg status -C' without a path
- # and skim the output for the path we want.
- if self.status is None:
- if use_hg_shell:
- out = RunShell(["hg", "status", "-C", "--rev", rev])
- else:
- fui = FakeMercurialUI()
- ret = hg_commands.status(fui, self.repo, *[], **{'rev': [rev], 'copies': True})
- if ret:
- raise hg_util.Abort(ret)
- out = fui.output
- self.status = out.splitlines()
- for i in range(len(self.status)):
- # line is
- # A path
- # M path
- # etc
- line = to_slash(self.status[i])
- if line[2:] == path:
- if i+1 < len(self.status) and self.status[i+1][:2] == ' ':
- return self.status[i:i+2]
- return self.status[i:i+1]
- raise hg_util.Abort("no status for " + path)
-
- def GetBaseFile(self, filename):
- set_status("inspecting " + filename)
- # "hg status" and "hg cat" both take a path relative to the current subdir
- # rather than to the repo root, but "hg diff" has given us the full path
- # to the repo root.
- base_content = ""
- new_content = None
- is_binary = False
- oldrelpath = relpath = self._GetRelPath(filename)
- out = self.get_hg_status(self.base_rev, relpath)
- status, what = out[0].split(' ', 1)
- if len(out) > 1 and status == "A" and what == relpath:
- oldrelpath = out[1].strip()
- status = "M"
- if ":" in self.base_rev:
- base_rev = self.base_rev.split(":", 1)[0]
- else:
- base_rev = self.base_rev
- if status != "A":
- if use_hg_shell:
- base_content = RunShell(["hg", "cat", "-r", base_rev, oldrelpath], silent_ok=True)
- else:
- base_content = str(self.repo[base_rev][oldrelpath].data())
- is_binary = "\0" in base_content # Mercurial's heuristic
- if status != "R":
- new_content = open(relpath, "rb").read()
- is_binary = is_binary or "\0" in new_content
- if is_binary and base_content and use_hg_shell:
- # Fetch again without converting newlines
- base_content = RunShell(["hg", "cat", "-r", base_rev, oldrelpath],
- silent_ok=True, universal_newlines=False)
- if not is_binary or not self.IsImage(relpath):
- new_content = None
- return base_content, new_content, is_binary, status
-
-
-# NOTE: The SplitPatch function is duplicated in engine.py, keep them in sync.
-def SplitPatch(data):
- """Splits a patch into separate pieces for each file.
-
- Args:
- data: A string containing the output of svn diff.
-
- Returns:
- A list of 2-tuple (filename, text) where text is the svn diff output
- pertaining to filename.
- """
- patches = []
- filename = None
- diff = []
- for line in data.splitlines(True):
- new_filename = None
- if line.startswith('Index:'):
- unused, new_filename = line.split(':', 1)
- new_filename = new_filename.strip()
- elif line.startswith('Property changes on:'):
- unused, temp_filename = line.split(':', 1)
- # When a file is modified, paths use '/' between directories, however
- # when a property is modified '\' is used on Windows. Make them the same
- # otherwise the file shows up twice.
- temp_filename = to_slash(temp_filename.strip())
- if temp_filename != filename:
- # File has property changes but no modifications, create a new diff.
- new_filename = temp_filename
- if new_filename:
- if filename and diff:
- patches.append((filename, ''.join(diff)))
- filename = new_filename
- diff = [line]
- continue
- if diff is not None:
- diff.append(line)
- if filename and diff:
- patches.append((filename, ''.join(diff)))
- return patches
-
-
-def UploadSeparatePatches(issue, rpc_server, patchset, data, options):
- """Uploads a separate patch for each file in the diff output.
-
- Returns a list of [patch_key, filename] for each file.
- """
- patches = SplitPatch(data)
- rv = []
- for patch in patches:
- set_status("uploading patch for " + patch[0])
- if len(patch[1]) > MAX_UPLOAD_SIZE:
- print ("Not uploading the patch for " + patch[0] +
- " because the file is too large.")
- continue
- form_fields = [("filename", patch[0])]
- if not options.download_base:
- form_fields.append(("content_upload", "1"))
- files = [("data", "data.diff", patch[1])]
- ctype, body = EncodeMultipartFormData(form_fields, files)
- url = "/%d/upload_patch/%d" % (int(issue), int(patchset))
- print "Uploading patch for " + patch[0]
- response_body = rpc_server.Send(url, body, content_type=ctype)
- lines = response_body.splitlines()
- if not lines or lines[0] != "OK":
- StatusUpdate(" --> %s" % response_body)
- sys.exit(1)
- rv.append([lines[1], patch[0]])
- return rv
diff --git a/lib/codereview/test.sh b/lib/codereview/test.sh
deleted file mode 100755
index 13f2b9cda..000000000
--- a/lib/codereview/test.sh
+++ /dev/null
@@ -1,198 +0,0 @@
-#!/bin/bash
-# Copyright 2011 The Go Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file.
-
-# Test the code review plugin.
-# Assumes a local Rietveld is running using the App Engine SDK
-# at http://localhost:7777/
-#
-# dev_appserver.py -p 7777 $HOME/pub/rietveld
-
-codereview_script=$(pwd)/codereview.py
-server=localhost:7777
-master=/tmp/go.test
-clone1=/tmp/go.test1
-clone2=/tmp/go.test2
-export HGEDITOR=true
-
-must() {
- if ! "$@"; then
- echo "$@" failed >&2
- exit 1
- fi
-}
-
-not() {
- if "$@"; then
- false
- else
- true
- fi
-}
-
-status() {
- echo '+++' "$@" >&2
-}
-
-firstcl() {
- hg pending | sed 1q | tr -d ':'
-}
-
-# Initial setup.
-status Create repositories.
-rm -rf $master $clone1 $clone2
-mkdir $master
-cd $master
-must hg init .
-echo Initial state >file
-must hg add file
-must hg ci -m 'first commit' file
-must hg clone $master $clone1
-must hg clone $master $clone2
-
-echo "
-[ui]
-username=Grace R Emlin <gre@golang.org>
-[extensions]
-codereview=$codereview_script
-[codereview]
-server=$server
-" >>$clone1/.hg/hgrc
-cp $clone1/.hg/hgrc $clone2/.hg/hgrc
-
-status Codereview should be disabled.
-cd $clone1
-must hg status
-must not hg pending
-
-status Enabling code review.
-must mkdir lib lib/codereview
-must touch lib/codereview/codereview.cfg
-
-status Code review should work even without CONTRIBUTORS.
-must hg pending
-
-status Add CONTRIBUTORS.
-echo 'Grace R Emlin <gre@golang.org>' >CONTRIBUTORS
-must hg add lib/codereview/codereview.cfg CONTRIBUTORS
-
-status First submit.
-must hg submit -r gre@golang.org -m codereview \
- lib/codereview/codereview.cfg CONTRIBUTORS
-
-status Should see change in other client.
-cd $clone2
-must hg pull -u
-must test -f lib/codereview/codereview.cfg
-must test -f CONTRIBUTORS
-
-test_clpatch() {
- # The email address must be test@example.com to match
- # the test code review server's default user.
- # Clpatch will check.
-
- cd $clone1
- # Tried to use UTF-8 here to test that, but dev_appserver.py crashes. Ha ha.
- if false; then
- status Using UTF-8.
- name="Grácè T Emlïn <test@example.com>"
- else
- status Using ASCII.
- name="Grace T Emlin <test@example.com>"
- fi
- echo "$name" >>CONTRIBUTORS
- cat .hg/hgrc | sed "s/Grace.*/$name/" >/tmp/x && mv /tmp/x .hg/hgrc
- echo '
-Reviewer: gre@golang.org
-Description:
- CONTRIBUTORS: add $name
-Files:
- CONTRIBUTORS
-' | must hg change -i
- num=$(hg pending | sed 1q | tr -d :)
-
- status Patch CL.
- cd $clone2
- must hg clpatch $num
- must [ "$num" = "$(firstcl)" ]
- must hg submit $num
-
- status Issue should be open with no reviewers.
- must curl http://$server/api/$num >/tmp/x
- must not grep '"closed":true' /tmp/x
- must grep '"reviewers":\[\]' /tmp/x
-
- status Sync should close issue.
- cd $clone1
- must hg sync
- must curl http://$server/api/$num >/tmp/x
- must grep '"closed":true' /tmp/x
- must grep '"reviewers":\[\]' /tmp/x
- must [ "$(firstcl)" = "" ]
-}
-
-test_reviewer() {
- status Submit without reviewer should fail.
- cd $clone1
- echo dummy >dummy
- must hg add dummy
- echo '
-Description:
- no reviewer
-Files:
- dummy
-' | must hg change -i
- num=$(firstcl)
- must not hg submit $num
- must hg revert dummy
- must rm dummy
- must hg change -d $num
-}
-
-test_linearity() {
- status Linearity of changes.
- cd $clone1
- echo file1 >file1
- must hg add file1
- echo '
-Reviewer: gre@golang.org
-Description: file1
-Files: file1
- ' | must hg change -i
- must hg submit $(firstcl)
-
- cd $clone2
- echo file2 >file2
- must hg add file2
- echo '
-Reviewer: gre@golang.org
-Description: file2
-Files: file2
- ' | must hg change -i
- must not hg submit $(firstcl)
- must hg sync
- must hg submit $(firstcl)
-}
-
-test_restrict() {
- status Cannot use hg ci.
- cd $clone1
- echo file1a >file1a
- hg add file1a
- must not hg ci -m commit file1a
- must rm file1a
- must hg revert file1a
-
- status Cannot use hg rollback.
- must not hg rollback
-
- status Cannot use hg backout
- must not hg backout -r -1
-}
-
-test_reviewer
-test_clpatch
-test_linearity
-test_restrict
-status ALL TESTS PASSED.
diff --git a/lib/time/update.bash b/lib/time/update.bash
index c2377e124..e0eb891e3 100755
--- a/lib/time/update.bash
+++ b/lib/time/update.bash
@@ -7,8 +7,8 @@
# downloaded from the ICANN/IANA distribution.
# Versions to use.
-CODE=2013b
-DATA=2013b
+CODE=2013c
+DATA=2013c
set -e
rm -rf work
diff --git a/lib/time/zoneinfo.zip b/lib/time/zoneinfo.zip
index c10a42576..e9ddfff81 100644
--- a/lib/time/zoneinfo.zip
+++ b/lib/time/zoneinfo.zip
Binary files differ
diff --git a/misc/cgo/test/cflags.go b/misc/cgo/test/cflags.go
new file mode 100644
index 000000000..24caab471
--- /dev/null
+++ b/misc/cgo/test/cflags.go
@@ -0,0 +1,32 @@
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Test that the #cgo CFLAGS directive works,
+// with and without platform filters.
+// See http://code.google.com/p/go/issues/detail?id=5224 for details.
+package cgotest
+
+/*
+#cgo CFLAGS: -DCOMMON_VALUE=123
+#cgo windows CFLAGS: -DIS_WINDOWS=1
+#cgo !windows CFLAGS: -DIS_WINDOWS=0
+int common = COMMON_VALUE;
+int is_windows = IS_WINDOWS;
+*/
+import "C"
+
+import (
+ "runtime"
+ "testing"
+)
+
+func testCflags(t *testing.T) {
+ is_windows := C.is_windows == 1
+ if is_windows != (runtime.GOOS == "windows") {
+ t.Errorf("is_windows: %v, runtime.GOOS: %s", is_windows, runtime.GOOS)
+ }
+ if C.common != 123 {
+ t.Errorf("common: %v (expected 123)", C.common)
+ }
+}
diff --git a/misc/cgo/test/cgo_test.go b/misc/cgo/test/cgo_test.go
index 1901d5d08..56e1a0625 100644
--- a/misc/cgo/test/cgo_test.go
+++ b/misc/cgo/test/cgo_test.go
@@ -37,5 +37,7 @@ func Test3729(t *testing.T) { test3729(t) }
func Test3775(t *testing.T) { test3775(t) }
func TestCthread(t *testing.T) { testCthread(t) }
func TestCallbackCallers(t *testing.T) { testCallbackCallers(t) }
+func Test5227(t *testing.T) { test5227(t) }
+func TestCflags(t *testing.T) { testCflags(t) }
func BenchmarkCgoCall(b *testing.B) { benchCgoCall(b) }
diff --git a/misc/cgo/test/cthread.go b/misc/cgo/test/cthread.go
index bdfd1103d..68d4a03ea 100644
--- a/misc/cgo/test/cthread.go
+++ b/misc/cgo/test/cthread.go
@@ -8,7 +8,6 @@ package cgotest
import "C"
import (
- "runtime"
"sync"
"testing"
)
@@ -31,10 +30,6 @@ func Add(x int) {
}
func testCthread(t *testing.T) {
- if runtime.GOARCH == "arm" {
- t.Skip("testCthread disabled on arm")
- }
-
sum.i = 0
C.doAdd(10, 6)
diff --git a/misc/cgo/test/issue5227.go b/misc/cgo/test/issue5227.go
new file mode 100644
index 000000000..336c4c609
--- /dev/null
+++ b/misc/cgo/test/issue5227.go
@@ -0,0 +1,38 @@
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Issue 5227: linker incorrectly treats common symbols and
+// leaves them undefined.
+
+package cgotest
+
+/*
+typedef struct {
+ int Count;
+} Fontinfo;
+
+Fontinfo SansTypeface;
+
+extern void init();
+
+Fontinfo loadfont() {
+ Fontinfo f = {0};
+ return f;
+}
+
+void init() {
+ SansTypeface = loadfont();
+}
+*/
+import "C"
+
+import "testing"
+
+func test5227(t *testing.T) {
+ C.init()
+}
+
+func selectfont() C.Fontinfo {
+ return C.SansTypeface
+}
diff --git a/misc/cgo/testso/cgoso.c b/misc/cgo/testso/cgoso.c
new file mode 100644
index 000000000..917f472d3
--- /dev/null
+++ b/misc/cgo/testso/cgoso.c
@@ -0,0 +1,14 @@
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+#include "_cgo_export.h"
+
+#ifdef WIN32
+extern void setCallback(void *);
+void init() {
+ setCallback(goCallback);
+}
+#else
+void init() {}
+#endif
diff --git a/misc/cgo/testso/cgoso.go b/misc/cgo/testso/cgoso.go
index 44fb616c1..216cb1f05 100644
--- a/misc/cgo/testso/cgoso.go
+++ b/misc/cgo/testso/cgoso.go
@@ -6,11 +6,13 @@ package cgosotest
/*
#cgo LDFLAGS: -L. -lcgosotest
+void init(void);
void sofunc(void);
*/
import "C"
func Test() {
+ C.init()
C.sofunc()
}
diff --git a/misc/cgo/testso/cgoso_c.c b/misc/cgo/testso/cgoso_c.c
index 8c15a6b9f..27155c27f 100644
--- a/misc/cgo/testso/cgoso_c.c
+++ b/misc/cgo/testso/cgoso_c.c
@@ -4,8 +4,22 @@
// +build ignore
+#ifdef WIN32
+// A Windows DLL is unable to call an arbitrary function in
+// the main executable. Work around that by making the main
+// executable pass the callback function pointer to us.
+void (*goCallback)(void);
+__declspec(dllexport) void setCallback(void *f)
+{
+ goCallback = (void (*)())f;
+}
+__declspec(dllexport) void sofunc(void);
+#else
+extern void goCallback(void);
+void setCallback(void *f) { (void)f; }
+#endif
+
void sofunc(void)
{
- extern void goCallback(void);
goCallback();
}
diff --git a/misc/cgo/testso/test.bat b/misc/cgo/testso/test.bat
new file mode 100644
index 000000000..b8cc3842b
--- /dev/null
+++ b/misc/cgo/testso/test.bat
@@ -0,0 +1,18 @@
+:: Copyright 2013 The Go Authors. All rights reserved.
+:: Use of this source code is governed by a BSD-style
+:: license that can be found in the LICENSE file.
+
+@echo off
+
+gcc -c cgoso_c.c
+gcc -shared -o libcgosotest.dll cgoso_c.o
+if not exist libcgosotest.dll goto fail
+go build main.go
+if not exist main.exe goto fail
+main.exe
+goto :end
+
+:fail
+set FAIL=1
+:end
+del /F cgoso_c.o libcgosotest.dll main.exe 2>NUL
diff --git a/misc/dashboard/builder/main.go b/misc/dashboard/builder/main.go
index b2b8f43a6..9a155bd0c 100644
--- a/misc/dashboard/builder/main.go
+++ b/misc/dashboard/builder/main.go
@@ -33,10 +33,9 @@ const (
var extraEnv = []string{
"CC",
"GOARM",
- "GOHOSTARCH",
- "GOHOSTOS",
"PATH",
"TMPDIR",
+ "USER",
}
type Builder struct {
@@ -64,6 +63,7 @@ var (
binaryTagRe = regexp.MustCompile(`^(release\.r|weekly\.)[0-9\-.]+`)
releaseRe = regexp.MustCompile(`^release\.r[0-9\-.]+`)
allCmd = "all" + suffix
+ raceCmd = "race" + suffix
cleanCmd = "clean" + suffix
suffix = defaultSuffix()
)
@@ -211,6 +211,16 @@ func NewBuilder(goroot *Repo, name string) (*Builder, error) {
return b, nil
}
+// buildCmd returns the build command to invoke.
+// Builders which contain the string '-race' in their
+// name will override *buildCmd and return raceCmd.
+func (b *Builder) buildCmd() string {
+ if strings.Contains(b.name, "-race") {
+ return raceCmd
+ }
+ return *buildCmd
+}
+
// build checks for a new commit for this builder
// and builds it if one is found.
// It returns true if a build was attempted.
@@ -262,7 +272,7 @@ func (b *Builder) buildHash(hash string) error {
defer f.Close()
w := io.MultiWriter(f, &buildlog)
- cmd := *buildCmd
+ cmd := b.buildCmd()
if !filepath.IsAbs(cmd) {
cmd = filepath.Join(srcDir, cmd)
}
@@ -397,7 +407,9 @@ func (b *Builder) envv() []string {
}
e := []string{
"GOOS=" + b.goos,
+ "GOHOSTOS=" + b.goos,
"GOARCH=" + b.goarch,
+ "GOHOSTARCH=" + b.goarch,
"GOROOT_FINAL=/usr/local/go",
}
for _, k := range extraEnv {
@@ -412,7 +424,9 @@ func (b *Builder) envv() []string {
func (b *Builder) envvWindows() []string {
start := map[string]string{
"GOOS": b.goos,
+ "GOHOSTOS": b.goos,
"GOARCH": b.goarch,
+ "GOHOSTARCH": b.goarch,
"GOROOT_FINAL": `c:\go`,
"GOBUILDEXIT": "1", // exit all.bat with completion status.
}
diff --git a/misc/dist/bindist.go b/misc/dist/bindist.go
index 76859bc68..19b0baac2 100644
--- a/misc/dist/bindist.go
+++ b/misc/dist/bindist.go
@@ -74,6 +74,7 @@ var tourPackages = []string{
}
var tourContent = []string{
+ "js",
"prog",
"solutions",
"static",
@@ -422,13 +423,13 @@ func (b *Build) tour() error {
}
// Copy gotour binary to tool directory as "tour"; invoked as "go tool tour".
- gotour := "gotour"
+ ext := ""
if runtime.GOOS == "windows" {
- gotour += ".exe"
+ ext = ".exe"
}
return cp(
- filepath.Join(b.root, "pkg", "tool", b.OS+"_"+b.Arch, "tour"),
- filepath.Join(b.gopath, "bin", gotour),
+ filepath.Join(b.root, "pkg", "tool", b.OS+"_"+b.Arch, "tour"+ext),
+ filepath.Join(b.gopath, "bin", "gotour"+ext),
)
}
diff --git a/misc/dist/darwin/scripts/preinstall b/misc/dist/darwin/scripts/preinstall
index 4cdaaa4bc..4cdaaa4bc 100644..100755
--- a/misc/dist/darwin/scripts/preinstall
+++ b/misc/dist/darwin/scripts/preinstall
diff --git a/misc/zsh/go b/misc/zsh/go
index dce25547d..18bcaaff2 100644
--- a/misc/zsh/go
+++ b/misc/zsh/go
@@ -20,6 +20,7 @@ __go_tool_complete() {
'build[compile packages and dependencies]'
'clean[remove object files]'
'doc[run godoc on package sources]'
+ 'env[print Go environment information]'
'fix[run go tool fix on packages]'
'fmt[run gofmt on package sources]'
'get[download and install packages and dependencies]'
@@ -40,12 +41,17 @@ __go_tool_complete() {
build_flags=(
'-a[force reinstallation of packages that are already up-to-date]'
'-n[print the commands but do not run them]'
- "-p[number of parallel builds]:number"
+ '-p[number of parallel builds]:number'
+ '-race[enable data race detection]'
'-x[print the commands]'
- "-work[print temporary directory name and keep it]"
- "-gcflags[flags for 5g/6g/8g]:flags"
- "-ldflags[flags for 5l/6l/8l]:flags"
- "-gccgoflags[flags for gccgo]:flags"
+ '-work[print temporary directory name and keep it]'
+ '-ccflags[flags for 5c/6c/8c]:flags'
+ '-gcflags[flags for 5g/6g/8g]:flags'
+ '-ldflags[flags for 5l/6l/8l]:flags'
+ '-gccgoflags[flags for gccgo]:flags'
+ '-compiler[name of compiler to use]:name'
+ '-installsuffix[suffix to add to package directory]:suffix'
+ '-tags[list of build tags to consider satisfied]:tags'
)
__go_list() {
local expl importpaths
@@ -63,7 +69,7 @@ __go_tool_complete() {
install)
_arguments -s -w : ${build_flags[@]} \
"-v[show package names]" \
- '*:importpaths:__go_list'
+ '*:importpaths:__go_list'
;;
get)
_arguments -s -w : \
@@ -88,7 +94,10 @@ __go_tool_complete() {
"-cpu[values of GOMAXPROCS to use]:number list" \
"-run[run tests and examples matching regexp]:regexp" \
"-bench[run benchmarks matching regexp]:regexp" \
+ "-benchmem[print memory allocation stats]" \
"-benchtime[run each benchmark until taking this long]:duration" \
+ "-blockprofile[write goroutine blocking profile to file]:file" \
+ "-blockprofilerate[set sampling rate of goroutine blocking profile]:number" \
"-timeout[kill test after that duration]:duration" \
"-cpuprofile[write CPU profile to file]:file:_files" \
"-memprofile[write heap profile to file]:file:_files" \
@@ -98,7 +107,7 @@ __go_tool_complete() {
help)
_values "${commands[@]}" \
'gopath[GOPATH environment variable]' \
- 'importpath[description of import paths]' \
+ 'packages[description of package lists]' \
'remote[remote import path syntax]' \
'testflag[description of testing flags]' \
'testfunc[description of testing functions]'
diff --git a/src/cmd/5g/cgen.c b/src/cmd/5g/cgen.c
index 9e35f9566..1620f410a 100644
--- a/src/cmd/5g/cgen.c
+++ b/src/cmd/5g/cgen.c
@@ -679,6 +679,21 @@ agen(Node *n, Node *res)
case ODOT:
agen(nl, res);
+ // explicit check for nil if struct is large enough
+ // that we might derive too big a pointer. If the left node
+ // was ODOT we have already done the nil check.
+ if(nl->op != ODOT)
+ if(nl->type->width >= unmappedzero) {
+ regalloc(&n1, types[tptr], N);
+ gmove(res, &n1);
+ regalloc(&n2, types[TUINT8], &n1);
+ n1.op = OINDREG;
+ n1.type = types[TUINT8];
+ n1.xoffset = 0;
+ gmove(&n1, &n2);
+ regfree(&n1);
+ regfree(&n2);
+ }
if(n->xoffset != 0) {
nodconst(&n1, types[TINT32], n->xoffset);
regalloc(&n2, n1.type, N);
@@ -694,20 +709,20 @@ agen(Node *n, Node *res)
case ODOTPTR:
cgen(nl, res);
+ // explicit check for nil if struct is large enough
+ // that we might derive too big a pointer.
+ if(nl->type->type->width >= unmappedzero) {
+ regalloc(&n1, types[tptr], N);
+ gmove(res, &n1);
+ regalloc(&n2, types[TUINT8], &n1);
+ n1.op = OINDREG;
+ n1.type = types[TUINT8];
+ n1.xoffset = 0;
+ gmove(&n1, &n2);
+ regfree(&n1);
+ regfree(&n2);
+ }
if(n->xoffset != 0) {
- // explicit check for nil if struct is large enough
- // that we might derive too big a pointer.
- if(nl->type->type->width >= unmappedzero) {
- regalloc(&n1, types[tptr], N);
- gmove(res, &n1);
- regalloc(&n2, types[TUINT8], &n1);
- n1.op = OINDREG;
- n1.type = types[TUINT8];
- n1.xoffset = 0;
- gmove(&n1, &n2);
- regfree(&n1);
- regfree(&n2);
- }
nodconst(&n1, types[TINT32], n->xoffset);
regalloc(&n2, n1.type, N);
regalloc(&n3, types[tptr], N);
@@ -777,20 +792,18 @@ igen(Node *n, Node *a, Node *res)
regalloc(a, types[tptr], res);
cgen(n->left, a);
}
- if(n->xoffset != 0) {
- // explicit check for nil if struct is large enough
- // that we might derive too big a pointer.
- if(n->left->type->type->width >= unmappedzero) {
- regalloc(&n1, types[tptr], N);
- gmove(a, &n1);
- regalloc(&n2, types[TUINT8], &n1);
- n1.op = OINDREG;
- n1.type = types[TUINT8];
- n1.xoffset = 0;
- gmove(&n1, &n2);
- regfree(&n1);
- regfree(&n2);
- }
+ // explicit check for nil if struct is large enough
+ // that we might derive too big a pointer.
+ if(n->left->type->type->width >= unmappedzero) {
+ regalloc(&n1, types[tptr], N);
+ gmove(a, &n1);
+ regalloc(&n2, types[TUINT8], &n1);
+ n1.op = OINDREG;
+ n1.type = types[TUINT8];
+ n1.xoffset = 0;
+ gmove(&n1, &n2);
+ regfree(&n1);
+ regfree(&n2);
}
a->op = OINDREG;
a->xoffset = n->xoffset;
diff --git a/src/cmd/5g/gsubr.c b/src/cmd/5g/gsubr.c
index d049ebe05..815d6fab2 100644
--- a/src/cmd/5g/gsubr.c
+++ b/src/cmd/5g/gsubr.c
@@ -1785,7 +1785,8 @@ sudoclean(void)
int
dotaddable(Node *n, Node *n1)
{
- int o, oary[10];
+ int o;
+ int64 oary[10];
Node *nn;
if(n->op != ODOT)
@@ -1816,7 +1817,7 @@ int
sudoaddable(int as, Node *n, Addr *a, int *w)
{
int o, i;
- int oary[10];
+ int64 oary[10];
int64 v;
Node n1, n2, n3, n4, *nn, *l, *r;
Node *reg, *reg1;
diff --git a/src/cmd/6g/cgen.c b/src/cmd/6g/cgen.c
index a51c0ca58..2eae865f3 100644
--- a/src/cmd/6g/cgen.c
+++ b/src/cmd/6g/cgen.c
@@ -568,7 +568,7 @@ agenr(Node *n, Node *a, Node *res)
Node n1, n2, n3, n4, n5, tmp, tmp2, nlen;
Prog *p1;
Type *t;
- uint32 w;
+ uint64 w;
uint64 v;
int freelen;
@@ -882,24 +882,37 @@ agen(Node *n, Node *res)
case ODOT:
agen(nl, res);
+ // explicit check for nil if struct is large enough
+ // that we might derive too big a pointer. If the left node
+ // was ODOT we have already done the nil check.
+ if(nl->op != ODOT)
+ if(nl->type->width >= unmappedzero) {
+ regalloc(&n1, types[tptr], res);
+ gmove(res, &n1);
+ n1.op = OINDREG;
+ n1.type = types[TUINT8];
+ n1.xoffset = 0;
+ gins(ATESTB, nodintconst(0), &n1);
+ regfree(&n1);
+ }
if(n->xoffset != 0)
ginscon(optoas(OADD, types[tptr]), n->xoffset, res);
break;
case ODOTPTR:
cgen(nl, res);
+ // explicit check for nil if struct is large enough
+ // that we might derive too big a pointer.
+ if(nl->type->type->width >= unmappedzero) {
+ regalloc(&n1, types[tptr], res);
+ gmove(res, &n1);
+ n1.op = OINDREG;
+ n1.type = types[TUINT8];
+ n1.xoffset = 0;
+ gins(ATESTB, nodintconst(0), &n1);
+ regfree(&n1);
+ }
if(n->xoffset != 0) {
- // explicit check for nil if struct is large enough
- // that we might derive too big a pointer.
- if(nl->type->type->width >= unmappedzero) {
- regalloc(&n1, types[tptr], res);
- gmove(res, &n1);
- n1.op = OINDREG;
- n1.type = types[TUINT8];
- n1.xoffset = 0;
- gins(ATESTB, nodintconst(0), &n1);
- regfree(&n1);
- }
ginscon(optoas(OADD, types[tptr]), n->xoffset, res);
}
break;
@@ -950,16 +963,14 @@ igen(Node *n, Node *a, Node *res)
case ODOTPTR:
cgenr(n->left, a, res);
- if(n->xoffset != 0) {
- // explicit check for nil if struct is large enough
- // that we might derive too big a pointer.
- if(n->left->type->type->width >= unmappedzero) {
- n1 = *a;
- n1.op = OINDREG;
- n1.type = types[TUINT8];
- n1.xoffset = 0;
- gins(ATESTB, nodintconst(0), &n1);
- }
+ // explicit check for nil if struct is large enough
+ // that we might derive too big a pointer.
+ if(n->left->type->type->width >= unmappedzero) {
+ n1 = *a;
+ n1.op = OINDREG;
+ n1.type = types[TUINT8];
+ n1.xoffset = 0;
+ gins(ATESTB, nodintconst(0), &n1);
}
a->op = OINDREG;
a->xoffset += n->xoffset;
@@ -1276,12 +1287,12 @@ ret:
* or return value from function call.
* return n's offset from SP.
*/
-int32
+int64
stkof(Node *n)
{
Type *t;
Iter flist;
- int32 off;
+ int64 off;
switch(n->op) {
case OINDREG:
diff --git a/src/cmd/6g/ggen.c b/src/cmd/6g/ggen.c
index 23bb5093f..5e426753c 100644
--- a/src/cmd/6g/ggen.c
+++ b/src/cmd/6g/ggen.c
@@ -942,7 +942,7 @@ cgen_bmul(int op, Node *nl, Node *nr, Node *res)
void
clearfat(Node *nl)
{
- uint32 w, c, q;
+ int64 w, c, q;
Node n1, oldn1, ax, oldax;
/* clear a fat object */
diff --git a/src/cmd/6g/gobj.c b/src/cmd/6g/gobj.c
index 508a3548f..cdbbd5d9d 100644
--- a/src/cmd/6g/gobj.c
+++ b/src/cmd/6g/gobj.c
@@ -501,7 +501,8 @@ void
genembedtramp(Type *rcvr, Type *method, Sym *newnam, int iface)
{
Sym *e;
- int c, d, o, mov, add, loaded;
+ int c, d, mov, add, loaded;
+ int64 o;
Prog *p;
Type *f;
diff --git a/src/cmd/6g/gsubr.c b/src/cmd/6g/gsubr.c
index 739983246..55864c34e 100644
--- a/src/cmd/6g/gsubr.c
+++ b/src/cmd/6g/gsubr.c
@@ -1147,6 +1147,8 @@ naddr(Node *n, Addr *a, int canemitcode)
a->type = n->val.u.reg+D_INDIR;
a->sym = n->sym;
a->offset = n->xoffset;
+ if(a->offset != (int32)a->offset)
+ yyerror("offset %lld too large for OINDREG", a->offset);
checkoffset(a, canemitcode);
break;
@@ -1947,9 +1949,9 @@ sudoclean(void)
int
sudoaddable(int as, Node *n, Addr *a)
{
- int o, i, w;
- int oary[10];
- int64 v;
+ int o, i;
+ int64 oary[10];
+ int64 v, w;
Node n1, n2, n3, n4, *nn, *l, *r;
Node *reg, *reg1;
Prog *p1;
diff --git a/src/cmd/6g/reg.c b/src/cmd/6g/reg.c
index 7db6beab9..ab826d431 100644
--- a/src/cmd/6g/reg.c
+++ b/src/cmd/6g/reg.c
@@ -947,9 +947,9 @@ doregbits(int r)
}
static int
-overlap(int32 o1, int w1, int32 o2, int w2)
+overlap(int64 o1, int w1, int64 o2, int w2)
{
- int32 t1, t2;
+ int64 t1, t2;
t1 = o1+w1;
t2 = o2+w2;
@@ -967,7 +967,7 @@ mkvar(Reg *r, Adr *a)
int i, t, n, et, z, flag;
int64 w;
uint32 regu;
- int32 o;
+ int64 o;
Bits bit;
Node *node;
diff --git a/src/cmd/8g/cgen.c b/src/cmd/8g/cgen.c
index f93be57e5..d54db7e62 100644
--- a/src/cmd/8g/cgen.c
+++ b/src/cmd/8g/cgen.c
@@ -739,6 +739,19 @@ agen(Node *n, Node *res)
case ODOT:
agen(nl, res);
+ // explicit check for nil if struct is large enough
+ // that we might derive too big a pointer. If the left node
+ // was ODOT we have already done the nil check.
+ if(nl->op != ODOT)
+ if(nl->type->width >= unmappedzero) {
+ regalloc(&n1, types[tptr], res);
+ gmove(res, &n1);
+ n1.op = OINDREG;
+ n1.type = types[TUINT8];
+ n1.xoffset = 0;
+ gins(ATESTB, nodintconst(0), &n1);
+ regfree(&n1);
+ }
if(n->xoffset != 0) {
nodconst(&n1, types[tptr], n->xoffset);
gins(optoas(OADD, types[tptr]), &n1, res);
@@ -750,18 +763,18 @@ agen(Node *n, Node *res)
if(!isptr[t->etype])
fatal("agen: not ptr %N", n);
cgen(nl, res);
+ // explicit check for nil if struct is large enough
+ // that we might derive too big a pointer.
+ if(nl->type->type->width >= unmappedzero) {
+ regalloc(&n1, types[tptr], res);
+ gmove(res, &n1);
+ n1.op = OINDREG;
+ n1.type = types[TUINT8];
+ n1.xoffset = 0;
+ gins(ATESTB, nodintconst(0), &n1);
+ regfree(&n1);
+ }
if(n->xoffset != 0) {
- // explicit check for nil if struct is large enough
- // that we might derive too big a pointer.
- if(nl->type->type->width >= unmappedzero) {
- regalloc(&n1, types[tptr], res);
- gmove(res, &n1);
- n1.op = OINDREG;
- n1.type = types[TUINT8];
- n1.xoffset = 0;
- gins(ATESTB, nodintconst(0), &n1);
- regfree(&n1);
- }
nodconst(&n1, types[tptr], n->xoffset);
gins(optoas(OADD, types[tptr]), &n1, res);
}
@@ -825,16 +838,14 @@ igen(Node *n, Node *a, Node *res)
regalloc(a, types[tptr], res);
cgen(n->left, a);
}
- if(n->xoffset != 0) {
- // explicit check for nil if struct is large enough
- // that we might derive too big a pointer.
- if(n->left->type->type->width >= unmappedzero) {
- n1 = *a;
- n1.op = OINDREG;
- n1.type = types[TUINT8];
- n1.xoffset = 0;
- gins(ATESTB, nodintconst(0), &n1);
- }
+ // explicit check for nil if struct is large enough
+ // that we might derive too big a pointer.
+ if(n->left->type->type->width >= unmappedzero) {
+ n1 = *a;
+ n1.op = OINDREG;
+ n1.type = types[TUINT8];
+ n1.xoffset = 0;
+ gins(ATESTB, nodintconst(0), &n1);
}
a->op = OINDREG;
a->xoffset += n->xoffset;
diff --git a/src/cmd/8g/gsubr.c b/src/cmd/8g/gsubr.c
index 79348a42d..756bdd203 100644
--- a/src/cmd/8g/gsubr.c
+++ b/src/cmd/8g/gsubr.c
@@ -2391,7 +2391,8 @@ naddr(Node *n, Addr *a, int canemitcode)
int
dotaddable(Node *n, Node *n1)
{
- int o, oary[10];
+ int o;
+ int64 oary[10];
Node *nn;
if(n->op != ODOT)
diff --git a/src/cmd/api/goapi.go b/src/cmd/api/goapi.go
index d5e66428b..ff75f00e3 100644
--- a/src/cmd/api/goapi.go
+++ b/src/cmd/api/goapi.go
@@ -38,9 +38,7 @@ import (
// Flags
var (
- // TODO(bradfitz): once Go 1.1 comes out, allow the -c flag to take a comma-separated
- // list of files, rather than just one.
- checkFile = flag.String("c", "", "optional filename to check API against")
+ checkFile = flag.String("c", "", "optional comma-separated filename(s) to check API against")
allowNew = flag.Bool("allow_new", true, "allow API additions")
exceptFile = flag.String("except", "", "optional filename of packages that are allowed to change without triggering a failure in the tool")
nextFile = flag.String("next", "", "optional filename of tentative upcoming API features for the next release. This file can be lazily maintained. It only affects the delta warnings from the -c file printed on success.")
@@ -186,7 +184,10 @@ func main() {
return
}
- required := fileFeatures(*checkFile)
+ var required []string
+ for _, file := range strings.Split(*checkFile, ",") {
+ required = append(required, fileFeatures(file)...)
+ }
optional := fileFeatures(*nextFile)
exception := fileFeatures(*exceptFile)
fail = !compareAPI(bw, features, required, optional, exception)
diff --git a/src/cmd/cgo/doc.go b/src/cmd/cgo/doc.go
index efbeae958..a1b02d4be 100644
--- a/src/cmd/cgo/doc.go
+++ b/src/cmd/cgo/doc.go
@@ -463,7 +463,7 @@ The directives are:
#pragma cgo_import_dynamic puts puts#GLIBC_2.2.5
#pragma cgo_import_dynamic puts puts#GLIBC_2.2.5 "libc.so.6"
- A side effect of the cgo_dynamic_import directive with a
+ A side effect of the cgo_import_dynamic directive with a
library is to make the final binary depend on that dynamic
library. To get the dependency without importing any specific
symbols, use _ for local and remote.
@@ -472,7 +472,7 @@ The directives are:
#pragma cgo_import_dynamic _ _ "libc.so.6"
For compatibility with current versions of SWIG,
- #pragma dynimport is an alias for #pragma cgo_dynamic_import.
+ #pragma dynimport is an alias for #pragma cgo_import_dynamic.
#pragma cgo_dynamic_linker "<path>"
@@ -573,7 +573,7 @@ The directives in the 6c-compiled file are used according to the kind
of final link used.
In internal mode, 6l itself processes all the host object files, in
-particular foo.cgo2.o. To do so, it uses the cgo_dynamic_import and
+particular foo.cgo2.o. To do so, it uses the cgo_import_dynamic and
cgo_dynamic_linker directives to learn that the otherwise undefined
reference to sin in foo.cgo2.o should be rewritten to refer to the
symbol sin with version GLIBC_2.2.5 from the dynamic library
diff --git a/src/cmd/cgo/gcc.go b/src/cmd/cgo/gcc.go
index 585f01477..bc7a6472f 100644
--- a/src/cmd/cgo/gcc.go
+++ b/src/cmd/cgo/gcc.go
@@ -66,71 +66,16 @@ func cname(s string) string {
return s
}
-// ParseFlags extracts #cgo CFLAGS and LDFLAGS options from the file
-// preamble. Multiple occurrences are concatenated with a separating space,
-// even across files.
-func (p *Package) ParseFlags(f *File, srcfile string) {
+// DiscardCgoDirectives processes the import C preamble, and discards
+// all #cgo CFLAGS and LDFLAGS directives, so they don't make their
+// way into _cgo_export.h.
+func (f *File) DiscardCgoDirectives() {
linesIn := strings.Split(f.Preamble, "\n")
linesOut := make([]string, 0, len(linesIn))
-
-NextLine:
for _, line := range linesIn {
l := strings.TrimSpace(line)
if len(l) < 5 || l[:4] != "#cgo" || !unicode.IsSpace(rune(l[4])) {
linesOut = append(linesOut, line)
- continue
- }
-
- l = strings.TrimSpace(l[4:])
- fields := strings.SplitN(l, ":", 2)
- if len(fields) != 2 {
- fatalf("%s: bad #cgo line: %s", srcfile, line)
- }
-
- var k string
- kf := strings.Fields(fields[0])
- switch len(kf) {
- case 1:
- k = kf[0]
- case 2:
- k = kf[1]
- switch kf[0] {
- case goos:
- case goarch:
- case goos + "/" + goarch:
- default:
- continue NextLine
- }
- default:
- fatalf("%s: bad #cgo option: %s", srcfile, fields[0])
- }
-
- args, err := splitQuoted(fields[1])
- if err != nil {
- fatalf("%s: bad #cgo option %s: %s", srcfile, k, err)
- }
- for _, arg := range args {
- if !safeName(arg) {
- fatalf("%s: #cgo option %s is unsafe: %s", srcfile, k, arg)
- }
- }
-
- switch k {
-
- case "CFLAGS", "LDFLAGS":
- p.addToFlag(k, args)
-
- case "pkg-config":
- cflags, ldflags, err := pkgConfig(args)
- if err != nil {
- fatalf("%s: bad #cgo option %s: %s", srcfile, k, err)
- }
- p.addToFlag("CFLAGS", cflags)
- p.addToFlag("LDFLAGS", ldflags)
-
- default:
- fatalf("%s: unsupported #cgo option %s", srcfile, k)
-
}
}
f.Preamble = strings.Join(linesOut, "\n")
@@ -146,36 +91,6 @@ func (p *Package) addToFlag(flag string, args []string) {
}
}
-// pkgConfig runs pkg-config and extracts --libs and --cflags information
-// for packages.
-func pkgConfig(packages []string) (cflags, ldflags []string, err error) {
- for _, name := range packages {
- if len(name) == 0 || name[0] == '-' {
- return nil, nil, errors.New(fmt.Sprintf("invalid name: %q", name))
- }
- }
-
- args := append([]string{"pkg-config", "--cflags"}, packages...)
- stdout, stderr, ok := run(nil, args)
- if !ok {
- os.Stderr.Write(stderr)
- return nil, nil, errors.New("pkg-config failed")
- }
- cflags, err = splitQuoted(string(stdout))
- if err != nil {
- return
- }
-
- args = append([]string{"pkg-config", "--libs"}, packages...)
- stdout, stderr, ok = run(nil, args)
- if !ok {
- os.Stderr.Write(stderr)
- return nil, nil, errors.New("pkg-config failed")
- }
- ldflags, err = splitQuoted(string(stdout))
- return
-}
-
// splitQuoted splits the string s around each instance of one or more consecutive
// white space characters while taking into account quotes and escaping, and
// returns an array of substrings of s or an empty list if s contains only white space.
@@ -894,6 +809,15 @@ func (p *Package) gccDefines(stdin []byte) string {
func (p *Package) gccErrors(stdin []byte) string {
// TODO(rsc): require failure
args := p.gccCmd()
+
+ // GCC 4.8.0 has a bug: it sometimes does not apply
+ // -Wunused-value to values that are macros defined in system
+ // headers. See issue 5118. Adding -Wsystem-headers avoids
+ // that problem. This will produce additional errors, but it
+ // doesn't matter because we will ignore all errors that are
+ // not marked for the cgo-test file.
+ args = append(args, "-Wsystem-headers")
+
if *debugGcc {
fmt.Fprintf(os.Stderr, "$ %s <<EOF\n", strings.Join(args, " "))
os.Stderr.Write(stdin)
diff --git a/src/cmd/cgo/main.go b/src/cmd/cgo/main.go
index ca370ef3f..9bd326e1d 100644
--- a/src/cmd/cgo/main.go
+++ b/src/cmd/cgo/main.go
@@ -208,6 +208,15 @@ func main() {
p := newPackage(args[:i])
+ // Record CGO_LDFLAGS from the environment for external linking.
+ if ldflags := os.Getenv("CGO_LDFLAGS"); ldflags != "" {
+ args, err := splitQuoted(ldflags)
+ if err != nil {
+ fatalf("bad CGO_LDFLAGS: %q (%s)", ldflags, err)
+ }
+ p.addToFlag("LDFLAGS", args)
+ }
+
// Need a unique prefix for the global C symbols that
// we use to coordinate between gcc and ourselves.
// We already put _cgo_ at the beginning, so the main
@@ -226,10 +235,9 @@ func main() {
fs := make([]*File, len(goFiles))
for i, input := range goFiles {
- // Parse flags for all files before translating due to CFLAGS.
f := new(File)
f.ReadGo(input)
- p.ParseFlags(f, input)
+ f.DiscardCgoDirectives()
fs[i] = f
}
@@ -282,11 +290,6 @@ func main() {
// newPackage returns a new Package that will invoke
// gcc with the additional arguments specified in args.
func newPackage(args []string) *Package {
- // Copy the gcc options to a new slice so the list
- // can grow without overwriting the slice that args is in.
- gccOptions := make([]string, len(args))
- copy(gccOptions, args)
-
goarch = runtime.GOARCH
if s := os.Getenv("GOARCH"); s != "" {
goarch = s
@@ -309,12 +312,12 @@ func newPackage(args []string) *Package {
os.Setenv("LC_ALL", "C")
p := &Package{
- PtrSize: ptrSize,
- IntSize: intSize,
- GccOptions: gccOptions,
- CgoFlags: make(map[string][]string),
- Written: make(map[string]bool),
+ PtrSize: ptrSize,
+ IntSize: intSize,
+ CgoFlags: make(map[string][]string),
+ Written: make(map[string]bool),
}
+ p.addToFlag("CFLAGS", args)
return p
}
diff --git a/src/cmd/cov/Makefile b/src/cmd/cov/Makefile
deleted file mode 100644
index 3f528d751..000000000
--- a/src/cmd/cov/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# Copyright 2012 The Go Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file.
-
-include ../../Make.dist
diff --git a/src/cmd/cov/doc.go b/src/cmd/cov/doc.go
deleted file mode 100644
index ab5d1220a..000000000
--- a/src/cmd/cov/doc.go
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-/*
-
-Cov is a rudimentary code coverage tool.
-
-Usage:
- go tool cov [-lsv] [-g substring] [-m minlines] [6.out args]
-
-Given a command to run, it runs the command while tracking which
-sections of code have been executed. When the command finishes,
-cov prints the line numbers of sections of code in the binary that
-were not executed. With no arguments it assumes the command "6.out".
-
-
-The options are:
-
- -l
- print full path names instead of paths relative to the current directory
- -s
- show the source code that didn't execute, in addition to the line numbers.
- -v
- print debugging information during the run.
- -g substring
- restrict the coverage analysis to functions or files whose names contain substring
- -m minlines
- only report uncovered sections of code larger than minlines lines
-
-The program is the same for all architectures: 386, amd64, and arm.
-
-*/
-package main
diff --git a/src/cmd/cov/main.c b/src/cmd/cov/main.c
deleted file mode 100644
index 33ef49e17..000000000
--- a/src/cmd/cov/main.c
+++ /dev/null
@@ -1,484 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-/*
- * code coverage
- */
-
-#include <u.h>
-#include <libc.h>
-#include <bio.h>
-#include "tree.h"
-
-#include <ureg_amd64.h>
-#include <mach.h>
-typedef struct Ureg Ureg;
-
-void
-usage(void)
-{
- fprint(2, "usage: cov [-lsv] [-g substring] [-m minlines] [6.out args...]\n");
- fprint(2, "-g specifies pattern of interesting functions or files\n");
- exits("usage");
-}
-
-typedef struct Range Range;
-struct Range
-{
- uvlong pc;
- uvlong epc;
-};
-
-int chatty;
-int fd;
-int longnames;
-int pid;
-int doshowsrc;
-Map *mem;
-Map *text;
-Fhdr fhdr;
-char *substring;
-char cwd[1000];
-int ncwd;
-int minlines = -1000;
-
-Tree breakpoints; // code ranges not run
-
-/*
- * comparison for Range structures
- * they are "equal" if they overlap, so
- * that a search for [pc, pc+1) finds the
- * Range containing pc.
- */
-int
-rangecmp(void *va, void *vb)
-{
- Range *a = va, *b = vb;
- if(a->epc <= b->pc)
- return 1;
- if(b->epc <= a->pc)
- return -1;
- return 0;
-}
-
-/*
- * remember that we ran the section of code [pc, epc).
- */
-void
-ran(uvlong pc, uvlong epc)
-{
- Range key;
- Range *r;
- uvlong oldepc;
-
- if(chatty)
- print("run %#llux-%#llux\n", pc, epc);
-
- key.pc = pc;
- key.epc = pc+1;
- r = treeget(&breakpoints, &key);
- if(r == nil)
- sysfatal("unchecked breakpoint at %#llux+%d", pc, (int)(epc-pc));
-
- // Might be that the tail of the sequence
- // was run already, so r->epc is before the end.
- // Adjust len.
- if(epc > r->epc)
- epc = r->epc;
-
- if(r->pc == pc) {
- r->pc = epc;
- } else {
- // Chop r to before pc;
- // add new entry for after if needed.
- // Changing r->epc does not affect r's position in the tree.
- oldepc = r->epc;
- r->epc = pc;
- if(epc < oldepc) {
- Range *n;
- n = malloc(sizeof *n);
- if(n == nil)
- sysfatal("out of memory");
- n->pc = epc;
- n->epc = oldepc;
- treeput(&breakpoints, n, n);
- }
- }
-}
-
-void
-showsrc(char *file, int line1, int line2)
-{
- Biobuf *b;
- char *p;
- int n, stop;
-
- if((b = Bopen(file, OREAD)) == nil) {
- print("\topen %s: %r\n", file);
- return;
- }
-
- for(n=1; n<line1 && (p = Brdstr(b, '\n', 1)) != nil; n++)
- free(p);
-
- // print up to five lines (this one and 4 more).
- // if there are more than five lines, print 4 and "..."
- stop = n+4;
- if(stop > line2)
- stop = line2;
- if(stop < line2)
- stop--;
- for(; n<=stop && (p = Brdstr(b, '\n', 1)) != nil; n++) {
- print(" %d %s\n", n, p);
- free(p);
- }
- if(n < line2)
- print(" ...\n");
- Bterm(b);
-}
-
-/*
- * if s is in the current directory or below,
- * return the relative path.
- */
-char*
-shortname(char *s)
-{
- if(!longnames && strlen(s) > ncwd && memcmp(s, cwd, ncwd) == 0 && s[ncwd] == '/')
- return s+ncwd+1;
- return s;
-}
-
-/*
- * we've decided that [pc, epc) did not run.
- * do something about it.
- */
-void
-missing(uvlong pc, uvlong epc)
-{
- char file[1000];
- int line1, line2;
- char buf[100];
- Symbol s;
- char *p;
- uvlong uv;
-
- if(!findsym(pc, CTEXT, &s) || !fileline(file, sizeof file, pc)) {
- notfound:
- print("%#llux-%#llux\n", pc, epc);
- return;
- }
- p = strrchr(file, ':');
- *p++ = 0;
- line1 = atoi(p);
- for(uv=pc; uv<epc; ) {
- if(!fileline(file, sizeof file, epc-2))
- goto notfound;
- uv += machdata->instsize(text, uv);
- }
- p = strrchr(file, ':');
- *p++ = 0;
- line2 = atoi(p);
-
- if(line2+1-line2 < minlines)
- return;
-
- if(pc == s.value) {
- // never entered function
- print("%s:%d %s never called (%#llux-%#llux)\n", shortname(file), line1, s.name, pc, epc);
- return;
- }
- if(pc <= s.value+13) {
- // probably stub for stack growth.
- // check whether last instruction is call to morestack.
- // the -5 below is the length of
- // CALL sys.morestack.
- buf[0] = 0;
- machdata->das(text, epc-5, 0, buf, sizeof buf);
- if(strstr(buf, "morestack"))
- return;
- }
-
- if(epc - pc == 5) {
- // check for CALL sys.panicindex
- buf[0] = 0;
- machdata->das(text, pc, 0, buf, sizeof buf);
- if(strstr(buf, "panicindex"))
- return;
- }
-
- if(epc - pc == 2 || epc -pc == 3) {
- // check for XORL inside shift.
- // (on x86 have to implement large left or unsigned right shift with explicit zeroing).
- // f+90 0x00002c9f CMPL CX,$20
- // f+93 0x00002ca2 JCS f+97(SB)
- // f+95 0x00002ca4 XORL AX,AX <<<
- // f+97 0x00002ca6 SHLL CL,AX
- // f+99 0x00002ca8 MOVL $1,CX
- //
- // f+c8 0x00002cd7 CMPL CX,$40
- // f+cb 0x00002cda JCS f+d0(SB)
- // f+cd 0x00002cdc XORQ AX,AX <<<
- // f+d0 0x00002cdf SHLQ CL,AX
- // f+d3 0x00002ce2 MOVQ $1,CX
- buf[0] = 0;
- machdata->das(text, pc, 0, buf, sizeof buf);
- if(strncmp(buf, "XOR", 3) == 0) {
- machdata->das(text, epc, 0, buf, sizeof buf);
- if(strncmp(buf, "SHL", 3) == 0 || strncmp(buf, "SHR", 3) == 0)
- return;
- }
- }
-
- if(epc - pc == 3) {
- // check for SAR inside shift.
- // (on x86 have to implement large signed right shift as >>31).
- // f+36 0x00016216 CMPL CX,$20
- // f+39 0x00016219 JCS f+3e(SB)
- // f+3b 0x0001621b SARL $1f,AX <<<
- // f+3e 0x0001621e SARL CL,AX
- // f+40 0x00016220 XORL CX,CX
- // f+42 0x00016222 CMPL CX,AX
- buf[0] = 0;
- machdata->das(text, pc, 0, buf, sizeof buf);
- if(strncmp(buf, "SAR", 3) == 0) {
- machdata->das(text, epc, 0, buf, sizeof buf);
- if(strncmp(buf, "SAR", 3) == 0)
- return;
- }
- }
-
- // show first instruction to make clear where we were.
- machdata->das(text, pc, 0, buf, sizeof buf);
-
- if(line1 != line2)
- print("%s:%d,%d %#llux-%#llux %s\n",
- shortname(file), line1, line2, pc, epc, buf);
- else
- print("%s:%d %#llux-%#llux %s\n",
- shortname(file), line1, pc, epc, buf);
- if(doshowsrc)
- showsrc(file, line1, line2);
-}
-
-/*
- * walk the tree, calling missing for each non-empty
- * section of missing code.
- */
-void
-walktree(TreeNode *t)
-{
- Range *n;
-
- if(t == nil)
- return;
- walktree(t->left);
- n = t->key;
- if(n->pc < n->epc)
- missing(n->pc, n->epc);
- walktree(t->right);
-}
-
-/*
- * set a breakpoint all over [pc, epc)
- * and remember that we did.
- */
-void
-breakpoint(uvlong pc, uvlong epc)
-{
- Range *r;
-
- r = malloc(sizeof *r);
- if(r == nil)
- sysfatal("out of memory");
- r->pc = pc;
- r->epc = epc;
- treeput(&breakpoints, r, r);
-
- for(; pc < epc; pc+=machdata->bpsize)
- put1(mem, pc, machdata->bpinst, machdata->bpsize);
-}
-
-/*
- * install breakpoints over all text symbols
- * that match the pattern.
- */
-void
-cover(void)
-{
- Symbol s;
- char *lastfn;
- uvlong lastpc;
- int i;
- char buf[200];
-
- lastfn = nil;
- lastpc = 0;
- for(i=0; textsym(&s, i); i++) {
- switch(s.type) {
- case 'T':
- case 't':
- if(lastpc != 0) {
- breakpoint(lastpc, s.value);
- lastpc = 0;
- }
- // Ignore second entry for a given name;
- // that's the debugging blob.
- if(lastfn && strcmp(s.name, lastfn) == 0)
- break;
- lastfn = s.name;
- buf[0] = 0;
- fileline(buf, sizeof buf, s.value);
- if(substring == nil || strstr(buf, substring) || strstr(s.name, substring))
- lastpc = s.value;
- }
- }
-}
-
-uvlong
-rgetzero(Map *map, char *reg)
-{
- USED(map);
- USED(reg);
-
- return 0;
-}
-
-/*
- * remove the breakpoints at pc and successive instructions,
- * up to and including the first jump or other control flow transfer.
- */
-void
-uncover(uvlong pc)
-{
- uchar buf[1000];
- int n, n1, n2;
- uvlong foll[2];
-
- // Double-check that we stopped at a breakpoint.
- if(get1(mem, pc, buf, machdata->bpsize) < 0)
- sysfatal("read mem inst at %#llux: %r", pc);
- if(memcmp(buf, machdata->bpinst, machdata->bpsize) != 0)
- sysfatal("stopped at %#llux; not at breakpoint %d", pc, machdata->bpsize);
-
- // Figure out how many bytes of straight-line code
- // there are in the text starting at pc.
- n = 0;
- while(n < sizeof buf) {
- n1 = machdata->instsize(text, pc+n);
- if(n+n1 > sizeof buf)
- break;
- n2 = machdata->foll(text, pc+n, rgetzero, foll);
- n += n1;
- if(n2 != 1 || foll[0] != pc+n)
- break;
- }
-
- // Record that this section of code ran.
- ran(pc, pc+n);
-
- // Put original instructions back.
- if(get1(text, pc, buf, n) < 0)
- sysfatal("get1: %r");
- if(put1(mem, pc, buf, n) < 0)
- sysfatal("put1: %r");
-}
-
-int
-startprocess(char **argv)
-{
- int pid;
-
- if((pid = fork()) < 0)
- sysfatal("fork: %r");
- if(pid == 0) {
- pid = getpid();
- if(ctlproc(pid, "hang") < 0)
- sysfatal("ctlproc hang: %r");
- exec(argv[0], argv);
- sysfatal("exec %s: %r", argv[0]);
- }
- if(ctlproc(pid, "attached") < 0 || ctlproc(pid, "waitstop") < 0)
- sysfatal("attach %d %s: %r", pid, argv[0]);
- return pid;
-}
-
-int
-go(void)
-{
- uvlong pc;
- char buf[100];
- int n;
-
- for(n = 0;; n++) {
- ctlproc(pid, "startstop");
- if(get8(mem, offsetof(Ureg, ip), &pc) < 0) {
- rerrstr(buf, sizeof buf);
- if(strstr(buf, "exited") || strstr(buf, "No such process"))
- return n;
- sysfatal("cannot read pc: %r");
- }
- pc--;
- if(put8(mem, offsetof(Ureg, ip), pc) < 0)
- sysfatal("cannot write pc: %r");
- uncover(pc);
- }
-}
-
-void
-main(int argc, char **argv)
-{
- int n;
-
- ARGBEGIN{
- case 'g':
- substring = EARGF(usage());
- break;
- case 'l':
- longnames++;
- break;
- case 'n':
- minlines = atoi(EARGF(usage()));
- break;
- case 's':
- doshowsrc = 1;
- break;
- case 'v':
- chatty++;
- break;
- default:
- usage();
- }ARGEND
-
- getwd(cwd, sizeof cwd);
- ncwd = strlen(cwd);
-
- if(argc == 0) {
- *--argv = "6.out";
- }
- fd = open(argv[0], OREAD);
- if(fd < 0)
- sysfatal("open %s: %r", argv[0]);
- if(crackhdr(fd, &fhdr) <= 0)
- sysfatal("crackhdr: %r");
- machbytype(fhdr.type);
- if(syminit(fd, &fhdr) <= 0)
- sysfatal("syminit: %r");
- text = loadmap(nil, fd, &fhdr);
- if(text == nil)
- sysfatal("loadmap: %r");
- pid = startprocess(argv);
- mem = attachproc(pid, &fhdr);
- if(mem == nil)
- sysfatal("attachproc: %r");
- breakpoints.cmp = rangecmp;
- cover();
- n = go();
- walktree(breakpoints.root);
- if(chatty)
- print("%d breakpoints\n", n);
- detachproc(mem);
- exits(0);
-}
-
diff --git a/src/cmd/cov/tree.c b/src/cmd/cov/tree.c
deleted file mode 100644
index 366a47efd..000000000
--- a/src/cmd/cov/tree.c
+++ /dev/null
@@ -1,245 +0,0 @@
-// Renamed from Map to Tree to avoid conflict with libmach.
-
-/*
-Copyright (c) 2003-2007 Russ Cox, Tom Bergan, Austin Clements,
- Massachusetts Institute of Technology
-Portions Copyright (c) 2009 The Go Authors. All rights reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-// Mutable map structure, but still based on
-// Okasaki, Red Black Trees in a Functional Setting, JFP 1999,
-// which is a lot easier than the traditional red-black
-// and plenty fast enough for me. (Also I could copy
-// and edit fmap.c.)
-
-#include <u.h>
-#include <libc.h>
-#include "tree.h"
-
-enum
-{
- Red = 0,
- Black = 1
-};
-
-
-// Red-black trees are binary trees with this property:
-// 1. No red node has a red parent.
-// 2. Every path from the root to a leaf contains the
-// same number of black nodes.
-
-static TreeNode*
-rwTreeNode(TreeNode *p, int color, TreeNode *left, void *key, void *value, TreeNode *right)
-{
- if(p == nil)
- p = malloc(sizeof *p);
- if(p == nil)
- sysfatal("out of memory");
- p->color = color;
- p->left = left;
- p->key = key;
- p->value = value;
- p->right = right;
- return p;
-}
-
-static TreeNode*
-balance(TreeNode *m0)
-{
- void *xk, *xv, *yk, *yv, *zk, *zv;
- TreeNode *a, *b, *c, *d;
- TreeNode *m1, *m2;
- int color;
- TreeNode *left, *right;
- void *key, *value;
-
- color = m0->color;
- left = m0->left;
- key = m0->key;
- value = m0->value;
- right = m0->right;
-
- // Okasaki notation: (T is mkTreeNode, B is Black, R is Red, x, y, z are key-value.
- //
- // balance B (T R (T R a x b) y c) z d
- // balance B (T R a x (T R b y c)) z d
- // balance B a x (T R (T R b y c) z d)
- // balance B a x (T R b y (T R c z d))
- //
- // = T R (T B a x b) y (T B c z d)
-
- if(color == Black){
- if(left && left->color == Red){
- if(left->left && left->left->color == Red){
- a = left->left->left;
- xk = left->left->key;
- xv = left->left->value;
- b = left->left->right;
- yk = left->key;
- yv = left->value;
- c = left->right;
- zk = key;
- zv = value;
- d = right;
- m1 = left;
- m2 = left->left;
- goto hard;
- }else if(left->right && left->right->color == Red){
- a = left->left;
- xk = left->key;
- xv = left->value;
- b = left->right->left;
- yk = left->right->key;
- yv = left->right->value;
- c = left->right->right;
- zk = key;
- zv = value;
- d = right;
- m1 = left;
- m2 = left->right;
- goto hard;
- }
- }else if(right && right->color == Red){
- if(right->left && right->left->color == Red){
- a = left;
- xk = key;
- xv = value;
- b = right->left->left;
- yk = right->left->key;
- yv = right->left->value;
- c = right->left->right;
- zk = right->key;
- zv = right->value;
- d = right->right;
- m1 = right;
- m2 = right->left;
- goto hard;
- }else if(right->right && right->right->color == Red){
- a = left;
- xk = key;
- xv = value;
- b = right->left;
- yk = right->key;
- yv = right->value;
- c = right->right->left;
- zk = right->right->key;
- zv = right->right->value;
- d = right->right->right;
- m1 = right;
- m2 = right->right;
- goto hard;
- }
- }
- }
- return rwTreeNode(m0, color, left, key, value, right);
-
-hard:
- return rwTreeNode(m0, Red, rwTreeNode(m1, Black, a, xk, xv, b),
- yk, yv, rwTreeNode(m2, Black, c, zk, zv, d));
-}
-
-static TreeNode*
-ins0(TreeNode *p, void *k, void *v, TreeNode *rw)
-{
- if(p == nil)
- return rwTreeNode(rw, Red, nil, k, v, nil);
- if(p->key == k){
- if(rw)
- return rwTreeNode(rw, p->color, p->left, k, v, p->right);
- p->value = v;
- return p;
- }
- if(p->key < k)
- p->left = ins0(p->left, k, v, rw);
- else
- p->right = ins0(p->right, k, v, rw);
- return balance(p);
-}
-
-static TreeNode*
-ins1(Tree *m, TreeNode *p, void *k, void *v, TreeNode *rw)
-{
- int i;
-
- if(p == nil)
- return rwTreeNode(rw, Red, nil, k, v, nil);
- i = m->cmp(p->key, k);
- if(i == 0){
- if(rw)
- return rwTreeNode(rw, p->color, p->left, k, v, p->right);
- p->value = v;
- return p;
- }
- if(i < 0)
- p->left = ins1(m, p->left, k, v, rw);
- else
- p->right = ins1(m, p->right, k, v, rw);
- return balance(p);
-}
-
-void
-treeputelem(Tree *m, void *key, void *val, TreeNode *rw)
-{
- if(m->cmp)
- m->root = ins1(m, m->root, key, val, rw);
- else
- m->root = ins0(m->root, key, val, rw);
-}
-
-void
-treeput(Tree *m, void *key, void *val)
-{
- treeputelem(m, key, val, nil);
-}
-
-void*
-treeget(Tree *m, void *key)
-{
- int i;
- TreeNode *p;
-
- p = m->root;
- if(m->cmp){
- for(;;){
- if(p == nil)
- return nil;
- i = m->cmp(p->key, key);
- if(i < 0)
- p = p->left;
- else if(i > 0)
- p = p->right;
- else
- return p->value;
- }
- }else{
- for(;;){
- if(p == nil)
- return nil;
- if(p->key == key)
- return p->value;
- if(p->key < key)
- p = p->left;
- else
- p = p->right;
- }
- }
-}
diff --git a/src/cmd/cov/tree.h b/src/cmd/cov/tree.h
deleted file mode 100644
index a716d83ad..000000000
--- a/src/cmd/cov/tree.h
+++ /dev/null
@@ -1,47 +0,0 @@
-// Renamed from Map to Tree to avoid conflict with libmach.
-
-/*
-Copyright (c) 2003-2007 Russ Cox, Tom Bergan, Austin Clements,
- Massachusetts Institute of Technology
-Portions Copyright (c) 2009 The Go Authors. All rights reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-typedef struct Tree Tree;
-typedef struct TreeNode TreeNode;
-struct Tree
-{
- int (*cmp)(void*, void*);
- TreeNode *root;
-};
-
-struct TreeNode
-{
- int color;
- TreeNode *left;
- void *key;
- void *value;
- TreeNode *right;
-};
-
-void *treeget(Tree*, void*);
-void treeput(Tree*, void*, void*);
-void treeputelem(Tree*, void*, void*, TreeNode*);
diff --git a/src/cmd/dist/build.c b/src/cmd/dist/build.c
index e94862325..169e5cadd 100644
--- a/src/cmd/dist/build.c
+++ b/src/cmd/dist/build.c
@@ -622,6 +622,10 @@ install(char *dir)
// clang is too smart about unused command-line arguments
vadd(&gccargs, "-Qunused-arguments");
}
+ if(streq(gohostos, "darwin")) {
+ // golang.org/issue/5261
+ vadd(&gccargs, "-mmacosx-version-min=10.6");
+ }
}
islib = hasprefix(dir, "lib") || streq(dir, "cmd/cc") || streq(dir, "cmd/gc");
diff --git a/src/cmd/dist/goc2c.c b/src/cmd/dist/goc2c.c
index a103bce8d..f58460397 100644
--- a/src/cmd/dist/goc2c.c
+++ b/src/cmd/dist/goc2c.c
@@ -66,7 +66,7 @@ static int gcc;
/* File and line number */
static const char *file;
-static unsigned int lineno = 1;
+static unsigned int lineno;
/* List of names and types. */
struct params {
@@ -754,6 +754,7 @@ goc2c(char *goc, char *c)
input = bstr(&in);
output = &out;
+ lineno = 1;
process_file();
writefile(&out, c, 0);
diff --git a/src/cmd/gc/align.c b/src/cmd/gc/align.c
index be9f552f6..80c65387b 100644
--- a/src/cmd/gc/align.c
+++ b/src/cmd/gc/align.c
@@ -46,7 +46,8 @@ static vlong
widstruct(Type *errtype, Type *t, vlong o, int flag)
{
Type *f;
- int32 w, maxalign;
+ int64 w;
+ int32 maxalign;
maxalign = flag;
if(maxalign < 1)
@@ -643,7 +644,7 @@ argsize(Type *t)
{
Iter save;
Type *fp;
- int w, x;
+ int64 w, x;
w = 0;
@@ -664,5 +665,7 @@ argsize(Type *t)
}
w = (w+widthptr-1) & ~(widthptr-1);
+ if((int)w != w)
+ fatal("argsize too big");
return w;
}
diff --git a/src/cmd/gc/closure.c b/src/cmd/gc/closure.c
index c1a9eb14c..d81c5281d 100644
--- a/src/cmd/gc/closure.c
+++ b/src/cmd/gc/closure.c
@@ -135,7 +135,7 @@ makeclosure(Node *func)
NodeList *l, *body;
static int closgen;
char *p;
- int offset;
+ vlong offset;
/*
* wrap body in external function
@@ -280,12 +280,12 @@ typecheckpartialcall(Node *fn, Node *sym)
static Node*
makepartialcall(Node *fn, Type *t0, Node *meth)
{
- Node *ptr, *n, *call, *xtype, *xfunc, *cv;
+ Node *ptr, *n, *fld, *call, *xtype, *xfunc, *cv;
Type *rcvrtype, *basetype, *t;
NodeList *body, *l, *callargs, *retargs;
char *p;
Sym *sym;
- int i;
+ int i, ddd;
// TODO: names are not right
rcvrtype = fn->left->type;
@@ -309,6 +309,7 @@ makepartialcall(Node *fn, Type *t0, Node *meth)
i = 0;
l = nil;
callargs = nil;
+ ddd = 0;
xfunc = nod(ODCLFUNC, N, N);
for(t = getinargx(t0)->type; t; t = t->down) {
snprint(namebuf, sizeof namebuf, "a%d", i++);
@@ -316,7 +317,12 @@ makepartialcall(Node *fn, Type *t0, Node *meth)
n->class = PPARAM;
xfunc->dcl = list(xfunc->dcl, n);
callargs = list(callargs, n);
- l = list(l, nod(ODCLFIELD, n, typenod(t->type)));
+ fld = nod(ODCLFIELD, n, typenod(t->type));
+ if(t->isddd) {
+ fld->isddd = 1;
+ ddd = 1;
+ }
+ l = list(l, fld);
}
xtype->list = l;
i = 0;
@@ -338,7 +344,7 @@ makepartialcall(Node *fn, Type *t0, Node *meth)
xfunc->nname->ntype = xtype;
xfunc->nname->defn = xfunc;
declare(xfunc->nname, PFUNC);
-
+
// Declare and initialize variable holding receiver.
body = nil;
cv = nod(OCLOSUREVAR, N, N);
@@ -362,6 +368,7 @@ makepartialcall(Node *fn, Type *t0, Node *meth)
call = nod(OCALL, nod(OXDOT, ptr, meth), N);
call->list = callargs;
+ call->isddd = ddd;
if(t0->outtuple == 0) {
body = list(body, call);
} else {
@@ -393,7 +400,7 @@ walkpartialcall(Node *n, NodeList **init)
// clos = &struct{F uintptr; R T}{M.T·f, x}
//
// Like walkclosure above.
-
+
if(isinter(n->left->type)) {
n->left = cheapexpr(n->left, init);
checknotnil(n->left, init);
diff --git a/src/cmd/gc/fmt.c b/src/cmd/gc/fmt.c
index 8a14aa2df..35f01a5c2 100644
--- a/src/cmd/gc/fmt.c
+++ b/src/cmd/gc/fmt.c
@@ -443,6 +443,9 @@ Zconv(Fmt *fp)
fmtrune(fp, '\\');
fmtrune(fp, r);
break;
+ case 0xFEFF: // BOM, basically disallowed in source code
+ fmtstrcpy(fp, "\\uFEFF");
+ break;
}
}
return 0;
diff --git a/src/cmd/gc/gen.c b/src/cmd/gc/gen.c
index b47a04bf0..955ec2c5b 100644
--- a/src/cmd/gc/gen.c
+++ b/src/cmd/gc/gen.c
@@ -836,7 +836,7 @@ cgen_slice(Node *n, Node *res)
* <0 is pointer to next field (+1)
*/
int
-dotoffset(Node *n, int *oary, Node **nn)
+dotoffset(Node *n, int64 *oary, Node **nn)
{
int i;
diff --git a/src/cmd/gc/go.h b/src/cmd/gc/go.h
index 1f5fb41aa..48bcf0233 100644
--- a/src/cmd/gc/go.h
+++ b/src/cmd/gc/go.h
@@ -156,9 +156,9 @@ struct Type
int lineno;
// TFUNC
- uchar thistuple;
- uchar outtuple;
- uchar intuple;
+ int thistuple;
+ int outtuple;
+ int intuple;
uchar outnamed;
Type* method;
@@ -252,9 +252,7 @@ struct Node
uchar embedded; // ODCLFIELD embedded type
uchar colas; // OAS resulting from :=
uchar diag; // already printed error about this
- uchar esc; // EscXXX
uchar noescape; // func arguments do not escape
- uchar funcdepth;
uchar builtin; // built-in name, like len or close
uchar walkdef;
uchar typecheck;
@@ -269,6 +267,8 @@ struct Node
uchar dupok; // duplicate definitions ok (for func)
schar likely; // likeliness of if statement
uchar hasbreak; // has break statement
+ uint esc; // EscXXX
+ int funcdepth;
// most nodes
Type* type;
@@ -1103,7 +1103,7 @@ void cgen_eface(Node* n, Node* res);
void cgen_slice(Node* n, Node* res);
void clearlabels(void);
void checklabels(void);
-int dotoffset(Node *n, int *oary, Node **nn);
+int dotoffset(Node *n, int64 *oary, Node **nn);
void gen(Node *n);
void genlist(NodeList *l);
Node* sysfunc(char *name);
diff --git a/src/cmd/gc/inl.c b/src/cmd/gc/inl.c
index 850bb36ec..f77b51d70 100644
--- a/src/cmd/gc/inl.c
+++ b/src/cmd/gc/inl.c
@@ -188,6 +188,7 @@ ishairy(Node *n, int *budget)
break;
case OCLOSURE:
+ case OCALLPART:
case ORANGE:
case OFOR:
case OSELECT:
diff --git a/src/cmd/gc/pgen.c b/src/cmd/gc/pgen.c
index df8903baf..82d8186b0 100644
--- a/src/cmd/gc/pgen.c
+++ b/src/cmd/gc/pgen.c
@@ -177,8 +177,13 @@ cmpstackvar(Node *a, Node *b)
{
if (a->class != b->class)
return (a->class == PAUTO) ? 1 : -1;
- if (a->class != PAUTO)
- return a->xoffset - b->xoffset;
+ if (a->class != PAUTO) {
+ if (a->xoffset < b->xoffset)
+ return -1;
+ if (a->xoffset > b->xoffset)
+ return 1;
+ return 0;
+ }
if ((a->used == 0) != (b->used == 0))
return b->used - a->used;
return b->type->align - a->type->align;
@@ -240,6 +245,10 @@ allocauto(Prog* ptxt)
stksize = rnd(stksize, n->type->align);
if(thechar == '5')
stksize = rnd(stksize, widthptr);
+ if(stksize >= (1ULL<<31)) {
+ setlineno(curfn);
+ yyerror("stack frame too large (>2GB)");
+ }
n->stkdelta = -stksize - n->xoffset;
}
diff --git a/src/cmd/gc/reflect.c b/src/cmd/gc/reflect.c
index d128bf117..fc182b03e 100644
--- a/src/cmd/gc/reflect.c
+++ b/src/cmd/gc/reflect.c
@@ -1046,6 +1046,9 @@ dgcsym1(Sym *s, int ot, Type *t, vlong *off, int stack_size)
if(t->align > 0 && (*off % t->align) != 0)
fatal("dgcsym1: invalid initial alignment, %T", t);
+
+ if(t->width == BADWIDTH)
+ dowidth(t);
switch(t->etype) {
case TINT8:
@@ -1141,6 +1144,8 @@ dgcsym1(Sym *s, int ot, Type *t, vlong *off, int stack_size)
case TARRAY:
if(t->bound < -1)
fatal("dgcsym1: invalid bound, %T", t);
+ if(t->type->width == BADWIDTH)
+ dowidth(t->type);
if(isslice(t)) {
// NOTE: Any changes here need to be made to reflect.SliceOf as well.
// struct { byte* array; uint32 len; uint32 cap; }
@@ -1214,6 +1219,9 @@ dgcsym(Type *t)
return s;
s->flags |= SymGcgen;
+ if(t->width == BADWIDTH)
+ dowidth(t);
+
ot = 0;
off = 0;
ot = duintptr(s, ot, t->width);
diff --git a/src/cmd/gc/sinit.c b/src/cmd/gc/sinit.c
index 353fc00ce..f8c61828c 100644
--- a/src/cmd/gc/sinit.c
+++ b/src/cmd/gc/sinit.c
@@ -801,7 +801,8 @@ maplit(int ctxt, Node *n, Node *var, NodeList **init)
{
Node *r, *a;
NodeList *l;
- int nerr, b;
+ int nerr;
+ int64 b;
Type *t, *tk, *tv, *t1;
Node *vstat, *index, *value;
Sym *syma, *symb;
@@ -1142,7 +1143,10 @@ stataddr(Node *nam, Node *n)
l = getlit(n->right);
if(l < 0)
break;
- nam->xoffset += l*n->type->width;
+ // Check for overflow.
+ if(n->type->width != 0 && MAXWIDTH/n->type->width <= l)
+ break;
+ nam->xoffset += l*n->type->width;
nam->type = n->type;
return 1;
}
diff --git a/src/cmd/gc/subr.c b/src/cmd/gc/subr.c
index bd78fb024..20a15bc71 100644
--- a/src/cmd/gc/subr.c
+++ b/src/cmd/gc/subr.c
@@ -839,7 +839,7 @@ Type*
aindex(Node *b, Type *t)
{
Type *r;
- int bound;
+ int64 bound;
bound = -1; // open bound
typecheck(&b, Erv);
@@ -1794,6 +1794,8 @@ ullmancalc(Node *n)
ul = ur;
out:
+ if(ul > 200)
+ ul = 200; // clamp to uchar with room to grow
n->ullman = ul;
}
@@ -2118,7 +2120,7 @@ localexpr(Node *n, Type *t, NodeList **init)
void
setmaxarg(Type *t)
{
- int32 w;
+ int64 w;
dowidth(t);
w = t->argwid;
@@ -3296,11 +3298,14 @@ liststmt(NodeList *l)
int
count(NodeList *l)
{
- int n;
+ vlong n;
n = 0;
for(; l; l=l->next)
n++;
+ if((int)n != n) { // Overflow.
+ yyerror("too many elements in list");
+ }
return n;
}
diff --git a/src/cmd/gc/swt.c b/src/cmd/gc/swt.c
index 5fba73140..3ad5f02a5 100644
--- a/src/cmd/gc/swt.c
+++ b/src/cmd/gc/swt.c
@@ -358,6 +358,8 @@ mkcaselist(Node *sw, int arg)
c = c1;
ord++;
+ if((uint16)ord != ord)
+ fatal("too many cases in switch");
c->ordinal = ord;
c->node = n;
diff --git a/src/cmd/gc/typecheck.c b/src/cmd/gc/typecheck.c
index 938716e21..40eecd337 100644
--- a/src/cmd/gc/typecheck.c
+++ b/src/cmd/gc/typecheck.c
@@ -2350,7 +2350,8 @@ pushtype(Node *n, Type *t)
static void
typecheckcomplit(Node **np)
{
- int bad, i, len, nerr;
+ int bad, i, nerr;
+ int64 len;
Node *l, *n, *norig, *r, **hash;
NodeList *ll;
Type *t, *f;
diff --git a/src/cmd/gc/unsafe.c b/src/cmd/gc/unsafe.c
index 95200ad41..ff08c0eef 100644
--- a/src/cmd/gc/unsafe.c
+++ b/src/cmd/gc/unsafe.c
@@ -16,10 +16,10 @@
Node*
unsafenmagic(Node *nn)
{
- Node *r, *n;
+ Node *r, *n, *base, *r1;
Sym *s;
Type *t, *tr;
- long v;
+ vlong v;
Val val;
Node *fn;
NodeList *args;
@@ -49,11 +49,43 @@ unsafenmagic(Node *nn)
goto yes;
}
if(strcmp(s->name, "Offsetof") == 0) {
- typecheck(&r, Erv);
- if(r->op != ODOT && r->op != ODOTPTR)
+ // must be a selector.
+ if(r->op != OXDOT)
goto bad;
+ // Remember base of selector to find it back after dot insertion.
+ // Since r->left may be mutated by typechecking, check it explicitly
+ // first to track it correctly.
+ typecheck(&r->left, Erv);
+ base = r->left;
typecheck(&r, Erv);
- v = r->xoffset;
+ switch(r->op) {
+ case ODOT:
+ case ODOTPTR:
+ break;
+ case OCALLPART:
+ yyerror("invalid expression %N: argument is a method value", nn);
+ v = 0;
+ goto ret;
+ default:
+ goto bad;
+ }
+ v = 0;
+ // add offsets for inserted dots.
+ for(r1=r; r1->left!=base; r1=r1->left) {
+ switch(r1->op) {
+ case ODOT:
+ v += r1->xoffset;
+ break;
+ case ODOTPTR:
+ yyerror("invalid expression %N: selector implies indirection of embedded %N", nn, r1->left);
+ goto ret;
+ default:
+ dump("unsafenmagic", r);
+ fatal("impossible %#O node after dot insertion", r1->op);
+ goto bad;
+ }
+ }
+ v += r1->xoffset;
goto yes;
}
if(strcmp(s->name, "Alignof") == 0) {
diff --git a/src/cmd/go/build.go b/src/cmd/go/build.go
index e7f3fb5bb..025b258bf 100644
--- a/src/cmd/go/build.go
+++ b/src/cmd/go/build.go
@@ -20,6 +20,7 @@ import (
"path/filepath"
"regexp"
"runtime"
+ "strconv"
"strings"
"sync"
"time"
@@ -1200,8 +1201,8 @@ var cgoLine = regexp.MustCompile(`\[[^\[\]]+\.cgo1\.go:[0-9]+\]`)
// run runs the command given by cmdline in the directory dir.
// If the command fails, run prints information about the failure
// and returns a non-nil error.
-func (b *builder) run(dir string, desc string, cmdargs ...interface{}) error {
- out, err := b.runOut(dir, desc, cmdargs...)
+func (b *builder) run(dir string, desc string, env []string, cmdargs ...interface{}) error {
+ out, err := b.runOut(dir, desc, env, cmdargs...)
if len(out) > 0 {
if desc == "" {
desc = b.fmtcmd(dir, "%s", strings.Join(stringList(cmdargs...), " "))
@@ -1233,10 +1234,10 @@ func (b *builder) processOutput(out []byte) string {
// runOut runs the command given by cmdline in the directory dir.
// It returns the command output and any errors that occurred.
-func (b *builder) runOut(dir string, desc string, cmdargs ...interface{}) ([]byte, error) {
+func (b *builder) runOut(dir string, desc string, env []string, cmdargs ...interface{}) ([]byte, error) {
cmdline := stringList(cmdargs...)
if buildN || buildX {
- b.showcmd(dir, "%s", strings.Join(cmdline, " "))
+ b.showcmd(dir, "%s", joinUnambiguously(cmdline))
if buildN {
return nil, nil
}
@@ -1249,7 +1250,7 @@ func (b *builder) runOut(dir string, desc string, cmdargs ...interface{}) ([]byt
cmd.Stdout = &buf
cmd.Stderr = &buf
cmd.Dir = dir
- cmd.Env = envForDir(cmd.Dir)
+ cmd.Env = mergeEnvLists(env, envForDir(cmd.Dir))
err := cmd.Run()
// cmd.Run will fail on Unix if some other process has the binary
@@ -1303,6 +1304,25 @@ func (b *builder) runOut(dir string, desc string, cmdargs ...interface{}) ([]byt
}
}
+// joinUnambiguously prints the slice, quoting where necessary to make the
+// output unambiguous.
+// TODO: See issue 5279. The printing of commands needs a complete redo.
+func joinUnambiguously(a []string) string {
+ var buf bytes.Buffer
+ for i, s := range a {
+ if i > 0 {
+ buf.WriteByte(' ')
+ }
+ q := strconv.Quote(s)
+ if s == "" || strings.Contains(s, " ") || len(q) > len(s)+2 {
+ buf.WriteString(q)
+ } else {
+ buf.WriteString(s)
+ }
+ }
+ return buf.String()
+}
+
// mkdir makes the named directory.
func (b *builder) mkdir(dir string) error {
b.exec.Lock()
@@ -1450,13 +1470,13 @@ func (gcToolchain) gc(b *builder, p *Package, obj string, importArgs []string, g
args = append(args, mkAbs(p.Dir, f))
}
- output, err = b.runOut(p.Dir, p.ImportPath, args)
+ output, err = b.runOut(p.Dir, p.ImportPath, nil, args)
return ofile, output, err
}
func (gcToolchain) asm(b *builder, p *Package, obj, ofile, sfile string) error {
sfile = mkAbs(p.Dir, sfile)
- return b.run(p.Dir, p.ImportPath, tool(archChar+"a"), "-I", obj, "-o", ofile, "-D", "GOOS_"+goos, "-D", "GOARCH_"+goarch, sfile)
+ return b.run(p.Dir, p.ImportPath, nil, tool(archChar+"a"), "-I", obj, "-o", ofile, "-D", "GOOS_"+goos, "-D", "GOARCH_"+goarch, sfile)
}
func (gcToolchain) pkgpath(basedir string, p *Package) string {
@@ -1469,7 +1489,7 @@ func (gcToolchain) pack(b *builder, p *Package, objDir, afile string, ofiles []s
for _, f := range ofiles {
absOfiles = append(absOfiles, mkAbs(objDir, f))
}
- return b.run(p.Dir, p.ImportPath, tool("pack"), "grcP", b.work, mkAbs(objDir, afile), absOfiles)
+ return b.run(p.Dir, p.ImportPath, nil, tool("pack"), "grcP", b.work, mkAbs(objDir, afile), absOfiles)
}
func (gcToolchain) ld(b *builder, p *Package, out string, allactions []*action, mainpkg string, ofiles []string) error {
@@ -1488,14 +1508,14 @@ func (gcToolchain) ld(b *builder, p *Package, out string, allactions []*action,
swigDirs[sd] = true
}
}
- return b.run(".", p.ImportPath, tool(archChar+"l"), "-o", out, importArgs, swigArg, buildLdflags, mainpkg)
+ return b.run(".", p.ImportPath, nil, tool(archChar+"l"), "-o", out, importArgs, swigArg, buildLdflags, mainpkg)
}
func (gcToolchain) cc(b *builder, p *Package, objdir, ofile, cfile string) error {
inc := filepath.Join(goroot, "pkg", fmt.Sprintf("%s_%s", goos, goarch))
cfile = mkAbs(p.Dir, cfile)
args := stringList(tool(archChar+"c"), "-F", "-V", "-w", "-I", objdir, "-I", inc, "-o", ofile, buildCcflags, "-D", "GOOS_"+goos, "-D", "GOARCH_"+goarch, cfile)
- return b.run(p.Dir, p.ImportPath, args)
+ return b.run(p.Dir, p.ImportPath, nil, args)
}
// The Gccgo toolchain.
@@ -1527,7 +1547,7 @@ func (gccgoToolchain) gc(b *builder, p *Package, obj string, importArgs []string
args = append(args, mkAbs(p.Dir, f))
}
- output, err = b.runOut(p.Dir, p.ImportPath, args)
+ output, err = b.runOut(p.Dir, p.ImportPath, nil, args)
return ofile, output, err
}
@@ -1538,7 +1558,7 @@ func (gccgoToolchain) asm(b *builder, p *Package, obj, ofile, sfile string) erro
defs = append(defs, `-D`, `GOPKGPATH="`+pkgpath+`"`)
}
defs = append(defs, b.gccArchArgs()...)
- return b.run(p.Dir, p.ImportPath, "gccgo", "-I", obj, "-o", ofile, defs, sfile)
+ return b.run(p.Dir, p.ImportPath, nil, "gccgo", "-I", obj, "-o", ofile, defs, sfile)
}
func (gccgoToolchain) pkgpath(basedir string, p *Package) string {
@@ -1553,7 +1573,7 @@ func (gccgoToolchain) pack(b *builder, p *Package, objDir, afile string, ofiles
for _, f := range ofiles {
absOfiles = append(absOfiles, mkAbs(objDir, f))
}
- return b.run(p.Dir, p.ImportPath, "ar", "cru", mkAbs(objDir, afile), absOfiles)
+ return b.run(p.Dir, p.ImportPath, nil, "ar", "cru", mkAbs(objDir, afile), absOfiles)
}
func (tools gccgoToolchain) ld(b *builder, p *Package, out string, allactions []*action, mainpkg string, ofiles []string) error {
@@ -1595,7 +1615,7 @@ func (tools gccgoToolchain) ld(b *builder, p *Package, out string, allactions []
if usesCgo && goos == "linux" {
ldflags = append(ldflags, "-Wl,-E")
}
- return b.run(".", p.ImportPath, "gccgo", "-o", out, ofiles, "-Wl,-(", ldflags, "-Wl,-)", buildGccgoflags)
+ return b.run(".", p.ImportPath, nil, "gccgo", "-o", out, ofiles, "-Wl,-(", ldflags, "-Wl,-)", buildGccgoflags)
}
func (gccgoToolchain) cc(b *builder, p *Package, objdir, ofile, cfile string) error {
@@ -1607,7 +1627,7 @@ func (gccgoToolchain) cc(b *builder, p *Package, objdir, ofile, cfile string) er
defs = append(defs, `-D`, `GOPKGPATH="`+pkgpath+`"`)
}
// TODO: Support using clang here (during gccgo build)?
- return b.run(p.Dir, p.ImportPath, "gcc", "-Wall", "-g",
+ return b.run(p.Dir, p.ImportPath, nil, "gcc", "-Wall", "-g",
"-I", objdir, "-I", inc, "-o", ofile, defs, "-c", cfile)
}
@@ -1647,7 +1667,7 @@ func (b *builder) libgcc(p *Package) (string, error) {
return fmt.Fprint(&buf, a...)
}
}
- f, err := b.runOut(p.Dir, p.ImportPath, gccCmd, "-print-libgcc-file-name")
+ f, err := b.runOut(p.Dir, p.ImportPath, nil, gccCmd, "-print-libgcc-file-name")
if err != nil {
return "", fmt.Errorf("gcc -print-libgcc-file-name: %v (%s)", err, f)
}
@@ -1670,12 +1690,12 @@ func (b *builder) libgcc(p *Package) (string, error) {
// gcc runs the gcc C compiler to create an object from a single C file.
func (b *builder) gcc(p *Package, out string, flags []string, cfile string) error {
cfile = mkAbs(p.Dir, cfile)
- return b.run(p.Dir, p.ImportPath, b.gccCmd(p.Dir), flags, "-o", out, "-c", cfile)
+ return b.run(p.Dir, p.ImportPath, nil, b.gccCmd(p.Dir), flags, "-o", out, "-c", cfile)
}
// gccld runs the gcc linker to create an executable from a set of object files
func (b *builder) gccld(p *Package, out string, flags []string, obj []string) error {
- return b.run(p.Dir, p.ImportPath, b.gccCmd(p.Dir), "-o", out, obj, flags)
+ return b.run(p.Dir, p.ImportPath, nil, b.gccCmd(p.Dir), "-o", out, obj, flags)
}
// gccCmd returns a gcc command line prefix
@@ -1756,7 +1776,7 @@ func (b *builder) cgo(p *Package, cgoExe, obj string, gccfiles []string) (outGo,
cgoLDFLAGS := stringList(envList("CGO_LDFLAGS"), p.CgoLDFLAGS)
if pkgs := p.CgoPkgConfig; len(pkgs) > 0 {
- out, err := b.runOut(p.Dir, p.ImportPath, "pkg-config", "--cflags", pkgs)
+ out, err := b.runOut(p.Dir, p.ImportPath, nil, "pkg-config", "--cflags", pkgs)
if err != nil {
b.showOutput(p.Dir, "pkg-config --cflags "+strings.Join(pkgs, " "), string(out))
b.print(err.Error() + "\n")
@@ -1765,7 +1785,7 @@ func (b *builder) cgo(p *Package, cgoExe, obj string, gccfiles []string) (outGo,
if len(out) > 0 {
cgoCFLAGS = append(cgoCFLAGS, strings.Fields(string(out))...)
}
- out, err = b.runOut(p.Dir, p.ImportPath, "pkg-config", "--libs", pkgs)
+ out, err = b.runOut(p.Dir, p.ImportPath, nil, "pkg-config", "--libs", pkgs)
if err != nil {
b.showOutput(p.Dir, "pkg-config --libs "+strings.Join(pkgs, " "), string(out))
b.print(err.Error() + "\n")
@@ -1802,6 +1822,16 @@ func (b *builder) cgo(p *Package, cgoExe, obj string, gccfiles []string) (outGo,
cgoflags = append(cgoflags, "-import_syscall=false")
}
+ // Update $CGO_LDFLAGS with p.CgoLDFLAGS.
+ var cgoenv []string
+ if len(cgoLDFLAGS) > 0 {
+ flags := make([]string, len(cgoLDFLAGS))
+ for i, f := range cgoLDFLAGS {
+ flags[i] = strconv.Quote(f)
+ }
+ cgoenv = []string{"CGO_LDFLAGS=" + strings.Join(flags, " ")}
+ }
+
if _, ok := buildToolchain.(gccgoToolchain); ok {
cgoflags = append(cgoflags, "-gccgo")
if pkgpath := gccgoPkgpath(p); pkgpath != "" {
@@ -1809,7 +1839,7 @@ func (b *builder) cgo(p *Package, cgoExe, obj string, gccfiles []string) (outGo,
}
objExt = "o"
}
- if err := b.run(p.Dir, p.ImportPath, cgoExe, "-objdir", obj, cgoflags, "--", cgoCFLAGS, p.CgoFiles); err != nil {
+ if err := b.run(p.Dir, p.ImportPath, cgoenv, cgoExe, "-objdir", obj, cgoflags, "--", cgoCFLAGS, p.CgoFiles); err != nil {
return nil, nil, err
}
outGo = append(outGo, gofiles...)
@@ -1894,7 +1924,7 @@ func (b *builder) cgo(p *Package, cgoExe, obj string, gccfiles []string) (outGo,
if p.Standard && p.ImportPath == "runtime/cgo" {
cgoflags = append(cgoflags, "-dynlinker") // record path to dynamic linker
}
- if err := b.run(p.Dir, p.ImportPath, cgoExe, "-objdir", obj, "-dynimport", dynobj, "-dynout", importC, cgoflags); err != nil {
+ if err := b.run(p.Dir, p.ImportPath, nil, cgoExe, "-objdir", obj, "-dynimport", dynobj, "-dynout", importC, cgoflags); err != nil {
return nil, nil, err
}
@@ -2017,7 +2047,7 @@ func (b *builder) swigOne(p *Package, file, obj string, cxx bool, intgosize stri
args = append(args, "-c++")
}
- if out, err := b.runOut(p.Dir, p.ImportPath, "swig", args, file); err != nil {
+ if out, err := b.runOut(p.Dir, p.ImportPath, nil, "swig", args, file); err != nil {
if len(out) > 0 {
if bytes.Contains(out, []byte("Unrecognized option -intgosize")) {
return "", "", errors.New("must have SWIG version >= 2.0.9\n")
@@ -2055,7 +2085,7 @@ func (b *builder) swigOne(p *Package, file, obj string, cxx bool, intgosize stri
cxxlib = []string{"-lstdc++"}
}
ldflags := stringList(osldflags[goos], cxxlib)
- b.run(p.Dir, p.ImportPath, b.gccCmd(p.Dir), "-o", soname, gccObj, ldflags)
+ b.run(p.Dir, p.ImportPath, nil, b.gccCmd(p.Dir), "-o", soname, gccObj, ldflags)
return obj + goFile, cObj, nil
}
diff --git a/src/cmd/go/doc.go b/src/cmd/go/doc.go
index 3b22e0f04..df82ab45b 100644
--- a/src/cmd/go/doc.go
+++ b/src/cmd/go/doc.go
@@ -367,7 +367,7 @@ Compile and run Go program
Usage:
- go run [build flags] [gofiles...] [arguments...]
+ go run [build flags] gofiles... [arguments...]
Run compiles and runs the main package comprising the named Go source files.
If no files are named, it compiles and runs all non-test Go source files.
@@ -398,6 +398,9 @@ the file pattern "*_test.go". These additional files can contain test functions
benchmark functions, and example functions. See 'go help testfunc' for more.
Each listed package causes the execution of a separate test binary.
+Test files that declare a package with the suffix "_test" will be compiled as a
+separate package, and then linked and run with the main test binary.
+
By default, go test needs no arguments. It compiles and tests the package
with source in the current directory, including tests, and runs the tests.
@@ -407,6 +410,7 @@ non-test installation.
In addition to the build flags, the flags handled by 'go test' itself are:
-c Compile the test binary to pkg.test but do not run it.
+ (Where pkg is the last element of the package's import path.)
-i
Install packages that are dependencies of the test.
@@ -582,7 +586,7 @@ a revision control system.
A few common code hosting sites have special syntax:
- BitBucket (Mercurial)
+ Bitbucket (Git, Mercurial)
import "bitbucket.org/user/project"
import "bitbucket.org/user/project/sub/directory"
diff --git a/src/cmd/go/help.go b/src/cmd/go/help.go
index 6d2bd7dbb..c70a25fdd 100644
--- a/src/cmd/go/help.go
+++ b/src/cmd/go/help.go
@@ -20,13 +20,13 @@ denotes the package in that directory.
Otherwise, the import path P denotes the package found in
the directory DIR/src/P for some DIR listed in the GOPATH
-environment variable (see 'go help gopath').
+environment variable (see 'go help gopath').
If no import paths are given, the action applies to the
package in the current directory.
The special import path "all" expands to all package directories
-found in all the GOPATH trees. For example, 'go list all'
+found in all the GOPATH trees. For example, 'go list all'
lists all the packages on the local system.
The special import path "std" is like all but expands to just the
@@ -68,7 +68,7 @@ a revision control system.
A few common code hosting sites have special syntax:
- BitBucket (Mercurial)
+ Bitbucket (Git, Mercurial)
import "bitbucket.org/user/project"
import "bitbucket.org/user/project/sub/directory"
@@ -232,7 +232,7 @@ Here's an example directory layout:
bar.a (installed package object)
Go searches each directory listed in GOPATH to find source code,
-but new packages are always downloaded into the first directory
+but new packages are always downloaded into the first directory
in the list.
`,
}
diff --git a/src/cmd/go/main.go b/src/cmd/go/main.go
index 61e629968..3180dbeed 100644
--- a/src/cmd/go/main.go
+++ b/src/cmd/go/main.go
@@ -393,16 +393,26 @@ func runOut(dir string, cmdargs ...interface{}) []byte {
// child will be faster.
func envForDir(dir string) []string {
env := os.Environ()
- for i, kv := range env {
- if strings.HasPrefix(kv, "PWD=") {
- env[i] = "PWD=" + dir
- return env
- }
- }
// Internally we only use rooted paths, so dir is rooted.
// Even if dir is not rooted, no harm done.
- env = append(env, "PWD="+dir)
- return env
+ return mergeEnvLists([]string{"PWD=" + dir}, env)
+}
+
+// mergeEnvLists merges the two environment lists such that
+// variables with the same name in "in" replace those in "out".
+func mergeEnvLists(in, out []string) []string {
+NextVar:
+ for _, inkv := range in {
+ k := strings.SplitAfterN(inkv, "=", 2)[0]
+ for i, outkv := range out {
+ if strings.HasPrefix(outkv, k) {
+ out[i] = inkv
+ continue NextVar
+ }
+ }
+ out = append(out, inkv)
+ }
+ return out
}
// matchPattern(pattern)(name) reports whether
diff --git a/src/cmd/go/run.go b/src/cmd/go/run.go
index d8ba4dbdd..91bdc1be2 100644
--- a/src/cmd/go/run.go
+++ b/src/cmd/go/run.go
@@ -8,12 +8,11 @@ import (
"fmt"
"os"
"os/exec"
- "path/filepath"
"strings"
)
var cmdRun = &Command{
- UsageLine: "run [build flags] [gofiles...] [arguments...]",
+ UsageLine: "run [build flags] gofiles... [arguments...]",
Short: "compile and run Go program",
Long: `
Run compiles and runs the main package comprising the named Go source files.
@@ -46,18 +45,7 @@ func runRun(cmd *Command, args []string) {
}
files, cmdArgs := args[:i], args[i:]
if len(files) == 0 {
- allFiles, err := filepath.Glob("*.go")
- if err != nil {
- fatalf("go run: %s", err)
- }
- for _, file := range allFiles {
- if !strings.HasSuffix(file, "_test.go") {
- files = append(files, file)
- }
- }
- if len(files) == 0 {
- fatalf("go run: no go files found")
- }
+ fatalf("go run: no go files listed")
}
for _, file := range files {
if strings.HasSuffix(file, "_test.go") {
diff --git a/src/cmd/go/test.go b/src/cmd/go/test.go
index 58ebcc071..b1db16f77 100644
--- a/src/cmd/go/test.go
+++ b/src/cmd/go/test.go
@@ -50,6 +50,9 @@ the file pattern "*_test.go". These additional files can contain test functions
benchmark functions, and example functions. See 'go help testfunc' for more.
Each listed package causes the execution of a separate test binary.
+Test files that declare a package with the suffix "_test" will be compiled as a
+separate package, and then linked and run with the main test binary.
+
By default, go test needs no arguments. It compiles and tests the package
with source in the current directory, including tests, and runs the tests.
@@ -59,6 +62,7 @@ non-test installation.
In addition to the build flags, the flags handled by 'go test' itself are:
-c Compile the test binary to pkg.test but do not run it.
+ (Where pkg is the last element of the package's import path.)
-i
Install packages that are dependencies of the test.
diff --git a/src/cmd/go/vcs.go b/src/cmd/go/vcs.go
index b99579441..39881a6dc 100644
--- a/src/cmd/go/vcs.go
+++ b/src/cmd/go/vcs.go
@@ -641,7 +641,7 @@ func oldGoogleCode(match map[string]string) error {
}
// bitbucketVCS determines the version control system for a
-// BitBucket repository, by using the BitBucket API.
+// Bitbucket repository, by using the Bitbucket API.
func bitbucketVCS(match map[string]string) error {
if err := noVCSSuffix(match); err != nil {
return err
diff --git a/src/cmd/ld/data.c b/src/cmd/ld/data.c
index fa34aa3a1..23fc23e5f 100644
--- a/src/cmd/ld/data.c
+++ b/src/cmd/ld/data.c
@@ -38,7 +38,7 @@
#include "../../pkg/runtime/mgc0.h"
void dynreloc(void);
-static vlong addaddrplus4(Sym *s, Sym *t, int32 add);
+static vlong addaddrplus4(Sym *s, Sym *t, vlong add);
/*
* divide-and-conquer list-link
@@ -247,7 +247,13 @@ relocsym(Sym *s)
o = 0;
if(r->sym)
o += symaddr(r->sym);
- o += r->add - (s->value + r->off + r->siz);
+ // NOTE: The (int32) cast on the next line works around a bug in Plan 9's 8c
+ // compiler. The expression s->value + r->off + r->siz is int32 + int32 +
+ // uchar, and Plan 9 8c incorrectly treats the expression as type uint32
+ // instead of int32, causing incorrect values when sign extended for adding
+ // to o. The bug only occurs on Plan 9, because this C program is compiled by
+ // the standard host compiler (gcc on most other systems).
+ o += r->add - (s->value + r->off + (int32)r->siz);
break;
case D_SIZE:
o = r->sym->size + r->add;
@@ -259,6 +265,13 @@ relocsym(Sym *s)
cursym = s;
diag("bad reloc size %#ux for %s", siz, r->sym->name);
case 4:
+ if(r->type == D_PCREL) {
+ if(o != (int32)o)
+ diag("pc-relative relocation address is too big: %#llx", o);
+ } else {
+ if(o != (int32)o && o != (uint32)o)
+ diag("non-pc-relative relocation address is too big: %#llux", o);
+ }
fl = o;
cast = (uchar*)&fl;
for(i=0; i<4; i++)
@@ -716,7 +729,7 @@ addstring(Sym *s, char *str)
}
vlong
-setuintxx(Sym *s, vlong off, uint64 v, int wid)
+setuintxx(Sym *s, vlong off, uint64 v, vlong wid)
{
int32 i, fl;
vlong o;
@@ -756,7 +769,7 @@ setuintxx(Sym *s, vlong off, uint64 v, int wid)
vlong
adduintxx(Sym *s, uint64 v, int wid)
{
- int32 off;
+ vlong off;
off = s->size;
setuintxx(s, off, v, wid);
@@ -812,7 +825,7 @@ setuint64(Sym *s, vlong r, uint64 v)
}
vlong
-addaddrplus(Sym *s, Sym *t, int32 add)
+addaddrplus(Sym *s, Sym *t, vlong add)
{
vlong i;
Reloc *r;
@@ -833,7 +846,7 @@ addaddrplus(Sym *s, Sym *t, int32 add)
}
static vlong
-addaddrplus4(Sym *s, Sym *t, int32 add)
+addaddrplus4(Sym *s, Sym *t, vlong add)
{
vlong i;
Reloc *r;
@@ -854,7 +867,7 @@ addaddrplus4(Sym *s, Sym *t, int32 add)
}
vlong
-addpcrelplus(Sym *s, Sym *t, int32 add)
+addpcrelplus(Sym *s, Sym *t, vlong add)
{
vlong i;
Reloc *r;
@@ -881,7 +894,7 @@ addaddr(Sym *s, Sym *t)
}
vlong
-setaddrplus(Sym *s, vlong off, Sym *t, int32 add)
+setaddrplus(Sym *s, vlong off, Sym *t, vlong add)
{
Reloc *r;
@@ -958,8 +971,8 @@ symalign(Sym *s)
return align;
}
-static int32
-aligndatsize(int32 datsize, Sym *s)
+static vlong
+aligndatsize(vlong datsize, Sym *s)
{
return rnd(datsize, symalign(s));
}
@@ -981,9 +994,9 @@ maxalign(Sym *s, int type)
}
static void
-gcaddsym(Sym *gc, Sym *s, int32 off)
+gcaddsym(Sym *gc, Sym *s, vlong off)
{
- int32 a;
+ vlong a;
Sym *gotype;
if(s->size < PtrSize)
@@ -1009,9 +1022,23 @@ gcaddsym(Sym *gc, Sym *s, int32 off)
}
void
+growdatsize(vlong *datsizep, Sym *s)
+{
+ vlong datsize;
+
+ datsize = *datsizep;
+ if(s->size < 0)
+ diag("negative size (datsize = %lld, s->size = %lld)", datsize, s->size);
+ if(datsize + s->size < datsize)
+ diag("symbol too large (datsize = %lld, s->size = %lld)", datsize, s->size);
+ *datsizep = datsize + s->size;
+}
+
+void
dodata(void)
{
- int32 n, datsize;
+ int32 n;
+ vlong datsize;
Section *sect;
Sym *s, *last, **l;
Sym *gcdata1, *gcbss1;
@@ -1109,7 +1136,7 @@ dodata(void)
s->sect = sect;
s->type = SDATA;
s->value = datsize;
- datsize += s->size;
+ growdatsize(&datsize, s);
sect->len = datsize - sect->vaddr;
}
@@ -1125,7 +1152,7 @@ dodata(void)
s->sect = sect;
s->type = SDATA;
s->value = datsize;
- datsize += s->size;
+ growdatsize(&datsize, s);
}
sect->len = datsize - sect->vaddr;
@@ -1142,7 +1169,7 @@ dodata(void)
s->sect = sect;
s->type = SDATA;
s->value = datsize;
- datsize += s->size;
+ growdatsize(&datsize, s);
}
sect->len = datsize - sect->vaddr;
}
@@ -1164,7 +1191,7 @@ dodata(void)
datsize = aligndatsize(datsize, s);
s->value = datsize;
gcaddsym(gcdata1, s, datsize - sect->vaddr); // gc
- datsize += s->size;
+ growdatsize(&datsize, s);
}
sect->len = datsize - sect->vaddr;
@@ -1183,7 +1210,7 @@ dodata(void)
datsize = aligndatsize(datsize, s);
s->value = datsize;
gcaddsym(gcbss1, s, datsize - sect->vaddr); // gc
- datsize += s->size;
+ growdatsize(&datsize, s);
}
sect->len = datsize - sect->vaddr;
@@ -1201,10 +1228,15 @@ dodata(void)
datsize = aligndatsize(datsize, s);
s->sect = sect;
s->value = datsize;
- datsize += s->size;
+ growdatsize(&datsize, s);
}
sect->len = datsize - sect->vaddr;
lookup("end", 0)->sect = sect;
+
+ // 6g uses 4-byte relocation offsets, so the entire segment must fit in 32 bits.
+ if(datsize != (uint32)datsize) {
+ diag("data or bss segment too large");
+ }
if(iself && linkmode == LinkExternal && s != nil && s->type == STLSBSS && HEADTYPE != Hopenbsd) {
sect = addsection(&segdata, ".tbss", 06);
@@ -1215,7 +1247,7 @@ dodata(void)
datsize = aligndatsize(datsize, s);
s->sect = sect;
s->value = datsize;
- datsize += s->size;
+ growdatsize(&datsize, s);
}
sect->len = datsize;
}
@@ -1240,7 +1272,7 @@ dodata(void)
s->sect = sect;
s->type = SRODATA;
s->value = datsize;
- datsize += s->size;
+ growdatsize(&datsize, s);
}
sect->len = datsize - sect->vaddr;
@@ -1256,7 +1288,7 @@ dodata(void)
s->sect = sect;
s->type = SRODATA;
s->value = datsize;
- datsize += s->size;
+ growdatsize(&datsize, s);
}
sect->len = datsize - sect->vaddr;
@@ -1272,7 +1304,7 @@ dodata(void)
s->sect = sect;
s->type = SRODATA;
s->value = datsize;
- datsize += s->size;
+ growdatsize(&datsize, s);
}
sect->len = datsize - sect->vaddr;
@@ -1288,7 +1320,7 @@ dodata(void)
s->sect = sect;
s->type = SRODATA;
s->value = datsize;
- datsize += s->size;
+ growdatsize(&datsize, s);
}
sect->len = datsize - sect->vaddr;
@@ -1301,9 +1333,14 @@ dodata(void)
s->sect = sect;
s->type = SRODATA;
s->value = datsize;
- datsize += s->size;
+ growdatsize(&datsize, s);
sect->len = datsize - sect->vaddr;
}
+
+ // 6g uses 4-byte relocation offsets, so the entire segment must fit in 32 bits.
+ if(datsize != (uint32)datsize) {
+ diag("text segment too large");
+ }
/* number the sections */
n = 1;
diff --git a/src/cmd/ld/doc.go b/src/cmd/ld/doc.go
index 874db41c9..3493f41d8 100644
--- a/src/cmd/ld/doc.go
+++ b/src/cmd/ld/doc.go
@@ -31,19 +31,19 @@ Options new in this version:
is statically linked and does not refer to a dynamic linker. Without this option
(the default), the binary's contents are identical but it is loaded with a dynamic
linker. This flag cannot be used when $GOOS is windows.
- -Hdarwin (only in 6l/8l)
+ -H darwin (only in 6l/8l)
Write Apple Mach-O binaries (default when $GOOS is darwin)
- -Hlinux
+ -H linux
Write Linux ELF binaries (default when $GOOS is linux)
- -Hfreebsd
+ -H freebsd
Write FreeBSD ELF binaries (default when $GOOS is freebsd)
- -Hnetbsd (only in 6l/8l)
+ -H netbsd
Write NetBSD ELF binaries (default when $GOOS is netbsd)
- -Hopenbsd (only in 6l/8l)
+ -H openbsd (only in 6l/8l)
Write OpenBSD ELF binaries (default when $GOOS is openbsd)
- -Hwindows (only in 6l/8l)
+ -H windows (only in 6l/8l)
Write Windows PE32+ Console binaries (default when $GOOS is windows)
- -Hwindowsgui (only in 6l/8l)
+ -H windowsgui (only in 6l/8l)
Write Windows PE32+ GUI binaries
-I interpreter
Set the ELF dynamic linker to use.
diff --git a/src/cmd/ld/dwarf.c b/src/cmd/ld/dwarf.c
index 436e1e67e..98b03f1c3 100644
--- a/src/cmd/ld/dwarf.c
+++ b/src/cmd/ld/dwarf.c
@@ -27,10 +27,16 @@
static vlong abbrevo;
static vlong abbrevsize;
+static Sym* abbrevsym;
+static vlong abbrevsympos;
static vlong lineo;
static vlong linesize;
+static Sym* linesym;
+static vlong linesympos;
static vlong infoo; // also the base for DWDie->offs and reference attributes.
static vlong infosize;
+static Sym* infosym;
+static vlong infosympos;
static vlong frameo;
static vlong framesize;
static vlong pubnameso;
@@ -41,12 +47,20 @@ static vlong arangeso;
static vlong arangessize;
static vlong gdbscripto;
static vlong gdbscriptsize;
+
+static Sym *infosec;
static vlong inforeloco;
static vlong inforelocsize;
-static char gdbscript[1024];
+static Sym *arangessec;
+static vlong arangesreloco;
+static vlong arangesrelocsize;
-static Sym *dsym;
+static Sym *linesec;
+static vlong linereloco;
+static vlong linerelocsize;
+
+static char gdbscript[1024];
/*
* Basic I/O
@@ -573,6 +587,34 @@ find_or_diag(DWDie *die, char* name)
return r;
}
+static void
+adddwarfrel(Sym* sec, Sym* sym, vlong offsetbase, int siz, vlong addend)
+{
+ Reloc *r;
+
+ r = addrel(sec);
+ r->sym = sym;
+ r->xsym = sym;
+ r->off = cpos() - offsetbase;
+ r->siz = siz;
+ r->type = D_ADDR;
+ r->add = addend;
+ r->xadd = addend;
+ if(iself && thechar == '6')
+ addend = 0;
+ switch(siz) {
+ case 4:
+ LPUT(addend);
+ break;
+ case 8:
+ VPUT(addend);
+ break;
+ default:
+ diag("bad size in adddwarfrel");
+ break;
+ }
+}
+
static DWAttr*
newrefattr(DWDie *die, uint8 attr, DWDie* ref)
{
@@ -586,10 +628,15 @@ static int fwdcount;
static void
putattr(int abbrev, int form, int cls, vlong value, char *data)
{
- Reloc *r;
+ vlong off;
switch(form) {
case DW_FORM_addr: // address
+ if(linkmode == LinkExternal) {
+ value -= ((Sym*)data)->value;
+ adddwarfrel(infosec, (Sym*)data, infoo, PtrSize, value);
+ break;
+ }
addrput(value);
break;
@@ -598,15 +645,9 @@ putattr(int abbrev, int form, int cls, vlong value, char *data)
cput(1+PtrSize);
cput(DW_OP_addr);
if(linkmode == LinkExternal) {
- r = addrel(dsym);
- r->sym = (Sym*)data;
- r->xsym = r->sym;
- r->off = cpos() - infoo;
- r->siz = PtrSize;
- r->type = D_ADDR;
- r->add = value - r->sym->value;
- r->xadd = r->add;
- value = r->add;
+ value -= ((Sym*)data)->value;
+ adddwarfrel(infosec, (Sym*)data, infoo, PtrSize, value);
+ break;
}
addrput(value);
break;
@@ -646,6 +687,10 @@ putattr(int abbrev, int form, int cls, vlong value, char *data)
break;
case DW_FORM_data4: // constant, {line,loclist,mac,rangelist}ptr
+ if(linkmode == LinkExternal && cls == DW_CLS_PTR) {
+ adddwarfrel(infosec, linesym, infoo, 4, value);
+ break;
+ }
LPUT(value);
break;
@@ -681,12 +726,14 @@ putattr(int abbrev, int form, int cls, vlong value, char *data)
else
LPUT(0); // invalid dwarf, gdb will complain.
} else {
- if (((DWDie*)data)->offs == 0)
+ off = ((DWDie*)data)->offs;
+ if (off == 0)
fwdcount++;
- if(PtrSize == 8)
- VPUT(((DWDie*)data)->offs);
- else
- LPUT(((DWDie*)data)->offs);
+ if(linkmode == LinkExternal) {
+ adddwarfrel(infosec, infosym, infoo, PtrSize, off);
+ break;
+ }
+ addrput(off);
}
break;
@@ -1703,6 +1750,10 @@ writelines(void)
DWDie *varhash[HASHSIZE];
char *n, *nn;
+ if(linesec == S)
+ linesec = lookup(".dwarfline", 0);
+ linesec->nr = 0;
+
unitstart = -1;
headerend = -1;
pc = 0;
@@ -1777,7 +1828,11 @@ writelines(void)
cput(0); // start extended opcode
uleb128put(1 + PtrSize);
cput(DW_LNE_set_address);
- addrput(pc);
+
+ if(linkmode == LinkExternal)
+ adddwarfrel(linesec, s, lineo, PtrSize, 0);
+ else
+ addrput(pc);
}
if(s->text == nil)
continue;
@@ -1996,9 +2051,13 @@ writeinfo(void)
vlong unitstart, here;
fwdcount = 0;
- if (dsym == S)
- dsym = lookup(".dwarfinfo", 0);
- dsym->nr = 0;
+ if (infosec == S)
+ infosec = lookup(".dwarfinfo", 0);
+ infosec->nr = 0;
+
+ if(arangessec == S)
+ arangessec = lookup(".dwarfaranges", 0);
+ arangessec->nr = 0;
for (compunit = dwroot.child; compunit; compunit = compunit->link) {
unitstart = cpos();
@@ -2008,7 +2067,13 @@ writeinfo(void)
// This must match COMPUNITHEADERSIZE above.
LPUT(0); // unit_length (*), will be filled in later.
WPUT(2); // dwarf version (appendix F)
- LPUT(0); // debug_abbrev_offset (*)
+
+ // debug_abbrev_offset (*)
+ if(linkmode == LinkExternal)
+ adddwarfrel(infosec, abbrevsym, infoo, 4, 0);
+ else
+ LPUT(0);
+
cput(PtrSize); // address_size
putdie(compunit);
@@ -2096,6 +2161,7 @@ writearanges(void)
DWAttr *b, *e;
int headersize;
vlong sectionstart;
+ vlong value;
sectionstart = cpos();
headersize = rnd(4+2+4+1+1, PtrSize); // don't count unit_length field itself
@@ -2111,12 +2177,22 @@ writearanges(void)
// Write .debug_aranges Header + entry (sec 6.1.2)
LPUT(headersize + 4*PtrSize - 4); // unit_length (*)
WPUT(2); // dwarf version (appendix F)
- LPUT(compunit->offs - COMPUNITHEADERSIZE); // debug_info_offset
+
+ value = compunit->offs - COMPUNITHEADERSIZE; // debug_info_offset
+ if(linkmode == LinkExternal)
+ adddwarfrel(arangessec, infosym, sectionstart, 4, value);
+ else
+ LPUT(value);
+
cput(PtrSize); // address_size
cput(0); // segment_size
strnput("", headersize - (4+2+4+1+1)); // align to PtrSize
- addrput(b->value);
+ if(linkmode == LinkExternal)
+ adddwarfrel(arangessec, (Sym*)b->data, sectionstart, PtrSize, b->value-((Sym*)b->data)->value);
+ else
+ addrput(b->value);
+
addrput(e->value - b->value);
addrput(0);
addrput(0);
@@ -2148,14 +2224,14 @@ align(vlong size)
}
static vlong
-writeinforeloc(void)
+writedwarfreloc(Sym* s)
{
int i;
vlong start;
Reloc *r;
start = cpos();
- for(r = dsym->r; r < dsym->r+dsym->nr; r++) {
+ for(r = s->r; r < s->r+s->nr; r++) {
if(iself)
i = elfreloc1(r, r->off);
else if(HEADTYPE == Hdarwin)
@@ -2186,6 +2262,9 @@ dwarfemitdebugsections(void)
if(debug['w']) // disable dwarf
return;
+ if(linkmode == LinkExternal && !iself)
+ return;
+
// For diagnostic messages.
newattr(&dwtypes, DW_AT_name, DW_CLS_STRING, strlen("dwtypes"), "dwtypes");
@@ -2267,10 +2346,20 @@ dwarfemitdebugsections(void)
gdbscripto = writegdbscript();
gdbscriptsize = cpos() - gdbscripto;
align(gdbscriptsize);
-
- inforeloco = writeinforeloc();
+
+ while(cpos()&7)
+ cput(0);
+ inforeloco = writedwarfreloc(infosec);
inforelocsize = cpos() - inforeloco;
align(inforelocsize);
+
+ arangesreloco = writedwarfreloc(arangessec);
+ arangesrelocsize = cpos() - arangesreloco;
+ align(arangesrelocsize);
+
+ linereloco = writedwarfreloc(linesec);
+ linerelocsize = cpos() - linereloco;
+ align(linerelocsize);
}
/*
@@ -2290,6 +2379,9 @@ enum
ElfStrDebugRanges,
ElfStrDebugStr,
ElfStrGDBScripts,
+ ElfStrRelDebugInfo,
+ ElfStrRelDebugAranges,
+ ElfStrRelDebugLine,
NElfStrDbg
};
@@ -2313,13 +2405,72 @@ dwarfaddshstrings(Sym *shstrtab)
elfstrdbg[ElfStrDebugRanges] = addstring(shstrtab, ".debug_ranges");
elfstrdbg[ElfStrDebugStr] = addstring(shstrtab, ".debug_str");
elfstrdbg[ElfStrGDBScripts] = addstring(shstrtab, ".debug_gdb_scripts");
+ if(linkmode == LinkExternal) {
+ if(thechar == '6') {
+ elfstrdbg[ElfStrRelDebugInfo] = addstring(shstrtab, ".rela.debug_info");
+ elfstrdbg[ElfStrRelDebugAranges] = addstring(shstrtab, ".rela.debug_aranges");
+ elfstrdbg[ElfStrRelDebugLine] = addstring(shstrtab, ".rela.debug_line");
+ } else {
+ elfstrdbg[ElfStrRelDebugInfo] = addstring(shstrtab, ".rel.debug_info");
+ elfstrdbg[ElfStrRelDebugAranges] = addstring(shstrtab, ".rel.debug_aranges");
+ elfstrdbg[ElfStrRelDebugLine] = addstring(shstrtab, ".rel.debug_line");
+ }
+
+ infosym = lookup(".debug_info", 0);
+ infosym->hide = 1;
+
+ abbrevsym = lookup(".debug_abbrev", 0);
+ abbrevsym->hide = 1;
+
+ linesym = lookup(".debug_line", 0);
+ linesym->hide = 1;
+ }
}
+// Add section symbols for DWARF debug info. This is called before
+// dwarfaddelfheaders.
void
-dwarfaddelfheaders(void)
+dwarfaddelfsectionsyms()
+{
+ if(infosym != nil) {
+ infosympos = cpos();
+ putelfsectionsym(infosym, 0);
+ }
+ if(abbrevsym != nil) {
+ abbrevsympos = cpos();
+ putelfsectionsym(abbrevsym, 0);
+ }
+ if(linesym != nil) {
+ linesympos = cpos();
+ putelfsectionsym(linesym, 0);
+ }
+}
+
+static void
+dwarfaddelfrelocheader(int elfstr, ElfShdr *shdata, vlong off, vlong size)
{
ElfShdr *sh;
+ sh = newElfShdr(elfstrdbg[elfstr]);
+ if(thechar == '6') {
+ sh->type = SHT_RELA;
+ } else {
+ sh->type = SHT_REL;
+ }
+ sh->entsize = PtrSize*(2+(sh->type==SHT_RELA));
+ sh->link = elfshname(".symtab")->shnum;
+ sh->info = shdata->shnum;
+ sh->off = off;
+ sh->size = size;
+ sh->addralign = PtrSize;
+
+}
+
+void
+dwarfaddelfheaders(void)
+{
+ ElfShdr *sh, *shinfo, *sharanges, *shline;
+
if(debug['w']) // disable dwarf
return;
@@ -2328,12 +2479,17 @@ dwarfaddelfheaders(void)
sh->off = abbrevo;
sh->size = abbrevsize;
sh->addralign = 1;
+ if(abbrevsympos > 0)
+ putelfsymshndx(abbrevsympos, sh->shnum);
sh = newElfShdr(elfstrdbg[ElfStrDebugLine]);
sh->type = SHT_PROGBITS;
sh->off = lineo;
sh->size = linesize;
sh->addralign = 1;
+ if(linesympos > 0)
+ putelfsymshndx(linesympos, sh->shnum);
+ shline = sh;
sh = newElfShdr(elfstrdbg[ElfStrDebugFrame]);
sh->type = SHT_PROGBITS;
@@ -2346,6 +2502,9 @@ dwarfaddelfheaders(void)
sh->off = infoo;
sh->size = infosize;
sh->addralign = 1;
+ if(infosympos > 0)
+ putelfsymshndx(infosympos, sh->shnum);
+ shinfo = sh;
if (pubnamessize > 0) {
sh = newElfShdr(elfstrdbg[ElfStrDebugPubNames]);
@@ -2363,12 +2522,14 @@ dwarfaddelfheaders(void)
sh->addralign = 1;
}
+ sharanges = nil;
if (arangessize) {
sh = newElfShdr(elfstrdbg[ElfStrDebugAranges]);
sh->type = SHT_PROGBITS;
sh->off = arangeso;
sh->size = arangessize;
sh->addralign = 1;
+ sharanges = sh;
}
if (gdbscriptsize) {
@@ -2378,6 +2539,15 @@ dwarfaddelfheaders(void)
sh->size = gdbscriptsize;
sh->addralign = 1;
}
+
+ if(inforelocsize)
+ dwarfaddelfrelocheader(ElfStrRelDebugInfo, shinfo, inforeloco, inforelocsize);
+
+ if(arangesrelocsize)
+ dwarfaddelfrelocheader(ElfStrRelDebugAranges, sharanges, arangesreloco, arangesrelocsize);
+
+ if(linerelocsize)
+ dwarfaddelfrelocheader(ElfStrRelDebugLine, shline, linereloco, linerelocsize);
}
/*
@@ -2430,8 +2600,6 @@ dwarfaddmachoheaders(void)
msect = newMachoSect(ms, "__debug_info", "__DWARF");
msect->off = infoo;
msect->size = infosize;
- msect->reloc = inforeloco;
- msect->nreloc = inforelocsize / 8;
ms->filesize += msect->size;
if (pubnamessize > 0) {
diff --git a/src/cmd/ld/elf.c b/src/cmd/ld/elf.c
index 22bc64f8f..daef5793f 100644
--- a/src/cmd/ld/elf.c
+++ b/src/cmd/ld/elf.c
@@ -930,6 +930,8 @@ doelf(void)
addstring(shstrtab, ".rel.noptrdata");
addstring(shstrtab, ".rel.data");
}
+ // add a .note.GNU-stack section to mark the stack as non-executable
+ addstring(shstrtab, ".note.GNU-stack");
}
if(!debug['s']) {
@@ -1110,7 +1112,7 @@ asmbelfsetup(void)
void
asmbelf(vlong symo)
{
- int a, o;
+ vlong a, o;
vlong startva, resoff;
ElfEhdr *eh;
ElfPhdr *ph, *pph, *pnote;
@@ -1403,8 +1405,13 @@ elfobj:
elfshreloc(sect);
for(sect=segdata.sect; sect!=nil; sect=sect->next)
elfshreloc(sect);
+ // add a .note.GNU-stack section to mark the stack as non-executable
+ sh = elfshname(".note.GNU-stack");
+ sh->type = SHT_PROGBITS;
+ sh->addralign = 1;
+ sh->flags = 0;
}
-
+
if(!debug['s']) {
sh = elfshname(".symtab");
sh->type = SHT_SYMTAB;
@@ -1421,9 +1428,7 @@ elfobj:
sh->size = elfstrsize;
sh->addralign = 1;
- // TODO(rsc): Enable for linkmode == LinkExternal too, once we know it works.
- if(linkmode != LinkExternal)
- dwarfaddelfheaders();
+ dwarfaddelfheaders();
}
/* Main header */
diff --git a/src/cmd/ld/elf.h b/src/cmd/ld/elf.h
index 336fab4b4..24c0ac43e 100644
--- a/src/cmd/ld/elf.h
+++ b/src/cmd/ld/elf.h
@@ -855,7 +855,8 @@ struct Elf64_Shdr {
Elf64_Xword addralign; /* Alignment in bytes. */
Elf64_Xword entsize; /* Size of each entry in section. */
- int shnum; /* section number, not stored on disk */
+ int shnum; /* section number, not stored on disk */
+ Sym* secsym; /* section symbol, if needed; not on disk */
};
/*
@@ -998,6 +999,7 @@ void phsh(ElfPhdr*, ElfShdr*);
void doelf(void);
void elfsetupplt(void);
void dwarfaddshstrings(Sym*);
+void dwarfaddelfsectionsyms(void);
void dwarfaddelfheaders(void);
void asmbelf(vlong symo);
void asmbelfsetup(void);
@@ -1006,6 +1008,7 @@ extern char freebsddynld[];
extern char netbsddynld[];
extern char openbsddynld[];
int elfreloc1(Reloc*, vlong sectoff);
+void putelfsectionsyms(void);
EXTERN int elfstrsize;
EXTERN char* elfstrdat;
diff --git a/src/cmd/ld/go.c b/src/cmd/ld/go.c
index fa2ec4e28..47fdbe944 100644
--- a/src/cmd/ld/go.c
+++ b/src/cmd/ld/go.c
@@ -463,11 +463,12 @@ loadcgo(char *file, char *pkg, char *p, int n)
s = lookup(local, 0);
if(local != f[1])
free(local);
- if(s->type == 0 || s->type == SXREF) {
+ if(s->type == 0 || s->type == SXREF || s->type == SHOSTOBJ) {
s->dynimplib = lib;
s->extname = remote;
s->dynimpvers = q;
- s->type = SDYNIMPORT;
+ if(s->type != SHOSTOBJ)
+ s->type = SDYNIMPORT;
havedynamic = 1;
}
continue;
diff --git a/src/cmd/ld/ldmacho.c b/src/cmd/ld/ldmacho.c
index 098cb7bef..d384a5094 100644
--- a/src/cmd/ld/ldmacho.c
+++ b/src/cmd/ld/ldmacho.c
@@ -804,9 +804,9 @@ ldmacho(Biobuf *f, char *pkg, int64 len, char *pn)
//
// [For future reference, see Darwin's /usr/include/mach-o/x86_64/reloc.h]
secaddr = c->seg.sect[rel->symnum-1].addr;
- rp->add = e->e32(s->p+rp->off) + rp->off + 4 - secaddr;
+ rp->add = (int32)e->e32(s->p+rp->off) + rp->off + 4 - secaddr;
} else
- rp->add = e->e32(s->p+rp->off);
+ rp->add = (int32)e->e32(s->p+rp->off);
// For i386 Mach-O PC-relative, the addend is written such that
// it *is* the PC being subtracted. Use that to make
diff --git a/src/cmd/ld/ldpe.c b/src/cmd/ld/ldpe.c
index 98923bfbf..033e522f2 100644
--- a/src/cmd/ld/ldpe.c
+++ b/src/cmd/ld/ldpe.c
@@ -211,6 +211,13 @@ ldpe(Biobuf *f, char *pkg, int64 len, char *pn)
sect = &obj->sect[i];
if(sect->sh.Characteristics&IMAGE_SCN_MEM_DISCARDABLE)
continue;
+
+ if((sect->sh.Characteristics&(IMAGE_SCN_CNT_CODE|IMAGE_SCN_CNT_INITIALIZED_DATA|IMAGE_SCN_CNT_UNINITIALIZED_DATA)) == 0) {
+ // This has been seen for .idata sections, which we
+ // want to ignore. See issues 5106 and 5273.
+ continue;
+ }
+
if(map(obj, sect) < 0)
goto bad;
@@ -232,7 +239,7 @@ ldpe(Biobuf *f, char *pkg, int64 len, char *pn)
s->type = STEXT;
break;
default:
- werrstr("unexpected flags for PE section %s", sect->name);
+ werrstr("unexpected flags %#08ux for PE section %s", sect->sh.Characteristics, sect->name);
goto bad;
}
s->p = sect->base;
@@ -250,6 +257,11 @@ ldpe(Biobuf *f, char *pkg, int64 len, char *pn)
continue;
if(rsect->sh.Characteristics&IMAGE_SCN_MEM_DISCARDABLE)
continue;
+ if((sect->sh.Characteristics&(IMAGE_SCN_CNT_CODE|IMAGE_SCN_CNT_INITIALIZED_DATA|IMAGE_SCN_CNT_UNINITIALIZED_DATA)) == 0) {
+ // This has been seen for .idata sections, which we
+ // want to ignore. See issues 5106 and 5273.
+ continue;
+ }
r = mal(rsect->sh.NumberOfRelocations*sizeof r[0]);
Bseek(f, obj->base+rsect->sh.PointerToRelocations, 0);
for(j=0; j<rsect->sh.NumberOfRelocations; j++) {
@@ -279,7 +291,7 @@ ldpe(Biobuf *f, char *pkg, int64 len, char *pn)
case IMAGE_REL_AMD64_ADDR32: // R_X86_64_PC32
case IMAGE_REL_AMD64_ADDR32NB:
rp->type = D_PCREL;
- rp->add = le32(rsect->base+rp->off);
+ rp->add = (int32)le32(rsect->base+rp->off);
break;
case IMAGE_REL_I386_DIR32NB:
case IMAGE_REL_I386_DIR32:
diff --git a/src/cmd/ld/lib.c b/src/cmd/ld/lib.c
index 84777b1a9..0a6bd3e8f 100644
--- a/src/cmd/ld/lib.c
+++ b/src/cmd/ld/lib.c
@@ -45,6 +45,10 @@ int nlibdir = 0;
static int maxlibdir = 0;
static int cout = -1;
+// Set if we see an object compiled by the host compiler that is not
+// from a package that is known to support internal linking mode.
+static int externalobj = 0;
+
static void hostlinksetup(void);
char* goroot;
@@ -295,6 +299,19 @@ loadlib(void)
loadinternal("math");
if(flag_race)
loadinternal("runtime/race");
+ if(linkmode == LinkExternal) {
+ // This indicates a user requested -linkmode=external.
+ // The startup code uses an import of runtime/cgo to decide
+ // whether to initialize the TLS. So give it one. This could
+ // be handled differently but it's an unusual case.
+ loadinternal("runtime/cgo");
+ // Pretend that we really imported the package.
+ // This will do no harm if we did in fact import it.
+ s = lookup("go.importpath.runtime/cgo.", 0);
+ s->type = SDATA;
+ s->dupok = 1;
+ s->reachable = 1;
+ }
for(i=0; i<libraryp; i++) {
if(debug['v'])
@@ -303,19 +320,27 @@ loadlib(void)
objfile(library[i].file, library[i].pkg);
}
- if(linkmode == LinkExternal && !iscgo)
- linkmode = LinkInternal;
-
- // If we got this far in automatic mode, there were no
- // cgo uses that suggest we need external mode.
- // Switch to internal.
if(linkmode == LinkAuto) {
- linkmode = LinkInternal;
+ if(iscgo && externalobj)
+ linkmode = LinkExternal;
+ else
+ linkmode = LinkInternal;
+ }
+
+ if(linkmode == LinkInternal) {
// Drop all the cgo_import_static declarations.
// Turns out we won't be needing them.
for(s = allsym; s != S; s = s->allsym)
- if(s->type == SHOSTOBJ)
- s->type = 0;
+ if(s->type == SHOSTOBJ) {
+ // If a symbol was marked both
+ // cgo_import_static and cgo_import_dynamic,
+ // then we want to make it cgo_import_dynamic
+ // now.
+ if(s->extname != nil && s->dynimplib != nil && s->cgoexport == 0) {
+ s->type = SDYNIMPORT;
+ } else
+ s->type = 0;
+ }
}
// Now that we know the link mode, trim the dynexp list.
@@ -529,8 +554,8 @@ ldhostobj(void (*ld)(Biobuf*, char*, int64, char*), Biobuf *f, char *pkg, int64
}
}
- if(!isinternal && linkmode == LinkAuto)
- linkmode = LinkExternal;
+ if(!isinternal)
+ externalobj = 1;
if(nhostobj >= mhostobj) {
if(mhostobj == 0)
@@ -670,6 +695,7 @@ hostlink(void)
argv[argc++] = p;
w = create(p, 1, 0775);
if(w < 0) {
+ cursym = S;
diag("cannot create %s: %r", p);
errorexit();
}
@@ -681,6 +707,7 @@ hostlink(void)
len -= n;
}
if(close(w) < 0) {
+ cursym = S;
diag("cannot write %s: %r", p);
errorexit();
}
@@ -713,6 +740,7 @@ hostlink(void)
}
if(runcmd(argv) < 0) {
+ cursym = S;
diag("%s: running %s failed: %r", argv0, argv[0]);
errorexit();
}
diff --git a/src/cmd/ld/lib.h b/src/cmd/ld/lib.h
index 9bdfe95c4..e552deb02 100644
--- a/src/cmd/ld/lib.h
+++ b/src/cmd/ld/lib.h
@@ -237,10 +237,10 @@ vlong adduint32(Sym*, uint32);
vlong adduint64(Sym*, uint64);
vlong adduintxx(Sym*, uint64, int);
vlong addaddr(Sym*, Sym*);
-vlong addaddrplus(Sym*, Sym*, int32);
-vlong addpcrelplus(Sym*, Sym*, int32);
+vlong addaddrplus(Sym*, Sym*, vlong);
+vlong addpcrelplus(Sym*, Sym*, vlong);
vlong addsize(Sym*, Sym*);
-vlong setaddrplus(Sym*, vlong, Sym*, int32);
+vlong setaddrplus(Sym*, vlong, Sym*, vlong);
vlong setaddr(Sym*, vlong, Sym*);
void setuint8(Sym*, vlong, uint8);
void setuint16(Sym*, vlong, uint16);
@@ -249,6 +249,8 @@ void setuint64(Sym*, vlong, uint64);
void asmsym(void);
void asmelfsym(void);
void asmplan9sym(void);
+void putelfsectionsym(Sym*, int);
+void putelfsymshndx(vlong, int);
void strnput(char*, int);
void dodata(void);
void dosymtype(void);
diff --git a/src/cmd/ld/symtab.c b/src/cmd/ld/symtab.c
index d8a4645e0..7c8ba642f 100644
--- a/src/cmd/ld/symtab.c
+++ b/src/cmd/ld/symtab.c
@@ -143,6 +143,31 @@ putelfsym(Sym *x, char *s, int t, vlong addr, vlong size, int ver, Sym *go)
}
void
+putelfsectionsym(Sym* s, int shndx)
+{
+ putelfsyment(0, 0, 0, (STB_LOCAL<<4)|STT_SECTION, shndx, 0);
+ s->elfsym = numelfsym++;
+}
+
+void
+putelfsymshndx(vlong sympos, int shndx)
+{
+ vlong here;
+
+ here = cpos();
+ switch(thechar) {
+ case '6':
+ cseek(sympos+6);
+ break;
+ default:
+ cseek(sympos+14);
+ break;
+ }
+ WPUT(shndx);
+ cseek(here);
+}
+
+void
asmelfsym(void)
{
Sym *s;
@@ -150,6 +175,8 @@ asmelfsym(void)
// the first symbol entry is reserved
putelfsyment(0, 0, 0, (STB_LOCAL<<4)|STT_NOTYPE, 0, 0);
+ dwarfaddelfsectionsyms();
+
elfbind = STB_LOCAL;
genasmsym(putelfsym);
@@ -347,7 +374,7 @@ putsymb(Sym *s, char *name, int t, vlong v, vlong size, int ver, Sym *typ)
// type byte
if('A' <= t && t <= 'Z')
- c = t - 'A';
+ c = t - 'A' + (ver ? 26 : 0);
else if('a' <= t && t <= 'z')
c = t - 'a' + 26;
else {
diff --git a/src/cmd/prof/Makefile b/src/cmd/prof/Makefile
deleted file mode 100644
index 3f528d751..000000000
--- a/src/cmd/prof/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-# Copyright 2012 The Go Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file.
-
-include ../../Make.dist
diff --git a/src/cmd/prof/doc.go b/src/cmd/prof/doc.go
deleted file mode 100644
index 2640167d3..000000000
--- a/src/cmd/prof/doc.go
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-/*
-
-Prof is a rudimentary real-time profiler.
-
-Given a command to run or the process id (pid) of a command already
-running, it samples the program's state at regular intervals and reports
-on its behavior. With no options, it prints a histogram of the locations
-in the code that were sampled during execution.
-
-Since it is a real-time profiler, unlike a traditional profiler it samples
-the program's state even when it is not running, such as when it is
-asleep or waiting for I/O. Each thread contributes equally to the
-statistics.
-
-Usage:
- go tool prof -p pid [-t total_secs] [-d delta_msec] [6.out args ...]
-
-The output modes (default -h) are:
-
- -P file.prof:
- Write the profile information to file.prof, in the format used by pprof.
- At the moment, this only works on Linux amd64 binaries and requires that the
- binary be written using 6l -e to produce ELF debug info.
- See http://code.google.com/p/google-perftools for details.
- -h: histograms
- How many times a sample occurred at each location.
- -f: dynamic functions
- At each sample period, print the name of the executing function.
- -l: dynamic file and line numbers
- At each sample period, print the file and line number of the executing instruction.
- -r: dynamic registers
- At each sample period, print the register contents.
- -s: dynamic function stack traces
- At each sample period, print the symbolic stack trace.
-
-Flag -t sets the maximum real time to sample, in seconds, and -d
-sets the sampling interval in milliseconds. The default is to sample
-every 100ms until the program completes.
-
-It is installed as go tool prof and is architecture-independent.
-
-*/
-package main
diff --git a/src/cmd/prof/main.c b/src/cmd/prof/main.c
deleted file mode 100644
index 6c591ba18..000000000
--- a/src/cmd/prof/main.c
+++ /dev/null
@@ -1,910 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build !plan9
-
-#include <u.h>
-#include <time.h>
-#include <libc.h>
-#include <bio.h>
-#include <ctype.h>
-
-#define Ureg Ureg_amd64
- #include <ureg_amd64.h>
-#undef Ureg
-#define Ureg Ureg_x86
- #include <ureg_x86.h>
-#undef Ureg
-#include <mach.h>
-
-char* file = "6.out";
-static Fhdr fhdr;
-int have_syms;
-int fd;
-struct Ureg_amd64 ureg_amd64;
-struct Ureg_x86 ureg_x86;
-int total_sec = 0;
-int delta_msec = 100;
-int nsample;
-int nsamplethread;
-
-// pprof data, stored as sequences of N followed by N PC values.
-// See http://code.google.com/p/google-perftools .
-uvlong *ppdata; // traces
-Biobuf* pproffd; // file descriptor to write trace info
-long ppstart; // start position of current trace
-long nppdata; // length of data
-long ppalloc; // size of allocated data
-char ppmapdata[10*1024]; // the map information for the output file
-
-// output formats
-int pprof; // print pprof output to named file
-int functions; // print functions
-int histograms; // print histograms
-int linenums; // print file and line numbers rather than function names
-int registers; // print registers
-int stacks; // print stack traces
-
-int pid; // main process pid
-
-int nthread; // number of threads
-int thread[32]; // thread pids
-Map *map[32]; // thread maps
-
-void
-Usage(void)
-{
- fprint(2, "Usage: prof -p pid [-t total_secs] [-d delta_msec]\n");
- fprint(2, " prof [-t total_secs] [-d delta_msec] 6.out args ...\n");
- fprint(2, "\tformats (default -h):\n");
- fprint(2, "\t\t-P file.prof: write [c]pprof output to file.prof\n");
- fprint(2, "\t\t-h: histograms\n");
- fprint(2, "\t\t-f: dynamic functions\n");
- fprint(2, "\t\t-l: dynamic file and line numbers\n");
- fprint(2, "\t\t-r: dynamic registers\n");
- fprint(2, "\t\t-s: dynamic function stack traces\n");
- fprint(2, "\t\t-hs: include stack info in histograms\n");
- exit(2);
-}
-
-typedef struct PC PC;
-struct PC {
- uvlong pc;
- uvlong callerpc;
- unsigned int count;
- PC* next;
-};
-
-enum {
- Ncounters = 256
-};
-
-PC *counters[Ncounters];
-
-// Set up by setarch() to make most of the code architecture-independent.
-typedef struct Arch Arch;
-struct Arch {
- char* name;
- void (*regprint)(void);
- int (*getregs)(Map*);
- int (*getPC)(Map*);
- int (*getSP)(Map*);
- uvlong (*uregPC)(void);
- uvlong (*uregSP)(void);
- void (*ppword)(uvlong w);
-};
-
-void
-amd64_regprint(void)
-{
- fprint(2, "ax\t0x%llux\n", ureg_amd64.ax);
- fprint(2, "bx\t0x%llux\n", ureg_amd64.bx);
- fprint(2, "cx\t0x%llux\n", ureg_amd64.cx);
- fprint(2, "dx\t0x%llux\n", ureg_amd64.dx);
- fprint(2, "si\t0x%llux\n", ureg_amd64.si);
- fprint(2, "di\t0x%llux\n", ureg_amd64.di);
- fprint(2, "bp\t0x%llux\n", ureg_amd64.bp);
- fprint(2, "r8\t0x%llux\n", ureg_amd64.r8);
- fprint(2, "r9\t0x%llux\n", ureg_amd64.r9);
- fprint(2, "r10\t0x%llux\n", ureg_amd64.r10);
- fprint(2, "r11\t0x%llux\n", ureg_amd64.r11);
- fprint(2, "r12\t0x%llux\n", ureg_amd64.r12);
- fprint(2, "r13\t0x%llux\n", ureg_amd64.r13);
- fprint(2, "r14\t0x%llux\n", ureg_amd64.r14);
- fprint(2, "r15\t0x%llux\n", ureg_amd64.r15);
- fprint(2, "ds\t0x%llux\n", ureg_amd64.ds);
- fprint(2, "es\t0x%llux\n", ureg_amd64.es);
- fprint(2, "fs\t0x%llux\n", ureg_amd64.fs);
- fprint(2, "gs\t0x%llux\n", ureg_amd64.gs);
- fprint(2, "type\t0x%llux\n", ureg_amd64.type);
- fprint(2, "error\t0x%llux\n", ureg_amd64.error);
- fprint(2, "pc\t0x%llux\n", ureg_amd64.ip);
- fprint(2, "cs\t0x%llux\n", ureg_amd64.cs);
- fprint(2, "flags\t0x%llux\n", ureg_amd64.flags);
- fprint(2, "sp\t0x%llux\n", ureg_amd64.sp);
- fprint(2, "ss\t0x%llux\n", ureg_amd64.ss);
-}
-
-int
-amd64_getregs(Map *map)
-{
- int i;
- union {
- uvlong regs[1];
- struct Ureg_amd64 ureg;
- } u;
-
- for(i = 0; i < sizeof ureg_amd64; i+=8) {
- if(get8(map, (uvlong)i, &u.regs[i/8]) < 0)
- return -1;
- }
- ureg_amd64 = u.ureg;
- return 0;
-}
-
-int
-amd64_getPC(Map *map)
-{
- uvlong x;
- int r;
-
- r = get8(map, offsetof(struct Ureg_amd64, ip), &x);
- ureg_amd64.ip = x;
- return r;
-}
-
-int
-amd64_getSP(Map *map)
-{
- uvlong x;
- int r;
-
- r = get8(map, offsetof(struct Ureg_amd64, sp), &x);
- ureg_amd64.sp = x;
- return r;
-}
-
-uvlong
-amd64_uregPC(void)
-{
- return ureg_amd64.ip;
-}
-
-uvlong
-amd64_uregSP(void)
-{
- return ureg_amd64.sp;
-}
-
-void
-amd64_ppword(uvlong w)
-{
- uchar buf[8];
-
- buf[0] = w;
- buf[1] = w >> 8;
- buf[2] = w >> 16;
- buf[3] = w >> 24;
- buf[4] = w >> 32;
- buf[5] = w >> 40;
- buf[6] = w >> 48;
- buf[7] = w >> 56;
- Bwrite(pproffd, buf, 8);
-}
-
-void
-x86_regprint(void)
-{
- fprint(2, "ax\t0x%ux\n", ureg_x86.ax);
- fprint(2, "bx\t0x%ux\n", ureg_x86.bx);
- fprint(2, "cx\t0x%ux\n", ureg_x86.cx);
- fprint(2, "dx\t0x%ux\n", ureg_x86.dx);
- fprint(2, "si\t0x%ux\n", ureg_x86.si);
- fprint(2, "di\t0x%ux\n", ureg_x86.di);
- fprint(2, "bp\t0x%ux\n", ureg_x86.bp);
- fprint(2, "ds\t0x%ux\n", ureg_x86.ds);
- fprint(2, "es\t0x%ux\n", ureg_x86.es);
- fprint(2, "fs\t0x%ux\n", ureg_x86.fs);
- fprint(2, "gs\t0x%ux\n", ureg_x86.gs);
- fprint(2, "cs\t0x%ux\n", ureg_x86.cs);
- fprint(2, "flags\t0x%ux\n", ureg_x86.flags);
- fprint(2, "pc\t0x%ux\n", ureg_x86.pc);
- fprint(2, "sp\t0x%ux\n", ureg_x86.sp);
- fprint(2, "ss\t0x%ux\n", ureg_x86.ss);
-}
-
-int
-x86_getregs(Map *map)
-{
- int i;
-
- for(i = 0; i < sizeof ureg_x86; i+=4) {
- if(get4(map, (uvlong)i, &((uint32*)&ureg_x86)[i/4]) < 0)
- return -1;
- }
- return 0;
-}
-
-int
-x86_getPC(Map* map)
-{
- return get4(map, offsetof(struct Ureg_x86, pc), &ureg_x86.pc);
-}
-
-int
-x86_getSP(Map* map)
-{
- return get4(map, offsetof(struct Ureg_x86, sp), &ureg_x86.sp);
-}
-
-uvlong
-x86_uregPC(void)
-{
- return (uvlong)ureg_x86.pc;
-}
-
-uvlong
-x86_uregSP(void)
-{
- return (uvlong)ureg_x86.sp;
-}
-
-void
-x86_ppword(uvlong w)
-{
- uchar buf[4];
-
- buf[0] = w;
- buf[1] = w >> 8;
- buf[2] = w >> 16;
- buf[3] = w >> 24;
- Bwrite(pproffd, buf, 4);
-}
-
-Arch archtab[] = {
- {
- "amd64",
- amd64_regprint,
- amd64_getregs,
- amd64_getPC,
- amd64_getSP,
- amd64_uregPC,
- amd64_uregSP,
- amd64_ppword,
- },
- {
- "386",
- x86_regprint,
- x86_getregs,
- x86_getPC,
- x86_getSP,
- x86_uregPC,
- x86_uregSP,
- x86_ppword,
- },
- {
- nil
- }
-};
-
-Arch *arch;
-
-int
-setarch(void)
-{
- int i;
-
- if(mach != nil) {
- for(i = 0; archtab[i].name != nil; i++) {
- if (strcmp(mach->name, archtab[i].name) == 0) {
- arch = &archtab[i];
- return 0;
- }
- }
- }
- return -1;
-}
-
-int
-getthreads(void)
-{
- int i, j, curn, found;
- Map *curmap[nelem(map)];
- int curthread[nelem(map)];
- static int complained = 0;
-
- curn = procthreadpids(pid, curthread, nelem(curthread));
- if(curn <= 0)
- return curn;
-
- if(curn > nelem(map)) {
- if(complained == 0) {
- fprint(2, "prof: too many threads; limiting to %d\n", nthread, nelem(map));
- complained = 1;
- }
- curn = nelem(map);
- }
- if(curn == nthread && memcmp(thread, curthread, curn*sizeof(*thread)) == 0)
- return curn; // no changes
-
- // Number of threads has changed (might be the init case).
- // A bit expensive but rare enough not to bother being clever.
- for(i = 0; i < curn; i++) {
- found = 0;
- for(j = 0; j < nthread; j++) {
- if(curthread[i] == thread[j]) {
- found = 1;
- curmap[i] = map[j];
- map[j] = nil;
- break;
- }
- }
- if(found)
- continue;
-
- // map new thread
- curmap[i] = attachproc(curthread[i], &fhdr);
- if(curmap[i] == nil) {
- fprint(2, "prof: can't attach to %d: %r\n", curthread[i]);
- return -1;
- }
- }
-
- for(j = 0; j < nthread; j++)
- if(map[j] != nil)
- detachproc(map[j]);
-
- nthread = curn;
- memmove(thread, curthread, nthread*sizeof thread[0]);
- memmove(map, curmap, sizeof map);
- return nthread;
-}
-
-int
-sample(Map *map)
-{
- static int n;
-
- n++;
- if(registers) {
- if(arch->getregs(map) < 0)
- goto bad;
- } else {
- // we need only two registers
- if(arch->getPC(map) < 0)
- goto bad;
- if(arch->getSP(map) < 0)
- goto bad;
- }
- return 1;
-bad:
- if(n == 1)
- fprint(2, "prof: can't read registers: %r\n");
- return 0;
-}
-
-void
-addtohistogram(uvlong pc, uvlong callerpc, uvlong sp)
-{
- int h;
- PC *x;
-
- USED(sp);
-
- h = (pc + callerpc*101) % Ncounters;
- for(x = counters[h]; x != NULL; x = x->next) {
- if(x->pc == pc && x->callerpc == callerpc) {
- x->count++;
- return;
- }
- }
- x = malloc(sizeof(PC));
- if(x == nil)
- sysfatal("out of memory");
- x->pc = pc;
- x->callerpc = callerpc;
- x->count = 1;
- x->next = counters[h];
- counters[h] = x;
-}
-
-void
-addppword(uvlong pc)
-{
- if(pc == 0) {
- return;
- }
- if(nppdata == ppalloc) {
- ppalloc = (1000+nppdata)*2;
- ppdata = realloc(ppdata, ppalloc * sizeof ppdata[0]);
- if(ppdata == nil) {
- fprint(2, "prof: realloc failed: %r\n");
- exit(2);
- }
- }
- ppdata[nppdata++] = pc;
-}
-
-void
-startpptrace(void)
-{
- ppstart = nppdata;
- addppword(~0);
-}
-
-void
-endpptrace(void)
-{
- ppdata[ppstart] = nppdata-ppstart-1;
-}
-
-uvlong nextpc;
-
-void
-xptrace(Map *map, uvlong pc, uvlong sp, Symbol *sym)
-{
- USED(map);
-
- char buf[1024];
- if(sym == nil){
- fprint(2, "syms\n");
- return;
- }
- if(histograms)
- addtohistogram(nextpc, pc, sp);
- if(!histograms || stacks > 1 || pprof) {
- if(nextpc == 0)
- nextpc = sym->value;
- if(stacks){
- fprint(2, "%s(", sym->name);
- fprint(2, ")");
- if(nextpc != sym->value)
- fprint(2, "+%#llux ", nextpc - sym->value);
- if(have_syms && linenums && fileline(buf, sizeof buf, pc)) {
- fprint(2, " %s", buf);
- }
- fprint(2, "\n");
- }
- if (pprof) {
- addppword(nextpc);
- }
- }
- nextpc = pc;
-}
-
-void
-stacktracepcsp(Map *map, uvlong pc, uvlong sp)
-{
- nextpc = pc;
- if(pprof){
- startpptrace();
- }
- if(machdata->ctrace==nil)
- fprint(2, "no machdata->ctrace\n");
- else if(machdata->ctrace(map, pc, sp, 0, xptrace) <= 0)
- fprint(2, "no stack frame: pc=%#p sp=%#p\n", pc, sp);
- else {
- addtohistogram(nextpc, 0, sp);
- if(stacks)
- fprint(2, "\n");
- }
- if(pprof){
- endpptrace();
- }
-}
-
-void
-printpc(Map *map, uvlong pc, uvlong sp)
-{
- char buf[1024];
- if(registers)
- arch->regprint();
- if(have_syms > 0 && linenums && fileline(buf, sizeof buf, pc))
- fprint(2, "%s\n", buf);
- if(have_syms > 0 && functions) {
- symoff(buf, sizeof(buf), pc, CANY);
- fprint(2, "%s\n", buf);
- }
- if(stacks || pprof){
- stacktracepcsp(map, pc, sp);
- }
- else if(histograms){
- addtohistogram(pc, 0, sp);
- }
-}
-
-void
-ppmaps(void)
-{
- int fd, n;
- char tmp[100];
- Seg *seg;
-
- // If it's Linux, the info is in /proc/$pid/maps
- snprint(tmp, sizeof tmp, "/proc/%d/maps", pid);
- fd = open(tmp, 0);
- if(fd >= 0) {
- n = read(fd, ppmapdata, sizeof ppmapdata - 1);
- close(fd);
- if(n < 0) {
- fprint(2, "prof: can't read %s: %r\n", tmp);
- exit(2);
- }
- ppmapdata[n] = 0;
- return;
- }
-
- // It's probably a mac. Synthesize an entry for the text file.
- // The register segment may come first but it has a zero offset, so grab the first non-zero offset segment.
- for(n = 0; n < 3; n++){
- seg = &map[0]->seg[n];
- if(seg->b == 0) {
- continue;
- }
- snprint(ppmapdata, sizeof ppmapdata,
- "%.16x-%.16x r-xp %d 00:00 34968549 %s\n",
- seg->b, seg->e, seg->f, "/home/r/6.out"
- );
- return;
- }
- fprint(2, "prof: no text segment in maps for %s\n", file);
- exit(2);
-}
-
-void
-samples(void)
-{
- int i, pid, msec;
- struct timespec req;
- int getmaps;
-
- req.tv_sec = delta_msec/1000;
- req.tv_nsec = 1000000*(delta_msec % 1000);
- getmaps = 0;
- if(pprof)
- getmaps= 1;
- for(msec = 0; total_sec <= 0 || msec < 1000*total_sec; msec += delta_msec) {
- nsample++;
- nsamplethread += nthread;
- for(i = 0; i < nthread; i++) {
- pid = thread[i];
- if(ctlproc(pid, "stop") < 0)
- return;
- if(!sample(map[i])) {
- ctlproc(pid, "start");
- return;
- }
- printpc(map[i], arch->uregPC(), arch->uregSP());
- ctlproc(pid, "start");
- }
- nanosleep(&req, NULL);
- getthreads();
- if(nthread == 0)
- break;
- if(getmaps) {
- getmaps = 0;
- ppmaps();
- }
- }
-}
-
-typedef struct Func Func;
-struct Func
-{
- Func *next;
- Symbol s;
- uint onstack;
- uint leaf;
-};
-
-Func *func[257];
-int nfunc;
-
-Func*
-findfunc(uvlong pc)
-{
- Func *f;
- uint h;
- Symbol s;
-
- if(pc == 0)
- return nil;
-
- if(!findsym(pc, CTEXT, &s))
- return nil;
-
- h = s.value % nelem(func);
- for(f = func[h]; f != NULL; f = f->next)
- if(f->s.value == s.value)
- return f;
-
- f = malloc(sizeof *f);
- if(f == nil)
- sysfatal("out of memory");
- memset(f, 0, sizeof *f);
- f->s = s;
- f->next = func[h];
- func[h] = f;
- nfunc++;
- return f;
-}
-
-int
-compareleaf(const void *va, const void *vb)
-{
- Func *a, *b;
-
- a = *(Func**)va;
- b = *(Func**)vb;
- if(a->leaf != b->leaf)
- return b->leaf - a->leaf;
- if(a->onstack != b->onstack)
- return b->onstack - a->onstack;
- return strcmp(a->s.name, b->s.name);
-}
-
-void
-dumphistogram(void)
-{
- int i, h, n;
- PC *x;
- Func *f, **ff;
-
- if(!histograms)
- return;
-
- // assign counts to functions.
- for(h = 0; h < Ncounters; h++) {
- for(x = counters[h]; x != NULL; x = x->next) {
- f = findfunc(x->pc);
- if(f) {
- f->onstack += x->count;
- f->leaf += x->count;
- }
- f = findfunc(x->callerpc);
- if(f)
- f->leaf -= x->count;
- }
- }
-
- // build array
- ff = malloc(nfunc*sizeof ff[0]);
- if(ff == nil)
- sysfatal("out of memory");
- n = 0;
- for(h = 0; h < nelem(func); h++)
- for(f = func[h]; f != NULL; f = f->next)
- ff[n++] = f;
-
- // sort by leaf counts
- qsort(ff, nfunc, sizeof ff[0], compareleaf);
-
- // print.
- fprint(2, "%d samples (avg %.1g threads)\n", nsample, (double)nsamplethread/nsample);
- for(i = 0; i < nfunc; i++) {
- f = ff[i];
- fprint(2, "%6.2f%%\t", 100.0*(double)f->leaf/nsample);
- if(stacks)
- fprint(2, "%6.2f%%\t", 100.0*(double)f->onstack/nsample);
- fprint(2, "%s\n", f->s.name);
- }
-}
-
-typedef struct Trace Trace;
-struct Trace {
- int count;
- int npc;
- uvlong *pc;
- Trace *next;
-};
-
-void
-dumppprof(void)
-{
- uvlong i, n, *p, *e;
- int ntrace;
- Trace *trace, *tp, *up, *prev;
-
- if(!pprof)
- return;
- e = ppdata + nppdata;
- // Create list of traces. First, count the traces
- ntrace = 0;
- for(p = ppdata; p < e;) {
- n = *p++;
- p += n;
- if(n == 0)
- continue;
- ntrace++;
- }
- if(ntrace <= 0)
- return;
- // Allocate and link the traces together.
- trace = malloc(ntrace * sizeof(Trace));
- if(trace == nil)
- sysfatal("out of memory");
- tp = trace;
- for(p = ppdata; p < e;) {
- n = *p++;
- if(n == 0)
- continue;
- tp->count = 1;
- tp->npc = n;
- tp->pc = p;
- tp->next = tp+1;
- tp++;
- p += n;
- }
- trace[ntrace-1].next = nil;
- // Eliminate duplicates. Lousy algorithm, although not as bad as it looks because
- // the list collapses fast.
- for(tp = trace; tp != nil; tp = tp->next) {
- prev = tp;
- for(up = tp->next; up != nil; up = up->next) {
- if(up->npc == tp->npc && memcmp(up->pc, tp->pc, up->npc*sizeof up->pc[0]) == 0) {
- tp->count++;
- prev->next = up->next;
- } else {
- prev = up;
- }
- }
- }
- // Write file.
- // See http://code.google.com/p/google-perftools/source/browse/trunk/doc/cpuprofile-fileformat.html
- // 1) Header
- arch->ppword(0); // must be zero
- arch->ppword(3); // 3 words follow in header
- arch->ppword(0); // must be zero
- arch->ppword(delta_msec * 1000); // sampling period in microseconds
- arch->ppword(0); // must be zero (padding)
- // 2) One record for each trace.
- for(tp = trace; tp != nil; tp = tp->next) {
- arch->ppword(tp->count);
- arch->ppword(tp->npc);
- for(i = 0; i < tp->npc; i++) {
- arch->ppword(tp->pc[i]);
- }
- }
- // 3) Binary trailer
- arch->ppword(0); // must be zero
- arch->ppword(1); // must be one
- arch->ppword(0); // must be zero
- // 4) Mapped objects.
- Bwrite(pproffd, ppmapdata, strlen(ppmapdata));
- // 5) That's it.
- Bterm(pproffd);
-}
-
-int
-startprocess(char **argv)
-{
- int pid;
-
- if((pid = fork()) == 0) {
- pid = getpid();
- if(ctlproc(pid, "hang") < 0){
- fprint(2, "prof: child process could not hang\n");
- exits(0);
- }
- execv(argv[0], argv);
- fprint(2, "prof: could not exec %s: %r\n", argv[0]);
- exits(0);
- }
-
- if(pid == -1) {
- fprint(2, "prof: could not fork\n");
- exit(1);
- }
- if(ctlproc(pid, "attached") < 0 || ctlproc(pid, "waitstop") < 0) {
- fprint(2, "prof: could not attach to child process: %r\n");
- exit(1);
- }
- return pid;
-}
-
-void
-detach(void)
-{
- int i;
-
- for(i = 0; i < nthread; i++)
- detachproc(map[i]);
-}
-
-int
-main(int argc, char *argv[])
-{
- int i;
- char *ppfile;
-
- ARGBEGIN{
- case 'P':
- pprof =1;
- ppfile = EARGF(Usage());
- pproffd = Bopen(ppfile, OWRITE);
- if(pproffd == nil) {
- fprint(2, "prof: cannot open %s: %r\n", ppfile);
- exit(2);
- }
- break;
- case 'd':
- delta_msec = atoi(EARGF(Usage()));
- break;
- case 't':
- total_sec = atoi(EARGF(Usage()));
- break;
- case 'p':
- pid = atoi(EARGF(Usage()));
- break;
- case 'f':
- functions = 1;
- break;
- case 'h':
- histograms = 1;
- break;
- case 'l':
- linenums = 1;
- break;
- case 'r':
- registers = 1;
- break;
- case 's':
- stacks++;
- break;
- default:
- Usage();
- }ARGEND
- if(pid <= 0 && argc == 0)
- Usage();
- if(functions+linenums+registers+stacks+pprof == 0)
- histograms = 1;
- if(!machbyname("amd64")) {
- fprint(2, "prof: no amd64 support\n", pid);
- exit(1);
- }
- if(argc > 0)
- file = argv[0];
- else if(pid) {
- file = proctextfile(pid);
- if (file == NULL) {
- fprint(2, "prof: can't find file for pid %d: %r\n", pid);
- fprint(2, "prof: on Darwin, need to provide file name explicitly\n");
- exit(1);
- }
- }
- fd = open(file, 0);
- if(fd < 0) {
- fprint(2, "prof: can't open %s: %r\n", file);
- exit(1);
- }
- if(crackhdr(fd, &fhdr)) {
- have_syms = syminit(fd, &fhdr);
- if(!have_syms) {
- fprint(2, "prof: no symbols for %s: %r\n", file);
- }
- } else {
- fprint(2, "prof: crack header for %s: %r\n", file);
- exit(1);
- }
- if(pid <= 0)
- pid = startprocess(argv);
- attachproc(pid, &fhdr); // initializes thread list
- if(setarch() < 0) {
- detach();
- fprint(2, "prof: can't identify binary architecture for pid %d\n", pid);
- exit(1);
- }
- if(getthreads() <= 0) {
- detach();
- fprint(2, "prof: can't find threads for pid %d\n", pid);
- exit(1);
- }
- for(i = 0; i < nthread; i++)
- ctlproc(thread[i], "start");
- samples();
- detach();
- dumphistogram();
- dumppprof();
- exit(0);
-}
diff --git a/src/cmd/vet/Makefile b/src/cmd/vet/Makefile
index 45bd29170..67c7e1997 100644
--- a/src/cmd/vet/Makefile
+++ b/src/cmd/vet/Makefile
@@ -5,8 +5,10 @@
# Assumes go/types is installed
test testshort:
go build -tags 'vet_test gotypes'
- ../../../test/errchk ./vet -printfuncs='Warn:1,Warnf:1' *.go *.s
+ ../../../test/errchk ./vet -printfuncs='Warn:1,Warnf:1' test_*.go test_*.s
test_notypes:
go build -tags 'vet_test'
- ../../../test/errchk ./vet -printfuncs='Warn:1,Warnf:1' *.go *.s
+ # Only those tests that do not depend on types.
+ # Excluded: test_print.go
+ ../../../test/errchk ./vet -printfuncs='Warn:1,Warnf:1' test_asm.go test_assign.go test_atomic.go test_buildtag.go test_buildtag_bad.go test_deadcode.go test_method.go test_rangeloop.go test_structtag.go test_taglit.go test_*.s
diff --git a/src/cmd/vet/buildtag_bad.go b/src/cmd/vet/test_buildtag_bad.go
index 4dca6a443..0a0a39bd1 100644
--- a/src/cmd/vet/buildtag_bad.go
+++ b/src/cmd/vet/test_buildtag_bad.go
@@ -8,4 +8,8 @@
// +build @#$ // ERROR "invalid non-alphanumeric build constraint"
// +build toolate // ERROR "build comment appears too late in file"
-package main
+package bad
+
+// This is package 'bad' rather than 'main' so the erroneous build
+// tag doesn't end up looking like a package doc for the vet command
+// when examined by godoc.
diff --git a/src/lib9/run_plan9.c b/src/lib9/run_plan9.c
index 2b043cc2c..cd85652f7 100644
--- a/src/lib9/run_plan9.c
+++ b/src/lib9/run_plan9.c
@@ -16,7 +16,7 @@ runcmd(char **argv)
return -1;
case 0:
exec(argv[0], argv);
- fprint(2, "exec %s: %r", argv[0]);
+ fprint(2, "exec %s: %r\n", argv[0]);
exits("exec");
}
diff --git a/src/lib9/run_unix.c b/src/lib9/run_unix.c
index 1b4c6de1b..c26cf0afb 100644
--- a/src/lib9/run_unix.c
+++ b/src/lib9/run_unix.c
@@ -20,7 +20,7 @@ runcmd(char **argv)
return -1;
case 0:
execvp(argv[0], argv);
- fprint(2, "exec %s: %r", argv[0]);
+ fprint(2, "exec %s: %r\n", argv[0]);
_exit(1);
}
diff --git a/src/lib9/tempdir_unix.c b/src/lib9/tempdir_unix.c
index 7b7e58b4d..99a7092b6 100644
--- a/src/lib9/tempdir_unix.c
+++ b/src/lib9/tempdir_unix.c
@@ -16,7 +16,7 @@ mktempdir(void)
char *tmp, *p;
tmp = getenv("TMPDIR");
- if(tmp == nil)
+ if(tmp == nil || strlen(tmp) == 0)
tmp = "/var/tmp";
p = smprint("%s/go-link-XXXXXX", tmp);
if(mkdtemp(p) == nil)
diff --git a/src/libmach/8.c b/src/libmach/8.c
index 07ec30505..34248e6f3 100644
--- a/src/libmach/8.c
+++ b/src/libmach/8.c
@@ -30,6 +30,7 @@
* 386 definition
*/
#include <u.h>
+#include <libc.h>
#include <bio.h>
#include <ureg_x86.h>
#include <mach.h>
diff --git a/src/make.bash b/src/make.bash
index 8d0f6ebae..10696e765 100755
--- a/src/make.bash
+++ b/src/make.bash
@@ -111,6 +111,10 @@ case "$GOHOSTARCH" in
386) mflag=-m32;;
amd64) mflag=-m64;;
esac
+if [ "$(uname)" == "Darwin" ]; then
+ # golang.org/issue/5261
+ mflag="$mflag -mmacosx-version-min=10.6"
+fi
${CC:-gcc} $mflag -O2 -Wall -Werror -o cmd/dist/dist -Icmd/dist "$DEFGOROOT" cmd/dist/*.c
eval $(./cmd/dist/dist env -p)
diff --git a/src/pkg/archive/zip/reader.go b/src/pkg/archive/zip/reader.go
index c10f29a83..f19cf2d1f 100644
--- a/src/pkg/archive/zip/reader.go
+++ b/src/pkg/archive/zip/reader.go
@@ -353,6 +353,11 @@ func readDirectoryEnd(r io.ReaderAt, size int64) (dir *directoryEnd, err error)
if err != nil {
return nil, err
}
+
+ // Make sure directoryOffset points to somewhere in our file.
+ if o := int64(d.directoryOffset); o < 0 || o >= size {
+ return nil, ErrFormat
+ }
return d, nil
}
@@ -407,7 +412,7 @@ func findSignatureInBlock(b []byte) int {
if b[i] == 'P' && b[i+1] == 'K' && b[i+2] == 0x05 && b[i+3] == 0x06 {
// n is length of comment
n := int(b[i+directoryEndLen-2]) | int(b[i+directoryEndLen-1])<<8
- if n+directoryEndLen+i == len(b) {
+ if n+directoryEndLen+i <= len(b) {
return i
}
}
diff --git a/src/pkg/archive/zip/reader_test.go b/src/pkg/archive/zip/reader_test.go
index cf9c59c4b..833ba28ad 100644
--- a/src/pkg/archive/zip/reader_test.go
+++ b/src/pkg/archive/zip/reader_test.go
@@ -64,6 +64,24 @@ var tests = []ZipTest{
},
},
{
+ Name: "test-trailing-junk.zip",
+ Comment: "This is a zipfile comment.",
+ File: []ZipTestFile{
+ {
+ Name: "test.txt",
+ Content: []byte("This is a test text file.\n"),
+ Mtime: "09-05-10 12:12:02",
+ Mode: 0644,
+ },
+ {
+ Name: "gophercolor16x16.png",
+ File: "gophercolor16x16.png",
+ Mtime: "09-05-10 15:52:58",
+ Mode: 0644,
+ },
+ },
+ },
+ {
Name: "r.zip",
Source: returnRecursiveZip,
File: []ZipTestFile{
@@ -262,7 +280,7 @@ func readTestZip(t *testing.T, zt ZipTest) {
}
}
if err != zt.Error {
- t.Errorf("error=%v, want %v", err, zt.Error)
+ t.Errorf("%s: error=%v, want %v", zt.Name, err, zt.Error)
return
}
diff --git a/src/pkg/archive/zip/struct.go b/src/pkg/archive/zip/struct.go
index ea067f355..73972d41c 100644
--- a/src/pkg/archive/zip/struct.go
+++ b/src/pkg/archive/zip/struct.go
@@ -64,8 +64,15 @@ const (
zip64ExtraId = 0x0001 // zip64 Extended Information Extra Field
)
+// FileHeader describes a file within a zip file.
+// See the zip spec for details.
type FileHeader struct {
- Name string
+ // Name is the name of the file.
+ // It must be a relative path: it must not start with a drive
+ // letter (e.g. C:) or leading slash, and only forward slashes
+ // are allowed.
+ Name string
+
CreatorVersion uint16
ReaderVersion uint16
Flags uint16
diff --git a/src/pkg/archive/zip/testdata/test-trailing-junk.zip b/src/pkg/archive/zip/testdata/test-trailing-junk.zip
new file mode 100644
index 000000000..42281b4e3
--- /dev/null
+++ b/src/pkg/archive/zip/testdata/test-trailing-junk.zip
Binary files differ
diff --git a/src/pkg/archive/zip/writer.go b/src/pkg/archive/zip/writer.go
index 4c696e152..e9f147cea 100644
--- a/src/pkg/archive/zip/writer.go
+++ b/src/pkg/archive/zip/writer.go
@@ -163,6 +163,9 @@ func (w *Writer) Close() error {
// Create adds a file to the zip file using the provided name.
// It returns a Writer to which the file contents should be written.
+// The name must be a relative path: it must not start with a drive
+// letter (e.g. C:) or leading slash, and only forward slashes are
+// allowed.
// The file's contents must be written to the io.Writer before the next
// call to Create, CreateHeader, or Close.
func (w *Writer) Create(name string) (io.Writer, error) {
diff --git a/src/pkg/bufio/scan.go b/src/pkg/bufio/scan.go
index 486853e6b..2e1a2e999 100644
--- a/src/pkg/bufio/scan.go
+++ b/src/pkg/bufio/scan.go
@@ -158,15 +158,25 @@ func (s *Scanner) Scan() bool {
s.start = 0
continue
}
- // Finally we can read some input.
- n, err := s.r.Read(s.buf[s.end:len(s.buf)])
- if err != nil {
- s.setErr(err)
- }
- if n == 0 { // Don't loop forever if Reader doesn't deliver EOF.
- s.err = io.EOF
+ // Finally we can read some input. Make sure we don't get stuck with
+ // a misbehaving Reader. Officially we don't need to do this, but let's
+ // be extra careful: Scanner is for safe, simple jobs.
+ for loop := 0; ; {
+ n, err := s.r.Read(s.buf[s.end:len(s.buf)])
+ s.end += n
+ if err != nil {
+ s.setErr(err)
+ break
+ }
+ if n > 0 {
+ break
+ }
+ loop++
+ if loop > 100 {
+ s.setErr(io.ErrNoProgress)
+ break
+ }
}
- s.end += n
}
}
diff --git a/src/pkg/bufio/scan_test.go b/src/pkg/bufio/scan_test.go
index 48729aabb..c1483b268 100644
--- a/src/pkg/bufio/scan_test.go
+++ b/src/pkg/bufio/scan_test.go
@@ -368,3 +368,39 @@ func TestErrAtEOF(t *testing.T) {
t.Fatal("wrong error:", s.Err())
}
}
+
+// Test for issue 5268.
+type alwaysError struct{}
+
+func (alwaysError) Read(p []byte) (int, error) {
+ return 0, io.ErrUnexpectedEOF
+}
+
+func TestNonEOFWithEmptyRead(t *testing.T) {
+ scanner := NewScanner(alwaysError{})
+ for scanner.Scan() {
+ t.Fatal("read should fail")
+ }
+ err := scanner.Err()
+ if err != io.ErrUnexpectedEOF {
+ t.Errorf("unexpected error: %v", err)
+ }
+}
+
+// Test that Scan finishes if we have endless empty reads.
+type endlessZeros struct{}
+
+func (endlessZeros) Read(p []byte) (int, error) {
+ return 0, nil
+}
+
+func TestBadReader(t *testing.T) {
+ scanner := NewScanner(endlessZeros{})
+ for scanner.Scan() {
+ t.Fatal("read should fail")
+ }
+ err := scanner.Err()
+ if err != io.ErrNoProgress {
+ t.Errorf("unexpected error: %v", err)
+ }
+}
diff --git a/src/pkg/builtin/builtin.go b/src/pkg/builtin/builtin.go
index d3c1a5c55..128a1b5f8 100644
--- a/src/pkg/builtin/builtin.go
+++ b/src/pkg/builtin/builtin.go
@@ -13,6 +13,12 @@ package builtin
// bool is the set of boolean values, true and false.
type bool bool
+// true and false are the two untyped boolean values.
+const (
+ true = 0 == 0 // Untyped bool.
+ false = 0 != 0 // Untyped bool.
+)
+
// uint8 is the set of all unsigned 8-bit integers.
// Range: 0 through 255.
type uint8 uint8
diff --git a/src/pkg/crypto/ecdsa/ecdsa.go b/src/pkg/crypto/ecdsa/ecdsa.go
index 512d20c63..255000229 100644
--- a/src/pkg/crypto/ecdsa/ecdsa.go
+++ b/src/pkg/crypto/ecdsa/ecdsa.go
@@ -49,7 +49,7 @@ func randFieldElement(c elliptic.Curve, rand io.Reader) (k *big.Int, err error)
return
}
-// GenerateKey generates a public&private key pair.
+// GenerateKey generates a public and private key pair.
func GenerateKey(c elliptic.Curve, rand io.Reader) (priv *PrivateKey, err error) {
k, err := randFieldElement(c, rand)
if err != nil {
diff --git a/src/pkg/crypto/rand/util.go b/src/pkg/crypto/rand/util.go
index 21608dbac..0cd5e0e02 100644
--- a/src/pkg/crypto/rand/util.go
+++ b/src/pkg/crypto/rand/util.go
@@ -100,8 +100,11 @@ func Prime(rand io.Reader, bits int) (p *big.Int, err error) {
}
}
-// Int returns a uniform random value in [0, max).
+// Int returns a uniform random value in [0, max). It panics if max <= 0.
func Int(rand io.Reader, max *big.Int) (n *big.Int, err error) {
+ if max.Sign() <= 0 {
+ panic("crypto/rand: argument to Int is <= 0")
+ }
k := (max.BitLen() + 7) / 8
// b is the number of bits in the most significant byte of max.
diff --git a/src/pkg/database/sql/driver/driver.go b/src/pkg/database/sql/driver/driver.go
index 2434e419b..d7ca94f78 100644
--- a/src/pkg/database/sql/driver/driver.go
+++ b/src/pkg/database/sql/driver/driver.go
@@ -10,8 +10,8 @@ package driver
import "errors"
-// A driver Value is a value that drivers must be able to handle.
-// A Value is either nil or an instance of one of these types:
+// Value is a value that drivers must be able to handle.
+// It is either nil or an instance of one of these types:
//
// int64
// float64
diff --git a/src/pkg/database/sql/fakedb_test.go b/src/pkg/database/sql/fakedb_test.go
index 24c255f6e..d900e2ceb 100644
--- a/src/pkg/database/sql/fakedb_test.go
+++ b/src/pkg/database/sql/fakedb_test.go
@@ -13,6 +13,7 @@ import (
"strconv"
"strings"
"sync"
+ "testing"
"time"
)
@@ -34,9 +35,10 @@ var _ = log.Printf
// When opening a fakeDriver's database, it starts empty with no
// tables. All tables and data are stored in memory only.
type fakeDriver struct {
- mu sync.Mutex
- openCount int
- dbs map[string]*fakeDB
+ mu sync.Mutex // guards 3 following fields
+ openCount int // conn opens
+ closeCount int // conn closes
+ dbs map[string]*fakeDB
}
type fakeDB struct {
@@ -240,14 +242,31 @@ func setHookpostCloseConn(fn func(*fakeConn, error)) {
hookPostCloseConn.fn = fn
}
+var testStrictClose *testing.T
+
+// setStrictFakeConnClose sets the t to Errorf on when fakeConn.Close
+// fails to close. If nil, the check is disabled.
+func setStrictFakeConnClose(t *testing.T) {
+ testStrictClose = t
+}
+
func (c *fakeConn) Close() (err error) {
+ drv := fdriver.(*fakeDriver)
defer func() {
+ if err != nil && testStrictClose != nil {
+ testStrictClose.Errorf("failed to close a test fakeConn: %v", err)
+ }
hookPostCloseConn.Lock()
fn := hookPostCloseConn.fn
hookPostCloseConn.Unlock()
if fn != nil {
fn(c, err)
}
+ if err == nil {
+ drv.mu.Lock()
+ drv.closeCount++
+ drv.mu.Unlock()
+ }
}()
if c.currTx != nil {
return errors.New("can't close fakeConn; in a Transaction")
@@ -443,6 +462,12 @@ func (s *fakeStmt) ColumnConverter(idx int) driver.ValueConverter {
}
func (s *fakeStmt) Close() error {
+ if s.c == nil {
+ panic("nil conn in fakeStmt.Close")
+ }
+ if s.c.db == nil {
+ panic("in fakeStmt.Close, conn's db is nil (already closed)")
+ }
if !s.closed {
s.c.incrStat(&s.c.stmtsClosed)
s.closed = true
@@ -534,6 +559,15 @@ func (s *fakeStmt) Query(args []driver.Value) (driver.Rows, error) {
if !ok {
return nil, fmt.Errorf("fakedb: table %q doesn't exist", s.table)
}
+
+ if s.table == "magicquery" {
+ if len(s.whereCol) == 2 && s.whereCol[0] == "op" && s.whereCol[1] == "millis" {
+ if args[0] == "sleep" {
+ time.Sleep(time.Duration(args[1].(int64)) * time.Millisecond)
+ }
+ }
+ }
+
t.mu.Lock()
defer t.mu.Unlock()
diff --git a/src/pkg/database/sql/sql.go b/src/pkg/database/sql/sql.go
index bd450c7ec..a80782bfe 100644
--- a/src/pkg/database/sql/sql.go
+++ b/src/pkg/database/sql/sql.go
@@ -207,13 +207,46 @@ type DB struct {
type driverConn struct {
db *DB
- sync.Mutex // guards following
- ci driver.Conn
- closed bool
+ sync.Mutex // guards following
+ ci driver.Conn
+ closed bool
+ finalClosed bool // ci.Close has been called
+ openStmt map[driver.Stmt]bool
// guarded by db.mu
- inUse bool
- onPut []func() // code (with db.mu held) run when conn is next returned
+ inUse bool
+ onPut []func() // code (with db.mu held) run when conn is next returned
+ dbmuClosed bool // same as closed, but guarded by db.mu, for connIfFree
+}
+
+func (dc *driverConn) removeOpenStmt(si driver.Stmt) {
+ dc.Lock()
+ defer dc.Unlock()
+ delete(dc.openStmt, si)
+}
+
+func (dc *driverConn) prepareLocked(query string) (driver.Stmt, error) {
+ si, err := dc.ci.Prepare(query)
+ if err == nil {
+ // Track each driverConn's open statements, so we can close them
+ // before closing the conn.
+ //
+ // TODO(bradfitz): let drivers opt out of caring about
+ // stmt closes if the conn is about to close anyway? For now
+ // do the safe thing, in case stmts need to be closed.
+ //
+ // TODO(bradfitz): after Go 1.1, closing driver.Stmts
+ // should be moved to driverStmt, using unique
+ // *driverStmts everywhere (including from
+ // *Stmt.connStmt, instead of returning a
+ // driver.Stmt), using driverStmt as a pointer
+ // everywhere, and making it a finalCloser.
+ if dc.openStmt == nil {
+ dc.openStmt = make(map[driver.Stmt]bool)
+ }
+ dc.openStmt[si] = true
+ }
+ return si, err
}
// the dc.db's Mutex is held.
@@ -236,13 +269,27 @@ func (dc *driverConn) Close() error {
}
dc.closed = true
dc.Unlock() // not defer; removeDep finalClose calls may need to lock
- return dc.db.removeDep(dc, dc)
+
+ // And now updates that require holding dc.mu.Lock.
+ dc.db.mu.Lock()
+ dc.dbmuClosed = true
+ fn := dc.db.removeDepLocked(dc, dc)
+ dc.db.mu.Unlock()
+ return fn()
}
func (dc *driverConn) finalClose() error {
dc.Lock()
+
+ for si := range dc.openStmt {
+ si.Close()
+ }
+ dc.openStmt = nil
+
err := dc.ci.Close()
dc.ci = nil
+ dc.finalClosed = true
+
dc.Unlock()
return err
}
@@ -264,7 +311,8 @@ func (ds *driverStmt) Close() error {
// depSet is a finalCloser's outstanding dependencies
type depSet map[interface{}]bool // set of true bools
-// The finalCloser interface is used by (*DB).addDep and (*DB).get
+// The finalCloser interface is used by (*DB).addDep and related
+// dependency reference counting.
type finalCloser interface {
// finalClose is called when the reference count of an object
// goes to zero. (*DB).mu is not held while calling it.
@@ -448,16 +496,26 @@ func (db *DB) conn() (*driverConn, error) {
return dc, nil
}
-// connIfFree returns (wanted, true) if wanted is still a valid conn and
+var (
+ errConnClosed = errors.New("database/sql: internal sentinel error: conn is closed")
+ errConnBusy = errors.New("database/sql: internal sentinel error: conn is busy")
+)
+
+// connIfFree returns (wanted, nil) if wanted is still a valid conn and
// isn't in use.
//
-// If wanted is valid but in use, connIfFree returns (wanted, false).
-// If wanted is invalid, connIfFre returns (nil, false).
-func (db *DB) connIfFree(wanted *driverConn) (conn *driverConn, ok bool) {
+// The error is errConnClosed if the connection if the requested connection
+// is invalid because it's been closed.
+//
+// The error is errConnBusy if the connection is in use.
+func (db *DB) connIfFree(wanted *driverConn) (*driverConn, error) {
db.mu.Lock()
defer db.mu.Unlock()
if wanted.inUse {
- return conn, false
+ return nil, errConnBusy
+ }
+ if wanted.dbmuClosed {
+ return nil, errConnClosed
}
for i, conn := range db.freeConn {
if conn != wanted {
@@ -466,9 +524,14 @@ func (db *DB) connIfFree(wanted *driverConn) (conn *driverConn, ok bool) {
db.freeConn[i] = db.freeConn[len(db.freeConn)-1]
db.freeConn = db.freeConn[:len(db.freeConn)-1]
wanted.inUse = true
- return wanted, true
+ return wanted, nil
}
- return nil, false
+ // TODO(bradfitz): shouldn't get here. After Go 1.1, change this to:
+ // panic("connIfFree call requested a non-closed, non-busy, non-free conn")
+ // Which passes all the tests, but I'm too paranoid to include this
+ // late in Go 1.1.
+ // Instead, treat it like a busy connection:
+ return nil, errConnBusy
}
// putConnHook is a hook for testing.
@@ -485,7 +548,11 @@ func (db *DB) noteUnusedDriverStatement(c *driverConn, si driver.Stmt) {
si.Close()
})
} else {
- si.Close()
+ c.Lock()
+ defer c.Unlock()
+ if !c.finalClosed {
+ si.Close()
+ }
}
}
@@ -526,8 +593,6 @@ func (db *DB) putConn(dc *driverConn, err error) {
db.mu.Unlock()
return
}
- // TODO: check to see if we need this Conn for any prepared
- // statements which are still active?
db.mu.Unlock()
dc.Close()
@@ -560,7 +625,7 @@ func (db *DB) prepare(query string) (*Stmt, error) {
return nil, err
}
dc.Lock()
- si, err := dc.ci.Prepare(query)
+ si, err := dc.prepareLocked(query)
dc.Unlock()
if err != nil {
db.putConn(dc, err)
@@ -572,7 +637,6 @@ func (db *DB) prepare(query string) (*Stmt, error) {
css: []connStmt{{dc, si}},
}
db.addDep(stmt, stmt)
- db.addDep(dc, stmt)
db.putConn(dc, nil)
return stmt, nil
}
@@ -623,7 +687,6 @@ func (db *DB) exec(query string, args []interface{}) (res Result, err error) {
return nil, err
}
defer withLock(dc, func() { si.Close() })
-
return resultFromStatement(driverStmt{dc, si}, args...)
}
@@ -672,7 +735,6 @@ func (db *DB) queryConn(dc *driverConn, releaseConn func(error), query string, a
// Note: ownership of dc passes to the *Rows, to be freed
// with releaseConn.
rows := &Rows{
- db: db,
dc: dc,
releaseConn: releaseConn,
rowsi: rowsi,
@@ -702,7 +764,6 @@ func (db *DB) queryConn(dc *driverConn, releaseConn func(error), query string, a
// Note: ownership of ci passes to the *Rows, to be freed
// with releaseConn.
rows := &Rows{
- db: db,
dc: dc,
releaseConn: releaseConn,
rowsi: rowsi,
@@ -1049,13 +1110,21 @@ func (s *Stmt) connStmt() (ci *driverConn, releaseConn func(error), si driver.St
var cs connStmt
match := false
- for _, v := range s.css {
- // TODO(bradfitz): lazily clean up entries in this
- // list with dead conns while enumerating
- if _, match = s.db.connIfFree(v.dc); match {
+ for i := 0; i < len(s.css); i++ {
+ v := s.css[i]
+ _, err := s.db.connIfFree(v.dc)
+ if err == nil {
+ match = true
cs = v
break
}
+ if err == errConnClosed {
+ // Lazily remove dead conn from our freelist.
+ s.css[i] = s.css[len(s.css)-1]
+ s.css = s.css[:len(s.css)-1]
+ i--
+ }
+
}
s.mu.Unlock()
@@ -1068,7 +1137,7 @@ func (s *Stmt) connStmt() (ci *driverConn, releaseConn func(error), si driver.St
return nil, nil, nil, err
}
dc.Lock()
- si, err := dc.ci.Prepare(s.query)
+ si, err := dc.prepareLocked(s.query)
dc.Unlock()
if err == driver.ErrBadConn && i < 10 {
continue
@@ -1076,7 +1145,6 @@ func (s *Stmt) connStmt() (ci *driverConn, releaseConn func(error), si driver.St
if err != nil {
return nil, nil, nil, err
}
- s.db.addDep(dc, s)
s.mu.Lock()
cs = connStmt{dc, si}
s.css = append(s.css, cs)
@@ -1111,7 +1179,6 @@ func (s *Stmt) Query(args ...interface{}) (*Rows, error) {
// Note: ownership of ci passes to the *Rows, to be freed
// with releaseConn.
rows := &Rows{
- db: s.db,
dc: dc,
rowsi: rowsi,
// releaseConn set below
@@ -1195,6 +1262,7 @@ func (s *Stmt) Close() error {
func (s *Stmt) finalClose() error {
for _, v := range s.css {
s.db.noteUnusedDriverStatement(v.dc, v.si)
+ v.dc.removeOpenStmt(v.si)
s.db.removeDep(v.dc, s)
}
s.css = nil
@@ -1215,7 +1283,6 @@ func (s *Stmt) finalClose() error {
// err = rows.Err() // get any error encountered during iteration
// ...
type Rows struct {
- db *DB
dc *driverConn // owned; must call releaseConn when closed to release
releaseConn func(error)
rowsi driver.Rows
@@ -1311,10 +1378,10 @@ func (rs *Rows) Close() error {
}
rs.closed = true
err := rs.rowsi.Close()
- rs.releaseConn(err)
if rs.closeStmt != nil {
rs.closeStmt.Close()
}
+ rs.releaseConn(err)
return err
}
@@ -1389,7 +1456,7 @@ func (dr driverResult) RowsAffected() (int64, error) {
}
func stack() string {
- var buf [1024]byte
+ var buf [2 << 10]byte
return string(buf[:runtime.Stack(buf[:], false)])
}
diff --git a/src/pkg/database/sql/sql_test.go b/src/pkg/database/sql/sql_test.go
index 6b9178378..e6cc667fa 100644
--- a/src/pkg/database/sql/sql_test.go
+++ b/src/pkg/database/sql/sql_test.go
@@ -43,6 +43,7 @@ type testOrBench interface {
Errorf(string, ...interface{})
Fatal(...interface{})
Error(...interface{})
+ Logf(string, ...interface{})
}
func newTestDB(t testOrBench, name string) *DB {
@@ -59,6 +60,11 @@ func newTestDB(t testOrBench, name string) *DB {
exec(t, db, "INSERT|people|name=Bob,age=?,photo=BPHOTO", 2)
exec(t, db, "INSERT|people|name=Chris,age=?,photo=CPHOTO,bdate=?", 3, chrisBirthday)
}
+ if name == "magicquery" {
+ // Magic table name and column, known by fakedb_test.go.
+ exec(t, db, "CREATE|magicquery|op=string,millis=int32")
+ exec(t, db, "INSERT|magicquery|op=sleep,millis=10")
+ }
return db
}
@@ -80,6 +86,16 @@ func closeDB(t testOrBench, db *DB) {
t.Errorf("Error closing fakeConn: %v", err)
}
})
+ for i, dc := range db.freeConn {
+ if n := len(dc.openStmt); n > 0 {
+ // Just a sanity check. This is legal in
+ // general, but if we make the tests clean up
+ // their statements first, then we can safely
+ // verify this is always zero here, and any
+ // other value is a leak.
+ t.Errorf("while closing db, freeConn %d/%d had %d open stmts; want 0", i, len(db.freeConn), n)
+ }
+ }
err := db.Close()
if err != nil {
t.Fatalf("error closing DB: %v", err)
@@ -95,6 +111,51 @@ func numPrepares(t *testing.T, db *DB) int {
return db.freeConn[0].ci.(*fakeConn).numPrepare
}
+func (db *DB) numDeps() int {
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ return len(db.dep)
+}
+
+// Dependencies are closed via a goroutine, so this polls waiting for
+// numDeps to fall to want, waiting up to d.
+func (db *DB) numDepsPollUntil(want int, d time.Duration) int {
+ deadline := time.Now().Add(d)
+ for {
+ n := db.numDeps()
+ if n <= want || time.Now().After(deadline) {
+ return n
+ }
+ time.Sleep(50 * time.Millisecond)
+ }
+}
+
+func (db *DB) numFreeConns() int {
+ db.mu.Lock()
+ defer db.mu.Unlock()
+ return len(db.freeConn)
+}
+
+func (db *DB) dumpDeps(t *testing.T) {
+ for fc := range db.dep {
+ db.dumpDep(t, 0, fc, map[finalCloser]bool{})
+ }
+}
+
+func (db *DB) dumpDep(t *testing.T, depth int, dep finalCloser, seen map[finalCloser]bool) {
+ seen[dep] = true
+ indent := strings.Repeat(" ", depth)
+ ds := db.dep[dep]
+ for k := range ds {
+ t.Logf("%s%T (%p) waiting for -> %T (%p)", indent, dep, dep, k, k)
+ if fc, ok := k.(finalCloser); ok {
+ if !seen[fc] {
+ db.dumpDep(t, depth+1, fc, seen)
+ }
+ }
+ }
+}
+
func TestQuery(t *testing.T) {
db := newTestDB(t, "people")
defer closeDB(t, db)
@@ -131,7 +192,7 @@ func TestQuery(t *testing.T) {
// And verify that the final rows.Next() call, which hit EOF,
// also closed the rows connection.
- if n := len(db.freeConn); n != 1 {
+ if n := db.numFreeConns(); n != 1 {
t.Fatalf("free conns after query hitting EOF = %d; want 1", n)
}
if prepares := numPrepares(t, db) - prepares0; prepares != 1 {
@@ -806,8 +867,11 @@ func TestMaxIdleConns(t *testing.T) {
}
}
-// golang.org/issue/5046
-func TestCloseConnBeforeStmts(t *testing.T) {
+// golang.org/issue/5323
+func TestStmtCloseDeps(t *testing.T) {
+ if testing.Short() {
+ t.Skip("skipping in short mode")
+ }
defer setHookpostCloseConn(nil)
setHookpostCloseConn(func(_ *fakeConn, err error) {
if err != nil {
@@ -815,7 +879,112 @@ func TestCloseConnBeforeStmts(t *testing.T) {
}
})
+ db := newTestDB(t, "magicquery")
+ defer closeDB(t, db)
+
+ driver := db.driver.(*fakeDriver)
+
+ driver.mu.Lock()
+ opens0 := driver.openCount
+ closes0 := driver.closeCount
+ driver.mu.Unlock()
+ openDelta0 := opens0 - closes0
+
+ stmt, err := db.Prepare("SELECT|magicquery|op|op=?,millis=?")
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ // Start 50 parallel slow queries.
+ const (
+ nquery = 50
+ sleepMillis = 25
+ nbatch = 2
+ )
+ var wg sync.WaitGroup
+ for batch := 0; batch < nbatch; batch++ {
+ for i := 0; i < nquery; i++ {
+ wg.Add(1)
+ go func() {
+ defer wg.Done()
+ var op string
+ if err := stmt.QueryRow("sleep", sleepMillis).Scan(&op); err != nil && err != ErrNoRows {
+ t.Error(err)
+ }
+ }()
+ }
+ // Sleep for twice the expected length of time for the
+ // batch of 50 queries above to finish before starting
+ // the next round.
+ time.Sleep(2 * sleepMillis * time.Millisecond)
+ }
+ wg.Wait()
+
+ if g, w := db.numFreeConns(), 2; g != w {
+ t.Errorf("free conns = %d; want %d", g, w)
+ }
+
+ if n := db.numDepsPollUntil(4, time.Second); n > 4 {
+ t.Errorf("number of dependencies = %d; expected <= 4", n)
+ db.dumpDeps(t)
+ }
+
+ driver.mu.Lock()
+ opens := driver.openCount - opens0
+ closes := driver.closeCount - closes0
+ driver.mu.Unlock()
+ openDelta := (driver.openCount - driver.closeCount) - openDelta0
+
+ if openDelta > 2 {
+ t.Logf("open calls = %d", opens)
+ t.Logf("close calls = %d", closes)
+ t.Logf("open delta = %d", openDelta)
+ t.Errorf("db connections opened = %d; want <= 2", openDelta)
+ db.dumpDeps(t)
+ }
+
+ if len(stmt.css) > nquery {
+ t.Errorf("len(stmt.css) = %d; want <= %d", len(stmt.css), nquery)
+ }
+
+ if err := stmt.Close(); err != nil {
+ t.Fatal(err)
+ }
+
+ if g, w := db.numFreeConns(), 2; g != w {
+ t.Errorf("free conns = %d; want %d", g, w)
+ }
+
+ if n := db.numDepsPollUntil(2, time.Second); n > 2 {
+ t.Errorf("number of dependencies = %d; expected <= 2", n)
+ db.dumpDeps(t)
+ }
+
+ db.SetMaxIdleConns(0)
+
+ if g, w := db.numFreeConns(), 0; g != w {
+ t.Errorf("free conns = %d; want %d", g, w)
+ }
+
+ if n := db.numDepsPollUntil(0, time.Second); n > 0 {
+ t.Errorf("number of dependencies = %d; expected 0", n)
+ db.dumpDeps(t)
+ }
+}
+
+// golang.org/issue/5046
+func TestCloseConnBeforeStmts(t *testing.T) {
db := newTestDB(t, "people")
+ defer closeDB(t, db)
+
+ defer setHookpostCloseConn(nil)
+ setHookpostCloseConn(func(_ *fakeConn, err error) {
+ if err != nil {
+ t.Errorf("Error closing fakeConn: %v; from %s", err, stack())
+ db.dumpDeps(t)
+ t.Errorf("DB = %#v", db)
+ }
+ })
stmt, err := db.Prepare("SELECT|people|name|")
if err != nil {
@@ -830,6 +999,9 @@ func TestCloseConnBeforeStmts(t *testing.T) {
t.Errorf("conn shouldn't be closed")
}
+ if n := len(dc.openStmt); n != 1 {
+ t.Errorf("driverConn num openStmt = %d; want 1", n)
+ }
err = db.Close()
if err != nil {
t.Errorf("db Close = %v", err)
@@ -837,8 +1009,8 @@ func TestCloseConnBeforeStmts(t *testing.T) {
if !dc.closed {
t.Errorf("after db.Close, driverConn should be closed")
}
- if dc.ci == nil {
- t.Errorf("after db.Close, driverConn should still have its Conn interface")
+ if n := len(dc.openStmt); n != 0 {
+ t.Errorf("driverConn num openStmt = %d; want 0", n)
}
err = stmt.Close()
@@ -854,6 +1026,26 @@ func TestCloseConnBeforeStmts(t *testing.T) {
}
}
+// golang.org/issue/5283: don't release the Rows' connection in Close
+// before calling Stmt.Close.
+func TestRowsCloseOrder(t *testing.T) {
+ db := newTestDB(t, "people")
+ defer closeDB(t, db)
+
+ db.SetMaxIdleConns(0)
+ setStrictFakeConnClose(t)
+ defer setStrictFakeConnClose(nil)
+
+ rows, err := db.Query("SELECT|people|age,name|")
+ if err != nil {
+ t.Fatal(err)
+ }
+ err = rows.Close()
+ if err != nil {
+ t.Fatal(err)
+ }
+}
+
func manyConcurrentQueries(t testOrBench) {
maxProcs, numReqs := 16, 500
if testing.Short() {
@@ -868,6 +1060,7 @@ func manyConcurrentQueries(t testOrBench) {
if err != nil {
t.Fatal(err)
}
+ defer stmt.Close()
var wg sync.WaitGroup
wg.Add(numReqs)
diff --git a/src/pkg/encoding/json/decode_test.go b/src/pkg/encoding/json/decode_test.go
index 037c5b236..f845f69ab 100644
--- a/src/pkg/encoding/json/decode_test.go
+++ b/src/pkg/encoding/json/decode_test.go
@@ -30,7 +30,7 @@ type V struct {
F3 Number
}
-// ifaceNumAsFloat64/ifaceNumAsNumber are used to test unmarshalling with and
+// ifaceNumAsFloat64/ifaceNumAsNumber are used to test unmarshaling with and
// without UseNumber
var ifaceNumAsFloat64 = map[string]interface{}{
"k1": float64(1),
diff --git a/src/pkg/encoding/json/encode.go b/src/pkg/encoding/json/encode.go
index fb57f1d51..85727ba61 100644
--- a/src/pkg/encoding/json/encode.go
+++ b/src/pkg/encoding/json/encode.go
@@ -3,7 +3,8 @@
// license that can be found in the LICENSE file.
// Package json implements encoding and decoding of JSON objects as defined in
-// RFC 4627.
+// RFC 4627. The mapping between JSON objects and Go values is described
+// in the documentation for the Marshal and Unmarshal functions.
//
// See "JSON and Go" for an introduction to this package:
// http://golang.org/doc/articles/json_and_go.html
@@ -38,8 +39,8 @@ import (
//
// Floating point, integer, and Number values encode as JSON numbers.
//
-// String values encode as JSON strings, with each invalid UTF-8 sequence
-// replaced by the encoding of the Unicode replacement character U+FFFD.
+// String values encode as JSON strings. InvalidUTF8Error will be returned
+// if an invalid UTF-8 sequence is encountered.
// The angle brackets "<" and ">" are escaped to "\u003c" and "\u003e"
// to keep some browsers from misinterpreting JSON output as HTML.
//
@@ -86,9 +87,21 @@ import (
// underscores and slashes.
//
// Anonymous struct fields are usually marshaled as if their inner exported fields
-// were fields in the outer struct, subject to the usual Go visibility rules.
+// were fields in the outer struct, subject to the usual Go visibility rules amended
+// as described in the next paragraph.
// An anonymous struct field with a name given in its JSON tag is treated as
-// having that name instead of as anonymous.
+// having that name, rather than being anonymous.
+//
+// The Go visibility rules for struct fields are amended for JSON when
+// deciding which field to marshal or unmarshal. If there are
+// multiple fields at the same level, and that level is the least
+// nested (and would therefore be the nesting level selected by the
+// usual Go rules), the following extra rules apply:
+//
+// 1) Of those fields, if any are JSON-tagged, only tagged fields are considered,
+// even if there are multiple untagged fields that would otherwise conflict.
+// 2) If there is exactly one field (tagged or not according to the first rule), that is selected.
+// 3) Otherwise there are multiple fields, and all are ignored; no error occurs.
//
// Handling of anonymous struct fields is new in Go 1.1.
// Prior to Go 1.1, anonymous struct fields were ignored. To force ignoring of
@@ -187,8 +200,10 @@ func (e *UnsupportedValueError) Error() string {
return "json: unsupported value: " + e.Str
}
+// An InvalidUTF8Error is returned by Marshal when attempting
+// to encode a string value with invalid UTF-8 sequences.
type InvalidUTF8Error struct {
- S string
+ S string // the whole string value that caused the error
}
func (e *InvalidUTF8Error) Error() string {
@@ -654,27 +669,78 @@ func typeFields(t reflect.Type) []field {
sort.Sort(byName(fields))
- // Remove fields with annihilating name collisions
- // and also fields shadowed by fields with explicit JSON tags.
- name := ""
+ // Delete all fields that are hidden by the Go rules for embedded fields,
+ // except that fields with JSON tags are promoted.
+
+ // The fields are sorted in primary order of name, secondary order
+ // of field index length. Loop over names; for each name, delete
+ // hidden fields by choosing the one dominant field that survives.
out := fields[:0]
- for _, f := range fields {
- if f.name != name {
- name = f.name
- out = append(out, f)
+ for advance, i := 0, 0; i < len(fields); i += advance {
+ // One iteration per name.
+ // Find the sequence of fields with the name of this first field.
+ fi := fields[i]
+ name := fi.name
+ for advance = 1; i+advance < len(fields); advance++ {
+ fj := fields[i+advance]
+ if fj.name != name {
+ break
+ }
+ }
+ if advance == 1 { // Only one field with this name
+ out = append(out, fi)
continue
}
- if n := len(out); n > 0 && out[n-1].name == name && (!out[n-1].tag || f.tag) {
- out = out[:n-1]
+ dominant, ok := dominantField(fields[i : i+advance])
+ if ok {
+ out = append(out, dominant)
}
}
- fields = out
+ fields = out
sort.Sort(byIndex(fields))
return fields
}
+// dominantField looks through the fields, all of which are known to
+// have the same name, to find the single field that dominates the
+// others using Go's embedding rules, modified by the presence of
+// JSON tags. If there are multiple top-level fields, the boolean
+// will be false: This condition is an error in Go and we skip all
+// the fields.
+func dominantField(fields []field) (field, bool) {
+ // The fields are sorted in increasing index-length order. The winner
+ // must therefore be one with the shortest index length. Drop all
+ // longer entries, which is easy: just truncate the slice.
+ length := len(fields[0].index)
+ tagged := -1 // Index of first tagged field.
+ for i, f := range fields {
+ if len(f.index) > length {
+ fields = fields[:i]
+ break
+ }
+ if f.tag {
+ if tagged >= 0 {
+ // Multiple tagged fields at the same level: conflict.
+ // Return no field.
+ return field{}, false
+ }
+ tagged = i
+ }
+ }
+ if tagged >= 0 {
+ return fields[tagged], true
+ }
+ // All remaining fields have the same length. If there's more than one,
+ // we have a conflict (two fields named "X" at the same level) and we
+ // return no field.
+ if len(fields) > 1 {
+ return field{}, false
+ }
+ return fields[0], true
+}
+
var fieldCache struct {
sync.RWMutex
m map[reflect.Type][]field
diff --git a/src/pkg/encoding/json/encode_test.go b/src/pkg/encoding/json/encode_test.go
index be74c997c..5be0a992e 100644
--- a/src/pkg/encoding/json/encode_test.go
+++ b/src/pkg/encoding/json/encode_test.go
@@ -206,3 +206,107 @@ func TestAnonymousNonstruct(t *testing.T) {
t.Errorf("got %q, want %q", got, want)
}
}
+
+type BugA struct {
+ S string
+}
+
+type BugB struct {
+ BugA
+ S string
+}
+
+type BugC struct {
+ S string
+}
+
+// Legal Go: We never use the repeated embedded field (S).
+type BugX struct {
+ A int
+ BugA
+ BugB
+}
+
+// Issue 5245.
+func TestEmbeddedBug(t *testing.T) {
+ v := BugB{
+ BugA{"A"},
+ "B",
+ }
+ b, err := Marshal(v)
+ if err != nil {
+ t.Fatal("Marshal:", err)
+ }
+ want := `{"S":"B"}`
+ got := string(b)
+ if got != want {
+ t.Fatalf("Marshal: got %s want %s", got, want)
+ }
+ // Now check that the duplicate field, S, does not appear.
+ x := BugX{
+ A: 23,
+ }
+ b, err = Marshal(x)
+ if err != nil {
+ t.Fatal("Marshal:", err)
+ }
+ want = `{"A":23}`
+ got = string(b)
+ if got != want {
+ t.Fatalf("Marshal: got %s want %s", got, want)
+ }
+}
+
+type BugD struct { // Same as BugA after tagging.
+ XXX string `json:"S"`
+}
+
+// BugD's tagged S field should dominate BugA's.
+type BugY struct {
+ BugA
+ BugD
+}
+
+// Test that a field with a tag dominates untagged fields.
+func TestTaggedFieldDominates(t *testing.T) {
+ v := BugY{
+ BugA{"BugA"},
+ BugD{"BugD"},
+ }
+ b, err := Marshal(v)
+ if err != nil {
+ t.Fatal("Marshal:", err)
+ }
+ want := `{"S":"BugD"}`
+ got := string(b)
+ if got != want {
+ t.Fatalf("Marshal: got %s want %s", got, want)
+ }
+}
+
+// There are no tags here, so S should not appear.
+type BugZ struct {
+ BugA
+ BugC
+ BugY // Contains a tagged S field through BugD; should not dominate.
+}
+
+func TestDuplicatedFieldDisappears(t *testing.T) {
+ v := BugZ{
+ BugA{"BugA"},
+ BugC{"BugC"},
+ BugY{
+ BugA{"nested BugA"},
+ BugD{"nested BugD"},
+ },
+ }
+ b, err := Marshal(v)
+ if err != nil {
+ t.Fatal("Marshal:", err)
+ }
+ want := `{}`
+ got := string(b)
+ if got != want {
+ t.Fatalf("Marshal: got %s want %s", got, want)
+ }
+}
diff --git a/src/pkg/fmt/doc.go b/src/pkg/fmt/doc.go
index 3cd02d7ed..b8dd995c7 100644
--- a/src/pkg/fmt/doc.go
+++ b/src/pkg/fmt/doc.go
@@ -138,6 +138,16 @@
by a single character (the verb) and end with a parenthesized
description.
+ If an Error or String method triggers a panic when called by a
+ print routine, the fmt package reformats the error message
+ from the panic, decorating it with an indication that it came
+ through the fmt package. For example, if a String method
+ calls panic("bad"), the resulting formatted message will look
+ like
+ %s(PANIC=bad)
+
+ The %s just shows the print verb in use when the failure
+ occurred.
Scanning
diff --git a/src/pkg/fmt/fmt_test.go b/src/pkg/fmt/fmt_test.go
index 552f76931..20b723a99 100644
--- a/src/pkg/fmt/fmt_test.go
+++ b/src/pkg/fmt/fmt_test.go
@@ -497,6 +497,9 @@ var fmttests = []struct {
// causing +2+0i and +3+0i instead of 2+0i and 3+0i.
{"%v", []complex64{1, 2, 3}, "[(1+0i) (2+0i) (3+0i)]"},
{"%v", []complex128{1, 2, 3}, "[(1+0i) (2+0i) (3+0i)]"},
+
+ // Incomplete format specification caused crash.
+ {"%.", 3, "%!.(int=3)"},
}
func TestSprintf(t *testing.T) {
diff --git a/src/pkg/fmt/print.go b/src/pkg/fmt/print.go
index 7d7aa93b2..5f37fd120 100644
--- a/src/pkg/fmt/print.go
+++ b/src/pkg/fmt/print.go
@@ -47,7 +47,7 @@ type State interface {
}
// Formatter is the interface implemented by values with a custom formatter.
-// The implementation of Format may call Sprintf or Fprintf(f) etc.
+// The implementation of Format may call Sprint(f) or Fprint(f) etc.
// to generate its output.
type Formatter interface {
Format(f State, c rune)
@@ -56,7 +56,8 @@ type Formatter interface {
// Stringer is implemented by any value that has a String method,
// which defines the ``native'' format for that value.
// The String method is used to print values passed as an operand
-// to a %s or %v format or to an unformatted printer such as Print.
+// to any format that accepts a string or to an unformatted printer
+// such as Print.
type Stringer interface {
String() string
}
@@ -1071,7 +1072,7 @@ func (p *pp) doPrintf(format string, a []interface{}) {
p.fmt.wid, p.fmt.widPresent, i = parsenum(format, i, end)
}
// do we have precision?
- if i < end && format[i] == '.' {
+ if i+1 < end && format[i] == '.' {
if format[i+1] == '*' {
p.fmt.prec, p.fmt.precPresent, i, fieldnum = intFromArg(a, end, i+1, fieldnum)
if !p.fmt.precPresent {
diff --git a/src/pkg/go/ast/filter.go b/src/pkg/go/ast/filter.go
index 4db5814cb..71c9ed776 100644
--- a/src/pkg/go/ast/filter.go
+++ b/src/pkg/go/ast/filter.go
@@ -284,6 +284,27 @@ const (
FilterImportDuplicates
)
+// nameOf returns the function (foo) or method name (foo.bar) for
+// the given function declaration. If the AST is incorrect for the
+// receiver, it assumes a function instead.
+//
+func nameOf(f *FuncDecl) string {
+ if r := f.Recv; r != nil && len(r.List) == 1 {
+ // looks like a correct receiver declaration
+ t := r.List[0].Type
+ // dereference pointer receiver types
+ if p, _ := t.(*StarExpr); p != nil {
+ t = p.X
+ }
+ // the receiver type must be a type name
+ if p, _ := t.(*Ident); p != nil {
+ return p.Name + "." + f.Name.Name
+ }
+ // otherwise assume a function instead
+ }
+ return f.Name.Name
+}
+
// separator is an empty //-style comment that is interspersed between
// different comment groups when they are concatenated into a single group
//
@@ -348,7 +369,7 @@ func MergePackageFiles(pkg *Package, mode MergeMode) *File {
var decls []Decl
if ndecls > 0 {
decls = make([]Decl, ndecls)
- funcs := make(map[string]int) // map of global function name -> decls index
+ funcs := make(map[string]int) // map of func name -> decls index
i := 0 // current index
n := 0 // number of filtered entries
for _, filename := range filenames {
@@ -365,7 +386,7 @@ func MergePackageFiles(pkg *Package, mode MergeMode) *File {
// entities (const, type, vars) if
// multiple declarations are common.
if f, isFun := d.(*FuncDecl); isFun {
- name := f.Name.Name
+ name := nameOf(f)
if j, exists := funcs[name]; exists {
// function declared already
if decls[j] != nil && decls[j].(*FuncDecl).Doc == nil {
diff --git a/src/pkg/go/ast/filter_test.go b/src/pkg/go/ast/filter_test.go
new file mode 100644
index 000000000..9fd86cb46
--- /dev/null
+++ b/src/pkg/go/ast/filter_test.go
@@ -0,0 +1,86 @@
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// To avoid a cyclic dependency with go/parser, this file is in a separate package.
+
+package ast_test
+
+import (
+ "bytes"
+ "go/ast"
+ "go/format"
+ "go/parser"
+ "go/token"
+ "testing"
+)
+
+const input = `package p
+
+type t1 struct{}
+type t2 struct{}
+
+func f1() {}
+func f1() {}
+func f2() {}
+
+func (*t1) f1() {}
+func (t1) f1() {}
+func (t1) f2() {}
+
+func (t2) f1() {}
+func (t2) f2() {}
+func (x *t2) f2() {}
+`
+
+// Calling ast.MergePackageFiles with ast.FilterFuncDuplicates
+// keeps a duplicate entry with attached documentation in favor
+// of one without, and it favors duplicate entries appearing
+// later in the source over ones appearing earlier. This is why
+// (*t2).f2 is kept and t2.f2 is eliminated in this test case.
+//
+const golden = `package p
+
+type t1 struct{}
+type t2 struct{}
+
+func f1() {}
+func f2() {}
+
+func (t1) f1() {}
+func (t1) f2() {}
+
+func (t2) f1() {}
+
+func (x *t2) f2() {}
+`
+
+func TestFilterDuplicates(t *testing.T) {
+ // parse input
+ fset := token.NewFileSet()
+ file, err := parser.ParseFile(fset, "", input, 0)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ // create package
+ files := map[string]*ast.File{"": file}
+ pkg, err := ast.NewPackage(fset, files, nil, nil)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ // filter
+ merged := ast.MergePackageFiles(pkg, ast.FilterFuncDuplicates)
+
+ // pretty-print
+ var buf bytes.Buffer
+ if err := format.Node(&buf, fset, merged); err != nil {
+ t.Fatal(err)
+ }
+ output := buf.String()
+
+ if output != golden {
+ t.Errorf("incorrect output:\n%s", output)
+ }
+}
diff --git a/src/pkg/go/ast/print.go b/src/pkg/go/ast/print.go
index 4a1ce480f..f15dc11dc 100644
--- a/src/pkg/go/ast/print.go
+++ b/src/pkg/go/ast/print.go
@@ -34,7 +34,7 @@ func NotNilFilter(_ string, v reflect.Value) bool {
//
// A non-nil FieldFilter f may be provided to control the output:
// struct fields for which f(fieldname, fieldvalue) is true are
-// are printed; all others are filtered from the output. Unexported
+// printed; all others are filtered from the output. Unexported
// struct fields are never printed.
//
func Fprint(w io.Writer, fset *token.FileSet, x interface{}, f FieldFilter) (err error) {
diff --git a/src/pkg/go/build/deps_test.go b/src/pkg/go/build/deps_test.go
index 9a715ba60..71b1bcf06 100644
--- a/src/pkg/go/build/deps_test.go
+++ b/src/pkg/go/build/deps_test.go
@@ -47,7 +47,7 @@ var pkgDeps = map[string][]string{
"math": {"unsafe"},
"math/cmplx": {"math"},
"math/rand": {"L0", "math"},
- "sort": {"math"},
+ "sort": {},
"strconv": {"L0", "unicode/utf8", "math"},
"unicode/utf16": {},
"unicode/utf8": {},
diff --git a/src/pkg/go/build/doc.go b/src/pkg/go/build/doc.go
index c562d05d0..b5fc071d6 100644
--- a/src/pkg/go/build/doc.go
+++ b/src/pkg/go/build/doc.go
@@ -91,14 +91,22 @@
//
// - the target operating system, as spelled by runtime.GOOS
// - the target architecture, as spelled by runtime.GOARCH
-// - the compiler being used, currently either "gc" or "gccgo"
+// - the compiler being used, either "gc" or "gccgo"
// - "cgo", if ctxt.CgoEnabled is true
+// - "go1.1", from Go version 1.1 onward
// - any additional words listed in ctxt.BuildTags
//
// If a file's name, after stripping the extension and a possible _test suffix,
-// matches *_GOOS, *_GOARCH, or *_GOOS_GOARCH for any known operating
-// system and architecture values, then the file is considered to have an implicit
-// build constraint requiring those terms.
+// matches any of the following patterns:
+// *_GOOS
+// *_GOARCH
+// *_GOOS_GOARCH
+// (example: source_windows_amd64.go) or the literals:
+// GOOS
+// GOARCH
+// (example: windows.go) where GOOS and GOARCH represent any known operating
+// system and architecture values respectively, then the file is considered to
+// have an implicit build constraint requiring those terms.
//
// To keep a file from being considered for the build:
//
diff --git a/src/pkg/go/doc/example.go b/src/pkg/go/doc/example.go
index 693ad5b94..2761083c7 100644
--- a/src/pkg/go/doc/example.go
+++ b/src/pkg/go/doc/example.go
@@ -166,6 +166,13 @@ func playExample(file *ast.File, body *ast.BlockStmt) *ast.File {
ast.Inspect(e.X, inspectFunc)
return false
}
+ // For key value expressions, only inspect the value
+ // as the key should be resolved by the type of the
+ // composite literal.
+ if e, ok := n.(*ast.KeyValueExpr); ok {
+ ast.Inspect(e.Value, inspectFunc)
+ return false
+ }
if id, ok := n.(*ast.Ident); ok {
if id.Obj == nil {
unresolved[id.Name] = true
diff --git a/src/pkg/go/doc/example_test.go b/src/pkg/go/doc/example_test.go
index b70efd93d..e0477e3f6 100644
--- a/src/pkg/go/doc/example_test.go
+++ b/src/pkg/go/doc/example_test.go
@@ -18,6 +18,7 @@ const exampleTestFile = `
package foo_test
import (
+ "flag"
"fmt"
"log"
"os/exec"
@@ -35,6 +36,38 @@ func ExampleImport() {
}
fmt.Printf("The date is %s\n", out)
}
+
+func ExampleKeyValue() {
+ v := struct {
+ a string
+ b int
+ }{
+ a: "A",
+ b: 1,
+ }
+ fmt.Print(v)
+ // Output: a: "A", b: 1
+}
+
+func ExampleKeyValueImport() {
+ f := flag.Flag{
+ Name: "play",
+ }
+ fmt.Print(f)
+ // Output: Name: "play"
+}
+
+var keyValueTopDecl = struct {
+ a string
+ b int
+}{
+ a: "B",
+ b: 2,
+}
+
+func ExampleKeyValueTopDecl() {
+ fmt.Print(keyValueTopDecl)
+}
`
var exampleTestCases = []struct {
@@ -49,6 +82,20 @@ var exampleTestCases = []struct {
Name: "Import",
Play: exampleImportPlay,
},
+ {
+ Name: "KeyValue",
+ Play: exampleKeyValuePlay,
+ Output: "a: \"A\", b: 1\n",
+ },
+ {
+ Name: "KeyValueImport",
+ Play: exampleKeyValueImportPlay,
+ Output: "Name: \"play\"\n",
+ },
+ {
+ Name: "KeyValueTopDecl",
+ Play: "<nil>",
+ },
}
const exampleHelloPlay = `package main
@@ -78,6 +125,39 @@ func main() {
}
`
+const exampleKeyValuePlay = `package main
+
+import (
+ "fmt"
+)
+
+func main() {
+ v := struct {
+ a string
+ b int
+ }{
+ a: "A",
+ b: 1,
+ }
+ fmt.Print(v)
+}
+`
+
+const exampleKeyValueImportPlay = `package main
+
+import (
+ "flag"
+ "fmt"
+)
+
+func main() {
+ f := flag.Flag{
+ Name: "play",
+ }
+ fmt.Print(f)
+}
+`
+
func TestExamples(t *testing.T) {
fs := token.NewFileSet()
file, err := parser.ParseFile(fs, "test.go", strings.NewReader(exampleTestFile), parser.ParseComments)
diff --git a/src/pkg/go/scanner/scanner.go b/src/pkg/go/scanner/scanner.go
index 3322c58b3..1e259d5ed 100644
--- a/src/pkg/go/scanner/scanner.go
+++ b/src/pkg/go/scanner/scanner.go
@@ -48,6 +48,8 @@ type Scanner struct {
ErrorCount int // number of errors encountered
}
+const bom = 0xFEFF // byte order mark, only permitted as very first character
+
// Read the next Unicode char into s.ch.
// s.ch < 0 means end-of-file.
//
@@ -67,6 +69,8 @@ func (s *Scanner) next() {
r, w = utf8.DecodeRune(s.src[s.rdOffset:])
if r == utf8.RuneError && w == 1 {
s.error(s.offset, "illegal UTF-8 encoding")
+ } else if r == bom && s.offset > 0 {
+ s.error(s.offset, "illegal byte order mark")
}
}
s.rdOffset += w
@@ -125,8 +129,8 @@ func (s *Scanner) Init(file *token.File, src []byte, err ErrorHandler, mode Mode
s.ErrorCount = 0
s.next()
- if s.ch == '\uFEFF' {
- s.next() // ignore BOM
+ if s.ch == bom {
+ s.next() // ignore BOM at file beginning
}
}
@@ -713,7 +717,10 @@ scanAgain:
case '|':
tok = s.switch3(token.OR, token.OR_ASSIGN, '|', token.LOR)
default:
- s.error(s.file.Offset(pos), fmt.Sprintf("illegal character %#U", ch))
+ // next reports unexpected BOMs - don't repeat
+ if ch != bom {
+ s.error(s.file.Offset(pos), fmt.Sprintf("illegal character %#U", ch))
+ }
insertSemi = s.insertSemi // preserve insertSemi info
tok = token.ILLEGAL
lit = string(ch)
diff --git a/src/pkg/go/scanner/scanner_test.go b/src/pkg/go/scanner/scanner_test.go
index 1c19053e6..8c64c2b95 100644
--- a/src/pkg/go/scanner/scanner_test.go
+++ b/src/pkg/go/scanner/scanner_test.go
@@ -695,7 +695,10 @@ var errors = []struct {
{"0X", token.INT, 0, "illegal hexadecimal number"},
{"\"abc\x00def\"", token.STRING, 4, "illegal character NUL"},
{"\"abc\x80def\"", token.STRING, 4, "illegal UTF-8 encoding"},
- {"\ufeff\ufeff", token.ILLEGAL, 3, "illegal character U+FEFF"}, // only first BOM is ignored
+ {"\ufeff\ufeff", token.ILLEGAL, 3, "illegal byte order mark"}, // only first BOM is ignored
+ {"//\ufeff", token.COMMENT, 2, "illegal byte order mark"}, // only first BOM is ignored
+ {"'\ufeff" + `'`, token.CHAR, 1, "illegal byte order mark"}, // only first BOM is ignored
+ {`"` + "abc\ufeffdef" + `"`, token.STRING, 4, "illegal byte order mark"}, // only first BOM is ignored
}
func TestScanErrors(t *testing.T) {
diff --git a/src/pkg/go/token/token.go b/src/pkg/go/token/token.go
index 84b6314d5..865f63f4a 100644
--- a/src/pkg/go/token/token.go
+++ b/src/pkg/go/token/token.go
@@ -243,8 +243,8 @@ func (tok Token) String() string {
// A set of constants for precedence-based expression parsing.
// Non-operators have lowest precedence, followed by operators
// starting with precedence 1 up to unary operators. The highest
-// precedence corresponds serves as "catch-all" precedence for
-// selector, indexing, and other operator and delimiter tokens.
+// precedence serves as "catch-all" precedence for selector,
+// indexing, and other operator and delimiter tokens.
//
const (
LowestPrec = 0 // non-operators
diff --git a/src/pkg/image/png/writer.go b/src/pkg/image/png/writer.go
index 093d47193..629452cbf 100644
--- a/src/pkg/image/png/writer.go
+++ b/src/pkg/image/png/writer.go
@@ -436,7 +436,7 @@ func Encode(w io.Writer, m image.Image) error {
// also rejected.
mw, mh := int64(m.Bounds().Dx()), int64(m.Bounds().Dy())
if mw <= 0 || mh <= 0 || mw >= 1<<32 || mh >= 1<<32 {
- return FormatError("invalid image size: " + strconv.FormatInt(mw, 10) + "x" + strconv.FormatInt(mw, 10))
+ return FormatError("invalid image size: " + strconv.FormatInt(mw, 10) + "x" + strconv.FormatInt(mh, 10))
}
var e encoder
diff --git a/src/pkg/io/io.go b/src/pkg/io/io.go
index 23d05e575..ec2cd6056 100644
--- a/src/pkg/io/io.go
+++ b/src/pkg/io/io.go
@@ -34,6 +34,11 @@ var EOF = errors.New("EOF")
// middle of reading a fixed-size block or data structure.
var ErrUnexpectedEOF = errors.New("unexpected EOF")
+// ErrNoProgress is returned by some clients of an io.Reader when
+// many calls to Read have failed to return any data or error,
+// usually the sign of a broken io.Reader implementation.
+var ErrNoProgress = errors.New("multiple Read calls return no data or error")
+
// Reader is the interface that wraps the basic Read method.
//
// Read reads up to len(p) bytes into p. It returns the number of bytes
@@ -55,6 +60,10 @@ var ErrUnexpectedEOF = errors.New("unexpected EOF")
// considering the error err. Doing so correctly handles I/O errors
// that happen after reading some bytes and also both of the
// allowed EOF behaviors.
+//
+// Implementations of Read are discouraged from returning a
+// zero byte count with a nil error, and callers should treat
+// that situation as a no-op.
type Reader interface {
Read(p []byte) (n int, err error)
}
@@ -70,6 +79,9 @@ type Writer interface {
}
// Closer is the interface that wraps the basic Close method.
+//
+// The behavior of Close after the first call is undefined.
+// Specific implementations may document their own behavior.
type Closer interface {
Close() error
}
diff --git a/src/pkg/math/rand/zipf.go b/src/pkg/math/rand/zipf.go
index 38e8ec516..8db2c6f5b 100644
--- a/src/pkg/math/rand/zipf.go
+++ b/src/pkg/math/rand/zipf.go
@@ -34,7 +34,6 @@ func (z *Zipf) hinv(x float64) float64 {
// NewZipf returns a Zipf generating variates p(k) on [0, imax]
// proportional to (v+k)**(-s) where s>1 and k>=0, and v>=1.
-//
func NewZipf(r *Rand, s float64, v float64, imax uint64) *Zipf {
z := new(Zipf)
if s <= 1.0 || v < 1 {
@@ -52,9 +51,12 @@ func NewZipf(r *Rand, s float64, v float64, imax uint64) *Zipf {
return z
}
-// Uint64 returns a value drawn from the Zipf distributed described
+// Uint64 returns a value drawn from the Zipf distribution described
// by the Zipf object.
func (z *Zipf) Uint64() uint64 {
+ if z == nil {
+ panic("rand: nil Zipf")
+ }
k := 0.0
for {
diff --git a/src/pkg/mime/multipart/multipart.go b/src/pkg/mime/multipart/multipart.go
index a6204d7bd..2c862a647 100644
--- a/src/pkg/mime/multipart/multipart.go
+++ b/src/pkg/mime/multipart/multipart.go
@@ -28,7 +28,12 @@ var emptyParams = make(map[string]string)
type Part struct {
// The headers of the body, if any, with the keys canonicalized
// in the same fashion that the Go http.Request headers are.
- // i.e. "foo-bar" changes case to "Foo-Bar"
+ // For example, "foo-bar" changes case to "Foo-Bar"
+ //
+ // As a special case, if the "Content-Transfer-Encoding" header
+ // has a value of "quoted-printable", that header is instead
+ // hidden from this map and the body is transparently decoded
+ // during Read calls.
Header textproto.MIMEHeader
buffer *bytes.Buffer
diff --git a/src/pkg/mime/multipart/quotedprintable.go b/src/pkg/mime/multipart/quotedprintable.go
index 9e18e1ea1..9ff4ee703 100644
--- a/src/pkg/mime/multipart/quotedprintable.go
+++ b/src/pkg/mime/multipart/quotedprintable.go
@@ -18,16 +18,14 @@ import (
)
type qpReader struct {
- br *bufio.Reader
- skipWhite bool
- rerr error // last read error
- line []byte // to be consumed before more of br
+ br *bufio.Reader
+ rerr error // last read error
+ line []byte // to be consumed before more of br
}
func newQuotedPrintableReader(r io.Reader) io.Reader {
return &qpReader{
- br: bufio.NewReader(r),
- skipWhite: true,
+ br: bufio.NewReader(r),
}
}
@@ -55,10 +53,6 @@ func (q *qpReader) readHexByte(v []byte) (b byte, err error) {
return hb<<4 | lb, nil
}
-func isQPSkipWhiteByte(b byte) bool {
- return b == ' ' || b == '\t'
-}
-
func isQPDiscardWhitespace(r rune) bool {
switch r {
case '\n', '\r', ' ', '\t':
@@ -79,7 +73,6 @@ func (q *qpReader) Read(p []byte) (n int, err error) {
if q.rerr != nil {
return n, q.rerr
}
- q.skipWhite = true
q.line, q.rerr = q.br.ReadSlice('\n')
// Does the line end in CRLF instead of just LF?
@@ -103,11 +96,6 @@ func (q *qpReader) Read(p []byte) (n int, err error) {
continue
}
b := q.line[0]
- if q.skipWhite && isQPSkipWhiteByte(b) {
- q.line = q.line[1:]
- continue
- }
- q.skipWhite = false
switch {
case b == '=':
diff --git a/src/pkg/mime/multipart/quotedprintable_test.go b/src/pkg/mime/multipart/quotedprintable_test.go
index 7bcf5767b..8a95f7f03 100644
--- a/src/pkg/mime/multipart/quotedprintable_test.go
+++ b/src/pkg/mime/multipart/quotedprintable_test.go
@@ -32,8 +32,9 @@ func TestQuotedPrintable(t *testing.T) {
{in: "foo bar=0", want: "foo bar", err: io.ErrUnexpectedEOF},
{in: "foo bar=ab", want: "foo bar", err: "multipart: invalid quoted-printable hex byte 0x61"},
{in: "foo bar=0D=0A", want: "foo bar\r\n"},
- {in: " A B =\r\n C ", want: "A B C"},
- {in: " A B =\n C ", want: "A B C"}, // lax. treating LF as CRLF
+ {in: " A B \r\n C ", want: " A B\r\n C"},
+ {in: " A B =\r\n C ", want: " A B C"},
+ {in: " A B =\n C ", want: " A B C"}, // lax. treating LF as CRLF
{in: "foo=\nbar", want: "foobar"},
{in: "foo\x00bar", want: "foo", err: "multipart: invalid unescaped byte 0x00 in quoted-printable body"},
{in: "foo bar\xff", want: "foo bar", err: "multipart: invalid unescaped byte 0xff in quoted-printable body"},
@@ -57,6 +58,10 @@ func TestQuotedPrintable(t *testing.T) {
{in: "foo=\nbar", want: "foobar"},
{in: "foo=\rbar", want: "foo", err: "multipart: invalid quoted-printable hex byte 0x0d"},
{in: "foo=\r\r\r \nbar", want: "foo", err: `multipart: invalid bytes after =: "\r\r\r \n"`},
+
+ // Example from RFC 2045:
+ {in: "Now's the time =\n" + "for all folk to come=\n" + " to the aid of their country.",
+ want: "Now's the time for all folk to come to the aid of their country."},
}
for _, tt := range tests {
var buf bytes.Buffer
diff --git a/src/pkg/net/dial_gen.go b/src/pkg/net/dial_gen.go
index 0a3277de4..19f868168 100644
--- a/src/pkg/net/dial_gen.go
+++ b/src/pkg/net/dial_gen.go
@@ -10,14 +10,23 @@ import (
"time"
)
+var testingIssue5349 bool // used during tests
+
// resolveAndDialChannel is the simple pure-Go implementation of
// resolveAndDial, still used on operating systems where the deadline
// hasn't been pushed down into the pollserver. (Plan 9 and some old
// versions of Windows)
func resolveAndDialChannel(net, addr string, localAddr Addr, deadline time.Time) (Conn, error) {
- timeout := deadline.Sub(time.Now())
- if timeout < 0 {
- timeout = 0
+ var timeout time.Duration
+ if !deadline.IsZero() {
+ timeout = deadline.Sub(time.Now())
+ }
+ if timeout <= 0 {
+ ra, err := resolveAddr("dial", net, addr, noDeadline)
+ if err != nil {
+ return nil, err
+ }
+ return dial(net, addr, localAddr, ra, noDeadline)
}
t := time.NewTimer(timeout)
defer t.Stop()
@@ -28,6 +37,9 @@ func resolveAndDialChannel(net, addr string, localAddr Addr, deadline time.Time)
ch := make(chan pair, 1)
resolvedAddr := make(chan Addr, 1)
go func() {
+ if testingIssue5349 {
+ time.Sleep(time.Millisecond)
+ }
ra, err := resolveAddr("dial", net, addr, noDeadline)
if err != nil {
ch <- pair{nil, err}
diff --git a/src/pkg/net/dial_gen_test.go b/src/pkg/net/dial_gen_test.go
new file mode 100644
index 000000000..c857acd06
--- /dev/null
+++ b/src/pkg/net/dial_gen_test.go
@@ -0,0 +1,11 @@
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build windows plan9
+
+package net
+
+func init() {
+ testingIssue5349 = true
+}
diff --git a/src/pkg/net/dial_test.go b/src/pkg/net/dial_test.go
index 098df738b..e24fecc8d 100644
--- a/src/pkg/net/dial_test.go
+++ b/src/pkg/net/dial_test.go
@@ -330,3 +330,80 @@ func numFD() int {
// All tests using this should be skipped anyway, but:
panic("numFDs not implemented on " + runtime.GOOS)
}
+
+var testPoller = flag.Bool("poller", false, "platform supports runtime-integrated poller")
+
+// Assert that a failed Dial attempt does not leak
+// runtime.PollDesc structures
+func TestDialFailPDLeak(t *testing.T) {
+ if !*testPoller {
+ t.Skip("test disabled; use -poller to enable")
+ }
+
+ const loops = 10
+ const count = 20000
+ var old runtime.MemStats // used by sysdelta
+ runtime.ReadMemStats(&old)
+ sysdelta := func() uint64 {
+ var new runtime.MemStats
+ runtime.ReadMemStats(&new)
+ delta := old.Sys - new.Sys
+ old = new
+ return delta
+ }
+ d := &Dialer{Timeout: time.Nanosecond} // don't bother TCP with handshaking
+ failcount := 0
+ for i := 0; i < loops; i++ {
+ for i := 0; i < count; i++ {
+ conn, err := d.Dial("tcp", "127.0.0.1:1")
+ if err == nil {
+ t.Error("dial should not succeed")
+ conn.Close()
+ t.FailNow()
+ }
+ }
+ if delta := sysdelta(); delta > 0 {
+ failcount++
+ }
+ // there are always some allocations on the first loop
+ if failcount > 3 {
+ t.Error("detected possible memory leak in runtime")
+ t.FailNow()
+ }
+ }
+}
+
+func TestDialer(t *testing.T) {
+ ln, err := Listen("tcp4", "127.0.0.1:0")
+ if err != nil {
+ t.Fatalf("Listen failed: %v", err)
+ }
+ defer ln.Close()
+ ch := make(chan error, 1)
+ go func() {
+ var err error
+ c, err := ln.Accept()
+ if err != nil {
+ ch <- fmt.Errorf("Accept failed: %v", err)
+ return
+ }
+ defer c.Close()
+ ch <- nil
+ }()
+
+ laddr, err := ResolveTCPAddr("tcp4", "127.0.0.1:0")
+ if err != nil {
+ t.Fatalf("ResolveTCPAddr failed: %v", err)
+ }
+ d := &Dialer{LocalAddr: laddr}
+ c, err := d.Dial("tcp4", ln.Addr().String())
+ if err != nil {
+ t.Fatalf("Dial failed: %v", err)
+ }
+ defer c.Close()
+ c.Read(make([]byte, 1))
+ err = <-ch
+ if err != nil {
+ t.Error(err)
+ }
+}
diff --git a/src/pkg/net/fd_unix.go b/src/pkg/net/fd_unix.go
index f52c98a6c..8c59bff98 100644
--- a/src/pkg/net/fd_unix.go
+++ b/src/pkg/net/fd_unix.go
@@ -79,7 +79,7 @@ func (fd *netFD) name() string {
return fd.net + ":" + ls + "->" + rs
}
-func (fd *netFD) connect(ra syscall.Sockaddr) error {
+func (fd *netFD) connect(la, ra syscall.Sockaddr) error {
fd.wio.Lock()
defer fd.wio.Unlock()
if err := fd.pd.PrepareWrite(); err != nil {
@@ -122,12 +122,16 @@ func (fd *netFD) incref(closing bool) error {
func (fd *netFD) decref() {
fd.sysmu.Lock()
fd.sysref--
- if fd.closing && fd.sysref == 0 && fd.sysfile != nil {
+ if fd.closing && fd.sysref == 0 {
// Poller may want to unregister fd in readiness notification mechanism,
// so this must be executed before sysfile.Close().
fd.pd.Close()
- fd.sysfile.Close()
- fd.sysfile = nil
+ if fd.sysfile != nil {
+ fd.sysfile.Close()
+ fd.sysfile = nil
+ } else {
+ closesocket(fd.sysfd)
+ }
fd.sysfd = -1
}
fd.sysmu.Unlock()
diff --git a/src/pkg/net/fd_windows.go b/src/pkg/net/fd_windows.go
index 3a16d8ae7..fefd174ba 100644
--- a/src/pkg/net/fd_windows.go
+++ b/src/pkg/net/fd_windows.go
@@ -364,22 +364,23 @@ func (o *connectOp) Name() string {
return "ConnectEx"
}
-func (fd *netFD) connect(ra syscall.Sockaddr) error {
+func (fd *netFD) connect(la, ra syscall.Sockaddr) error {
if !canUseConnectEx(fd.net) {
return syscall.Connect(fd.sysfd, ra)
}
// ConnectEx windows API requires an unconnected, previously bound socket.
- var la syscall.Sockaddr
- switch ra.(type) {
- case *syscall.SockaddrInet4:
- la = &syscall.SockaddrInet4{}
- case *syscall.SockaddrInet6:
- la = &syscall.SockaddrInet6{}
- default:
- panic("unexpected type in connect")
- }
- if err := syscall.Bind(fd.sysfd, la); err != nil {
- return err
+ if la == nil {
+ switch ra.(type) {
+ case *syscall.SockaddrInet4:
+ la = &syscall.SockaddrInet4{}
+ case *syscall.SockaddrInet6:
+ la = &syscall.SockaddrInet6{}
+ default:
+ panic("unexpected type in connect")
+ }
+ if err := syscall.Bind(fd.sysfd, la); err != nil {
+ return err
+ }
}
// Call ConnectEx API.
var o connectOp
diff --git a/src/pkg/net/http/client_test.go b/src/pkg/net/http/client_test.go
index d7d2c1879..73f1fe3c1 100644
--- a/src/pkg/net/http/client_test.go
+++ b/src/pkg/net/http/client_test.go
@@ -180,7 +180,7 @@ func TestPostFormRequestFormat(t *testing.T) {
}
}
-func TestRedirects(t *testing.T) {
+func TestClientRedirects(t *testing.T) {
defer afterTest(t)
var ts *httptest.Server
ts = httptest.NewServer(HandlerFunc(func(w ResponseWriter, r *Request) {
diff --git a/src/pkg/net/http/cookiejar/jar.go b/src/pkg/net/http/cookiejar/jar.go
index 5d1aeb87f..5977d48b6 100644
--- a/src/pkg/net/http/cookiejar/jar.go
+++ b/src/pkg/net/http/cookiejar/jar.go
@@ -28,6 +28,9 @@ import (
// An implementation that always returns "" is valid and may be useful for
// testing but it is not secure: it means that the HTTP server for foo.com can
// set a cookie for bar.com.
+//
+// A public suffix list implementation is in the package
+// code.google.com/p/go.net/publicsuffix.
type PublicSuffixList interface {
// PublicSuffix returns the public suffix of domain.
//
diff --git a/src/pkg/net/http/httptest/example_test.go b/src/pkg/net/http/httptest/example_test.go
index 239470d97..42a0ec953 100644
--- a/src/pkg/net/http/httptest/example_test.go
+++ b/src/pkg/net/http/httptest/example_test.go
@@ -12,7 +12,7 @@ import (
"net/http/httptest"
)
-func ExampleRecorder() {
+func ExampleResponseRecorder() {
handler := func(w http.ResponseWriter, r *http.Request) {
http.Error(w, "something failed", http.StatusInternalServerError)
}
diff --git a/src/pkg/net/http/request.go b/src/pkg/net/http/request.go
index c1f862aad..6d4569146 100644
--- a/src/pkg/net/http/request.go
+++ b/src/pkg/net/http/request.go
@@ -48,7 +48,7 @@ var (
ErrUnexpectedTrailer = &ProtocolError{"trailer header without chunked transfer encoding"}
ErrMissingContentLength = &ProtocolError{"missing ContentLength in HEAD response"}
ErrNotMultipart = &ProtocolError{"request Content-Type isn't multipart/form-data"}
- ErrMissingBoundary = &ProtocolError{"no multipart boundary param Content-Type"}
+ ErrMissingBoundary = &ProtocolError{"no multipart boundary param in Content-Type"}
)
type badStringError struct {
diff --git a/src/pkg/net/http/serve_test.go b/src/pkg/net/http/serve_test.go
index 102f48942..d7b321597 100644
--- a/src/pkg/net/http/serve_test.go
+++ b/src/pkg/net/http/serve_test.go
@@ -1370,6 +1370,7 @@ func TestContentLengthZero(t *testing.T) {
}
func TestCloseNotifier(t *testing.T) {
+ defer afterTest(t)
gotReq := make(chan bool, 1)
sawClose := make(chan bool, 1)
ts := httptest.NewServer(HandlerFunc(func(rw ResponseWriter, req *Request) {
@@ -1405,6 +1406,31 @@ For:
ts.Close()
}
+func TestCloseNotifierChanLeak(t *testing.T) {
+ defer afterTest(t)
+ req := []byte(strings.Replace(`GET / HTTP/1.0
+Host: golang.org
+
+`, "\n", "\r\n", -1))
+ for i := 0; i < 20; i++ {
+ var output bytes.Buffer
+ conn := &rwTestConn{
+ Reader: bytes.NewReader(req),
+ Writer: &output,
+ closec: make(chan bool, 1),
+ }
+ ln := &oneConnListener{conn: conn}
+ handler := HandlerFunc(func(rw ResponseWriter, r *Request) {
+ // Ignore the return value and never read from
+ // it, testing that we don't leak goroutines
+ // on the sending side:
+ _ = rw.(CloseNotifier).CloseNotify()
+ })
+ go Serve(ln, handler)
+ <-conn.closec
+ }
+}
+
func TestOptions(t *testing.T) {
uric := make(chan string, 2) // only expect 1, but leave space for 2
mux := NewServeMux()
@@ -1940,7 +1966,7 @@ Host: golang.org
const someResponse = "<html>some response</html>"
-// A Reponse that's just no bigger than 2KB, the buffer-before-chunking threshold.
+// A Response that's just no bigger than 2KB, the buffer-before-chunking threshold.
var response = bytes.Repeat([]byte(someResponse), 2<<10/len(someResponse))
// Both Content-Type and Content-Length set. Should be no buffering.
diff --git a/src/pkg/net/http/server.go b/src/pkg/net/http/server.go
index 4792bfba2..b25960705 100644
--- a/src/pkg/net/http/server.go
+++ b/src/pkg/net/http/server.go
@@ -146,7 +146,7 @@ func (c *conn) closeNotify() <-chan bool {
c.mu.Lock()
defer c.mu.Unlock()
if c.closeNotifyc == nil {
- c.closeNotifyc = make(chan bool)
+ c.closeNotifyc = make(chan bool, 1)
if c.hijackedv {
// to obey the function signature, even though
// it'll never receive a value.
@@ -1222,9 +1222,9 @@ func Redirect(w ResponseWriter, r *Request, urlStr string, code int) {
}
// clean up but preserve trailing slash
- trailing := urlStr[len(urlStr)-1] == '/'
+ trailing := strings.HasSuffix(urlStr, "/")
urlStr = path.Clean(urlStr)
- if trailing && urlStr[len(urlStr)-1] != '/' {
+ if trailing && !strings.HasSuffix(urlStr, "/") {
urlStr += "/"
}
urlStr += query
@@ -1492,7 +1492,7 @@ type Server struct {
// TLSNextProto optionally specifies a function to take over
// ownership of the provided TLS connection when an NPN
- // protocol upgrade has occured. The map key is the protocol
+ // protocol upgrade has occurred. The map key is the protocol
// name negotiated. The Handler argument should be used to
// handle HTTP requests and will initialize the Request's TLS
// and RemoteAddr if not already set. The connection is
diff --git a/src/pkg/net/http/server_test.go b/src/pkg/net/http/server_test.go
index 8b4e8c6d6..e8b69f76c 100644
--- a/src/pkg/net/http/server_test.go
+++ b/src/pkg/net/http/server_test.go
@@ -2,9 +2,11 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-package http
+package http_test
import (
+ . "net/http"
+ "net/http/httptest"
"net/url"
"testing"
)
@@ -76,20 +78,27 @@ func TestServeMuxHandler(t *testing.T) {
},
}
h, pattern := mux.Handler(r)
- cs := &codeSaver{h: Header{}}
- h.ServeHTTP(cs, r)
- if pattern != tt.pattern || cs.code != tt.code {
- t.Errorf("%s %s %s = %d, %q, want %d, %q", tt.method, tt.host, tt.path, cs.code, pattern, tt.code, tt.pattern)
+ rr := httptest.NewRecorder()
+ h.ServeHTTP(rr, r)
+ if pattern != tt.pattern || rr.Code != tt.code {
+ t.Errorf("%s %s %s = %d, %q, want %d, %q", tt.method, tt.host, tt.path, rr.Code, pattern, tt.code, tt.pattern)
}
}
}
-// A codeSaver is a ResponseWriter that saves the code passed to WriteHeader.
-type codeSaver struct {
- h Header
- code int
+func TestServerRedirect(t *testing.T) {
+ // This used to crash. It's not valid input (bad path), but it
+ // shouldn't crash.
+ rr := httptest.NewRecorder()
+ req := &Request{
+ Method: "GET",
+ URL: &url.URL{
+ Scheme: "http",
+ Path: "not-empty-but-no-leading-slash", // bogus
+ },
+ }
+ Redirect(rr, req, "", 304)
+ if rr.Code != 304 {
+ t.Errorf("Code = %d; want 304", rr.Code)
+ }
}
-
-func (cs *codeSaver) Header() Header { return cs.h }
-func (cs *codeSaver) Write(p []byte) (int, error) { return len(p), nil }
-func (cs *codeSaver) WriteHeader(code int) { cs.code = code }
diff --git a/src/pkg/net/http/z_last_test.go b/src/pkg/net/http/z_last_test.go
index bf5e3f188..2161db736 100644
--- a/src/pkg/net/http/z_last_test.go
+++ b/src/pkg/net/http/z_last_test.go
@@ -76,6 +76,7 @@ func afterTest(t *testing.T) {
"created by net/http/httptest.(*Server).Start": "an httptest.Server",
"timeoutHandler": "a TimeoutHandler",
"net.(*netFD).connect(": "a timing out dial",
+ ").noteClientGone(": "a closenotifier sender",
}
var stacks string
for i := 0; i < 4; i++ {
diff --git a/src/pkg/net/ipraw_test.go b/src/pkg/net/ipraw_test.go
index 6cdb5ab84..12c199d1c 100644
--- a/src/pkg/net/ipraw_test.go
+++ b/src/pkg/net/ipraw_test.go
@@ -28,7 +28,7 @@ var resolveIPAddrTests = []resolveIPAddrTest{
{"ip", "::1", &IPAddr{IP: ParseIP("::1")}, nil},
{"ip6", "::1", &IPAddr{IP: ParseIP("::1")}, nil},
- {"ip6:icmp", "::1", &IPAddr{IP: ParseIP("::1")}, nil},
+ {"ip6:ipv6-icmp", "::1", &IPAddr{IP: ParseIP("::1")}, nil},
{"ip", "::1%en0", &IPAddr{IP: ParseIP("::1"), Zone: "en0"}, nil},
{"ip6", "::1%911", &IPAddr{IP: ParseIP("::1"), Zone: "911"}, nil},
@@ -55,9 +55,8 @@ func TestResolveIPAddr(t *testing.T) {
for _, tt := range resolveIPAddrTests {
addr, err := ResolveIPAddr(tt.net, tt.litAddr)
if err != tt.err {
- t.Fatalf("ResolveIPAddr(%v, %v) failed: %v", tt.net, tt.litAddr, err)
- }
- if !reflect.DeepEqual(addr, tt.addr) {
+ condFatalf(t, "ResolveIPAddr(%v, %v) failed: %v", tt.net, tt.litAddr, err)
+ } else if !reflect.DeepEqual(addr, tt.addr) {
t.Fatalf("got %#v; expected %#v", addr, tt.addr)
}
}
diff --git a/src/pkg/net/sock_posix.go b/src/pkg/net/sock_posix.go
index e2487c805..be89c26db 100644
--- a/src/pkg/net/sock_posix.go
+++ b/src/pkg/net/sock_posix.go
@@ -57,8 +57,8 @@ func socket(net string, f, t, p int, ipv6only bool, ulsa, ursa syscall.Sockaddr,
if !deadline.IsZero() {
setWriteDeadline(fd, deadline)
}
- if err = fd.connect(ursa); err != nil {
- closesocket(s)
+ if err = fd.connect(ulsa, ursa); err != nil {
+ fd.Close()
return nil, err
}
fd.isConnected = true
diff --git a/src/pkg/net/tcpsock_plan9.go b/src/pkg/net/tcpsock_plan9.go
index 96cbcc246..48334fed7 100644
--- a/src/pkg/net/tcpsock_plan9.go
+++ b/src/pkg/net/tcpsock_plan9.go
@@ -159,6 +159,10 @@ func (l *TCPListener) SetDeadline(t time.Time) error {
// File returns a copy of the underlying os.File, set to blocking
// mode. It is the caller's responsibility to close f when finished.
// Closing l does not affect f, and closing f does not affect l.
+//
+// The returned os.File's file descriptor is different from the
+// connection's. Attempting to change properties of the original
+// using this duplicate may or may not have the desired effect.
func (l *TCPListener) File() (f *os.File, err error) { return l.dup() }
// ListenTCP announces on the TCP address laddr and returns a TCP
diff --git a/src/pkg/net/tcpsock_posix.go b/src/pkg/net/tcpsock_posix.go
index 8133ca1c1..876edb101 100644
--- a/src/pkg/net/tcpsock_posix.go
+++ b/src/pkg/net/tcpsock_posix.go
@@ -267,6 +267,10 @@ func (l *TCPListener) SetDeadline(t time.Time) error {
// File returns a copy of the underlying os.File, set to blocking
// mode. It is the caller's responsibility to close f when finished.
// Closing l does not affect f, and closing f does not affect l.
+//
+// The returned os.File's file descriptor is different from the
+// connection's. Attempting to change properties of the original
+// using this duplicate may or may not have the desired effect.
func (l *TCPListener) File() (f *os.File, err error) { return l.fd.dup() }
// ListenTCP announces on the TCP address laddr and returns a TCP
@@ -288,7 +292,7 @@ func ListenTCP(net string, laddr *TCPAddr) (*TCPListener, error) {
}
err = syscall.Listen(fd.sysfd, listenerBacklog)
if err != nil {
- closesocket(fd.sysfd)
+ fd.Close()
return nil, &OpError{"listen", net, laddr, err}
}
return &TCPListener{fd}, nil
diff --git a/src/pkg/net/unixsock_plan9.go b/src/pkg/net/unixsock_plan9.go
index 0390207f0..8a1281fb1 100644
--- a/src/pkg/net/unixsock_plan9.go
+++ b/src/pkg/net/unixsock_plan9.go
@@ -126,6 +126,10 @@ func (l *UnixListener) SetDeadline(t time.Time) error {
// File returns a copy of the underlying os.File, set to blocking
// mode. It is the caller's responsibility to close f when finished.
// Closing l does not affect f, and closing f does not affect l.
+//
+// The returned os.File's file descriptor is different from the
+// connection's. Attempting to change properties of the original
+// using this duplicate may or may not have the desired effect.
func (l *UnixListener) File() (*os.File, error) {
return nil, syscall.EPLAN9
}
diff --git a/src/pkg/net/unixsock_posix.go b/src/pkg/net/unixsock_posix.go
index 760d38f27..5db30df95 100644
--- a/src/pkg/net/unixsock_posix.go
+++ b/src/pkg/net/unixsock_posix.go
@@ -271,7 +271,7 @@ func ListenUnix(net string, laddr *UnixAddr) (*UnixListener, error) {
}
err = syscall.Listen(fd.sysfd, listenerBacklog)
if err != nil {
- closesocket(fd.sysfd)
+ fd.Close()
return nil, &OpError{Op: "listen", Net: net, Addr: laddr, Err: err}
}
return &UnixListener{fd, laddr.Name}, nil
@@ -339,6 +339,10 @@ func (l *UnixListener) SetDeadline(t time.Time) (err error) {
// File returns a copy of the underlying os.File, set to blocking
// mode. It is the caller's responsibility to close f when finished.
// Closing l does not affect f, and closing f does not affect l.
+//
+// The returned os.File's file descriptor is different from the
+// connection's. Attempting to change properties of the original
+// using this duplicate may or may not have the desired effect.
func (l *UnixListener) File() (f *os.File, err error) { return l.fd.dup() }
// ListenUnixgram listens for incoming Unix datagram packets addressed
diff --git a/src/pkg/os/exec/exec_test.go b/src/pkg/os/exec/exec_test.go
index 2467d29a1..6f5860e95 100644
--- a/src/pkg/os/exec/exec_test.go
+++ b/src/pkg/os/exec/exec_test.go
@@ -19,6 +19,7 @@ import (
"strconv"
"strings"
"testing"
+ "time"
)
func helperCommand(s ...string) *Cmd {
@@ -194,6 +195,98 @@ func basefds() uintptr {
return n
}
+func TestExtraFilesFDShuffle(t *testing.T) {
+ t.Skip("TODO: TestExtraFilesFDShuffle is too non-portable; skipping")
+
+ // syscall.StartProcess maps all the FDs passed to it in
+ // ProcAttr.Files (the concatenation of stdin,stdout,stderr and
+ // ExtraFiles) into consecutive FDs in the child, that is:
+ // Files{11, 12, 6, 7, 9, 3} should result in the file
+ // represented by FD 11 in the parent being made available as 0
+ // in the child, 12 as 1, etc.
+ //
+ // We want to test that FDs in the child do not get overwritten
+ // by one another as this shuffle occurs. The original implementation
+ // was buggy in that in some data dependent cases it would ovewrite
+ // stderr in the child with one of the ExtraFile members.
+ // Testing for this case is difficult because it relies on using
+ // the same FD values as that case. In particular, an FD of 3
+ // must be at an index of 4 or higher in ProcAttr.Files and
+ // the FD of the write end of the Stderr pipe (as obtained by
+ // StderrPipe()) must be the same as the size of ProcAttr.Files;
+ // therefore we test that the read end of this pipe (which is what
+ // is returned to the parent by StderrPipe() being one less than
+ // the size of ProcAttr.Files, i.e. 3+len(cmd.ExtraFiles).
+ //
+ // Moving this test case around within the overall tests may
+ // affect the FDs obtained and hence the checks to catch these cases.
+ npipes := 2
+ c := helperCommand("extraFilesAndPipes", strconv.Itoa(npipes+1))
+ rd, wr, _ := os.Pipe()
+ defer rd.Close()
+ if rd.Fd() != 3 {
+ t.Errorf("bad test value for test pipe: fd %d", rd.Fd())
+ }
+ stderr, _ := c.StderrPipe()
+ wr.WriteString("_LAST")
+ wr.Close()
+
+ pipes := make([]struct {
+ r, w *os.File
+ }, npipes)
+ data := []string{"a", "b"}
+
+ for i := 0; i < npipes; i++ {
+ r, w, err := os.Pipe()
+ if err != nil {
+ t.Fatalf("unexpected error creating pipe: %s", err)
+ }
+ pipes[i].r = r
+ pipes[i].w = w
+ w.WriteString(data[i])
+ c.ExtraFiles = append(c.ExtraFiles, pipes[i].r)
+ defer func() {
+ r.Close()
+ w.Close()
+ }()
+ }
+ // Put fd 3 at the end.
+ c.ExtraFiles = append(c.ExtraFiles, rd)
+
+ stderrFd := int(stderr.(*os.File).Fd())
+ if stderrFd != ((len(c.ExtraFiles) + 3) - 1) {
+ t.Errorf("bad test value for stderr pipe")
+ }
+
+ expected := "child: " + strings.Join(data, "") + "_LAST"
+
+ err := c.Start()
+ if err != nil {
+ t.Fatalf("Run: %v", err)
+ }
+ ch := make(chan string, 1)
+ go func(ch chan string) {
+ buf := make([]byte, 512)
+ n, err := stderr.Read(buf)
+ if err != nil {
+ t.Fatalf("Read: %s", err)
+ ch <- err.Error()
+ } else {
+ ch <- string(buf[:n])
+ }
+ close(ch)
+ }(ch)
+ select {
+ case m := <-ch:
+ if m != expected {
+ t.Errorf("Read: '%s' not '%s'", m, expected)
+ }
+ case <-time.After(5 * time.Second):
+ t.Errorf("Read timedout")
+ }
+ c.Wait()
+}
+
func TestExtraFiles(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip("no operating system support; skipping")
@@ -316,6 +409,13 @@ func TestExtraFilesRace(t *testing.T) {
}
la.Close()
lb.Close()
+ for _, f := range ca.ExtraFiles {
+ f.Close()
+ }
+ for _, f := range cb.ExtraFiles {
+ f.Close()
+ }
+
}
}
@@ -449,6 +549,35 @@ func TestHelperProcess(*testing.T) {
}
}
os.Exit(0)
+ case "extraFilesAndPipes":
+ n, _ := strconv.Atoi(args[0])
+ pipes := make([]*os.File, n)
+ for i := 0; i < n; i++ {
+ pipes[i] = os.NewFile(uintptr(3+i), strconv.Itoa(i))
+ }
+ response := ""
+ for i, r := range pipes {
+ ch := make(chan string, 1)
+ go func(c chan string) {
+ buf := make([]byte, 10)
+ n, err := r.Read(buf)
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "Child: read error: %v on pipe %d\n", err, i)
+ os.Exit(1)
+ }
+ c <- string(buf[:n])
+ close(c)
+ }(ch)
+ select {
+ case m := <-ch:
+ response = response + m
+ case <-time.After(5 * time.Second):
+ fmt.Fprintf(os.Stderr, "Child: Timeout reading from pipe: %d\n", i)
+ os.Exit(1)
+ }
+ }
+ fmt.Fprintf(os.Stderr, "child: %s", response)
+ os.Exit(0)
default:
fmt.Fprintf(os.Stderr, "Unknown command %q\n", cmd)
os.Exit(2)
diff --git a/src/pkg/reflect/value.go b/src/pkg/reflect/value.go
index 5a3720489..80aa85723 100644
--- a/src/pkg/reflect/value.go
+++ b/src/pkg/reflect/value.go
@@ -1699,14 +1699,22 @@ func (v Value) UnsafeAddr() uintptr {
}
// StringHeader is the runtime representation of a string.
-// It cannot be used safely or portably.
+// It cannot be used safely or portably and its representation may
+// change in a later release.
+// Moreover, the Data field is not sufficient to guarantee the data
+// it references will not be garbage collected, so programs must keep
+// a separate, correctly typed pointer to the underlying data.
type StringHeader struct {
Data uintptr
Len int
}
// SliceHeader is the runtime representation of a slice.
-// It cannot be used safely or portably.
+// It cannot be used safely or portably and its representation may
+// change in a later release.
+// Moreover, the Data field is not sufficient to guarantee the data
+// it references will not be garbage collected, so programs must keep
+// a separate, correctly typed pointer to the underlying data.
type SliceHeader struct {
Data uintptr
Len int
diff --git a/src/pkg/regexp/regexp.go b/src/pkg/regexp/regexp.go
index 6f6908a74..c392b376f 100644
--- a/src/pkg/regexp/regexp.go
+++ b/src/pkg/regexp/regexp.go
@@ -397,7 +397,7 @@ func (re *Regexp) Match(b []byte) bool {
// MatchReader checks whether a textual regular expression matches the text
// read by the RuneReader. More complicated queries need to use Compile and
// the full Regexp interface.
-func MatchReader(pattern string, r io.RuneReader) (matched bool, error error) {
+func MatchReader(pattern string, r io.RuneReader) (matched bool, err error) {
re, err := Compile(pattern)
if err != nil {
return false, err
@@ -408,7 +408,7 @@ func MatchReader(pattern string, r io.RuneReader) (matched bool, error error) {
// MatchString checks whether a textual regular expression
// matches a string. More complicated queries need
// to use Compile and the full Regexp interface.
-func MatchString(pattern string, s string) (matched bool, error error) {
+func MatchString(pattern string, s string) (matched bool, err error) {
re, err := Compile(pattern)
if err != nil {
return false, err
@@ -419,7 +419,7 @@ func MatchString(pattern string, s string) (matched bool, error error) {
// Match checks whether a textual regular expression
// matches a byte slice. More complicated queries need
// to use Compile and the full Regexp interface.
-func Match(pattern string, b []byte) (matched bool, error error) {
+func Match(pattern string, b []byte) (matched bool, err error) {
re, err := Compile(pattern)
if err != nil {
return false, err
diff --git a/src/pkg/runtime/arch_arm.h b/src/pkg/runtime/arch_arm.h
index bb65d3faf..27c70c105 100644
--- a/src/pkg/runtime/arch_arm.h
+++ b/src/pkg/runtime/arch_arm.h
@@ -6,5 +6,5 @@ enum {
thechar = '5',
BigEndian = 0,
CacheLineSize = 32,
- appendCrossover = 16
+ appendCrossover = 8
};
diff --git a/src/pkg/runtime/asm_arm.s b/src/pkg/runtime/asm_arm.s
index ee9acb749..fed9b3021 100644
--- a/src/pkg/runtime/asm_arm.s
+++ b/src/pkg/runtime/asm_arm.s
@@ -417,7 +417,7 @@ havem:
RET
// void setmg(M*, G*); set m and g. for use by needm.
-TEXT runtime·setmg(SB), 7, $-4
+TEXT runtime·setmg(SB), 7, $0
MOVW mm+0(FP), m
MOVW gg+4(FP), g
diff --git a/src/pkg/runtime/atomic_arm.c b/src/pkg/runtime/atomic_arm.c
index 9193d599d..a78b1dfe2 100644
--- a/src/pkg/runtime/atomic_arm.c
+++ b/src/pkg/runtime/atomic_arm.c
@@ -5,9 +5,9 @@
#include "runtime.h"
#include "arch_GOARCH.h"
-static union {
+static struct {
Lock l;
- byte pad [CacheLineSize];
+ byte pad[CacheLineSize-sizeof(Lock)];
} locktab[57];
#define LOCK(addr) (&locktab[((uintptr)(addr)>>3)%nelem(locktab)].l)
diff --git a/src/pkg/runtime/cgo/callbacks.c b/src/pkg/runtime/cgo/callbacks.c
index 19f6115a6..524f30428 100644
--- a/src/pkg/runtime/cgo/callbacks.c
+++ b/src/pkg/runtime/cgo/callbacks.c
@@ -45,7 +45,8 @@ _cgo_allocate_internal(uintptr len, byte *ret)
FLUSH(&ret);
}
-#pragma dynexport _cgo_allocate _cgo_allocate
+#pragma cgo_export_static _cgo_allocate
+#pragma cgo_export_dynamic _cgo_allocate
void
_cgo_allocate(void *a, int32 n)
{
@@ -73,7 +74,8 @@ _cgo_panic_internal(byte *p)
runtime·panic(err);
}
-#pragma dynexport _cgo_panic _cgo_panic
+#pragma cgo_export_static _cgo_panic
+#pragma cgo_export_dynamic _cgo_panic
void
_cgo_panic(void *a, int32 n)
{
diff --git a/src/pkg/runtime/cgo/gcc_386.S b/src/pkg/runtime/cgo/gcc_386.S
index 94ba5842f..bf4142793 100644
--- a/src/pkg/runtime/cgo/gcc_386.S
+++ b/src/pkg/runtime/cgo/gcc_386.S
@@ -40,3 +40,6 @@ EXT(__stack_chk_fail_local):
1:
jmp 1b
+#ifdef __ELF__
+.section .note.GNU-stack,"",@progbits
+#endif
diff --git a/src/pkg/runtime/cgo/gcc_amd64.S b/src/pkg/runtime/cgo/gcc_amd64.S
index 81b270195..32d0200cf 100644
--- a/src/pkg/runtime/cgo/gcc_amd64.S
+++ b/src/pkg/runtime/cgo/gcc_amd64.S
@@ -42,3 +42,7 @@ EXT(crosscall_amd64):
popq %rbp
popq %rbx
ret
+
+#ifdef __ELF__
+.section .note.GNU-stack,"",@progbits
+#endif
diff --git a/src/pkg/runtime/cgo/gcc_arm.S b/src/pkg/runtime/cgo/gcc_arm.S
index 809fcb9a0..3ec6e5d97 100644
--- a/src/pkg/runtime/cgo/gcc_arm.S
+++ b/src/pkg/runtime/cgo/gcc_arm.S
@@ -34,3 +34,6 @@ EXT(__stack_chk_fail_local):
1:
b 1b
+#ifdef __ELF__
+.section .note.GNU-stack,"",%progbits
+#endif
diff --git a/src/pkg/runtime/chan.c b/src/pkg/runtime/chan.c
index 32995c6dd..fba36a4c3 100644
--- a/src/pkg/runtime/chan.c
+++ b/src/pkg/runtime/chan.c
@@ -809,16 +809,27 @@ sellock(Select *sel)
static void
selunlock(Select *sel)
{
- uint32 i;
- Hchan *c, *c0;
+ int32 i, n, r;
+ Hchan *c;
- c = nil;
- for(i=sel->ncase; i-->0;) {
- c0 = sel->lockorder[i];
- if(c0 && c0 != c) {
- c = c0;
- runtime·unlock(c);
- }
+ // We must be very careful here to not touch sel after we have unlocked
+ // the last lock, because sel can be freed right after the last unlock.
+ // Consider the following situation.
+ // First M calls runtime·park() in runtime·selectgo() passing the sel.
+ // Once runtime·park() has unlocked the last lock, another M makes
+ // the G that calls select runnable again and schedules it for execution.
+ // When the G runs on another M, it locks all the locks and frees sel.
+ // Now if the first M touches sel, it will access freed memory.
+ n = (int32)sel->ncase;
+ r = 0;
+ // skip the default case
+ if(n>0 && sel->lockorder[0] == nil)
+ r = 1;
+ for(i = n-1; i >= r; i--) {
+ c = sel->lockorder[i];
+ if(i>0 && sel->lockorder[i-1] == c)
+ continue; // will unlock it on the next iteration
+ runtime·unlock(c);
}
}
@@ -1011,7 +1022,7 @@ loop:
c = cas->chan;
if(c->dataqsiz > 0)
- runtime·throw("selectgo: shouldnt happen");
+ runtime·throw("selectgo: shouldn't happen");
if(debug)
runtime·printf("wait-return: sel=%p c=%p cas=%p kind=%d\n",
diff --git a/src/pkg/runtime/crash_test.go b/src/pkg/runtime/crash_test.go
index 80549a505..929d4a963 100644
--- a/src/pkg/runtime/crash_test.go
+++ b/src/pkg/runtime/crash_test.go
@@ -14,6 +14,22 @@ import (
"text/template"
)
+// testEnv excludes GOGCTRACE from the environment
+// to prevent its output from breaking tests that
+// are trying to parse other command output.
+func testEnv(cmd *exec.Cmd) *exec.Cmd {
+ if cmd.Env != nil {
+ panic("environment already set")
+ }
+ for _, env := range os.Environ() {
+ if strings.HasPrefix(env, "GOGCTRACE=") {
+ continue
+ }
+ cmd.Env = append(cmd.Env, env)
+ }
+ return cmd
+}
+
func executeTest(t *testing.T, templ string, data interface{}) string {
checkStaleRuntime(t)
@@ -37,13 +53,13 @@ func executeTest(t *testing.T, templ string, data interface{}) string {
}
f.Close()
- got, _ := exec.Command("go", "run", src).CombinedOutput()
+ got, _ := testEnv(exec.Command("go", "run", src)).CombinedOutput()
return string(got)
}
func checkStaleRuntime(t *testing.T) {
// 'go run' uses the installed copy of runtime.a, which may be out of date.
- out, err := exec.Command("go", "list", "-f", "{{.Stale}}", "runtime").CombinedOutput()
+ out, err := testEnv(exec.Command("go", "list", "-f", "{{.Stale}}", "runtime")).CombinedOutput()
if err != nil {
t.Fatalf("failed to execute 'go list': %v\n%v", err, string(out))
}
diff --git a/src/pkg/runtime/debug/garbage_test.go b/src/pkg/runtime/debug/garbage_test.go
index b93cfee56..149bafc6f 100644
--- a/src/pkg/runtime/debug/garbage_test.go
+++ b/src/pkg/runtime/debug/garbage_test.go
@@ -11,6 +11,8 @@ import (
)
func TestReadGCStats(t *testing.T) {
+ defer SetGCPercent(SetGCPercent(-1))
+
var stats GCStats
var mstats runtime.MemStats
var min, max time.Duration
diff --git a/src/pkg/runtime/defs_freebsd.go b/src/pkg/runtime/defs_freebsd.go
index 084022715..93f0703e3 100644
--- a/src/pkg/runtime/defs_freebsd.go
+++ b/src/pkg/runtime/defs_freebsd.go
@@ -45,8 +45,8 @@ const (
SA_RESTART = C.SA_RESTART
SA_ONSTACK = C.SA_ONSTACK
- UMTX_OP_WAIT = C.UMTX_OP_WAIT
- UMTX_OP_WAKE = C.UMTX_OP_WAKE
+ UMTX_OP_WAIT_UINT = C.UMTX_OP_WAIT_UINT
+ UMTX_OP_WAKE = C.UMTX_OP_WAKE
EINTR = C.EINTR
diff --git a/src/pkg/runtime/defs_freebsd_386.h b/src/pkg/runtime/defs_freebsd_386.h
index d00c852c6..8fa37c5d6 100644
--- a/src/pkg/runtime/defs_freebsd_386.h
+++ b/src/pkg/runtime/defs_freebsd_386.h
@@ -18,8 +18,8 @@ enum {
SA_RESTART = 0x2,
SA_ONSTACK = 0x1,
- UMTX_OP_WAIT = 0x2,
- UMTX_OP_WAKE = 0x3,
+ UMTX_OP_WAIT_UINT = 0xb,
+ UMTX_OP_WAKE = 0x3,
EINTR = 0x4,
diff --git a/src/pkg/runtime/defs_freebsd_amd64.h b/src/pkg/runtime/defs_freebsd_amd64.h
index 6348c0482..56d849bce 100644
--- a/src/pkg/runtime/defs_freebsd_amd64.h
+++ b/src/pkg/runtime/defs_freebsd_amd64.h
@@ -18,8 +18,8 @@ enum {
SA_RESTART = 0x2,
SA_ONSTACK = 0x1,
- UMTX_OP_WAIT = 0x2,
- UMTX_OP_WAKE = 0x3,
+ UMTX_OP_WAIT_UINT = 0xb,
+ UMTX_OP_WAKE = 0x3,
EINTR = 0x4,
diff --git a/src/pkg/runtime/defs_freebsd_arm.h b/src/pkg/runtime/defs_freebsd_arm.h
index a744b808f..334652eec 100644
--- a/src/pkg/runtime/defs_freebsd_arm.h
+++ b/src/pkg/runtime/defs_freebsd_arm.h
@@ -18,8 +18,8 @@ enum {
SA_RESTART = 0x2,
SA_ONSTACK = 0x1,
- UMTX_OP_WAIT = 0x2,
- UMTX_OP_WAKE = 0x3,
+ UMTX_OP_WAIT_UINT = 0xb,
+ UMTX_OP_WAKE = 0x3,
EINTR = 0x4,
diff --git a/src/pkg/runtime/hashmap.c b/src/pkg/runtime/hashmap.c
index 4ebfffd6c..892f0a170 100644
--- a/src/pkg/runtime/hashmap.c
+++ b/src/pkg/runtime/hashmap.c
@@ -95,8 +95,8 @@ struct Bucket
struct Hmap
{
uintgo count; // # live cells == size of map. Must be first (used by len() builtin)
+ uint32 flags;
uint8 B; // log_2 of # of buckets (can hold up to LOAD * 2^B items)
- uint8 flags;
uint8 keysize; // key size in bytes
uint8 valuesize; // value size in bytes
uint16 bucketsize; // bucket size in bytes
@@ -451,7 +451,7 @@ hash_grow(MapType *t, Hmap *h)
old_buckets = h->buckets;
// NOTE: this could be a big malloc, but since we don't need zeroing it is probably fast.
if(checkgc) mstats.next_gc = mstats.heap_alloc;
- new_buckets = runtime·mallocgc(h->bucketsize << (h->B + 1), 0, 1, 0);
+ new_buckets = runtime·mallocgc((uintptr)h->bucketsize << (h->B + 1), 0, 1, 0);
flags = (h->flags & ~(Iterator | OldIterator));
if((h->flags & Iterator) != 0) {
flags |= OldIterator;
@@ -767,6 +767,8 @@ struct hash_iter
static void
hash_iter_init(MapType *t, Hmap *h, struct hash_iter *it)
{
+ uint32 old;
+
if(sizeof(struct hash_iter) / sizeof(uintptr) != 11) {
runtime·throw("hash_iter size incorrect"); // see ../../cmd/gc/range.c
}
@@ -783,7 +785,14 @@ hash_iter_init(MapType *t, Hmap *h, struct hash_iter *it)
it->bptr = nil;
// Remember we have an iterator.
- h->flags |= Iterator | OldIterator; // careful: see issue 5120.
+ // Can run concurrently with another hash_iter_init() and with reflect·mapiterinit().
+ for(;;) {
+ old = h->flags;
+ if((old&(Iterator|OldIterator)) == (Iterator|OldIterator))
+ break;
+ if(runtime·cas(&h->flags, old, old|Iterator|OldIterator))
+ break;
+ }
if(h->buckets == nil) {
// Empty map. Force next hash_next to exit without
@@ -1370,18 +1379,24 @@ runtime·mapiterinit(MapType *t, Hmap *h, struct hash_iter *it)
void
reflect·mapiterinit(MapType *t, Hmap *h, struct hash_iter *it)
{
- uint8 flags;
+ uint32 old, new;
if(h != nil && t->key->size > sizeof(void*)) {
// reflect·mapiterkey returns pointers to key data,
// and reflect holds them, so we cannot free key data
// eagerly anymore.
- flags = h->flags;
- if(flags & IndirectKey)
- flags &= ~CanFreeKey;
- else
- flags &= ~CanFreeBucket;
- h->flags = flags;
+ // Can run concurrently with another reflect·mapiterinit() and with hash_iter_init().
+ for(;;) {
+ old = h->flags;
+ if(old & IndirectKey)
+ new = old & ~CanFreeKey;
+ else
+ new = old & ~CanFreeBucket;
+ if(new == old)
+ break;
+ if(runtime·cas(&h->flags, old, new))
+ break;
+ }
}
it = runtime·mal(sizeof *it);
diff --git a/src/pkg/runtime/lock_futex.c b/src/pkg/runtime/lock_futex.c
index 9b1f5f6db..3c2ef4ede 100644
--- a/src/pkg/runtime/lock_futex.c
+++ b/src/pkg/runtime/lock_futex.c
@@ -41,7 +41,7 @@ runtime·lock(Lock *l)
runtime·throw("runtime·lock: lock count");
// Speculative grab for lock.
- v = runtime·xchg(&l->key, MUTEX_LOCKED);
+ v = runtime·xchg((uint32*)&l->key, MUTEX_LOCKED);
if(v == MUTEX_UNLOCKED)
return;
@@ -64,7 +64,7 @@ runtime·lock(Lock *l)
// Try for lock, spinning.
for(i = 0; i < spin; i++) {
while(l->key == MUTEX_UNLOCKED)
- if(runtime·cas(&l->key, MUTEX_UNLOCKED, wait))
+ if(runtime·cas((uint32*)&l->key, MUTEX_UNLOCKED, wait))
return;
runtime·procyield(ACTIVE_SPIN_CNT);
}
@@ -72,17 +72,17 @@ runtime·lock(Lock *l)
// Try for lock, rescheduling.
for(i=0; i < PASSIVE_SPIN; i++) {
while(l->key == MUTEX_UNLOCKED)
- if(runtime·cas(&l->key, MUTEX_UNLOCKED, wait))
+ if(runtime·cas((uint32*)&l->key, MUTEX_UNLOCKED, wait))
return;
runtime·osyield();
}
// Sleep.
- v = runtime·xchg(&l->key, MUTEX_SLEEPING);
+ v = runtime·xchg((uint32*)&l->key, MUTEX_SLEEPING);
if(v == MUTEX_UNLOCKED)
return;
wait = MUTEX_SLEEPING;
- runtime·futexsleep(&l->key, MUTEX_SLEEPING, -1);
+ runtime·futexsleep((uint32*)&l->key, MUTEX_SLEEPING, -1);
}
}
@@ -94,11 +94,11 @@ runtime·unlock(Lock *l)
if(--m->locks < 0)
runtime·throw("runtime·unlock: lock count");
- v = runtime·xchg(&l->key, MUTEX_UNLOCKED);
+ v = runtime·xchg((uint32*)&l->key, MUTEX_UNLOCKED);
if(v == MUTEX_UNLOCKED)
runtime·throw("unlock of unlocked lock");
if(v == MUTEX_SLEEPING)
- runtime·futexwakeup(&l->key, 1);
+ runtime·futexwakeup((uint32*)&l->key, 1);
}
// One-time notifications.
@@ -111,9 +111,9 @@ runtime·noteclear(Note *n)
void
runtime·notewakeup(Note *n)
{
- if(runtime·xchg(&n->key, 1))
+ if(runtime·xchg((uint32*)&n->key, 1))
runtime·throw("notewakeup - double wakeup");
- runtime·futexwakeup(&n->key, 1);
+ runtime·futexwakeup((uint32*)&n->key, 1);
}
void
@@ -121,8 +121,8 @@ runtime·notesleep(Note *n)
{
if(m->profilehz > 0)
runtime·setprof(false);
- while(runtime·atomicload(&n->key) == 0)
- runtime·futexsleep(&n->key, 0, -1);
+ while(runtime·atomicload((uint32*)&n->key) == 0)
+ runtime·futexsleep((uint32*)&n->key, 0, -1);
if(m->profilehz > 0)
runtime·setprof(true);
}
@@ -137,15 +137,15 @@ runtime·notetsleep(Note *n, int64 ns)
return;
}
- if(runtime·atomicload(&n->key) != 0)
+ if(runtime·atomicload((uint32*)&n->key) != 0)
return;
if(m->profilehz > 0)
runtime·setprof(false);
deadline = runtime·nanotime() + ns;
for(;;) {
- runtime·futexsleep(&n->key, 0, ns);
- if(runtime·atomicload(&n->key) != 0)
+ runtime·futexsleep((uint32*)&n->key, 0, ns);
+ if(runtime·atomicload((uint32*)&n->key) != 0)
break;
now = runtime·nanotime();
if(now >= deadline)
diff --git a/src/pkg/runtime/lock_sema.c b/src/pkg/runtime/lock_sema.c
index 1d9c37fdb..ec4b15a98 100644
--- a/src/pkg/runtime/lock_sema.c
+++ b/src/pkg/runtime/lock_sema.c
@@ -41,7 +41,7 @@ runtime·lock(Lock *l)
runtime·throw("runtime·lock: lock count");
// Speculative grab for lock.
- if(runtime·casp(&l->waitm, nil, (void*)LOCKED))
+ if(runtime·casp((void**)&l->key, nil, (void*)LOCKED))
return;
if(m->waitsema == 0)
@@ -54,10 +54,10 @@ runtime·lock(Lock *l)
spin = ACTIVE_SPIN;
for(i=0;; i++) {
- v = (uintptr)runtime·atomicloadp(&l->waitm);
+ v = (uintptr)runtime·atomicloadp((void**)&l->key);
if((v&LOCKED) == 0) {
unlocked:
- if(runtime·casp(&l->waitm, (void*)v, (void*)(v|LOCKED)))
+ if(runtime·casp((void**)&l->key, (void*)v, (void*)(v|LOCKED)))
return;
i = 0;
}
@@ -72,9 +72,9 @@ unlocked:
// Queue this M.
for(;;) {
m->nextwaitm = (void*)(v&~LOCKED);
- if(runtime·casp(&l->waitm, (void*)v, (void*)((uintptr)m|LOCKED)))
+ if(runtime·casp((void**)&l->key, (void*)v, (void*)((uintptr)m|LOCKED)))
break;
- v = (uintptr)runtime·atomicloadp(&l->waitm);
+ v = (uintptr)runtime·atomicloadp((void**)&l->key);
if((v&LOCKED) == 0)
goto unlocked;
}
@@ -97,15 +97,15 @@ runtime·unlock(Lock *l)
runtime·throw("runtime·unlock: lock count");
for(;;) {
- v = (uintptr)runtime·atomicloadp(&l->waitm);
+ v = (uintptr)runtime·atomicloadp((void**)&l->key);
if(v == LOCKED) {
- if(runtime·casp(&l->waitm, (void*)LOCKED, nil))
+ if(runtime·casp((void**)&l->key, (void*)LOCKED, nil))
break;
} else {
// Other M's are waiting for the lock.
// Dequeue an M.
mp = (void*)(v&~LOCKED);
- if(runtime·casp(&l->waitm, (void*)v, mp->nextwaitm)) {
+ if(runtime·casp((void**)&l->key, (void*)v, mp->nextwaitm)) {
// Dequeued an M. Wake it.
runtime·semawakeup(mp);
break;
@@ -118,7 +118,7 @@ runtime·unlock(Lock *l)
void
runtime·noteclear(Note *n)
{
- n->waitm = nil;
+ n->key = 0;
}
void
@@ -127,8 +127,8 @@ runtime·notewakeup(Note *n)
M *mp;
do
- mp = runtime·atomicloadp(&n->waitm);
- while(!runtime·casp(&n->waitm, mp, (void*)LOCKED));
+ mp = runtime·atomicloadp((void**)&n->key);
+ while(!runtime·casp((void**)&n->key, mp, (void*)LOCKED));
// Successfully set waitm to LOCKED.
// What was it before?
@@ -148,8 +148,8 @@ runtime·notesleep(Note *n)
{
if(m->waitsema == 0)
m->waitsema = runtime·semacreate();
- if(!runtime·casp(&n->waitm, nil, m)) { // must be LOCKED (got wakeup)
- if(n->waitm != (void*)LOCKED)
+ if(!runtime·casp((void**)&n->key, nil, m)) { // must be LOCKED (got wakeup)
+ if(n->key != LOCKED)
runtime·throw("notesleep - waitm out of sync");
return;
}
@@ -176,8 +176,8 @@ runtime·notetsleep(Note *n, int64 ns)
m->waitsema = runtime·semacreate();
// Register for wakeup on n->waitm.
- if(!runtime·casp(&n->waitm, nil, m)) { // must be LOCKED (got wakeup already)
- if(n->waitm != (void*)LOCKED)
+ if(!runtime·casp((void**)&n->key, nil, m)) { // must be LOCKED (got wakeup already)
+ if(n->key != LOCKED)
runtime·throw("notetsleep - waitm out of sync");
return;
}
@@ -212,10 +212,10 @@ runtime·notetsleep(Note *n, int64 ns)
// so that any notewakeup racing with the return does not
// try to grant us the semaphore when we don't expect it.
for(;;) {
- mp = runtime·atomicloadp(&n->waitm);
+ mp = runtime·atomicloadp((void**)&n->key);
if(mp == m) {
// No wakeup yet; unregister if possible.
- if(runtime·casp(&n->waitm, mp, nil))
+ if(runtime·casp((void**)&n->key, mp, nil))
return;
} else if(mp == (M*)LOCKED) {
// Wakeup happened so semaphore is available.
diff --git a/src/pkg/runtime/malloc.h b/src/pkg/runtime/malloc.h
index 38122bf8a..52b76d557 100644
--- a/src/pkg/runtime/malloc.h
+++ b/src/pkg/runtime/malloc.h
@@ -115,10 +115,18 @@ enum
HeapAllocChunk = 1<<20, // Chunk size for heap growth
// Number of bits in page to span calculations (4k pages).
- // On 64-bit, we limit the arena to 128GB, or 37 bits.
+ // On Windows 64-bit we limit the arena to 32GB or 35 bits (see below for reason).
+ // On other 64-bit platforms, we limit the arena to 128GB, or 37 bits.
// On 32-bit, we don't bother limiting anything, so we use the full 32-bit address.
#ifdef _64BIT
+#ifdef GOOS_windows
+ // Windows counts memory used by page table into committed memory
+ // of the process, so we can't reserve too much memory.
+ // See http://golang.org/issue/5402 and http://golang.org/issue/5236.
+ MHeapMap_Bits = 35 - PageShift,
+#else
MHeapMap_Bits = 37 - PageShift,
+#endif
#else
MHeapMap_Bits = 32 - PageShift,
#endif
@@ -134,7 +142,7 @@ enum
// This must be a #define instead of an enum because it
// is so large.
#ifdef _64BIT
-#define MaxMem (1ULL<<(MHeapMap_Bits+PageShift)) /* 128 GB */
+#define MaxMem (1ULL<<(MHeapMap_Bits+PageShift)) /* 128 GB or 32 GB */
#else
#define MaxMem ((uintptr)-1)
#endif
@@ -416,10 +424,10 @@ struct MHeap
byte *arena_end;
// central free lists for small size classes.
- // the union makes sure that the MCentrals are
+ // the padding makes sure that the MCentrals are
// spaced CacheLineSize bytes apart, so that each MCentral.Lock
// gets its own cache line.
- union {
+ struct {
MCentral;
byte pad[CacheLineSize];
} central[NumSizeClasses];
diff --git a/src/pkg/runtime/map_test.go b/src/pkg/runtime/map_test.go
index 209355e93..9f9c40d15 100644
--- a/src/pkg/runtime/map_test.go
+++ b/src/pkg/runtime/map_test.go
@@ -7,7 +7,7 @@ package runtime_test
import (
"fmt"
"math"
- "os"
+ "reflect"
"runtime"
"sort"
"strings"
@@ -30,7 +30,7 @@ func TestNegativeZero(t *testing.T) {
t.Error("length wrong")
}
- for k, _ := range m {
+ for k := range m {
if math.Copysign(1.0, k) > 0 {
t.Error("wrong sign")
}
@@ -44,7 +44,7 @@ func TestNegativeZero(t *testing.T) {
t.Error("length wrong")
}
- for k, _ := range m {
+ for k := range m {
if math.Copysign(1.0, k) < 0 {
t.Error("wrong sign")
}
@@ -234,8 +234,8 @@ func TestIterGrowWithGC(t *testing.T) {
}
}
-func TestConcurrentReadsAfterGrowth(t *testing.T) {
- if os.Getenv("GOMAXPROCS") == "" {
+func testConcurrentReadsAfterGrowth(t *testing.T, useReflect bool) {
+ if runtime.GOMAXPROCS(-1) == 1 {
defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(16))
}
numLoop := 10
@@ -262,12 +262,31 @@ func TestConcurrentReadsAfterGrowth(t *testing.T) {
_ = m[key]
}
}()
+ if useReflect {
+ wg.Add(1)
+ go func() {
+ defer wg.Done()
+ mv := reflect.ValueOf(m)
+ keys := mv.MapKeys()
+ for _, k := range keys {
+ mv.MapIndex(k)
+ }
+ }()
+ }
}
wg.Wait()
}
}
}
+func TestConcurrentReadsAfterGrowth(t *testing.T) {
+ testConcurrentReadsAfterGrowth(t, false)
+}
+
+func TestConcurrentReadsAfterGrowthReflect(t *testing.T) {
+ testConcurrentReadsAfterGrowth(t, true)
+}
+
func TestBigItems(t *testing.T) {
var key [256]string
for i := 0; i < 256; i++ {
diff --git a/src/pkg/runtime/mgc0.c b/src/pkg/runtime/mgc0.c
index caf1b10e3..f9dbdbb4a 100644
--- a/src/pkg/runtime/mgc0.c
+++ b/src/pkg/runtime/mgc0.c
@@ -19,6 +19,7 @@ enum {
DebugMark = 0, // run second pass to check mark
CollectStats = 0,
ScanStackByFrames = 0,
+ IgnorePreciseGC = 0,
// Four bits per word (see #defines below).
wordsPerBitmapWord = sizeof(void*)*8/4,
@@ -553,6 +554,59 @@ struct Frame {
uintptr *loop_or_ret;
};
+// Sanity check for the derived type info objti.
+static void
+checkptr(void *obj, uintptr objti)
+{
+ uintptr *pc1, *pc2, type, tisize, i, j, x;
+ byte *objstart;
+ Type *t;
+ MSpan *s;
+
+ if(!Debug)
+ runtime·throw("checkptr is debug only");
+
+ if(obj < runtime·mheap->arena_start || obj >= runtime·mheap->arena_used)
+ return;
+ type = runtime·gettype(obj);
+ t = (Type*)(type & ~(uintptr)(PtrSize-1));
+ if(t == nil)
+ return;
+ x = (uintptr)obj >> PageShift;
+ if(sizeof(void*) == 8)
+ x -= (uintptr)(runtime·mheap->arena_start)>>PageShift;
+ s = runtime·mheap->map[x];
+ objstart = (byte*)((uintptr)s->start<<PageShift);
+ if(s->sizeclass != 0) {
+ i = ((byte*)obj - objstart)/s->elemsize;
+ objstart += i*s->elemsize;
+ }
+ tisize = *(uintptr*)objti;
+ // Sanity check for object size: it should fit into the memory block.
+ if((byte*)obj + tisize > objstart + s->elemsize)
+ runtime·throw("invalid gc type info");
+ if(obj != objstart)
+ return;
+ // If obj points to the beginning of the memory block,
+ // check type info as well.
+ if(t->string == nil ||
+ // Gob allocates unsafe pointers for indirection.
+ (runtime·strcmp(t->string->str, (byte*)"unsafe.Pointer") &&
+ // Runtime and gc think differently about closures.
+ runtime·strstr(t->string->str, (byte*)"struct { F uintptr") != t->string->str)) {
+ pc1 = (uintptr*)objti;
+ pc2 = (uintptr*)t->gc;
+ // A simple best-effort check until first GC_END.
+ for(j = 1; pc1[j] != GC_END && pc2[j] != GC_END; j++) {
+ if(pc1[j] != pc2[j]) {
+ runtime·printf("invalid gc type info for '%s' at %p, type info %p, block info %p\n",
+ t->string ? (int8*)t->string->str : (int8*)"?", j, pc1[j], pc2[j]);
+ runtime·throw("invalid gc type info");
+ }
+ }
+ }
+}
+
// scanblock scans a block of n bytes starting at pointer b for references
// to other objects, scanning any it finds recursively until there are no
// unscanned objects left. Instead of using an explicit recursion, it keeps
@@ -647,6 +701,17 @@ scanblock(Workbuf *wbuf, Obj *wp, uintptr nobj, bool keepworking)
} else {
stack_top.count = 1;
}
+ if(Debug) {
+ // Simple sanity check for provided type info ti:
+ // The declared size of the object must be not larger than the actual size
+ // (it can be smaller due to inferior pointers).
+ // It's difficult to make a comprehensive check due to inferior pointers,
+ // reflection, gob, etc.
+ if(pc[0] > n) {
+ runtime·printf("invalid gc type info: type info size %p, block size %p\n", pc[0], n);
+ runtime·throw("invalid gc type info");
+ }
+ }
} else if(UseSpanType) {
if(CollectStats)
runtime·xadd64(&gcstats.obj.notype, 1);
@@ -707,6 +772,9 @@ scanblock(Workbuf *wbuf, Obj *wp, uintptr nobj, bool keepworking)
pc = defaultProg;
}
+ if(IgnorePreciseGC)
+ pc = defaultProg;
+
pc++;
stack_top.b = (uintptr)b;
@@ -723,6 +791,8 @@ scanblock(Workbuf *wbuf, Obj *wp, uintptr nobj, bool keepworking)
obj = *(void**)(stack_top.b + pc[1]);
objti = pc[2];
pc += 3;
+ if(Debug)
+ checkptr(obj, objti);
break;
case GC_SLICE:
diff --git a/src/pkg/runtime/mheap.c b/src/pkg/runtime/mheap.c
index 177f40659..f4fbbee7a 100644
--- a/src/pkg/runtime/mheap.c
+++ b/src/pkg/runtime/mheap.c
@@ -121,6 +121,25 @@ HaveSpan:
s->state = MSpanInUse;
mstats.heap_idle -= s->npages<<PageShift;
mstats.heap_released -= s->npreleased<<PageShift;
+ if(s->npreleased > 0) {
+ // We have called runtime·SysUnused with these pages, and on
+ // Unix systems it called madvise. At this point at least
+ // some BSD-based kernels will return these pages either as
+ // zeros or with the old data. For our caller, the first word
+ // in the page indicates whether the span contains zeros or
+ // not (this word was set when the span was freed by
+ // MCentral_Free or runtime·MCentral_FreeSpan). If the first
+ // page in the span is returned as zeros, and some subsequent
+ // page is returned with the old data, then we will be
+ // returning a span that is assumed to be all zeros, but the
+ // actual data will not be all zeros. Avoid that problem by
+ // explicitly marking the span as not being zeroed, just in
+ // case. The beadbead constant we use here means nothing, it
+ // is just a unique constant not seen elsewhere in the
+ // runtime, as a clue in case it turns up unexpectedly in
+ // memory or in a stack trace.
+ *(uintptr*)(s->start<<PageShift) = (uintptr)0xbeadbeadbeadbeadULL;
+ }
s->npreleased = 0;
if(s->npages > npage) {
diff --git a/src/pkg/runtime/mprof.goc b/src/pkg/runtime/mprof.goc
index 707e505ba..63334e704 100644
--- a/src/pkg/runtime/mprof.goc
+++ b/src/pkg/runtime/mprof.goc
@@ -61,6 +61,8 @@ struct Bucket
Bucket *next; // next in hash list
Bucket *allnext; // next in list of all mbuckets/bbuckets
int32 typ;
+ // Generally unions can break precise GC,
+ // this one is fine because it does not contain pointers.
union
{
struct // typ == MProf
diff --git a/src/pkg/runtime/os_darwin.c b/src/pkg/runtime/os_darwin.c
index 6216e3a3c..276362a97 100644
--- a/src/pkg/runtime/os_darwin.c
+++ b/src/pkg/runtime/os_darwin.c
@@ -92,7 +92,7 @@ runtime·goenvs(void)
// Register our thread-creation callback (see sys_darwin_{amd64,386}.s)
// but only if we're not using cgo. If we are using cgo we need
- // to let the C pthread libary install its own thread-creation callback.
+ // to let the C pthread library install its own thread-creation callback.
if(!runtime·iscgo) {
if(runtime·bsdthread_register() != 0) {
if(runtime·getenv("DYLD_INSERT_LIBRARIES"))
@@ -540,14 +540,17 @@ static int8 badsignal[] = "runtime: signal received on thread not created by Go:
void
runtime·badsignal(int32 sig)
{
+ int32 len;
+
if (sig == SIGPROF) {
return; // Ignore SIGPROFs intended for a non-Go thread.
}
runtime·write(2, badsignal, sizeof badsignal - 1);
if (0 <= sig && sig < NSIG) {
- // Call runtime·findnull dynamically to circumvent static stack size check.
- static int32 (*findnull)(byte*) = runtime·findnull;
- runtime·write(2, runtime·sigtab[sig].name, findnull((byte*)runtime·sigtab[sig].name));
+ // Can't call findnull() because it will split stack.
+ for(len = 0; runtime·sigtab[sig].name[len]; len++)
+ ;
+ runtime·write(2, runtime·sigtab[sig].name, len);
}
runtime·write(2, "\n", 1);
runtime·exit(1);
diff --git a/src/pkg/runtime/os_freebsd.c b/src/pkg/runtime/os_freebsd.c
index 68c0f4750..f454ab349 100644
--- a/src/pkg/runtime/os_freebsd.c
+++ b/src/pkg/runtime/os_freebsd.c
@@ -60,7 +60,7 @@ runtime·futexsleep(uint32 *addr, uint32 val, int64 ns)
tsp = &ts;
}
- ret = runtime·sys_umtx_op(addr, UMTX_OP_WAIT, val, nil, tsp);
+ ret = runtime·sys_umtx_op(addr, UMTX_OP_WAIT_UINT, val, nil, tsp);
if(ret >= 0 || ret == -EINTR)
return;
@@ -252,14 +252,17 @@ static int8 badsignal[] = "runtime: signal received on thread not created by Go:
void
runtime·badsignal(int32 sig)
{
+ int32 len;
+
if (sig == SIGPROF) {
return; // Ignore SIGPROFs intended for a non-Go thread.
}
runtime·write(2, badsignal, sizeof badsignal - 1);
if (0 <= sig && sig < NSIG) {
- // Call runtime·findnull dynamically to circumvent static stack size check.
- static int32 (*findnull)(byte*) = runtime·findnull;
- runtime·write(2, runtime·sigtab[sig].name, findnull((byte*)runtime·sigtab[sig].name));
+ // Can't call findnull() because it will split stack.
+ for(len = 0; runtime·sigtab[sig].name[len]; len++)
+ ;
+ runtime·write(2, runtime·sigtab[sig].name, len);
}
runtime·write(2, "\n", 1);
runtime·exit(1);
diff --git a/src/pkg/runtime/os_linux.c b/src/pkg/runtime/os_linux.c
index e4ae1a5d8..6b86d2b17 100644
--- a/src/pkg/runtime/os_linux.c
+++ b/src/pkg/runtime/os_linux.c
@@ -300,14 +300,17 @@ static int8 badsignal[] = "runtime: signal received on thread not created by Go:
void
runtime·badsignal(int32 sig)
{
+ int32 len;
+
if (sig == SIGPROF) {
return; // Ignore SIGPROFs intended for a non-Go thread.
}
runtime·write(2, badsignal, sizeof badsignal - 1);
if (0 <= sig && sig < NSIG) {
- // Call runtime·findnull dynamically to circumvent static stack size check.
- static int32 (*findnull)(byte*) = runtime·findnull;
- runtime·write(2, runtime·sigtab[sig].name, findnull((byte*)runtime·sigtab[sig].name));
+ // Can't call findnull() because it will split stack.
+ for(len = 0; runtime·sigtab[sig].name[len]; len++)
+ ;
+ runtime·write(2, runtime·sigtab[sig].name, len);
}
runtime·write(2, "\n", 1);
runtime·exit(1);
diff --git a/src/pkg/runtime/os_netbsd.c b/src/pkg/runtime/os_netbsd.c
index 936334cac..7679ec255 100644
--- a/src/pkg/runtime/os_netbsd.c
+++ b/src/pkg/runtime/os_netbsd.c
@@ -292,14 +292,17 @@ static int8 badsignal[] = "runtime: signal received on thread not created by Go:
void
runtime·badsignal(int32 sig)
{
+ int32 len;
+
if (sig == SIGPROF) {
return; // Ignore SIGPROFs intended for a non-Go thread.
}
runtime·write(2, badsignal, sizeof badsignal - 1);
if (0 <= sig && sig < NSIG) {
- // Call runtime·findnull dynamically to circumvent static stack size check.
- static int32 (*findnull)(byte*) = runtime·findnull;
- runtime·write(2, runtime·sigtab[sig].name, findnull((byte*)runtime·sigtab[sig].name));
+ // Can't call findnull() because it will split stack.
+ for(len = 0; runtime·sigtab[sig].name[len]; len++)
+ ;
+ runtime·write(2, runtime·sigtab[sig].name, len);
}
runtime·write(2, "\n", 1);
runtime·exit(1);
diff --git a/src/pkg/runtime/os_openbsd.c b/src/pkg/runtime/os_openbsd.c
index 4ce64f9f2..4ce102ec2 100644
--- a/src/pkg/runtime/os_openbsd.c
+++ b/src/pkg/runtime/os_openbsd.c
@@ -274,14 +274,17 @@ static int8 badsignal[] = "runtime: signal received on thread not created by Go:
void
runtime·badsignal(int32 sig)
{
+ int32 len;
+
if (sig == SIGPROF) {
return; // Ignore SIGPROFs intended for a non-Go thread.
}
runtime·write(2, badsignal, sizeof badsignal - 1);
if (0 <= sig && sig < NSIG) {
- // Call runtime·findnull dynamically to circumvent static stack size check.
- static int32 (*findnull)(byte*) = runtime·findnull;
- runtime·write(2, runtime·sigtab[sig].name, findnull((byte*)runtime·sigtab[sig].name));
+ // Can't call findnull() because it will split stack.
+ for(len = 0; runtime·sigtab[sig].name[len]; len++)
+ ;
+ runtime·write(2, runtime·sigtab[sig].name, len);
}
runtime·write(2, "\n", 1);
runtime·exit(1);
diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c
index eec7531e1..018a453d6 100644
--- a/src/pkg/runtime/proc.c
+++ b/src/pkg/runtime/proc.c
@@ -695,6 +695,7 @@ runtime·dropm(void)
// Undo whatever initialization minit did during needm.
runtime·unminit();
+ m->seh = nil; // reset dangling typed pointer
// Clear m and g, and return m to the extra list.
// After the call to setmg we can only call nosplit functions.
@@ -874,6 +875,13 @@ handoffp(P *p)
startm(p, false);
return;
}
+ // If this is the last running P and nobody is polling network,
+ // need to wakeup another M to poll network.
+ if(runtime·sched.npidle == runtime·gomaxprocs-1 && runtime·atomicload64(&runtime·sched.lastpoll) != 0) {
+ runtime·unlock(&runtime·sched);
+ startm(p, false);
+ return;
+ }
pidleput(p);
runtime·unlock(&runtime·sched);
}
@@ -1177,6 +1185,7 @@ park0(G *gp)
if(m->waitunlockf) {
m->waitunlockf(m->waitlock);
m->waitunlockf = nil;
+ m->waitlock = nil;
}
if(m->lockedg) {
stoplockedm();
diff --git a/src/pkg/runtime/race/doc.go b/src/pkg/runtime/race/doc.go
new file mode 100644
index 000000000..aef805dad
--- /dev/null
+++ b/src/pkg/runtime/race/doc.go
@@ -0,0 +1,9 @@
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Package race implements data race detection logic.
+// No public interface is provided.
+// For details about the race detector see
+// http://golang.org/doc/articles/race_detector.html
+package race
diff --git a/src/pkg/runtime/race/race.go b/src/pkg/runtime/race/race.go
index b0a5c9a50..ee13057e3 100644
--- a/src/pkg/runtime/race/race.go
+++ b/src/pkg/runtime/race/race.go
@@ -4,7 +4,6 @@
// +build race,linux,amd64 race,darwin,amd64 race,windows,amd64
-// Package race provides low-level facilities for data race detection.
package race
/*
diff --git a/src/pkg/runtime/race/race_test.go b/src/pkg/runtime/race/race_test.go
index c77569c37..47d34d7ad 100644
--- a/src/pkg/runtime/race/race_test.go
+++ b/src/pkg/runtime/race/race_test.go
@@ -147,7 +147,7 @@ func runTests() ([]byte, error) {
// It is required because the tests contain a lot of data races on the same addresses
// (the tests are simple and the memory is constantly reused).
for _, env := range os.Environ() {
- if strings.HasPrefix(env, "GOMAXPROCS=") {
+ if strings.HasPrefix(env, "GOMAXPROCS=") || strings.HasPrefix(env, "GOGCTRACE=") {
continue
}
cmd.Env = append(cmd.Env, env)
diff --git a/src/pkg/runtime/race/testdata/atomic_test.go b/src/pkg/runtime/race/testdata/atomic_test.go
index 0c5c2c008..fc569b96c 100644
--- a/src/pkg/runtime/race/testdata/atomic_test.go
+++ b/src/pkg/runtime/race/testdata/atomic_test.go
@@ -6,6 +6,7 @@ package race_test
import (
"runtime"
+ "sync"
"sync/atomic"
"testing"
"unsafe"
@@ -269,3 +270,21 @@ func TestRaceAtomicAddStore(t *testing.T) {
a = 42
<-c
}
+
+// A nil pointer in an atomic operation should not deadlock
+// the rest of the program. Used to hang indefinitely.
+func TestNoRaceAtomicCrash(t *testing.T) {
+ var mutex sync.Mutex
+ var nilptr *int32
+ panics := 0
+ defer func() {
+ if x := recover(); x != nil {
+ mutex.Lock()
+ panics++
+ mutex.Unlock()
+ } else {
+ panic("no panic")
+ }
+ }()
+ atomic.AddInt32(nilptr, 1)
+}
diff --git a/src/pkg/runtime/race/testdata/sync_test.go b/src/pkg/runtime/race/testdata/sync_test.go
index e80ba3b74..93af0b1e6 100644
--- a/src/pkg/runtime/race/testdata/sync_test.go
+++ b/src/pkg/runtime/race/testdata/sync_test.go
@@ -195,3 +195,22 @@ func TestRaceGoroutineCreationStack(t *testing.T) {
x = 2
<-ch
}
+
+// A nil pointer in a mutex method call should not
+// corrupt the race detector state.
+// Used to hang indefinitely.
+func TestNoRaceNilMutexCrash(t *testing.T) {
+ var mutex sync.Mutex
+ panics := 0
+ defer func() {
+ if x := recover(); x != nil {
+ mutex.Lock()
+ panics++
+ mutex.Unlock()
+ } else {
+ panic("no panic")
+ }
+ }()
+ var othermutex *sync.RWMutex
+ othermutex.RLock()
+}
diff --git a/src/pkg/runtime/runtime.h b/src/pkg/runtime/runtime.h
index 864b2aa5f..cb72b92d6 100644
--- a/src/pkg/runtime/runtime.h
+++ b/src/pkg/runtime/runtime.h
@@ -50,11 +50,11 @@ typedef uint8 byte;
typedef struct Func Func;
typedef struct G G;
typedef struct Gobuf Gobuf;
-typedef union Lock Lock;
+typedef struct Lock Lock;
typedef struct M M;
typedef struct P P;
typedef struct Mem Mem;
-typedef union Note Note;
+typedef struct Note Note;
typedef struct Slice Slice;
typedef struct Stktop Stktop;
typedef struct String String;
@@ -156,15 +156,19 @@ enum
/*
* structures
*/
-union Lock
+struct Lock
{
- uint32 key; // futex-based impl
- M* waitm; // linked list of waiting M's (sema-based impl)
+ // Futex-based impl treats it as uint32 key,
+ // while sema-based impl as M* waitm.
+ // Used to be a union, but unions break precise GC.
+ uintptr key;
};
-union Note
+struct Note
{
- uint32 key; // futex-based impl
- M* waitm; // waiting M (sema-based impl)
+ // Futex-based impl treats it as uint32 key,
+ // while sema-based impl as M* waitm.
+ // Used to be a union, but unions break precise GC.
+ uintptr key;
};
struct String
{
@@ -317,7 +321,7 @@ struct M
bool needextram;
void* racepc;
void (*waitunlockf)(Lock*);
- Lock* waitlock;
+ void* waitlock;
uint32 moreframesize_minalloc;
uintptr settype_buf[1024];
@@ -507,7 +511,7 @@ struct ParFor
struct CgoMal
{
CgoMal *next;
- byte *alloc;
+ void *alloc;
};
/*
diff --git a/src/pkg/runtime/sema.goc b/src/pkg/runtime/sema.goc
index c4b5247b3..4df01fc4e 100644
--- a/src/pkg/runtime/sema.goc
+++ b/src/pkg/runtime/sema.goc
@@ -44,13 +44,13 @@ struct SemaRoot
// Prime to not correlate with any user patterns.
#define SEMTABLESZ 251
-union semtable
+struct semtable
{
SemaRoot;
- uint8 pad[CacheLineSize];
+ uint8 pad[CacheLineSize-sizeof(SemaRoot)];
};
#pragma dataflag 16 /* mark semtable as 'no pointers', hiding from garbage collector */
-static union semtable semtable[SEMTABLESZ];
+static struct semtable semtable[SEMTABLESZ];
static SemaRoot*
semroot(uint32 *addr)
diff --git a/src/pkg/runtime/signal_openbsd_386.h b/src/pkg/runtime/signal_openbsd_386.h
index 0ba66ab9f..6742db8d4 100644
--- a/src/pkg/runtime/signal_openbsd_386.h
+++ b/src/pkg/runtime/signal_openbsd_386.h
@@ -20,4 +20,4 @@
#define SIG_GS(info, ctxt) (SIG_REGS(ctxt).sc_gs)
#define SIG_CODE0(info, ctxt) ((info)->si_code)
-#define SIG_CODE1(info, ctxt) ((uintptr)(info)->si_addr)
+#define SIG_CODE1(info, ctxt) (*(uintptr*)((byte*)info + 12))
diff --git a/src/pkg/sort/sort.go b/src/pkg/sort/sort.go
index e10961992..d3092e801 100644
--- a/src/pkg/sort/sort.go
+++ b/src/pkg/sort/sort.go
@@ -6,8 +6,6 @@
// collections.
package sort
-import "math"
-
// A type, typically a collection, that satisfies sort.Interface can be
// sorted by the routines in this package. The methods require that the
// elements of the collection be enumerated by an integer index.
@@ -245,9 +243,14 @@ func (p IntSlice) Sort() { Sort(p) }
type Float64Slice []float64
func (p Float64Slice) Len() int { return len(p) }
-func (p Float64Slice) Less(i, j int) bool { return p[i] < p[j] || math.IsNaN(p[i]) && !math.IsNaN(p[j]) }
+func (p Float64Slice) Less(i, j int) bool { return p[i] < p[j] || isNaN(p[i]) && !isNaN(p[j]) }
func (p Float64Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
+// isNaN is a copy of math.IsNaN to avoid a dependency on the math package.
+func isNaN(f float64) bool {
+ return f != f
+}
+
// Sort is a convenience method.
func (p Float64Slice) Sort() { Sort(p) }
diff --git a/src/pkg/sync/atomic/race.go b/src/pkg/sync/atomic/race.go
index 242bbf298..2320b5707 100644
--- a/src/pkg/sync/atomic/race.go
+++ b/src/pkg/sync/atomic/race.go
@@ -25,6 +25,7 @@ func CompareAndSwapInt32(val *int32, old, new int32) bool {
}
func CompareAndSwapUint32(val *uint32, old, new uint32) (swapped bool) {
+ _ = *val
swapped = false
runtime.RaceSemacquire(&mtx)
runtime.RaceRead(unsafe.Pointer(val))
@@ -43,6 +44,7 @@ func CompareAndSwapInt64(val *int64, old, new int64) bool {
}
func CompareAndSwapUint64(val *uint64, old, new uint64) (swapped bool) {
+ _ = *val
swapped = false
runtime.RaceSemacquire(&mtx)
runtime.RaceRead(unsafe.Pointer(val))
@@ -57,6 +59,7 @@ func CompareAndSwapUint64(val *uint64, old, new uint64) (swapped bool) {
}
func CompareAndSwapPointer(val *unsafe.Pointer, old, new unsafe.Pointer) (swapped bool) {
+ _ = *val
swapped = false
runtime.RaceSemacquire(&mtx)
runtime.RaceRead(unsafe.Pointer(val))
@@ -71,6 +74,7 @@ func CompareAndSwapPointer(val *unsafe.Pointer, old, new unsafe.Pointer) (swappe
}
func CompareAndSwapUintptr(val *uintptr, old, new uintptr) (swapped bool) {
+ _ = *val
swapped = false
runtime.RaceSemacquire(&mtx)
runtime.RaceRead(unsafe.Pointer(val))
@@ -89,6 +93,7 @@ func AddInt32(val *int32, delta int32) int32 {
}
func AddUint32(val *uint32, delta uint32) (new uint32) {
+ _ = *val
runtime.RaceSemacquire(&mtx)
runtime.RaceRead(unsafe.Pointer(val))
runtime.RaceAcquire(unsafe.Pointer(val))
@@ -105,6 +110,7 @@ func AddInt64(val *int64, delta int64) int64 {
}
func AddUint64(val *uint64, delta uint64) (new uint64) {
+ _ = *val
runtime.RaceSemacquire(&mtx)
runtime.RaceRead(unsafe.Pointer(val))
runtime.RaceAcquire(unsafe.Pointer(val))
@@ -117,6 +123,7 @@ func AddUint64(val *uint64, delta uint64) (new uint64) {
}
func AddUintptr(val *uintptr, delta uintptr) (new uintptr) {
+ _ = *val
runtime.RaceSemacquire(&mtx)
runtime.RaceRead(unsafe.Pointer(val))
runtime.RaceAcquire(unsafe.Pointer(val))
@@ -133,6 +140,7 @@ func LoadInt32(addr *int32) int32 {
}
func LoadUint32(addr *uint32) (val uint32) {
+ _ = *addr
runtime.RaceSemacquire(&mtx)
runtime.RaceRead(unsafe.Pointer(addr))
runtime.RaceAcquire(unsafe.Pointer(addr))
@@ -146,6 +154,7 @@ func LoadInt64(addr *int64) int64 {
}
func LoadUint64(addr *uint64) (val uint64) {
+ _ = *addr
runtime.RaceSemacquire(&mtx)
runtime.RaceRead(unsafe.Pointer(addr))
runtime.RaceAcquire(unsafe.Pointer(addr))
@@ -155,6 +164,7 @@ func LoadUint64(addr *uint64) (val uint64) {
}
func LoadPointer(addr *unsafe.Pointer) (val unsafe.Pointer) {
+ _ = *addr
runtime.RaceSemacquire(&mtx)
runtime.RaceRead(unsafe.Pointer(addr))
runtime.RaceAcquire(unsafe.Pointer(addr))
@@ -164,6 +174,7 @@ func LoadPointer(addr *unsafe.Pointer) (val unsafe.Pointer) {
}
func LoadUintptr(addr *uintptr) (val uintptr) {
+ _ = *addr
runtime.RaceSemacquire(&mtx)
runtime.RaceRead(unsafe.Pointer(addr))
runtime.RaceAcquire(unsafe.Pointer(addr))
@@ -177,6 +188,7 @@ func StoreInt32(addr *int32, val int32) {
}
func StoreUint32(addr *uint32, val uint32) {
+ _ = *addr
runtime.RaceSemacquire(&mtx)
runtime.RaceRead(unsafe.Pointer(addr))
*addr = val
@@ -189,6 +201,7 @@ func StoreInt64(addr *int64, val int64) {
}
func StoreUint64(addr *uint64, val uint64) {
+ _ = *addr
runtime.RaceSemacquire(&mtx)
runtime.RaceRead(unsafe.Pointer(addr))
*addr = val
@@ -197,6 +210,7 @@ func StoreUint64(addr *uint64, val uint64) {
}
func StorePointer(addr *unsafe.Pointer, val unsafe.Pointer) {
+ _ = *addr
runtime.RaceSemacquire(&mtx)
runtime.RaceRead(unsafe.Pointer(addr))
*addr = val
@@ -205,6 +219,7 @@ func StorePointer(addr *unsafe.Pointer, val unsafe.Pointer) {
}
func StoreUintptr(addr *uintptr, val uintptr) {
+ _ = *addr
runtime.RaceSemacquire(&mtx)
runtime.RaceRead(unsafe.Pointer(addr))
*addr = val
diff --git a/src/pkg/sync/cond.go b/src/pkg/sync/cond.go
index 491b98569..13547a8a1 100644
--- a/src/pkg/sync/cond.go
+++ b/src/pkg/sync/cond.go
@@ -57,6 +57,7 @@ func NewCond(l Locker) *Cond {
//
func (c *Cond) Wait() {
if raceenabled {
+ _ = c.m.state
raceDisable()
}
c.m.Lock()
@@ -80,6 +81,7 @@ func (c *Cond) Wait() {
// during the call.
func (c *Cond) Signal() {
if raceenabled {
+ _ = c.m.state
raceDisable()
}
c.m.Lock()
@@ -106,6 +108,7 @@ func (c *Cond) Signal() {
// during the call.
func (c *Cond) Broadcast() {
if raceenabled {
+ _ = c.m.state
raceDisable()
}
c.m.Lock()
diff --git a/src/pkg/sync/mutex.go b/src/pkg/sync/mutex.go
index b4629ebca..73b337702 100644
--- a/src/pkg/sync/mutex.go
+++ b/src/pkg/sync/mutex.go
@@ -81,6 +81,7 @@ func (m *Mutex) Lock() {
// arrange for another goroutine to unlock it.
func (m *Mutex) Unlock() {
if raceenabled {
+ _ = m.state
raceRelease(unsafe.Pointer(m))
}
diff --git a/src/pkg/sync/rwmutex.go b/src/pkg/sync/rwmutex.go
index b494c6435..3db541995 100644
--- a/src/pkg/sync/rwmutex.go
+++ b/src/pkg/sync/rwmutex.go
@@ -28,6 +28,7 @@ const rwmutexMaxReaders = 1 << 30
// RLock locks rw for reading.
func (rw *RWMutex) RLock() {
if raceenabled {
+ _ = rw.w.state
raceDisable()
}
if atomic.AddInt32(&rw.readerCount, 1) < 0 {
@@ -46,6 +47,7 @@ func (rw *RWMutex) RLock() {
// on entry to RUnlock.
func (rw *RWMutex) RUnlock() {
if raceenabled {
+ _ = rw.w.state
raceReleaseMerge(unsafe.Pointer(&rw.writerSem))
raceDisable()
}
@@ -69,6 +71,7 @@ func (rw *RWMutex) RUnlock() {
// the lock.
func (rw *RWMutex) Lock() {
if raceenabled {
+ _ = rw.w.state
raceDisable()
}
// First, resolve competition with other writers.
@@ -94,6 +97,7 @@ func (rw *RWMutex) Lock() {
// arrange for another goroutine to RUnlock (Unlock) it.
func (rw *RWMutex) Unlock() {
if raceenabled {
+ _ = rw.w.state
raceRelease(unsafe.Pointer(&rw.readerSem))
raceRelease(unsafe.Pointer(&rw.writerSem))
raceDisable()
diff --git a/src/pkg/sync/waitgroup.go b/src/pkg/sync/waitgroup.go
index 1277f1c6d..ca3883783 100644
--- a/src/pkg/sync/waitgroup.go
+++ b/src/pkg/sync/waitgroup.go
@@ -43,6 +43,7 @@ type WaitGroup struct {
// other event to be waited for. See the WaitGroup example.
func (wg *WaitGroup) Add(delta int) {
if raceenabled {
+ _ = wg.m.state
raceReleaseMerge(unsafe.Pointer(wg))
raceDisable()
defer raceEnable()
@@ -71,6 +72,7 @@ func (wg *WaitGroup) Done() {
// Wait blocks until the WaitGroup counter is zero.
func (wg *WaitGroup) Wait() {
if raceenabled {
+ _ = wg.m.state
raceDisable()
}
if atomic.LoadInt32(&wg.counter) == 0 {
diff --git a/src/pkg/syscall/exec_bsd.go b/src/pkg/syscall/exec_bsd.go
index bc644d97a..5d3d57813 100644
--- a/src/pkg/syscall/exec_bsd.go
+++ b/src/pkg/syscall/exec_bsd.go
@@ -39,10 +39,18 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
i int
)
+ // guard against side effects of shuffling fds below.
+ // Make sure that nextfd is beyond any currently open files so
+ // that we can't run the risk of overwriting any of them.
fd := make([]int, len(attr.Files))
+ nextfd = len(attr.Files)
for i, ufd := range attr.Files {
+ if nextfd < int(ufd) {
+ nextfd = int(ufd)
+ }
fd[i] = int(ufd)
}
+ nextfd++
darwin := runtime.GOOS == "darwin"
@@ -131,7 +139,6 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
// Pass 1: look for fd[i] < i and move those up above len(fd)
// so that pass 2 won't stomp on an fd it needs later.
- nextfd = int(len(fd))
if pipe < nextfd {
_, _, err1 = RawSyscall(SYS_DUP2, uintptr(pipe), uintptr(nextfd), 0)
if err1 != 0 {
diff --git a/src/pkg/syscall/exec_linux.go b/src/pkg/syscall/exec_linux.go
index a8dc672b8..ddd946ed2 100644
--- a/src/pkg/syscall/exec_linux.go
+++ b/src/pkg/syscall/exec_linux.go
@@ -40,11 +40,18 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
i int
)
- // guard against side effects of shuffling fds below.
+ // Guard against side effects of shuffling fds below.
+ // Make sure that nextfd is beyond any currently open files so
+ // that we can't run the risk of overwriting any of them.
fd := make([]int, len(attr.Files))
+ nextfd = len(attr.Files)
for i, ufd := range attr.Files {
+ if nextfd < int(ufd) {
+ nextfd = int(ufd)
+ }
fd[i] = int(ufd)
}
+ nextfd++
// About to call fork.
// No more allocation or calls of non-assembly functions.
@@ -143,7 +150,6 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
// Pass 1: look for fd[i] < i and move those up above len(fd)
// so that pass 2 won't stomp on an fd it needs later.
- nextfd = int(len(fd))
if pipe < nextfd {
_, _, err1 = RawSyscall(SYS_DUP2, uintptr(pipe), uintptr(nextfd), 0)
if err1 != 0 {
diff --git a/src/pkg/syscall/exec_plan9.go b/src/pkg/syscall/exec_plan9.go
index ebd57f3e3..99ad2f158 100644
--- a/src/pkg/syscall/exec_plan9.go
+++ b/src/pkg/syscall/exec_plan9.go
@@ -183,11 +183,18 @@ func forkAndExecInChild(argv0 *byte, argv []*byte, envv []envItem, dir *byte, at
errbuf [ERRMAX]byte
)
- // guard against side effects of shuffling fds below.
+ // Guard against side effects of shuffling fds below.
+ // Make sure that nextfd is beyond any currently open files so
+ // that we can't run the risk of overwriting any of them.
fd := make([]int, len(attr.Files))
+ nextfd = len(attr.Files)
for i, ufd := range attr.Files {
+ if nextfd < int(ufd) {
+ nextfd = int(ufd)
+ }
fd[i] = int(ufd)
}
+ nextfd++
if envv != nil {
clearenv = RFCENVG
@@ -251,7 +258,6 @@ func forkAndExecInChild(argv0 *byte, argv []*byte, envv []envItem, dir *byte, at
// Pass 1: look for fd[i] < i and move those up above len(fd)
// so that pass 2 won't stomp on an fd it needs later.
- nextfd = int(len(fd))
if pipe < nextfd {
r1, _, _ = RawSyscall(SYS_DUP, uintptr(pipe), uintptr(nextfd), 0)
if int32(r1) == -1 {
diff --git a/src/pkg/syscall/syscall_darwin.go b/src/pkg/syscall/syscall_darwin.go
index 7fe406aaa..75ef8f0a9 100644
--- a/src/pkg/syscall/syscall_darwin.go
+++ b/src/pkg/syscall/syscall_darwin.go
@@ -125,7 +125,7 @@ func Kill(pid int, signum Signal) (err error) { return kill(pid, int(signum), 1)
//sys Exchangedata(path1 string, path2 string, options int) (err error)
//sys Exit(code int)
//sys Fchdir(fd int) (err error)
-//sys Fchflags(path string, flags int) (err error)
+//sys Fchflags(fd int, flags int) (err error)
//sys Fchmod(fd int, mode uint32) (err error)
//sys Fchown(fd int, uid int, gid int) (err error)
//sys Flock(fd int, how int) (err error)
diff --git a/src/pkg/syscall/syscall_freebsd.go b/src/pkg/syscall/syscall_freebsd.go
index c7ffe223e..9fbcc48c6 100644
--- a/src/pkg/syscall/syscall_freebsd.go
+++ b/src/pkg/syscall/syscall_freebsd.go
@@ -118,7 +118,7 @@ func SetsockoptIPMreqn(fd, level, opt int, mreq *IPMreqn) (err error) {
//sysnb Dup2(from int, to int) (err error)
//sys Exit(code int)
//sys Fchdir(fd int) (err error)
-//sys Fchflags(path string, flags int) (err error)
+//sys Fchflags(fd int, flags int) (err error)
//sys Fchmod(fd int, mode uint32) (err error)
//sys Fchown(fd int, uid int, gid int) (err error)
//sys Flock(fd int, how int) (err error)
diff --git a/src/pkg/syscall/syscall_netbsd.go b/src/pkg/syscall/syscall_netbsd.go
index b0fa1112d..97812717f 100644
--- a/src/pkg/syscall/syscall_netbsd.go
+++ b/src/pkg/syscall/syscall_netbsd.go
@@ -152,7 +152,7 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
//sysnb Dup2(from int, to int) (err error)
//sys Exit(code int)
//sys Fchdir(fd int) (err error)
-//sys Fchflags(path string, flags int) (err error)
+//sys Fchflags(fd int, flags int) (err error)
//sys Fchmod(fd int, mode uint32) (err error)
//sys Fchown(fd int, uid int, gid int) (err error)
//sys Flock(fd int, how int) (err error)
diff --git a/src/pkg/syscall/syscall_openbsd.go b/src/pkg/syscall/syscall_openbsd.go
index a146dca2c..89c73215a 100644
--- a/src/pkg/syscall/syscall_openbsd.go
+++ b/src/pkg/syscall/syscall_openbsd.go
@@ -110,7 +110,7 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
//sysnb Dup2(from int, to int) (err error)
//sys Exit(code int)
//sys Fchdir(fd int) (err error)
-//sys Fchflags(path string, flags int) (err error)
+//sys Fchflags(fd int, flags int) (err error)
//sys Fchmod(fd int, mode uint32) (err error)
//sys Fchown(fd int, uid int, gid int) (err error)
//sys Flock(fd int, how int) (err error)
diff --git a/src/pkg/syscall/zsyscall_darwin_386.go b/src/pkg/syscall/zsyscall_darwin_386.go
index 2f99b7f6c..98500792d 100644
--- a/src/pkg/syscall/zsyscall_darwin_386.go
+++ b/src/pkg/syscall/zsyscall_darwin_386.go
@@ -458,13 +458,8 @@ func Fchdir(fd int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func Fchflags(path string, flags int) (err error) {
- var _p0 *byte
- _p0, err = BytePtrFromString(path)
- if err != nil {
- return
- }
- _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
+func Fchflags(fd int, flags int) (err error) {
+ _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0)
if e1 != 0 {
err = e1
}
diff --git a/src/pkg/syscall/zsyscall_darwin_amd64.go b/src/pkg/syscall/zsyscall_darwin_amd64.go
index 0f08df4c5..ee810e076 100644
--- a/src/pkg/syscall/zsyscall_darwin_amd64.go
+++ b/src/pkg/syscall/zsyscall_darwin_amd64.go
@@ -458,13 +458,8 @@ func Fchdir(fd int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func Fchflags(path string, flags int) (err error) {
- var _p0 *byte
- _p0, err = BytePtrFromString(path)
- if err != nil {
- return
- }
- _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
+func Fchflags(fd int, flags int) (err error) {
+ _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0)
if e1 != 0 {
err = e1
}
diff --git a/src/pkg/syscall/zsyscall_freebsd_386.go b/src/pkg/syscall/zsyscall_freebsd_386.go
index 5ca0bcb16..631994fba 100644
--- a/src/pkg/syscall/zsyscall_freebsd_386.go
+++ b/src/pkg/syscall/zsyscall_freebsd_386.go
@@ -418,13 +418,8 @@ func Fchdir(fd int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func Fchflags(path string, flags int) (err error) {
- var _p0 *byte
- _p0, err = BytePtrFromString(path)
- if err != nil {
- return
- }
- _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
+func Fchflags(fd int, flags int) (err error) {
+ _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0)
if e1 != 0 {
err = e1
}
diff --git a/src/pkg/syscall/zsyscall_freebsd_amd64.go b/src/pkg/syscall/zsyscall_freebsd_amd64.go
index 260677473..1d5180853 100644
--- a/src/pkg/syscall/zsyscall_freebsd_amd64.go
+++ b/src/pkg/syscall/zsyscall_freebsd_amd64.go
@@ -418,13 +418,8 @@ func Fchdir(fd int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func Fchflags(path string, flags int) (err error) {
- var _p0 *byte
- _p0, err = BytePtrFromString(path)
- if err != nil {
- return
- }
- _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
+func Fchflags(fd int, flags int) (err error) {
+ _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0)
if e1 != 0 {
err = e1
}
diff --git a/src/pkg/syscall/zsyscall_netbsd_386.go b/src/pkg/syscall/zsyscall_netbsd_386.go
index 10ac072db..0ee19bee1 100644
--- a/src/pkg/syscall/zsyscall_netbsd_386.go
+++ b/src/pkg/syscall/zsyscall_netbsd_386.go
@@ -435,13 +435,8 @@ func Fchdir(fd int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func Fchflags(path string, flags int) (err error) {
- var _p0 *byte
- _p0, err = BytePtrFromString(path)
- if err != nil {
- return
- }
- _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
+func Fchflags(fd int, flags int) (err error) {
+ _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0)
if e1 != 0 {
err = e1
}
diff --git a/src/pkg/syscall/zsyscall_netbsd_amd64.go b/src/pkg/syscall/zsyscall_netbsd_amd64.go
index f10dc0bf4..b9d272144 100644
--- a/src/pkg/syscall/zsyscall_netbsd_amd64.go
+++ b/src/pkg/syscall/zsyscall_netbsd_amd64.go
@@ -435,13 +435,8 @@ func Fchdir(fd int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func Fchflags(path string, flags int) (err error) {
- var _p0 *byte
- _p0, err = BytePtrFromString(path)
- if err != nil {
- return
- }
- _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
+func Fchflags(fd int, flags int) (err error) {
+ _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0)
if e1 != 0 {
err = e1
}
diff --git a/src/pkg/syscall/zsyscall_openbsd_386.go b/src/pkg/syscall/zsyscall_openbsd_386.go
index 60e907bd2..2c2a56732 100644
--- a/src/pkg/syscall/zsyscall_openbsd_386.go
+++ b/src/pkg/syscall/zsyscall_openbsd_386.go
@@ -416,13 +416,8 @@ func Fchdir(fd int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func Fchflags(path string, flags int) (err error) {
- var _p0 *byte
- _p0, err = BytePtrFromString(path)
- if err != nil {
- return
- }
- _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
+func Fchflags(fd int, flags int) (err error) {
+ _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0)
if e1 != 0 {
err = e1
}
diff --git a/src/pkg/syscall/zsyscall_openbsd_amd64.go b/src/pkg/syscall/zsyscall_openbsd_amd64.go
index 1403dd7e7..4e1470696 100644
--- a/src/pkg/syscall/zsyscall_openbsd_amd64.go
+++ b/src/pkg/syscall/zsyscall_openbsd_amd64.go
@@ -416,13 +416,8 @@ func Fchdir(fd int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
-func Fchflags(path string, flags int) (err error) {
- var _p0 *byte
- _p0, err = BytePtrFromString(path)
- if err != nil {
- return
- }
- _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(unsafe.Pointer(_p0)), uintptr(flags), 0)
+func Fchflags(fd int, flags int) (err error) {
+ _, _, e1 := Syscall(SYS_FCHFLAGS, uintptr(fd), uintptr(flags), 0)
if e1 != 0 {
err = e1
}
diff --git a/src/pkg/testing/iotest/reader.go b/src/pkg/testing/iotest/reader.go
index 441b9102d..a5bccca90 100644
--- a/src/pkg/testing/iotest/reader.go
+++ b/src/pkg/testing/iotest/reader.go
@@ -37,9 +37,11 @@ func (r *halfReader) Read(p []byte) (int, error) {
return r.r.Read(p[0 : (len(p)+1)/2])
}
-// DataErrReader returns a Reader that returns the final
-// error with the last data read, instead of by itself with
-// zero bytes of data.
+// DataErrReader changes the way errors are handled by a Reader. Normally, a
+// Reader returns an error (typically EOF) from the first Read call after the
+// last piece of data is read. DataErrReader wraps a Reader and changes its
+// behavior so the final error is returned along with the final data, instead
+// of in the first call after the final data.
func DataErrReader(r io.Reader) io.Reader { return &dataErrReader{r, nil, make([]byte, 1024)} }
type dataErrReader struct {
diff --git a/src/pkg/text/template/funcs.go b/src/pkg/text/template/funcs.go
index 31549dc45..818766364 100644
--- a/src/pkg/text/template/funcs.go
+++ b/src/pkg/text/template/funcs.go
@@ -18,7 +18,7 @@ import (
// FuncMap is the type of the map defining the mapping from names to functions.
// Each function must have either a single return value, or two return values of
// which the second has type error. In that case, if the second (error)
-// argument evaluates to non-nil during execution, execution terminates and
+// return value evaluates to non-nil during execution, execution terminates and
// Execute returns that error.
type FuncMap map[string]interface{}
diff --git a/src/pkg/time/example_test.go b/src/pkg/time/example_test.go
index 8928caaba..cfa5b38c5 100644
--- a/src/pkg/time/example_test.go
+++ b/src/pkg/time/example_test.go
@@ -58,20 +58,25 @@ func ExampleDate() {
}
func ExampleTime_Format() {
- const format = "Jan 2, 2006 at 3:04pm (MST)"
+ // layout shows by example how the reference time should be represented.
+ const layout = "Jan 2, 2006 at 3:04pm (MST)"
t := time.Date(2009, time.November, 10, 15, 0, 0, 0, time.Local)
- fmt.Println(t.Format(format))
- fmt.Println(t.UTC().Format(format))
+ fmt.Println(t.Format(layout))
+ fmt.Println(t.UTC().Format(layout))
// Output:
// Nov 10, 2009 at 3:00pm (PST)
// Nov 10, 2009 at 11:00pm (UTC)
}
func ExampleParse() {
+ // longForm shows by example how the reference time would be represented in
+ // the desired layout.
const longForm = "Jan 2, 2006 at 3:04pm (MST)"
t, _ := time.Parse(longForm, "Feb 3, 2013 at 7:54pm (PST)")
fmt.Println(t)
+ // shortForm is another way the reference time would be represented
+ // in the desired layout; it has no time zone present.
// Note: without explicit zone, returns time in UTC.
const shortForm = "2006-Jan-02"
t, _ = time.Parse(shortForm, "2013-Feb-03")
diff --git a/src/pkg/time/format.go b/src/pkg/time/format.go
index 817c79a80..7fe040231 100644
--- a/src/pkg/time/format.go
+++ b/src/pkg/time/format.go
@@ -6,15 +6,17 @@ package time
import "errors"
-// These are predefined layouts for use in Time.Format.
-// The standard time used in the layouts is:
+// These are predefined layouts for use in Time.Format and Time.Parse.
+// The reference time used in the layouts is:
// Mon Jan 2 15:04:05 MST 2006
// which is Unix time 1136239445. Since MST is GMT-0700,
-// the standard time can be thought of as
+// the reference time can be thought of as
// 01/02 03:04:05PM '06 -0700
-// To define your own format, write down what the standard time would look
+// To define your own format, write down what the reference time would look
// like formatted your way; see the values of constants like ANSIC,
-// StampMicro or Kitchen for examples.
+// StampMicro or Kitchen for examples. The model is to demonstrate what the
+// reference time looks like so that the Format and Parse methods can apply
+// the same transformation to a general time value.
//
// Within the format string, an underscore _ represents a space that may be
// replaced by a digit if the following number (a day) has two digits; for
@@ -367,13 +369,16 @@ func (t Time) String() string {
}
// Format returns a textual representation of the time value formatted
-// according to layout. The layout defines the format by showing the
-// representation of the standard time,
+// according to layout, which defines the format by showing how the reference
+// time,
// Mon Jan 2 15:04:05 -0700 MST 2006
-// which is then used to describe the time to be formatted. Predefined
-// layouts ANSIC, UnixDate, RFC3339 and others describe standard
-// representations. For more information about the formats and the
-// definition of the standard time, see the documentation for ANSIC.
+// would be displayed if it were the value; it serves as an example of the
+// desired output. The same display rules will then be applied to the time
+// value.
+// Predefined layouts ANSIC, UnixDate, RFC3339 and others describe standard
+// and convenient representations of the reference time. For more information
+// about the formats and the definition of the reference time, see the
+// documentation for ANSIC and the other constants defined by this package.
func (t Time) Format(layout string) string {
var (
name, offset, abs = t.locabs()
@@ -627,13 +632,15 @@ func skip(value, prefix string) (string, error) {
}
// Parse parses a formatted string and returns the time value it represents.
-// The layout defines the format by showing the representation of the
-// standard time,
+// The layout defines the format by showing how the reference time,
// Mon Jan 2 15:04:05 -0700 MST 2006
-// which is then used to describe the string to be parsed. Predefined layouts
-// ANSIC, UnixDate, RFC3339 and others describe standard representations. For
-// more information about the formats and the definition of the standard
-// time, see the documentation for ANSIC.
+// would be interpreted if it were the value; it serves as an example of
+// the input format. The same interpretation will then be made to the
+// input string.
+// Predefined layouts ANSIC, UnixDate, RFC3339 and others describe standard
+// and convenient representations of the reference time. For more information
+// about the formats and the definition of the reference time, see the
+// documentation for ANSIC and the other constants defined by this package.
//
// Elements omitted from the value are assumed to be zero or, when
// zero is impossible, one, so parsing "3:04pm" returns the time
diff --git a/src/pkg/time/sleep_test.go b/src/pkg/time/sleep_test.go
index 9908e220f..1322f0611 100644
--- a/src/pkg/time/sleep_test.go
+++ b/src/pkg/time/sleep_test.go
@@ -60,10 +60,11 @@ func TestAfterStress(t *testing.T) {
Sleep(Nanosecond)
}
}()
- c := Tick(1)
+ ticker := NewTicker(1)
for i := 0; i < 100; i++ {
- <-c
+ <-ticker.C
}
+ ticker.Stop()
atomic.StoreUint32(&stop, 1)
}
diff --git a/src/run.bash b/src/run.bash
index b197844fe..305ff7f41 100755
--- a/src/run.bash
+++ b/src/run.bash
@@ -150,7 +150,7 @@ time go run run.go
echo
echo '# Checking API compatibility.'
-go tool api -c $GOROOT/api/go1.txt -next $GOROOT/api/next.txt -except $GOROOT/api/except.txt
+go tool api -c $GOROOT/api/go1.txt,$GOROOT/api/go1.1.txt -next $GOROOT/api/next.txt -except $GOROOT/api/except.txt
echo
echo ALL TESTS PASSED
diff --git a/src/run.bat b/src/run.bat
index 1a68eb573..6f8ab0e7d 100644
--- a/src/run.bat
+++ b/src/run.bat
@@ -43,7 +43,7 @@ if errorlevel 1 goto fail
echo.
echo # runtime -cpu=1,2,4
-go test runtime -short -timeout=120s -cpu=1,2,4
+go test runtime -short -timeout=240s -cpu=1,2,4
if errorlevel 1 goto fail
echo.
@@ -87,6 +87,14 @@ echo # ..\misc\cgo\test
go test ..\misc\cgo\test
if errorlevel 1 goto fail
echo.
+
+echo # ..\misc\cgo\testso
+cd ..\misc\cgo\testso
+set FAIL=0
+call test.bat
+cd ..\..\..\src
+if %FAIL%==1 goto fail
+echo.
:nocgo
echo # ..\doc\progs
@@ -113,7 +121,7 @@ set GOMAXPROCS=%OLDGOMAXPROCS%
set OLDGOMAXPROCS=
echo # Checking API compatibility.
-go tool api -c ..\api\go1.txt -next ..\api\next.txt -except ..\api\except.txt
+go tool api -c ..\api\go1.txt,..\api\go1.1.txt -next ..\api\next.txt -except ..\api\except.txt
if errorlevel 1 goto fail
echo.
diff --git a/test/chan/select2.go b/test/chan/select2.go
index 40bc357b5..4a0813912 100644
--- a/test/chan/select2.go
+++ b/test/chan/select2.go
@@ -47,7 +47,7 @@ func main() {
runtime.GC()
runtime.ReadMemStats(memstats)
- if memstats.Alloc-alloc > 1e5 {
+ if memstats.Alloc-alloc > 1.1e5 {
println("BUG: too much memory for 100,000 selects:", memstats.Alloc-alloc)
}
}
diff --git a/test/fixedbugs/issue4909a.go b/test/fixedbugs/issue4909a.go
new file mode 100644
index 000000000..aefe2d645
--- /dev/null
+++ b/test/fixedbugs/issue4909a.go
@@ -0,0 +1,35 @@
+// errorcheck
+
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Issue 4909: compiler incorrectly accepts unsafe.Offsetof(t.x)
+// where x is a field of an embedded pointer field.
+
+package p
+
+import (
+ "unsafe"
+)
+
+type T struct {
+ A int
+ *B
+}
+
+func (t T) Method() {}
+
+type B struct {
+ X, Y int
+}
+
+var t T
+var p *T
+
+const N1 = unsafe.Offsetof(t.X) // ERROR "indirection"
+const N2 = unsafe.Offsetof(p.X) // ERROR "indirection"
+const N3 = unsafe.Offsetof(t.B.X) // valid
+const N4 = unsafe.Offsetof(p.B.X) // valid
+const N5 = unsafe.Offsetof(t.Method) // ERROR "method value"
+const N6 = unsafe.Offsetof(p.Method) // ERROR "method value"
diff --git a/test/fixedbugs/issue4909b.go b/test/fixedbugs/issue4909b.go
new file mode 100644
index 000000000..0f594e3db
--- /dev/null
+++ b/test/fixedbugs/issue4909b.go
@@ -0,0 +1,80 @@
+// errorcheckoutput
+
+package main
+
+import "fmt"
+
+// We are going to define 256 types T(n),
+// such that T(n) embeds T(2n) and *T(2n+1).
+
+func main() {
+ fmt.Printf("// errorcheck\n\n")
+ fmt.Printf("package p\n\n")
+ fmt.Println(`import "unsafe"`)
+
+ // Dump types.
+ for n := 1; n < 256; n++ {
+ writeStruct(n)
+ }
+ // Dump leaves
+ for n := 256; n < 512; n++ {
+ fmt.Printf("type T%d int\n", n)
+ }
+
+ fmt.Printf("var t T1\n")
+ fmt.Printf("var p *T1\n")
+
+ // Simple selectors
+ for n := 2; n < 256; n++ {
+ writeDot(n)
+ }
+
+ // Double selectors
+ for n := 128; n < 256; n++ {
+ writeDot(n/16, n)
+ }
+
+ // Triple selectors
+ for n := 128; n < 256; n++ {
+ writeDot(n/64, n/8, n)
+ }
+}
+
+const structTpl = `
+type T%d struct {
+ A%d int
+ T%d
+ *T%d
+}
+`
+
+func writeStruct(n int) {
+ fmt.Printf(structTpl, n, n, 2*n, 2*n+1)
+}
+
+func writeDot(ns ...int) {
+ for _, root := range []string{"t", "p"} {
+ fmt.Printf("const _ = unsafe.Offsetof(%s", root)
+ for _, n := range ns {
+ fmt.Printf(".T%d", n)
+ }
+ // Does it involve an indirection?
+ nlast := ns[len(ns)-1]
+ nprev := 1
+ if len(ns) > 1 {
+ nprev = ns[len(ns)-2]
+ }
+ isIndirect := false
+ for n := nlast / 2; n > nprev; n /= 2 {
+ if n%2 == 1 {
+ isIndirect = true
+ break
+ }
+ }
+ fmt.Print(")")
+ if isIndirect {
+ fmt.Print(` // ERROR "indirection"`)
+ }
+ fmt.Print("\n")
+ }
+}
diff --git a/test/fixedbugs/issue5231.go b/test/fixedbugs/issue5231.go
new file mode 100644
index 000000000..4039913dc
--- /dev/null
+++ b/test/fixedbugs/issue5231.go
@@ -0,0 +1,45 @@
+// compile
+
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Issue 5231: method values lose their variadic property.
+
+package p
+
+type T int
+
+func (t T) NotVariadic(s []int) int {
+ return int(t) + s[0]
+}
+
+func (t T) Variadic(s ...int) int {
+ return int(t) + s[0]
+}
+
+type I interface {
+ NotVariadic(s []int) int
+ Variadic(s ...int) int
+}
+
+func F() {
+ var t T
+ var p *T = &t
+ var i I = p
+
+ nv := t.NotVariadic
+ nv = p.NotVariadic
+ nv = i.NotVariadic
+ var s int = nv([]int{1, 2, 3})
+
+ v := t.Variadic
+ v = p.Variadic
+ v = i.Variadic
+ s = v(1, 2, 3)
+
+ var f1 func([]int) int = nv
+ var f2 func(...int) int = v
+
+ _, _, _ = f1, f2, s
+}
diff --git a/test/fixedbugs/issue5259.dir/bug.go b/test/fixedbugs/issue5259.dir/bug.go
new file mode 100644
index 000000000..851246168
--- /dev/null
+++ b/test/fixedbugs/issue5259.dir/bug.go
@@ -0,0 +1,17 @@
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package bug
+
+type S struct {
+ F func()
+}
+
+type X interface {
+ Bar()
+}
+
+func Foo(x X) *S {
+ return &S{F: x.Bar}
+}
diff --git a/test/fixedbugs/issue5259.dir/main.go b/test/fixedbugs/issue5259.dir/main.go
new file mode 100644
index 000000000..ad1da78f5
--- /dev/null
+++ b/test/fixedbugs/issue5259.dir/main.go
@@ -0,0 +1,16 @@
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import "./bug"
+
+type foo int
+
+func (f *foo) Bar() {
+}
+
+func main() {
+ bug.Foo(new(foo))
+}
diff --git a/test/fixedbugs/issue5259.go b/test/fixedbugs/issue5259.go
new file mode 100644
index 000000000..00fe19ff9
--- /dev/null
+++ b/test/fixedbugs/issue5259.go
@@ -0,0 +1,9 @@
+// compiledir
+
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Issue 5259: Inlining of method value causes internal compiler error
+
+package ignored
diff --git a/test/fixedbugs/issue5260.dir/a.go b/test/fixedbugs/issue5260.dir/a.go
new file mode 100644
index 000000000..5a2c99f65
--- /dev/null
+++ b/test/fixedbugs/issue5260.dir/a.go
@@ -0,0 +1,7 @@
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package a
+
+const BOM = "\uFEFF"
diff --git a/test/fixedbugs/issue5260.dir/b.go b/test/fixedbugs/issue5260.dir/b.go
new file mode 100644
index 000000000..299b75e4a
--- /dev/null
+++ b/test/fixedbugs/issue5260.dir/b.go
@@ -0,0 +1,11 @@
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import "./a"
+
+func main() {
+ _ = a.BOM
+}
diff --git a/test/fixedbugs/issue5260.go b/test/fixedbugs/issue5260.go
new file mode 100644
index 000000000..11fd5d048
--- /dev/null
+++ b/test/fixedbugs/issue5260.go
@@ -0,0 +1,10 @@
+// rundir
+
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Issue 5260: Unicode BOM in exported string constant
+// cannot be read back during package import.
+
+package ignored
diff --git a/test/fixedbugs/issue5291.dir/pkg1.go b/test/fixedbugs/issue5291.dir/pkg1.go
new file mode 100644
index 000000000..b1c893ac8
--- /dev/null
+++ b/test/fixedbugs/issue5291.dir/pkg1.go
@@ -0,0 +1,34 @@
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package pkg1
+
+import (
+ "runtime"
+)
+
+type T2 *[]string
+
+type Data struct {
+ T1 *[]T2
+}
+
+func CrashCall() (err error) {
+ var d Data
+
+ for count := 0; count < 10; count++ {
+ runtime.GC()
+
+ len := 2 // crash when >=2
+ x := make([]T2, len)
+
+ d = Data{T1: &x}
+
+ for j := 0; j < len; j++ {
+ y := make([]string, 1)
+ (*d.T1)[j] = &y
+ }
+ }
+ return nil
+}
diff --git a/test/fixedbugs/issue5291.dir/prog.go b/test/fixedbugs/issue5291.dir/prog.go
new file mode 100644
index 000000000..8301091bd
--- /dev/null
+++ b/test/fixedbugs/issue5291.dir/prog.go
@@ -0,0 +1,17 @@
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import (
+ "./pkg1"
+)
+
+type message struct { // Presence of this creates a crash
+ data pkg1.Data
+}
+
+func main() {
+ pkg1.CrashCall()
+}
diff --git a/test/fixedbugs/issue5291.go b/test/fixedbugs/issue5291.go
new file mode 100644
index 000000000..00d2ada4c
--- /dev/null
+++ b/test/fixedbugs/issue5291.go
@@ -0,0 +1,9 @@
+// rundir
+
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Issue 5291: GC crash
+
+package ignored
diff --git a/test/goprint.go b/test/goprint.go
index 2f0d3c390..cdaccf4f7 100644
--- a/test/goprint.go
+++ b/test/goprint.go
@@ -12,5 +12,5 @@ import "time"
func main() {
go println(42, true, false, true, 1.5, "world", (chan int)(nil), []int(nil), (map[string]int)(nil), (func())(nil), byte(255))
- time.Sleep(1e6)
+ time.Sleep(100*time.Millisecond)
}
diff --git a/test/map.go b/test/map.go
index 041c8fbbe..485e743fe 100644
--- a/test/map.go
+++ b/test/map.go
@@ -5,6 +5,7 @@
// license that can be found in the LICENSE file.
// Test maps, almost exhaustively.
+// NaN complexity test is in mapnan.go.
package main
@@ -12,7 +13,6 @@ import (
"fmt"
"math"
"strconv"
- "time"
)
const count = 100
@@ -659,39 +659,26 @@ func testfloat() {
}
func testnan() {
- // Test that NaNs in maps don't go quadratic.
- t := func(n int) time.Duration {
- t0 := time.Now()
- m := map[float64]int{}
- nan := math.NaN()
- for i := 0; i < n; i++ {
- m[nan] = 1
- }
- if len(m) != n {
- panic("wrong size map after nan insertion")
- }
- return time.Since(t0)
+ n := 500
+ m := map[float64]int{}
+ nan := math.NaN()
+ for i := 0; i < n; i++ {
+ m[nan] = 1
}
-
- // Depending on the machine and OS, this test might be too fast
- // to measure with accurate enough granularity. On failure,
- // make it run longer, hoping that the timing granularity
- // is eventually sufficient.
-
- n := 30000 // 0.02 seconds on a MacBook Air
- fails := 0
- for {
- t1 := t(n)
- t2 := t(2 * n)
- // should be 2x (linear); allow up to 3x
- if t2 < 3*t1 {
- return
- }
- fails++
- if fails == 4 {
- panic(fmt.Sprintf("too slow: %d inserts: %v; %d inserts: %v\n", n, t1, 2*n, t2))
- return
- }
- n *= 2
+ if len(m) != n {
+ panic("wrong size map after nan insertion")
+ }
+ iters := 0
+ for k, v := range m {
+ iters++
+ if !math.IsNaN(k) {
+ panic("not NaN")
+ }
+ if v != 1 {
+ panic("wrong value")
+ }
+ }
+ if iters != n {
+ panic("wrong number of nan range iters")
}
}
diff --git a/test/mapnan.go b/test/mapnan.go
new file mode 100644
index 000000000..60b35fbea
--- /dev/null
+++ b/test/mapnan.go
@@ -0,0 +1,64 @@
+// +build darwin linux
+// run
+
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Test that NaNs in maps don't go quadratic.
+
+package main
+
+import (
+ "fmt"
+ "math"
+ "time"
+ "syscall"
+)
+
+func main() {
+
+ // Test that NaNs in maps don't go quadratic.
+ t := func(n int) time.Duration {
+ var u0 syscall.Rusage
+ if err := syscall.Getrusage(0, &u0); err != nil {
+ panic(err)
+ }
+ m := map[float64]int{}
+ nan := math.NaN()
+ for i := 0; i < n; i++ {
+ m[nan] = 1
+ }
+ if len(m) != n {
+ panic("wrong size map after nan insertion")
+ }
+ var u1 syscall.Rusage
+ if err := syscall.Getrusage(0, &u1); err != nil {
+ panic(err)
+ }
+ return time.Duration(u1.Utime.Nano() - u0.Utime.Nano())
+ }
+
+ // Depending on the machine and OS, this test might be too fast
+ // to measure with accurate enough granularity. On failure,
+ // make it run longer, hoping that the timing granularity
+ // is eventually sufficient.
+
+ n := 30000 // ~8ms user time on a Mid 2011 MacBook Air (1.8 GHz Core i7)
+ fails := 0
+ for {
+ t1 := t(n)
+ t2 := t(2 * n)
+ // should be 2x (linear); allow up to 3x
+ if t2 < 3*t1 {
+ return
+ }
+ fails++
+ if fails == 6 {
+ panic(fmt.Sprintf("too slow: %d inserts: %v; %d inserts: %v\n", n, t1, 2*n, t2))
+ }
+ if fails < 4 {
+ n *= 2
+ }
+ }
+}
diff --git a/test/nilptr.go b/test/nilptr.go
index b784914e5..793e99673 100644
--- a/test/nilptr.go
+++ b/test/nilptr.go
@@ -38,6 +38,8 @@ func main() {
shouldPanic(p8)
shouldPanic(p9)
shouldPanic(p10)
+ shouldPanic(p11)
+ shouldPanic(p12)
}
func shouldPanic(f func()) {
@@ -130,3 +132,23 @@ func p10() {
var t *T
println(t.i) // should crash
}
+
+type T1 struct {
+ T
+}
+
+type T2 struct {
+ *T1
+}
+
+func p11() {
+ t := &T2{}
+ p := &t.i
+ println(*p)
+}
+
+// ADDR(DOT(IND(p))) needs a check also
+func p12() {
+ var p *T = nil
+ println(*(&((*p).i)))
+}
diff --git a/test/sizeof.go b/test/sizeof.go
index a6abdd5c6..9aa95677d 100644
--- a/test/sizeof.go
+++ b/test/sizeof.go
@@ -4,8 +4,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// Test unsafe.Sizeof, unsafe.Alignof, and unsafe.Offsetof all return uintptr.
-
package main
import "unsafe"
@@ -18,8 +16,143 @@ var t T
func isUintptr(uintptr) {}
+type T2 struct {
+ A int32
+ U2
+}
+
+type U2 struct {
+ B int32
+ C int32
+}
+
+var t2 T2
+var p2 *T2
+
func main() {
+ // Test unsafe.Sizeof, unsafe.Alignof, and unsafe.Offsetof all return uintptr.
isUintptr(unsafe.Sizeof(t))
isUintptr(unsafe.Alignof(t))
isUintptr(unsafe.Offsetof(t.X))
+
+ // Test correctness of Offsetof with respect to embedded fields (issue 4909).
+ if unsafe.Offsetof(t2.C) != 8 {
+ println(unsafe.Offsetof(t2.C), "!= 8")
+ panic("unsafe.Offsetof(t2.C) != 8")
+ }
+ if unsafe.Offsetof(p2.C) != 8 {
+ println(unsafe.Offsetof(p2.C), "!= 8")
+ panic("unsafe.Offsetof(p2.C) != 8")
+ }
+ if unsafe.Offsetof(t2.U2.C) != 4 {
+ println(unsafe.Offsetof(t2.U2.C), "!= 4")
+ panic("unsafe.Offsetof(t2.U2.C) != 4")
+ }
+ if unsafe.Offsetof(p2.U2.C) != 4 {
+ println(unsafe.Offsetof(p2.U2.C), "!= 4")
+ panic("unsafe.Offsetof(p2.U2.C) != 4")
+ }
+ testDeep()
+ testNotEmbedded()
+}
+
+type (
+ S1 struct {
+ A int32
+ S2
+ }
+ S2 struct {
+ B int32
+ S3
+ }
+ S3 struct {
+ C int32
+ S4
+ }
+ S4 struct {
+ D int32
+ S5
+ }
+ S5 struct {
+ E int32
+ S6
+ }
+ S6 struct {
+ F int32
+ S7
+ }
+ S7 struct {
+ G int32
+ S8
+ }
+ S8 struct {
+ H int32
+ *S1
+ }
+)
+
+func testDeep() {
+ var s1 S1
+ switch {
+ case unsafe.Offsetof(s1.A) != 0:
+ panic("unsafe.Offsetof(s1.A) != 0")
+ case unsafe.Offsetof(s1.B) != 4:
+ panic("unsafe.Offsetof(s1.B) != 4")
+ case unsafe.Offsetof(s1.C) != 8:
+ panic("unsafe.Offsetof(s1.C) != 8")
+ case unsafe.Offsetof(s1.D) != 12:
+ panic("unsafe.Offsetof(s1.D) != 12")
+ case unsafe.Offsetof(s1.E) != 16:
+ panic("unsafe.Offsetof(s1.E) != 16")
+ case unsafe.Offsetof(s1.F) != 20:
+ panic("unsafe.Offsetof(s1.F) != 20")
+ case unsafe.Offsetof(s1.G) != 24:
+ panic("unsafe.Offsetof(s1.G) != 24")
+ case unsafe.Offsetof(s1.H) != 28:
+ panic("unsafe.Offsetof(s1.H) != 28")
+ case unsafe.Offsetof(s1.S1) != 32:
+ panic("unsafe.Offsetof(s1.S1) != 32")
+ case unsafe.Offsetof(s1.S1.S2.S3.S4.S5.S6.S7.S8.S1.S2) != 4:
+ panic("unsafe.Offsetof(s1.S1.S2.S3.S4.S5.S6.S7.S8.S1.S2) != 4")
+ }
+}
+
+func testNotEmbedded() {
+ type T2 struct {
+ B int32
+ C int32
+ }
+ type T1 struct {
+ A int32
+ T2
+ }
+ type T struct {
+ Dummy int32
+ F T1
+ P *T1
+ }
+
+ var t T
+ var p *T
+ switch {
+ case unsafe.Offsetof(t.F.B) != 4:
+ panic("unsafe.Offsetof(t.F.B) != 4")
+ case unsafe.Offsetof(t.F.C) != 8:
+ panic("unsafe.Offsetof(t.F.C) != 8")
+
+ case unsafe.Offsetof(t.P.B) != 4:
+ panic("unsafe.Offsetof(t.P.B) != 4")
+ case unsafe.Offsetof(t.P.C) != 8:
+ panic("unsafe.Offsetof(t.P.C) != 8")
+
+ case unsafe.Offsetof(p.F.B) != 4:
+ panic("unsafe.Offsetof(p.F.B) != 4")
+ case unsafe.Offsetof(p.F.C) != 8:
+ panic("unsafe.Offsetof(p.F.C) != 8")
+
+ case unsafe.Offsetof(p.P.B) != 4:
+ panic("unsafe.Offsetof(p.P.B) != 4")
+ case unsafe.Offsetof(p.P.C) != 8:
+ panic("unsafe.Offsetof(p.P.C) != 8")
+ }
}
diff --git a/test/stress/maps.go b/test/stress/maps.go
new file mode 100644
index 000000000..d022e19ad
--- /dev/null
+++ b/test/stress/maps.go
@@ -0,0 +1,111 @@
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import (
+ "math/rand"
+ "runtime"
+ "sync"
+)
+
+func mapTypes() []MapType {
+ // TODO(bradfitz): bunch more map types of all different key and value types.
+ // Use reflect.MapOf and a program to generate lots of types & struct types.
+ // For now, just one:
+ return []MapType{intMapType{}}
+}
+
+type MapType interface {
+ NewMap() Map
+}
+
+type Map interface {
+ AddItem()
+ DelItem()
+ Len() int
+ GetItem()
+ RangeAll()
+}
+
+func stressMapType(mt MapType, done func()) {
+ defer done()
+ m := mt.NewMap()
+ for m.Len() < 10000 {
+ Println("map at ", m.Len())
+ if m.Len()%100 == 0 {
+ runtime.Gosched()
+ }
+ m.AddItem()
+ m.AddItem()
+ m.DelItem()
+ var wg sync.WaitGroup
+ const numGets = 10
+ wg.Add(numGets)
+ for i := 0; i < numGets; i++ {
+ go func(i int) {
+ if i&1 == 0 {
+ m.GetItem()
+ } else {
+ m.RangeAll()
+ }
+ wg.Done()
+ }(i)
+ }
+ wg.Wait()
+ }
+ for m.Len() > 0 {
+ m.DelItem()
+ }
+}
+
+type intMapType struct{}
+
+func (intMapType) NewMap() Map {
+ return make(intMap)
+}
+
+var deadcafe = []byte("\xDE\xAD\xCA\xFE")
+
+type intMap map[int][]byte
+
+func (m intMap) AddItem() {
+ s0 := len(m)
+ for len(m) == s0 {
+ key := rand.Intn(s0 + 1)
+ m[key] = make([]byte, rand.Intn(64<<10))
+ }
+}
+
+func (m intMap) DelItem() {
+ for k := range m {
+ delete(m, k)
+ return
+ }
+}
+
+func (m intMap) GetItem() {
+ key := rand.Intn(len(m))
+ if s, ok := m[key]; ok {
+ copy(s, deadcafe)
+ }
+}
+
+func (m intMap) Len() int { return len(m) }
+
+func (m intMap) RangeAll() {
+ for _ = range m {
+ }
+}
+
+func stressMaps() {
+ for {
+ var wg sync.WaitGroup
+ for _, mt := range mapTypes() {
+ wg.Add(1)
+ go stressMapType(mt, wg.Done)
+ }
+ wg.Wait()
+ }
+}
diff --git a/test/stress/parsego.go b/test/stress/parsego.go
new file mode 100644
index 000000000..a781f1993
--- /dev/null
+++ b/test/stress/parsego.go
@@ -0,0 +1,220 @@
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import (
+ "go/ast"
+ "go/parser"
+ "go/token"
+ "os"
+ "path"
+ "runtime"
+ "strings"
+)
+
+func isGoFile(dir os.FileInfo) bool {
+ return !dir.IsDir() &&
+ !strings.HasPrefix(dir.Name(), ".") && // ignore .files
+ path.Ext(dir.Name()) == ".go"
+}
+
+func isPkgFile(dir os.FileInfo) bool {
+ return isGoFile(dir) &&
+ !strings.HasSuffix(dir.Name(), "_test.go") // ignore test files
+}
+
+func pkgName(filename string) string {
+ file, err := parser.ParseFile(token.NewFileSet(), filename, nil, parser.PackageClauseOnly)
+ if err != nil || file == nil {
+ return ""
+ }
+ return file.Name.Name
+}
+
+func parseDir(dirpath string) map[string]*ast.Package {
+ // the package name is the directory name within its parent.
+ // (use dirname instead of path because dirname is clean; it
+ // has no trailing '/')
+ _, pkgname := path.Split(dirpath)
+
+ // filter function to select the desired .go files
+ filter := func(d os.FileInfo) bool {
+ if isPkgFile(d) {
+ // Some directories contain main packages: Only accept
+ // files that belong to the expected package so that
+ // parser.ParsePackage doesn't return "multiple packages
+ // found" errors.
+ // Additionally, accept the special package name
+ // fakePkgName if we are looking at cmd documentation.
+ name := pkgName(dirpath + "/" + d.Name())
+ return name == pkgname
+ }
+ return false
+ }
+
+ // get package AST
+ pkgs, err := parser.ParseDir(token.NewFileSet(), dirpath, filter, parser.ParseComments)
+ if err != nil {
+ println("parse", dirpath, err.Error())
+ panic("go ParseDir fail: " + err.Error())
+ }
+ return pkgs
+}
+
+func stressParseGo() {
+ pkgroot := runtime.GOROOT() + "/src/pkg/"
+ for {
+ m := make(map[string]map[string]*ast.Package)
+ for _, pkg := range packages {
+ m[pkg] = parseDir(pkgroot + pkg)
+ Println("parsed go package", pkg)
+ }
+ }
+}
+
+// find . -type d -not -path "./exp" -not -path "./exp/*" -printf "\t\"%p\",\n" | sort | sed "s/\.\///" | grep -v testdata
+var packages = []string{
+ "archive",
+ "archive/tar",
+ "archive/zip",
+ "bufio",
+ "builtin",
+ "bytes",
+ "compress",
+ "compress/bzip2",
+ "compress/flate",
+ "compress/gzip",
+ "compress/lzw",
+ "compress/zlib",
+ "container",
+ "container/heap",
+ "container/list",
+ "container/ring",
+ "crypto",
+ "crypto/aes",
+ "crypto/cipher",
+ "crypto/des",
+ "crypto/dsa",
+ "crypto/ecdsa",
+ "crypto/elliptic",
+ "crypto/hmac",
+ "crypto/md5",
+ "crypto/rand",
+ "crypto/rc4",
+ "crypto/rsa",
+ "crypto/sha1",
+ "crypto/sha256",
+ "crypto/sha512",
+ "crypto/subtle",
+ "crypto/tls",
+ "crypto/x509",
+ "crypto/x509/pkix",
+ "database",
+ "database/sql",
+ "database/sql/driver",
+ "debug",
+ "debug/dwarf",
+ "debug/elf",
+ "debug/gosym",
+ "debug/macho",
+ "debug/pe",
+ "encoding",
+ "encoding/ascii85",
+ "encoding/asn1",
+ "encoding/base32",
+ "encoding/base64",
+ "encoding/binary",
+ "encoding/csv",
+ "encoding/gob",
+ "encoding/hex",
+ "encoding/json",
+ "encoding/pem",
+ "encoding/xml",
+ "errors",
+ "expvar",
+ "flag",
+ "fmt",
+ "go",
+ "go/ast",
+ "go/build",
+ "go/doc",
+ "go/format",
+ "go/parser",
+ "go/printer",
+ "go/scanner",
+ "go/token",
+ "hash",
+ "hash/adler32",
+ "hash/crc32",
+ "hash/crc64",
+ "hash/fnv",
+ "html",
+ "html/template",
+ "image",
+ "image/color",
+ "image/draw",
+ "image/gif",
+ "image/jpeg",
+ "image/png",
+ "index",
+ "index/suffixarray",
+ "io",
+ "io/ioutil",
+ "log",
+ "log/syslog",
+ "math",
+ "math/big",
+ "math/cmplx",
+ "math/rand",
+ "mime",
+ "mime/multipart",
+ "net",
+ "net/http",
+ "net/http/cgi",
+ "net/http/cookiejar",
+ "net/http/fcgi",
+ "net/http/httptest",
+ "net/http/httputil",
+ "net/http/pprof",
+ "net/mail",
+ "net/rpc",
+ "net/rpc/jsonrpc",
+ "net/smtp",
+ "net/textproto",
+ "net/url",
+ "os",
+ "os/exec",
+ "os/signal",
+ "os/user",
+ "path",
+ "path/filepath",
+ "reflect",
+ "regexp",
+ "regexp/syntax",
+ "runtime",
+ "runtime/cgo",
+ "runtime/debug",
+ "runtime/pprof",
+ "runtime/race",
+ "sort",
+ "strconv",
+ "strings",
+ "sync",
+ "sync/atomic",
+ "syscall",
+ "testing",
+ "testing/iotest",
+ "testing/quick",
+ "text",
+ "text/scanner",
+ "text/tabwriter",
+ "text/template",
+ "text/template/parse",
+ "time",
+ "unicode",
+ "unicode/utf16",
+ "unicode/utf8",
+ "unsafe",
+}
diff --git a/test/stress/runstress.go b/test/stress/runstress.go
new file mode 100644
index 000000000..b5adf6a4a
--- /dev/null
+++ b/test/stress/runstress.go
@@ -0,0 +1,164 @@
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// The runstress tool stresses the runtime.
+//
+// It runs forever and should never fail. It tries to stress the garbage collector,
+// maps, channels, the network, and everything else provided by the runtime.
+package main
+
+import (
+ "flag"
+ "fmt"
+ "io"
+ "io/ioutil"
+ "log"
+ "math/rand"
+ "net"
+ "net/http"
+ "net/http/httptest"
+ "os/exec"
+ "strconv"
+ "time"
+)
+
+var (
+ v = flag.Bool("v", false, "verbose")
+ doMaps = flag.Bool("maps", true, "stress maps")
+ doExec = flag.Bool("exec", true, "stress exec")
+ doChan = flag.Bool("chan", true, "stress channels")
+ doNet = flag.Bool("net", true, "stress networking")
+ doParseGo = flag.Bool("parsego", true, "stress parsing Go (generates garbage)")
+)
+
+func Println(a ...interface{}) {
+ if *v {
+ log.Println(a...)
+ }
+}
+
+func dialStress(a net.Addr) {
+ for {
+ d := net.Dialer{Timeout: time.Duration(rand.Intn(1e9))}
+ c, err := d.Dial("tcp", a.String())
+ if err == nil {
+ Println("did dial")
+ go func() {
+ time.Sleep(time.Duration(rand.Intn(500)) * time.Millisecond)
+ c.Close()
+ Println("closed dial")
+ }()
+ }
+ // Don't run out of ephermeral ports too quickly:
+ time.Sleep(250 * time.Millisecond)
+ }
+}
+
+func stressNet() {
+ ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ size, _ := strconv.Atoi(r.FormValue("size"))
+ w.Write(make([]byte, size))
+ }))
+ go dialStress(ts.Listener.Addr())
+ for {
+ size := rand.Intn(128 << 10)
+ res, err := http.Get(fmt.Sprintf("%s/?size=%d", ts.URL, size))
+ if err != nil {
+ log.Fatalf("stressNet: http Get error: %v", err)
+ }
+ if res.StatusCode != 200 {
+ log.Fatalf("stressNet: Status code = %d", res.StatusCode)
+ }
+ n, err := io.Copy(ioutil.Discard, res.Body)
+ if err != nil {
+ log.Fatalf("stressNet: io.Copy: %v", err)
+ }
+ if n != int64(size) {
+ log.Fatalf("stressNet: copied = %d; want %d", n, size)
+ }
+ res.Body.Close()
+ Println("did http", size)
+ }
+}
+
+func doAnExec() {
+ exit := rand.Intn(2)
+ wantOutput := fmt.Sprintf("output-%d", rand.Intn(1e9))
+ cmd := exec.Command("/bin/sh", "-c", fmt.Sprintf("echo %s; exit %d", wantOutput, exit))
+ out, err := cmd.CombinedOutput()
+ if exit == 1 {
+ if err == nil {
+ log.Fatal("stressExec: unexpected exec success")
+ }
+ return
+ }
+ if err != nil {
+ log.Fatalf("stressExec: exec failure: %v: %s", err, out)
+ }
+ wantOutput += "\n"
+ if string(out) != wantOutput {
+ log.Fatalf("stressExec: exec output = %q; want %q", out, wantOutput)
+ }
+ Println("did exec")
+}
+
+func stressExec() {
+ gate := make(chan bool, 10) // max execs at once
+ for {
+ gate <- true
+ go func() {
+ doAnExec()
+ <-gate
+ }()
+ }
+}
+
+func ringf(in <-chan int, out chan<- int, donec chan<- bool) {
+ for {
+ n := <-in
+ if n == 0 {
+ donec <- true
+ return
+ }
+ out <- n - 1
+ }
+}
+
+func threadRing(bufsize int) {
+ const N = 100
+ donec := make(chan bool)
+ one := make(chan int, bufsize) // will be input to thread 1
+ var in, out chan int = nil, one
+ for i := 1; i <= N-1; i++ {
+ in, out = out, make(chan int, bufsize)
+ go ringf(in, out, donec)
+ }
+ go ringf(out, one, donec)
+ one <- N
+ <-donec
+ Println("did threadring of", bufsize)
+}
+
+func stressChannels() {
+ for {
+ threadRing(0)
+ threadRing(1)
+ }
+}
+
+func main() {
+ flag.Parse()
+ for want, f := range map[*bool]func(){
+ doMaps: stressMaps,
+ doNet: stressNet,
+ doExec: stressExec,
+ doChan: stressChannels,
+ doParseGo: stressParseGo,
+ } {
+ if *want {
+ go f()
+ }
+ }
+ select {}
+}