1
0
mirror of https://github.com/golang/go synced 2024-11-06 06:36:20 -07:00
Commit Graph

261 Commits

Author SHA1 Message Date
Ronald G. Minnich
d8ed449d8e os/exec: handle Unshareflags with CLONE_NEWNS
In some newer Linux distros, systemd forces
all mount namespaces to be shared, starting
at /. This disables the CLONE_NEWNS
flag in unshare(2) and clone(2).
While this problem is most commonly seen
on systems with systemd, it can happen anywhere,
due to how Linux namespaces now work.

Hence, to create a private mount namespace,
it is not sufficient to just set
CLONE_NEWS; you have to call mount(2) to change
the behavior of namespaces, i.e.
mount("none", "/", NULL, MS_REC|MS_PRIVATE, NULL)

This is tested and working and we can now correctly
start child process with private namespaces on Linux
distros that use systemd.

The new test works correctly on Ubuntu 16.04.2 LTS.
It fails if I comment out the new Mount, and
succeeds otherwise. In each case it correctly
cleans up after itself.

Fixes #19661

Change-Id: I52240b59628e3772b529d9bbef7166606b0c157d
Reviewed-on: https://go-review.googlesource.com/38471
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-03-23 17:53:18 +00:00
Richard Musiol
9e6b79a5df syscall: use CLONE_VFORK and CLONE_VM
This greatly improves the latency of starting a child process when
the Go process is using a lot of memory. Even though the kernel uses
copy-on-write, preparation for that can take up to several 100ms under
certain conditions. All other goroutines are suspended while starting
a subprocess so this latency directly affects total throughput.

With CLONE_VM the child process shares the same memory with the parent
process. On its own this would lead to conflicting use of the same
memory, so CLONE_VFORK is used to suspend the parent process until the
child releases the memory when switching to to the new program binary
via the exec syscall. When the parent process continues to run, one
has to consider the changes to memory that the child process did,
namely the return address of the syscall function needs to be restored
from a register.

A simple benchmark has shown a difference in latency of 16ms vs. 0.5ms
at 10GB memory usage. However, much higher latencies of several 100ms
have been observed in real world scenarios. For more information see
comments on #5838.

Fixes #5838

Change-Id: I6377d7bd8dcd00c85ca0c52b6683e70ce2174ba6
Reviewed-on: https://go-review.googlesource.com/37439
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-03-22 23:53:01 +00:00
Brad Fitzpatrick
2730c17a86 syscall, os: fix FreeBSD 9 build
I broke FreeBSD 9 in https://golang.org/cl/38426 by using Pipe2.

We still want to support FreeBSD 9 for one last release (Go 1.9 will
be the last), and FreeBSD 9 doesn't have Pipe2.

So this still uses Pipe2, but falls back to Pipe on error.

Updates #18854
Updates #19072

Change-Id: I1de90fb83606c93fb84b4b86fba31e207a702835
Reviewed-on: https://go-review.googlesource.com/38430
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-03-21 22:37:27 +00:00
Brad Fitzpatrick
0ebaca6ba2 syscall, os: use pipe2 syscall on FreeBSD instead of pipe
The pipe2 syscall exists in all officially supported FreeBSD
versions: 10, 11 and future 12.
The pipe syscall no longer exists in 11 and 12. To build and
run Go on these versions, kernel needs COMPAT_FREEBSD10 option.

Based on Gleb Smirnoff's https://golang.org/cl/38422

Fixes #18854

Change-Id: I8e201ee1b15dca10427c3093b966025d160aaf61
Reviewed-on: https://go-review.googlesource.com/38426
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-03-21 20:01:23 +00:00
Josh Bleecher Snyder
689fa9cc28 syscall: fix linux/mipsx ret value FP offsets for Syscall9
Found by vet.

Change-Id: Idf910405566816ddce6781c8e99f90b59f33d63c
Reviewed-on: https://go-review.googlesource.com/37308
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2017-02-21 18:43:02 +00:00
Wander Lairson Costa
79f6a5c7bd syscall: only call setgroups if we need to
If the caller set ups a Credential in os/exec.Command,
os/exec.Command.Start will end up calling setgroups(2), even if no
supplementary groups were given.

Only root can call setgroups(2) on BSD kernels, which causes Start to
fail for non-root users when they try to set uid and gid for the new
process.

We fix by introducing a new field to syscall.Credential named
NoSetGroups, and setgroups(2) is only called if it is false.
We make this field with inverted logic to preserve backward
compatibility.

RELNOTES=yes

Change-Id: I3cff1f21c117a1430834f640ef21fd4e87e06804
Reviewed-on: https://go-review.googlesource.com/36697
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-02-17 14:36:27 +00:00
Sameer Ajmani
8d7722ede2 cmd/go: add "syscall" to the set of packages that run extFiles++
This eliminates the need for syscall/asm.s, which is now empty.

Change-Id: Ied060195e03e9653251f54ea8ef6572444b37fdf
Reviewed-on: https://go-review.googlesource.com/36844
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-13 20:28:02 +00:00
Sameer Ajmani
5a303aa1e9 syscall: delete the "use" function and calls in non-generated files.
Delete use stub from asm.s, leaving only a dummy file.
Deleting the file causes Windows build to fail.

Fixes #16607

Change-Id: Ic5a55e042e588f1e1bc6605a3d309d1eabdeb288
Reviewed-on: https://go-review.googlesource.com/36716
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-02-13 19:58:05 +00:00
Sameer Ajmani
bd2f7c7c41 syscall: remove "use" function and calls from generated code.
Update syscall code generators to set build tags.

Regenerate zsyscall files, which makes the following changes:
- remove calls to "use"
- update build tags, adding missing ones in some cases
- "stat" renamed to "st" in some cases
- "libc_Utimes" renamed "libc_utimes" in one case

I'll mirror this change to x/sys/unix once committed.

Change-Id: Ic07e0ae1433dd133eb57e8dd2a3b86a62aab4eda
Reviewed-on: https://go-review.googlesource.com/36616
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-02-09 18:30:49 +00:00
Elias Naur
7ef746961c syscall: regenerate zsyscall_darwin_arm64.go with mksyscall.pl
Notably, this change fixes the TestTCPReadWriteAllocs test because
the errnoErr wrapper is now used, elimitating the allocation for
common errnos.

The change to Dup is caused by a CL 8095 that changed the Dup* calls
to use Syscall instead of RawSyscall.

Found while working on the new iOS builders.

Change-Id: I44ab9dcad27db190e175aa149865b33944f48674
Reviewed-on: https://go-review.googlesource.com/36061
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-01 22:09:32 +00:00
Michael Munday
0642b8a2f1 syscall: export Fsid.X__val on s390x
mkpost.go replaces all variables prefixed with 'X_' with '_' on s390x
because most of them do not need to be exposed. X__val is being used
by a third party library so it turns out we do need to expose it on
s390x (it is already exposed on all other Linux architectures).

Fixes #17298 and updates #18632.

Change-Id: Ic03463229a5f75ca41a4a4b50300da4b4d892d45
Reviewed-on: https://go-review.googlesource.com/30130
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-01-13 19:31:47 +00:00
Joel Sing
f91ddaabe6 runtime, syscall: update openbsd for changes to syskill
Change the openbsd runtime to use the current sys_kill and sys_thrkill
system calls.

Prior to OpenBSD 5.9 the sys_kill system call could be used with both
processes and threads. In OpenBSD 5.9 this functionality was split into
a sys_kill system call for processes (with a new syscall number) and a
sys_thrkill system call for threads. The original/legacy system call was
retained in OpenBSD 5.9 and OpenBSD 6.0, however has been removed and
will not exist in the upcoming OpenBSD 6.1 release.

Note: This change is needed to make Go work on OpenBSD 6.1 (to be
released in May 2017) and should be included in the Go 1.8 release.
This change also drops support for OpenBSD 5.8, which is already an
unsupported OpenBSD release.

Change-Id: I525ed9b57c66c0c6f438dfa32feb29c7eefc72b0
Reviewed-on: https://go-review.googlesource.com/34093
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-12-12 01:30:39 +00:00
David du Colombier
816aa99b9a syscall: define bind flags on Plan 9
These bind flags were removed by mistake in CL 2167.

Fixes #17921.

Change-Id: I1e8089dade30a212b8db0b216c8299946d924d4b
Reviewed-on: https://go-review.googlesource.com/33271
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-11-15 18:19:10 +00:00
Jesse Szwedko
5f74ce394f syscall: Clearenv now unsets env vars on Windows
Previously, `os.Clearenv()` (by way of `syscall.Clearenv`) would simply
set all environment variables' values to `""` rather than actually
unsetting them causing subsequent `os.LookupEnv` calls to return that
they were still set.

Fixes #17902

Change-Id: I54081b4b98665e9a39f55ea7582c8d40bb8a2a22
Reviewed-on: https://go-review.googlesource.com/33168
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2016-11-14 00:04:03 +00:00
Dmitri Shuralyov
d8264de868 all: spell "marshal" and "unmarshal" consistently
The tree is inconsistent about single l vs double l in those
words in documentation, test messages, and one error value text.

	$ git grep -E '[Mm]arshall(|s|er|ers|ed|ing)' | wc -l
	      42
	$ git grep -E '[Mm]arshal(|s|er|ers|ed|ing)' | wc -l
	    1694

Make it consistently a single l, per earlier decisions. This means
contributors won't be confused by misleading precedence, and it helps
consistency.

Change the spelling in one error value text in newRawAttributes of
crypto/x509 package to be consistent.

This change was generated with:

	perl -i -npe 's,([Mm]arshal)l(|s|er|ers|ed|ing),$1$2,' $(git grep -l -E '[Mm]arshall' | grep -v AUTHORS | grep -v CONTRIBUTORS)

Updates #12431.
Follows https://golang.org/cl/14150.

Change-Id: I85d28a2d7692862ccb02d6a09f5d18538b6049a2
Reviewed-on: https://go-review.googlesource.com/33017
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-11-12 00:13:35 +00:00
Brad Fitzpatrick
22c70f268b syscall: use 32-bit setuid/setgid syscalls on linux/{386,arm}
Fixes #17092

Change-Id: Ib14e4db13116ebbe4d72c414fb979d27a06d6174
Reviewed-on: https://go-review.googlesource.com/33011
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-11-09 21:50:55 +00:00
Brad Fitzpatrick
c41137d242 syscall: fix name of prlimit parameters
Fixes #17606

Change-Id: I040c7621cef265d44b58f16556e6d58660a2245d
Reviewed-on: https://go-review.googlesource.com/32889
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-11-08 16:09:48 +00:00
Shenghou Ma
f335fcf0fc syscall: add Getexecname on Solaris for os.Executable
Change-Id: Icd77ccbfe6a31117a11effb949b5826950df75a9
Reviewed-on: https://go-review.googlesource.com/16550
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-11-07 20:18:29 +00:00
Vladimir Stefanovic
58e3bf11fb syscall: add support for GOARCH=mips{,le}
Change-Id: I39a46b2a9412981db1780b688a86fec791f68b6f
Reviewed-on: https://go-review.googlesource.com/31488
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2016-11-03 23:02:18 +00:00
Ian Gudger
154860ff17 syscall: remove X__cmsg_data from Cmsghdr
This field is a zero length array and has little use. Since Go 1.5, trailing
zero-length arrays take up space. Both syscall.UnixRights() and
syscall.ParseSocketControlMessage() depend on being able to do an unsafe cast
of socket control message data to Cmsghdr this is only safe if the socket
control message data is greater than or equal to the size of Cmsghdr. Since
control message data that is equal in size to Cmsghdr without X__cmsg_data is
a valid socket control message, we must remove X__cmsg_data or not perform the
unsafe cast.

Removing X__cmsg_data will prevent Go code that uses X__cmsg_data from
compiling, but removing the unsafe cast will cause Go code that uses
X__cmsg_data to fail or exhibit undefined behavior at runtime. It was
therefore decided that removing X__cmsg_data was the better option.

Fixes #17649

Change-Id: I39f323f978eca09d62da5785c5c5c9c7cbdf8c31
Reviewed-on: https://go-review.googlesource.com/32319
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-10-30 19:04:09 +00:00
David du Colombier
263a825b05 syscall: use name+(NN)FP on plan9/amd64
Generated from go vet.

Change-Id: Ie775c29b505166e0bd511826ef20eeb153a0424c
Reviewed-on: https://go-review.googlesource.com/32071
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-10-25 22:13:35 +00:00
David du Colombier
71f72e9d4f syscall: use name+(NN)FP on plan9/386
Generated from go vet.

Change-Id: I2620e5544be46485a876c7dce26b0592bf5a4101
Reviewed-on: https://go-review.googlesource.com/32070
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-10-25 22:13:29 +00:00
Josh Bleecher Snyder
d8f7e4fadb runtime, syscall: appease vet
No functional changes.

Change-Id: I0842b2560f4296abfc453410fdd79514132cab83
Reviewed-on: https://go-review.googlesource.com/31935
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-10-25 15:11:54 +00:00
Alex Brainman
b7477f3869 syscall: use ERROR_IO_PENDING value in errnoErr
So errnoErr can be used in other packages.
This is something I missed when I sent CL 28990.

Fixes #17539

Change-Id: I8ee3b79c4d70ca1e5b29e5b40024f7ae9a86061e
Reviewed-on: https://go-review.googlesource.com/29690
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-10-22 23:05:01 +00:00
Brad Fitzpatrick
1e3dc3d5d4 syscall: make Utimes on Solaris match all the other geese
Updates #14892

Change-Id: I640c6e1635ccdf611f219521a7d297a9885c4cb3
Reviewed-on: https://go-review.googlesource.com/31446
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-10-19 13:55:50 +00:00
Russ Cox
6c295a9a71 syscall: for ForkExec on Linux, always use 32-bit setgroups system call
Fixes #17092.

Change-Id: If203d802a919e00594ddc1282782fc59a083fd63
Reviewed-on: https://go-review.googlesource.com/31458
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-10-19 13:33:18 +00:00
Hiroshi Ioka
e65bce7144 os, syscall: fix incorrect offset calculation in Readlink on windows
Current implementation of syscall.Readlink mistakenly calculates
the end offset of the PrintName field.
Also, there are some cases that the PrintName field is empty.
Instead, the CL uses SubstituteName with correct calculation.

Fixes #15978
Fixes #16145

Change-Id: If3257137141129ac1c552d003726d5b9c08bb754
Reviewed-on: https://go-review.googlesource.com/31118
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-10-19 01:25:18 +00:00
Brad Fitzpatrick
7a7ea01c65 syscall, net: make deadline changes affect blocked read/write calls on nacl
Flesh out nacl's fake network system to match how all the other
platforms work: all other systems' SetReadDeadline and
SetWriteDeadline affect currently-blocked read & write calls.
This was documented in golang.org/cl/30164 because it was the status
quo and existing packages relied on it. (notably the net/http package)

And add a test.

Change-Id: I074a1054dcabcedc97b173dad5e827f8babf7cfc
Reviewed-on: https://go-review.googlesource.com/31178
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-10-17 05:53:00 +00:00
Russ Cox
90a750857c syscall: update darwin/amd64 for timespec change
Change-Id: I74f47f519dfee10cd079ad9a4e09e36e8d74c6dc
Reviewed-on: https://go-review.googlesource.com/30937
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-10-12 23:51:42 +00:00
Kevin Burke
8d1d9292ff syscall: document that Exec wraps execve(2)
Change-Id: I611511434f37c75f77c22f61f469108243bc0101
Reviewed-on: https://go-review.googlesource.com/29121
Reviewed-by: Russ Cox <rsc@golang.org>
2016-10-12 15:02:57 +00:00
Ian Lance Taylor
6c517df4da syscall: unify NsecToTime{spec,val}, fix for times < 1970
All the implementations of NsecToTimespec and NsecToTimeval were the
same other than types. Write a single version that uses
GOARCH/GOOS-specific setTimespec and setTimeval functions to handle the
types.

The logic in NsecToTimespec and NsecToTimeval caused times before 1970
to have a negative usec/nsec. The Linux kernel requires that usec
contain a positive number; for consistency, we do this for both
NsecToTimespec and NsecToTimeval.

Change-Id: I525eaba2e7cdb00cb57fa00182dabf19fec298ae
Reviewed-on: https://go-review.googlesource.com/30826
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-10-12 13:10:54 +00:00
Ian Lance Taylor
7f6eadb64f syscall: unify TimespecToNsec and TimevalToNsec
All implementations of these functions are identical.

Change-Id: I7cbea53c02bb0cee75e30beed19d29ba0a7ef657
Reviewed-on: https://go-review.googlesource.com/30819
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-10-11 22:58:57 +00:00
Quentin Smith
cb986def67 syscall: relax TestUnshare
Fixes #17224.

Some systems have more than just "lo" in a fresh network namespace, due
to IPv6. Instead of testing for exactly 3 lines of output (implying 1
interface), just test to make sure that the unshare call resulted in
fewer interfaces than before. This should still verify that unshare did
something.

Change-Id: Iaf84c2b0e673fc207059d62e2f4dd7583a753419
Reviewed-on: https://go-review.googlesource.com/30372
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Jessica Frazelle <me@jessfraz.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-10-05 19:30:42 +00:00
Mikio Hara
89c4cbd7ac syscall: fix Send{msg,msgN}, Recvmsg and control message handling on solaris
This change switches the use of socket implementation from the
conventional SUS-based one to the latest POSIX-based one to make
socket control message work correctly on Solaris.

It looks like those two implementations, Socket over TLI/XTI and
Socket, have different semantics in details but it wouldn't hurt
the existing applications because the exposed syscall API doesn't
support socket properties related to such a protocol independent
application framework.

Fixes #7402.

Change-Id: I45a4e782d606bfbebe1404086c50a8c69af53461
Reviewed-on: https://go-review.googlesource.com/30171
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-10-03 23:53:42 +00:00
Mikio Hara
05f599594a syscall: re-enable TestPassFD on dragonfly
At least it works well on DragonFly BSD 4.6.

Change-Id: I3b210745246c6d8d42e32ba65ee3b9a17d171ff7
Reviewed-on: https://go-review.googlesource.com/30170
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-10-01 15:35:23 +00:00
Matthew Dempsky
9828b7c468 runtime, syscall: use FP instead of SP for parameters
Consistently access function parameters using the FP pseudo-register
instead of SP (e.g., x+0(FP) instead of x+4(SP) or x+8(SP), depending
on register size). Two reasons: 1) doc/asm says the SP pseudo-register
should use negative offsets in the range [-framesize, 0), and 2)
cmd/vet only validates parameter offsets when indexed from the FP
pseudo-register.

No binary changes to the compiled object files for any of the affected
package/OS/arch combinations.

Change-Id: I0efc6079bc7519fcea588c114ec6a39b245d68b0
Reviewed-on: https://go-review.googlesource.com/30085
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-09-30 05:40:43 +00:00
Brad Fitzpatrick
8e69d43b32 net: add Buffers type, do writev on unix
No fast path currently for solaris, windows, nacl, plan9.

Fixes #13451

Change-Id: I24b3233a2e3a57fc6445e276a5c0d7b097884007
Reviewed-on: https://go-review.googlesource.com/29951
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-09-29 20:33:45 +00:00
Kale Blankenship
890c09efb7 os: make IsExist report true on ERROR_DIR_NOT_EMPTY on Windows
Fixes #17164

Change-Id: I3e626d92293c1379e2922276f033fdee6f48dda3
Reviewed-on: https://go-review.googlesource.com/29753
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-09-25 02:38:11 +00:00
Mikio Hara
6072e4d710 syscall: fix build on dragonfly
This change fixes the broken build caused by CL 23780.

Change-Id: I142cf8a1af033d036d57ac56e9e21ea925d922d4
Reviewed-on: https://go-review.googlesource.com/29490
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-09-21 05:23:57 +00:00
Damien Neil
f5f7d6e32d syscall: validate ParseDirent inputs
Don't panic, crash, or return references to uninitialized memory when
ParseDirent is passed invalid input.

Move common dirent parsing to syscall.go with minimal platform-specific
functions in syscall_$GOOS.go.

Fixes #15653

Change-Id: I5602475e02321fe381064488401c14b33bec6886
Reviewed-on: https://go-review.googlesource.com/23780
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-09-20 19:27:57 +00:00
David Stainton
6fd8c006ad syscall: add bounds checking and error returns to ParseNetlinkMessage
Fixes #16681

Change-Id: I6ff7ec81fe48ab06be3aae5b7ff92e9dc70960c3
Reviewed-on: https://go-review.googlesource.com/26990
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
2016-09-14 08:42:28 +00:00
Alex Brainman
fca3dd3718 syscall: avoid convT2I allocs for ERROR_IO_PENDING instead of WSAEINPROGRESS
CL 28484 mistakenly assumed that WSARecv returns WSAEINPROGRESS
when there is nothing to read. But the error is ERROR_IO_PENDING.
Fix that mistake.

I was about to write a test for it. But I have found
TestTCPReadWriteAllocs in net package that does nearly what I need,
but was conveniently disabled. So enable and extend the test.

Fixes #16988

Change-Id: I55e5cf8998a9cf29e92b398d702280bdf7d6fc85
Reviewed-on: https://go-review.googlesource.com/28990
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-09-11 01:42:30 +00:00
Brad Fitzpatrick
ca264cdc62 syscall: avoid convT2I allocs for common Windows error values
This is was already done for Unix in https://golang.org/cl/6701 +
https://golang.org/cl/8192. Do it for Windows also.

Fixes #16988

Change-Id: Ia7832b0d0d48566b0cd205652b85130df529592e
Reviewed-on: https://go-review.googlesource.com/28484
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2016-09-07 04:46:25 +00:00
Brad Fitzpatrick
a4bdd64555 syscall: use MNT_NOWAIT in TestGetfsstat
Fixes test failure when VMWare's shared folder filesystem is present.

MNT_NOWAIT is what the mount(8) command does.

Fixes #16937

Change-Id: Id436185f544b7069db46c8716d6a0bf580b31da0
Reviewed-on: https://go-review.googlesource.com/28550
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2016-09-07 00:58:19 +00:00
Austin Clements
1b9499b069 syscall: make Getpagesize return page size from runtime
syscall.Getpagesize currently returns hard-coded page sizes on all
architectures (some of which are probably always wrong, and some of
which are definitely not always right). The runtime now has this
information, queried from the OS during runtime init, so make
syscall.Getpagesize return the page size that the runtime knows.

Updates #10180.

Change-Id: I4daa6fbc61a2193eb8fa9e7878960971205ac346
Reviewed-on: https://go-review.googlesource.com/25051
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-09-06 21:05:55 +00:00
Brad Fitzpatrick
6db13e071b syscall: add yet more TestGetfsstat debugging
Updates #16937

Change-Id: I98aa203176f8f2ca2fcca6e334a65bc60d6f824d
Reviewed-on: https://go-review.googlesource.com/28535
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-09-06 04:16:42 +00:00
Brad Fitzpatrick
d588864093 syscall: add more TestGetfsstat debugging
Updates #16937

Change-Id: I6d1b210c741269b58040bd68bf3b51644f891737
Reviewed-on: https://go-review.googlesource.com/28487
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2016-09-05 02:13:32 +00:00
Brad Fitzpatrick
b040bc9c06 syscall: add some debugging to TestGetfsstat
TestGetfsstat is failing on OS X 10.8.

Not sure why. Add more debug info.

Change-Id: I7dabb70dd7aeffda7e8959103db9e4886b84741e
Reviewed-on: https://go-review.googlesource.com/28220
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-08-31 05:14:30 +00:00
Josh Bleecher Snyder
e022dcd35f syscall: fix plan9/386 RawSyscall6
Fixes the build.

Change-Id: I34bcae08cfb43257aeb9086336966ef85f15fe1d
Reviewed-on: https://go-review.googlesource.com/27815
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2016-08-26 00:20:34 +00:00
Josh Bleecher Snyder
71ab9fa312 all: fix assembly vet issues
Add missing function prototypes.
Fix function prototypes.
Use FP references instead of SP references.
Fix variable names.
Update comments.
Clean up whitespace. (Not for vet.)

All fairly minor fixes to make vet happy.

Updates #11041

Change-Id: Ifab2cdf235ff61cdc226ab1d84b8467b5ac9446c
Reviewed-on: https://go-review.googlesource.com/27713
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-08-25 18:52:31 +00:00