net: change ListenUnixgram signature to return UnixConn instead of UDPConn

This CL breaks Go 1 API compatibility but it doesn't matter because
previous ListenUnixgram doesn't work in any use cases, oops.

The public API change is:
-pkg net, func ListenUnixgram(string, *UnixAddr) (*UDPConn, error)
+pkg net, func ListenUnixgram(string, *UnixAddr) (*UnixConn, error)

Fixes issue 3875.

R=rsc, golang-dev, dave
CC=golang-dev
https://codereview.appspot.com/6937059
A+C: Alexander Surma (individual CLA)

Generated by addca.

R=gobot
CC=golang-dev
https://codereview.appspot.com/6951043
A+C: Christopher Cahoon (individual CLA)

Generated by addca.

R=gobot
CC=golang-dev
https://codereview.appspot.com/6947067
cmd/fix: Add keys to printer.Config composite literals.

Fixes issue 4499.

R=rsc
CC=golang-dev
https://codereview.appspot.com/6931046

Committer: Russ Cox <rsc@golang.org>
runtime: struct Obj in mgc0.c and buffers in scanblock()

Details:

- This CL is the conceptual skeleton of code found in CL 6114046

- The garbage collector uses struct Obj to specify memory blocks

- scanblock() is putting found memory blocks into an intermediate buffer
  (xbuf) before adding/flushing them to the main work buffer (wbuf)

- The main loop in scanblock() is replaced with a skeleton code that
  in the future will be able to recognize the type of objects and
  thus will improve the garbage collector's precision.
  For now, all objects are simply sequences of pointers so
  the precision of the garbage collector remains unchanged.

- The code plugs .gcdata and .gcbss sections into the garbage collector.
  scanblock() in this CL is unable to make any use of this.

R=rsc, dvyukov, remyoudompheng
CC=dave, golang-dev, minux.ma
https://codereview.appspot.com/6856121

Committer: Russ Cox <rsc@golang.org>
net/smtp: add optional Hello method

Add a Hello method that allows clients to set the server sent in the EHLO/HELO exchange; the default remains localhost.
Based on CL 5555045 by rsc.

Fixes issue 4219.

R=golang-dev, rsc
CC=golang-dev
https://codereview.appspot.com/6946057

Committer: Russ Cox <rsc@golang.org>
encoding/json: cleanup leftover redundant variables.

Those variables come from ancient times when reflect.Value was
an interface.

R=dave, rsc
CC=golang-dev
https://codereview.appspot.com/6946059
fmt: fix a typo

R=golang-dev, dsymonds
CC=golang-dev
https://codereview.appspot.com/6937065

Committer: David Symonds <dsymonds@golang.org>
cmd/gc: racewalk: fix compiler crash
The code:
func main() {
        v := make([]int64, 10)
        i := 1
        _ = v[(i*4)/3]
}
crashes compiler with:

Program received signal SIGSEGV, Segmentation fault.
0x000000000043c274 in walkexpr (np=0x7fffffffc9b8, init=0x0) at src/cmd/gc/walk.c:587
587			*init = concat(*init, n->ninit);
(gdb) bt
#0  0x000000000043c274 in walkexpr (np=0x7fffffffc9b8, init=0x0) at src/cmd/gc/walk.c:587
#1  0x0000000000432d15 in copyexpr (n=0x7ffff7f69a48, t=<optimized out>, init=0x0) at src/cmd/gc/subr.c:2020
#2  0x000000000043f281 in walkdiv (init=0x0, np=0x7fffffffca70) at src/cmd/gc/walk.c:2901
#3  walkexpr (np=0x7ffff7f69760, init=0x0) at src/cmd/gc/walk.c:956
#4  0x000000000043d801 in walkexpr (np=0x7ffff7f69bc0, init=0x0) at src/cmd/gc/walk.c:988
#5  0x000000000043cc9b in walkexpr (np=0x7ffff7f69d38, init=0x0) at src/cmd/gc/walk.c:1068
#6  0x000000000043c50b in walkexpr (np=0x7ffff7f69f50, init=0x0) at src/cmd/gc/walk.c:879
#7  0x000000000043c50b in walkexpr (np=0x7ffff7f6a0c8, init=0x0) at src/cmd/gc/walk.c:879
#8  0x0000000000440a53 in walkexprlist (l=0x7ffff7f6a0c8, init=0x0) at src/cmd/gc/walk.c:357
#9  0x000000000043d0bf in walkexpr (np=0x7fffffffd318, init=0x0) at src/cmd/gc/walk.c:566
#10 0x00000000004402bf in vmkcall (fn=<optimized out>, t=0x0, init=0x0, va=0x7fffffffd368) at src/cmd/gc/walk.c:2275
#11 0x000000000044059a in mkcall (name=<optimized out>, t=0x0, init=0x0) at src/cmd/gc/walk.c:2287
#12 0x000000000042862b in callinstr (np=0x7fffffffd4c8, init=0x7fffffffd568, wr=0, skip=<optimized out>) at src/cmd/gc/racewalk.c:478
#13 0x00000000004288b7 in racewalknode (np=0x7ffff7f68108, init=0x7fffffffd568, wr=0, skip=0) at src/cmd/gc/racewalk.c:287
#14 0x0000000000428781 in racewalknode (np=0x7ffff7f65840, init=0x7fffffffd568, wr=0, skip=0) at src/cmd/gc/racewalk.c:302
#15 0x0000000000428abd in racewalklist (l=0x7ffff7f65840, init=0x0) at src/cmd/gc/racewalk.c:97
#16 0x0000000000428d0b in racewalk (fn=0x7ffff7f5f010) at src/cmd/gc/racewalk.c:63
#17 0x0000000000402b9c in compile (fn=0x7ffff7f5f010) at src/cmd/6g/../gc/pgen.c:67
#18 0x0000000000419f86 in funccompile (n=0x7ffff7f5f010, isclosure=0) at src/cmd/gc/dcl.c:1414
#19 0x0000000000424161 in p9main (argc=<optimized out>, argv=<optimized out>) at src/cmd/gc/lex.c:431
#20 0x0000000000401739 in main (argc=<optimized out>, argv=<optimized out>) at src/lib9/main.c:35

The problem is nil init passed to mkcall().

R=golang-dev, rsc
CC=golang-dev
https://codereview.appspot.com/6940045
syscall: document that documentation is platform specific

Fixes issue 4051

R=golang-dev, minux.ma, rsc
CC=golang-dev
https://codereview.appspot.com/6943063

Committer: Shenghou Ma <minux.ma@gmail.com>
api/next.txt: update

R=golang-dev, rsc, bradfitz
CC=golang-dev
https://codereview.appspot.com/6935061
net/http/pprof: fix doc for /debug/pprof/
Fixes issue 4548.

R=golang-dev, rsc
CC=golang-dev
https://codereview.appspot.com/6944053
os: fix docs for Expand
there is no concept of “undefined” variables for Expand。

R=golang-dev, rsc
CC=golang-dev
https://codereview.appspot.com/6946063
net/smtp: remove data race from TestSendMail.

A data race was found in TestSendMail by the race detector.

Fixes issue 4559.

R=golang-dev, bradfitz, dave, rsc
CC=golang-dev
https://codereview.appspot.com/6944057

Committer: Russ Cox <rsc@golang.org>
test: add "duplicate" struct map key test

Update issue 4555.

R=gri, iant
CC=golang-dev
https://codereview.appspot.com/6944059
runtime: implement getenv for Plan 9

With this change the runtime can now read GOMAXPROCS, GOGC, etc.

I'm not quite sure how we missed this.

R=seed, lucio.dere, rsc
CC=golang-dev
https://codereview.appspot.com/6935062

Committer: Russ Cox <rsc@golang.org>
cmd/cgo: access errno from void C function
Fixes issue 3729.

R=rsc
CC=golang-dev
https://codereview.appspot.com/6938052
syscall: lazily populate the environment cache on Plan 9

This decreases the amount of system calls during the
first call to Getenv. Calling Environ will still read
in all environment variables and populate the cache.

R=golang-dev, rsc
CC=golang-dev
https://codereview.appspot.com/6939048
fmt, encoding/gob: fix misuse of Read
reader.Read() can return both 0,nil and len(buf),err.
To be safe, we use io.ReadFull instead of doing reader.Read directly.

Fixes issue 3472.

R=bradfitz, rsc, ality
CC=golang-dev
https://codereview.appspot.com/6285050
cmd/gc: add GOEXPERIMENT=zerostack to clear stack on function entry

This is expensive but it might be useful in cases where
people are suffering from false positives during garbage
collection and are willing to trade the CPU time for getting
rid of the false positives.

On the other hand it only eliminates false positives caused
by other function calls, not false positives caused by dead
temporaries stored in the current function call.

The 5g/6g/8g changes were pulled out of the history, from
the last time we needed to do this (to work around a goto bug).
The code in go.h, lex.c, pgen.c is new but tiny.

R=ken2
CC=golang-dev
https://codereview.appspot.com/6938073