This CL introduces new API into package net to identify the network
interface. A functionality of new API is very similar to RFC3493 -
"Interface Identification".
R=r, gri, bradfitz, robert.hencke, fullung, rsc
CC=golang-dev
https://golang.org/cl/4437087
Input code like
0000 (x.go:2) TEXT main+0(SB),$36-0
0001 (x.go:3) MOVL $5,i+-8(SP)
0002 (x.go:3) MOVL $0,i+-4(SP)
0003 (x.go:4) MOVL $1,BX
0004 (x.go:4) MOVL i+-8(SP),AX
0005 (x.go:4) MOVL i+-4(SP),DX
0006 (x.go:4) MOVL AX,autotmp_0000+-20(SP)
0007 (x.go:4) MOVL DX,autotmp_0000+-16(SP)
0008 (x.go:4) MOVL autotmp_0000+-20(SP),CX
0009 (x.go:4) CMPL autotmp_0000+-16(SP),$0
0010 (x.go:4) JNE ,13
0011 (x.go:4) CMPL CX,$32
0012 (x.go:4) JCS ,14
0013 (x.go:4) MOVL $0,BX
0014 (x.go:4) SHLL CX,BX
0015 (x.go:4) MOVL BX,x+-12(SP)
0016 (x.go:5) MOVL x+-12(SP),AX
0017 (x.go:5) CDQ ,
0018 (x.go:5) MOVL AX,autotmp_0001+-28(SP)
0019 (x.go:5) MOVL DX,autotmp_0001+-24(SP)
0020 (x.go:5) MOVL autotmp_0001+-28(SP),AX
0021 (x.go:5) MOVL autotmp_0001+-24(SP),DX
0022 (x.go:5) MOVL AX,(SP)
0023 (x.go:5) MOVL DX,4(SP)
0024 (x.go:5) CALL ,runtime.printint+0(SB)
0025 (x.go:5) CALL ,runtime.printnl+0(SB)
0026 (x.go:6) RET ,
is problematic because the liveness range for
autotmp_0000 (0006-0009) is nested completely
inside a span where BX holds a live value (0003-0015).
Because the register allocator only looks at 0006-0009
to see which registers are used, it misses the fact that
BX is unavailable and uses it anyway.
The n->pun = anyregalloc() check in tempname is
a workaround for this bug, but I hit it again because
I did the tempname call before allocating BX, even
though I then used the temporary after storing in BX.
This should fix the real bug, and then we can remove
the workaround in tempname.
The code creates pseudo-variables for each register
and includes that information in the liveness propagation.
Then the regu fields can be populated using that more
complete information. With that approach, BX is marked
as in use on every line in the whole span 0003-0015,
so that the decision about autotmp_0000
(using only 0006-0009) still has all the information
it needs.
This is not specific to the 386, but it only happens in
generated code of the form
load R1
...
load var into R2
...
store R2 back into var
...
use R1
and for the most part the other compilers generate
the loads for a given compiled line before any of
the stores. Even so, this may not be the case everywhere,
so the change is worth making in all three.
R=ken2, ken, ken
CC=golang-dev
https://golang.org/cl/4529106
Plus fix spoiling of GOMAXPROCS in 2 existing rwmutex tests.
Plus fix benchmark output to stdout (now it outputs to stderr like all other output).
R=rsc
CC=golang-dev
https://golang.org/cl/4529111
These changes are not particularly invasive and have been tested
as broadly as possible.
8l/l.h:
- #pragma varargck: added some, removed duplicates.
ld/dwarf.c:
- As Plan 9 has no NULL, changed all occurrences to nil.
- Added USED(size); where necessary.
- Added (void) argument in definition of finddebugruntimepath().
- Plan 9 compiler was complaining about multiple
assignments, repeaired by breaking up the commands.
- Correction: havedynamic = 1; restored.
ld/go.c:
- Needed USED(file); in two functions.
- Removed unused assignments flagged by the Plan 9 compiler.
ld/lib.c:
- Replaced unlink() with remove() which seems available everywhere.
- Removed USED(c4); and USED(magic) no longer required.
- Removed code flagged as unused by the Plan 9 compiler.
- Added attributes to a number of format strings.
R=rsc
CC=golang-dev
https://golang.org/cl/4435047
This is in preparation of escape analysis; function parameters
can now be tagged with interesting bits by the compiler by
assigning to n->note.
tested by having typecheck put a fake tag on all parameters of
pointer type and compiling the tree.
R=rsc
CC=golang-dev
https://golang.org/cl/4524092
There were two issues:
1) It might not be a path error, it might be 'permission denied'.
2) The concept of $PATH is Unix-specific.
R=alex.brainman, rsc, r, mattn.jp
CC=golang-dev
https://golang.org/cl/4530096
It gets annoying to do this in caller code otherwise,
especially having to remember to Close one side.
R=rsc
CC=golang-dev
https://golang.org/cl/4517134
The LDREXD and STREXD instructions require
aligned addresses, and the ARM stack is not
guaranteed to be aligned during the check.
This may cause other problems later (on the ARM
not all 64-bit pointers may be 64-bit aligned)
but at least the check is correct now.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/4564053
Add IPv6Mreq and Inet6Pktinfo for specifying the network interface.
Rename IpMreq to IPMreq, SetsockoptIpMreq to SetsockoptIPMreq.
R=rsc, dave, robert.hencke
CC=golang-dev
https://golang.org/cl/4532098
Programs expect that Read and Write are synchronous.
The background goroutines make the implementation
a little easier, but they introduce asynchrony that
trips up calling code. Remove them.
R=golang-dev, krasin
CC=golang-dev
https://golang.org/cl/4548079
This changes the internal implementation of Cond so that
it uses two generations of waiters. This enables Signal
to guarantee that it will only wake up waiters that are
currently sleeping at the call time.
Fixes#1648.
R=dvyukov, gustavo, rsc
CC=golang-dev
https://golang.org/cl/4524083
This removes exec.Run and replaces exec.Cmd with a
new implementation. The new exec.Cmd represents
both a currently-running command and also a command
being prepared. It has a good zero value.
You can Start + Wait on a Cmd, or simply Run it.
Start (and Run) deal with copying stdout, stdin,
and stderr between the Cmd's io.Readers and
io.Writers.
There are convenience methods to capture a command's
stdout and/or stderr.
R=r, n13m3y3r, rsc, gustavo, alex.brainman, dsymonds, r, adg, duzy.chan, mike.rosset, kevlar
CC=golang-dev
https://golang.org/cl/4552052
- better number scanning algorithm
- fixed a couple of bugs related to base interpretation
- added scan benchmark
- added more test cases and made tests more precise
- introduced Int.scan method matching nat.scan
- refactored Int.Scan; now uses int.scan
- refactored Int.SetString; now uses int.scan
There is more potential, this was a fairly simple change.
gotest -test.bench="ScanPi" before/after (best of 3 runs):
big.BenchmarkScanPi 1000 2024900 ns/op
big.BenchmarkScanPi 10000 257540 ns/op
R=chickencha
CC=golang-dev, rsc
https://golang.org/cl/4527089
Using the getaddrinfo order is only okay if we
are smart enough to try multiple addresses in Dial.
Since the code does not do that, we must make
the right first choice, regardless of what getaddrinfo
does, and more often that not that means using the
IPv4 address, even on IPv6 systems. With the CL
applied, gotest fails in package net on OS X.
helix.cam=; gotest
...
--- FAIL: net.TestDialGoogleIPv4 (1.05 seconds)
-- 74.125.226.179:80 --
-- www.google.com:80 --
Dial("tcp", "", "www.google.com:80") = _, dial tcp [2001:4860:800f::69]:80: address family not supported by protocol family
-- 74.125.226.179:http --
-- www.google.com:http --
Dial("tcp", "", "www.google.com:http") = _, dial tcp [2001:4860:800f::69]:80: address family not supported by protocol family
-- 074.125.226.179:0080 --
-- [::ffff:74.125.226.179]:80 --
-- [::ffff:4a7d:e2b3]:80 --
-- [0:0:0:0:0000:ffff:74.125.226.179]:80 --
-- [0:0:0:0:000000:ffff:74.125.226.179]:80 --
-- [0:0:0:0:0:ffff::74.125.226.179]:80 --
FAIL
gotest: "./6.out" failed: exit status 1
««« original CL description
net: name-based destination address selection
getaddrinfo() orders the addresses according to RFC 3484.
This means when IPv6 is working on a host we get results like:
[]string = {"2001:4810::110", "66.117.47.214"}
and when it's not working we get:
[]string = {"66.117.47.214", "2001:4810::110"}
thus can drop firstFavoriteAddr.
This also means /etc/gai.conf works on relevant systems.
R=rsc, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/4557058
»»»
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/4532101
This mostly adds the infrastructure for writing various forms of
packets as well as reading them. Adding symmetric encryption support
was simply an easy motivation.
There's also one brown-paper-bag fix in here. Previously I had the
conditional for the MDC hash check backwards: the code was checking
that the hash was *incorrect*. This was neatly counteracted by another
bug: it was hashing the ciphertext of the OCFB prefix, not the
plaintext.
R=bradfitz
CC=golang-dev
https://golang.org/cl/4564046
Make plan 9 Readdir & Readdirnames return os.EOF at end.
Also fix typos in the unix and windows comments.
R=golang-dev, fshahriar, bradfitz, rsc, r
CC=golang-dev
https://golang.org/cl/4557053
values >= 16 bits, so the lookup code can be smaller in the
common case.
Also make CaseRange uint32s rather than ints, so if we go to
64-bit ints we don't waste more space.
R=rsc
CC=golang-dev
https://golang.org/cl/4550094
flate's reader greedily reads from the shared io.Reader in Framer. This leads to a data race on Framer.r. Fix this by providing a corkedReader to zlib.NewReaderDict(). We uncork the reader and allow it to read the number of bytes in the compressed payload.
Fixes#1884.
R=bradfitz, rsc, go.peter.90
CC=golang-dev
https://golang.org/cl/4530089
breaks Mac build
««« original CL description
runtime: use HOST_CC to compile mkversion
HOST_CC is set in Make.inc, so use that rather
than hardcoding quietgcc
R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/4515163
»»»
R=iant
CC=golang-dev
https://golang.org/cl/4515168
I found this useful, esp with an io.MultiWriter. But I fear that
it may be bloat in such a low-level package so please feel free to
decline if you feel likewise.
R=rsc, ality
CC=golang-dev
https://golang.org/cl/4530088
Also some cleanup, removing redundant code. Make more
things use NewRequest. Add some tests, docs.
R=golang-dev, adg, rsc
CC=golang-dev
https://golang.org/cl/4561047
getaddrinfo() orders the addresses according to RFC 3484.
This means when IPv6 is working on a host we get results like:
[]string = {"2001:4810::110", "66.117.47.214"}
and when it's not working we get:
[]string = {"66.117.47.214", "2001:4810::110"}
thus can drop firstFavoriteAddr.
This also means /etc/gai.conf works on relevant systems.
R=rsc, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/4557058
On windows, the command line is passed as a single null-terminated string. While the automatic parameter escaping done by syscall.StartProcess works fine with most Windows programs, some applications do their own custom parsing of the command line, in which case the automatic escaping becomes harmful.
This CL adds a new extra CmdLine field to syscall.ProcAttr that will be used as the raw/unescaped command line if not empty.
Fixes#1849.
R=golang-dev, alex.brainman, bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4548050
When I was first coding Abs, I wondered if people wouldn't
expect the path to be consistently clean, even if the path
passed in was already absolute.
CL 4524078 has a potential problem based on exactly that
assumption, so it feels like this behavior is indeed the
most useful and least surprising.
R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/4548074
By splitting the ranges into 16-bit values and 32-bit values,
we can reduce about 3000 entries by 48 bits per entry, or about
16KB, at the cost of a little more complexity in the code.
R=iant, bradfitz, rsc, r
CC=golang-dev
https://golang.org/cl/4547066
Remove the idea of space being white. Sometimes space is green.
Simplify a comment and remove the Latin.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4532096
MkdirAll() need to use isSeparator().
Move primary defines of filepath.Separator/filepath.ListSeparator
to os.PathSeparator/os.PathListSeparator.
Move filepath.isSeparator() to os.IsPathSeparator().
filepath package refer them from os package.
Fixes#1831.
R=rsc, alex.brainman
CC=golang-dev
https://golang.org/cl/4535100
Adds tests for Readdir and Readdirnames with different n
values. No good way to inject faults during full reads,
though.
Also fixes bug report from fshahriar:
Readdir(0) wasn't behaving like Readdir(-1).
R=rsc, fshahriar
CC=golang-dev
https://golang.org/cl/4529092
Fixes issue #1879.
Directives were not directly expanded, but since their
content ended up in makefiles, further expansion would
take place there. This prevents such artifacts by
restricting the set of characters that may be used in
a directive value.
To build the list of safe characters I went through the
contents of /usr/lib/pkgconfig and extracted LDFLAGS
and CFLAGS information, so hopefully this is a
reasonable default to get started.
R=rsc
CC=golang-dev
https://golang.org/cl/4532092
Added a new Framer to handle reading/writing Frames. This is necessary since we have to maintain a compression context across streams.
TODO:
* Separate the types and read/write routines into different files.
* Improve error handling.
R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/4503042
Makes all.bash work after echo 4 >/proc/cpu/alignment,
which means kill the process on an unaligned access.
The default behavior on DreamPlug/GuruPlug/SheevaPlug
is to simulate an ARMv3 and just let the unaligned accesses
stop at the word boundary, resulting in all kinds of surprises.
Fixes#1240.
R=ken2
CC=golang-dev
https://golang.org/cl/4551064
Reenable dwarf output on Mac.
Was writing headers but no actual dwarf data.
Fixes#1877 (accidentally).
Workaround for issue 1878.
R=lvd
CC=golang-dev
https://golang.org/cl/4515139
On Solaris /bin is a symlink to /usr/bin, so running "pwd" in
the directory "/bin" prints out "/usr/bin".
R=rsc, r, bradfitz
CC=golang-dev
https://golang.org/cl/4559043
The spec was adjusted in commit df410d6a4842 to allow the
implicit assignment of strutures with unexported fields in
method receivers. This change updates the compiler.
Also moved bug322 into fixedbugs and updated golden.out
to reflect the removal of the last known bug.
Fixes#1402.
R=golang-dev, gri, rsc
CC=golang-dev
https://golang.org/cl/4526069
I had a report that this was broken. It seems fine.
I think the reporter was just never flushing their response
headers. If I omit the test server's initial Flush I get the
same behavior as reported. (a hang at Client.Get)
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4552062
A FlagSet is an independent set of flags that may be used,
for example, to provide flag processing for subcommands
in a CLI. The standard, os.Args-derived set of flags is a
global but non-exported FlagSet and the standard functions
are wrappers for methods of that FlagSet.
Allow the programmer to control whether the program
exits if there is a parse error. For the default set, the behavior
remains to exit on error.
The handling of Usage is odd due to backward compatibility.
R=golang-dev, bradfitz, r, bradfitz
CC=golang-dev
https://golang.org/cl/4517092
A user pointed out that Go didn't work with their
corp proxy, always throwing 400 Bad Request errors.
Looking at the RFC 2616, Host is always required,
even with proxies.
The old code assumed that writing an absolute URL
in the first line of an HTTP request implied
that the Host header was no longer necessary.
Double-checked behavior with curl.
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/4539075
Initially I wanted to minimise dependencies but it's become clear that
big int support in ASN.1 is a common need and that it should be part
of the core.
R=bradfitz
CC=golang-dev
https://golang.org/cl/4550063
This change adds a function for generating new Entities and inchoate
support for reserialising Entities.
R=bradfitz, r, bradfitz
CC=golang-dev
https://golang.org/cl/4551044
This appears to have been a long-standing formatting bug.
The test cases has misformatted golden files.
Applied gofmt -w src misc .
Fixes#1839.
R=iant
CC=golang-dev
https://golang.org/cl/4515113
This enables customizing the behavior of formatters
with logic such as {"template"|import} or even
{Field1 Field2 "%.2f 0x%X"|printf}
Thanks to Roger Peppe for some debate on this.
R=golang-dev, r, r
CC=golang-dev
https://golang.org/cl/4536059
It's documented as such, but it was never wired up
after Transport went in and Head was fixed.
If people don't want redirects, that's what RoundTripper/
Transport are for. Or a custom redirect policy.
R=golang-dev, kevlar
CC=golang-dev
https://golang.org/cl/4526065