1
0
mirror of https://github.com/golang/go synced 2024-10-04 20:21:22 -06:00
Commit Graph

550 Commits

Author SHA1 Message Date
Mikio Hara
9a7947288b syscall: update routing socket parser for NetBSD 6 and beyond
NetBSD 6 kernel and beyond require 64-bit aligned access to routing
facilities.

Fixes #6226.

R=golang-dev, bsiegert, bradfitz
CC=golang-dev
https://golang.org/cl/13170043
2013-08-25 08:44:31 +09:00
Rémy Oudompheng
534c67abc4 syscall: add Cloneflags to Linux SysProcAttr.
Also use clone(2) syscall instead of fork().

Fixes #6214.

R=golang-dev, bradfitz, dave
CC=golang-dev
https://golang.org/cl/13159044
2013-08-24 03:34:07 +02:00
Rémy Oudompheng
d4f719ee13 syscall: define CLONE_* constants on Linux.
Update #6214

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13160043
2013-08-23 22:26:49 +02:00
Joel Sing
f3442a80c3 syscall: dragonfly/amd64 z-files
Add generated z-files for dragonfly/amd64.

R=bradfitz
CC=golang-dev
https://golang.org/cl/13056045
2013-08-24 01:52:33 +10:00
Joel Sing
8f3f4c96a3 syscall: dragonfly/amd64 support
Add syscall support for dragonfly/amd64.

Also add support for generating syscall z* files for dragonfly.

R=bradfitz
CC=golang-dev
https://golang.org/cl/13188043
2013-08-24 01:51:25 +10:00
Rémy Oudompheng
4a7a72b8c1 syscall: fix stale URL for linux/arm unistd.h
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13105047
2013-08-22 00:59:48 +02:00
Dmitriy Vyukov
e33e476e07 syscall: disable cpu profiling around fork
Fixes #5517.
Fixes #5659.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12183044
2013-08-13 13:01:30 +04:00
Keith Randall
db324ccd72 syscall: Convert textflags from numbers to symbols.
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12773043
2013-08-12 10:24:30 -07:00
Dmitriy Vyukov
ed8c5501c7 net: use SetFileCompletionNotificationModes on windows if available
This allows to skip GetQueuedCompletionStatus if an IO operation completes synchronously.
benchmark                    old ns/op    new ns/op    delta
BenchmarkTCP4Persistent          27669        25863   -6.53%
BenchmarkTCP4Persistent-2        18173        15908  -12.46%
BenchmarkTCP4Persistent-4        10390         9766   -6.01%

R=golang-dev, mikioh.mikioh, alex.brainman
CC=golang-dev
https://golang.org/cl/12409044
2013-08-08 17:36:43 +04:00
Mikio Hara
262d6f58c7 syscall: fix IPv6 wrong network mask on latest FreeBSD
Looks like latest FreeBSD doesn't set address family identifer
for RTAX_NETMASK stuff; probably RTAX_GENMASK too, not confirmed.
This CL tries to identify address families by using the length of
each socket address if possible.

The issue is confirmed on FreeBSD 9.1.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12332043
2013-08-07 00:25:23 +09:00
Brad Fitzpatrick
37feacf623 net: use F_DUPFD_CLOEXEC when duping fds
This means that in the common case (modern kernel), we only
make 1 system call to dup instead of two, and we also avoid
grabbing the syscall.ForkLock.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/12476043
2013-08-05 15:43:45 -07:00
Brad Fitzpatrick
7963ba6a4a os, syscall: implement Getwd on darwin using getattrlist
Fixes #4807

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12349044
2013-08-05 12:26:05 -07:00
Brad Fitzpatrick
c8d49cf56f syscall: add Dup3 on Linux
With dup3, we can avoid an extra system call on some machines
while holding syscall.ForkLock. Currently we have to
syscall.Dup + syscall.CloseOnExec.

On machines with Linux and a new enough kernel, this can just
be dup3.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/12170045
2013-07-31 23:38:53 -07:00
Peter Mundy
5852760088 syscall: prlimit argument error for Getrlimit and Setrlimit on Linux 32-bit
The rlimit arguments for prlimit are reversed for linux 32-bit (386 and arm).
Getrlimit becomes Setrlimit and vice versa.
Fixes #5949.

R=iant, mikioh.mikioh, rsc
CC=golang-dev
https://golang.org/cl/11803043
2013-07-25 09:56:06 -04:00
Russ Cox
e69082ffdb syscall: record argument size for all assembly functions
While we're here, fix Syscall9 on NetBSD and OpenBSD:
it was storing the results into the wrong memory locations.
I guess no one uses that function's results on those systems.

Part of cleaning up stack traces and argument frame information.

R=golang-dev, dvyukov
CC=golang-dev
https://golang.org/cl/11355044
2013-07-16 16:23:53 -04:00
Dmitriy Vyukov
63e0ddc7bf cmd/gc: do not race instrument syscall.forkAndExecInChild
Race instrumentation can allocate, switch stacks, preempt, etc.
All that is not allowed in between fork and exec.
Fixes #4840.

R=golang-dev, daniel.morsing, dave
CC=golang-dev
https://golang.org/cl/11324044
2013-07-16 15:35:03 +04:00
Shenghou Ma
72faa4bc51 syscall: implement Sendfile for Darwin.
Update #5847
Summary: syscall: implement Sendfile for OpenBSD and NetBSD

R=golang-dev, rsc, dave
CC=golang-dev
https://golang.org/cl/10980043
2013-07-12 04:34:54 +08:00
Dave Cheney
2a730f8b16 syscall: reduce duplication between *bsd and linux
Part 3 of several.

* Linux has grown a SetsockoptByte.
* SetsockoptIPMreqn is handled directly by syscall_linux.go and syscall_freebsd.go.

R=golang-dev, mikioh.mikioh, r, bradfitz
CC=golang-dev
https://golang.org/cl/10775043
2013-07-05 13:25:23 +10:00
Alex Brainman
04b405c7fc syscall: handle empty environment variable values properly on windows
Setenv("AN_ENV_VAR", "") deletes AN_ENV_VAR instead of setting it
to "" at this moment. Also Getenv("AN_ENV_VAR") returns "not found",
if AN_ENV_VAR is "". Change it, so they behave like unix.

Fixes #5610

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/10594043
2013-06-27 10:11:30 +10:00
Dave Cheney
3b76d70e11 syscall: reduce duplication between *bsd and linux
Part 2 of several.

R=rsc, mikioh.mikioh, r
CC=golang-dev
https://golang.org/cl/10462043
2013-06-25 10:14:40 +10:00
Dave Cheney
dd3a3cfa49 syscall: reduce duplication between *bsd and linux
See discussion: https://groups.google.com/forum/#!topic/golang-dev/zSmH0lQxKAs

Part 1 of several.

Move identical types and functions to syscall_unix.go.

R=rsc, mikioh.mikioh, r
CC=golang-dev
https://golang.org/cl/10392048
2013-06-22 11:03:40 +10:00
Rob Pike
0bc7e79afd all: excise some warts found by vet -shadow
These are not erroneous, just poor or confusing.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/10448043
2013-06-20 16:14:40 -07:00
Alex Brainman
9b2561ef16 os: request appropriate access rights before calling windows TerminateProcess
Fixes #5615.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/9651047
2013-06-11 13:06:38 +10:00
Shenghou Ma
46e30c7d70 syscall: add {Set,Get}priority for Linux, and consistency tests
R=golang-dev, iant, bradfitz, dave
CC=golang-dev
https://golang.org/cl/7430044
2013-06-11 02:47:04 +08:00
Dmitriy Vyukov
fc80764792 runtime/race: tell race detector what memory Read/Write syscalls touch
Fixes #5567.

R=golang-dev, dave, iant
CC=golang-dev
https://golang.org/cl/10085043
2013-06-10 22:40:35 +04:00
Alex Brainman
bb6e265fed os: return io.EOF from windows ReadAt as documented
Fixes #5619.

R=golang-dev, r, peter.armitage, go.peter.90
CC=golang-dev
https://golang.org/cl/9952044
2013-06-10 19:14:41 +10:00
Mikio Hara
adbe59e332 syscall: add IPv6 socket options for Unix variants
This CL adds missing IPv6 socket options which are required
to control IPv6 as described in RFC 3493, RFC 3542.

Update #5538

R=golang-dev, dave, iant
CC=golang-dev
https://golang.org/cl/9373046
2013-05-23 16:22:05 +09:00
Mikio Hara
b98a4d1a10 syscall: prefer PATH environment variable in bootstrap scripts
R=golang-dev, dave, iant
CC=golang-dev
https://golang.org/cl/9575043
2013-05-20 23:18:52 +09:00
Alexey Borzenkov
fae362e97e os/user: faster user lookup on Windows
Trying to lookup user's display name with directory services can
take several seconds when user's computer is not in a domain.
As a workaround, check if computer is joined in a domain first,
and don't use directory services if it is not.
Additionally, don't leak tokens in user.Current().
Fixes #5298.

R=golang-dev, bradfitz, alex.brainman, lucio.dere
CC=golang-dev
https://golang.org/cl/8541047
2013-05-15 13:24:54 +10:00
Shenghou Ma
6de184b385 syscall: fix prototype of Fchflags (API change)
API change, but the old API is obviously wrong.

R=golang-dev, iant, r, rsc
CC=golang-dev
https://golang.org/cl/9157044
2013-05-07 05:20:00 +08:00
Cosmos Nicolaou
b493f0a868 syscall: fix a bug in the shuffling of file descriptors in StartProcess on Linux.
R=iant, iant, r, bradfitz
CC=golang-dev
https://golang.org/cl/8334044
2013-04-30 11:52:23 -07:00
Rob Pike
479b1241b5 syscall: fix exec_bsd.go to accompany exec_linux.go changes
exec_plan9.go too.
Those are in CL 8334044

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/9055043
2013-04-30 11:52:15 -07:00
Albert Strasheim
0399e76b66 os/exec, syscall: fix tests to pass when GOGCTRACE=1 is set
R=golang-dev, bradfitz, minux.ma
CC=golang-dev
https://golang.org/cl/8193043
2013-03-30 09:22:11 -07:00
Russ Cox
f6d0adedb6 build: remove dead code
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7877045
2013-03-22 17:28:22 -04:00
Dave Cheney
9dd92d522f syscall: add PROT_* and MAP_* constants to freebsd
Update #4929

Regenerated from FreeBSD-9.1 for amd64 and 386, FreeBSD-CURRENT for arm.

R=devon.odell, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/7438053
2013-03-09 16:25:30 +11:00
Akshat Kumar
a566deace1 syscall: Plan 9: use lightweight errstr in entersyscall mode
Change 231af8ac63aa (CL 7314062) made runtime.enteryscall()
set m->mcache = nil, which means that we can no longer use
syscall.errstr in syscall.Syscall and syscall.Syscall6, since it
requires a new buffer to be allocated for holding the error string.
Instead, we use pre-allocated per-M storage to hold error strings
from syscalls made while in entersyscall mode, and call
runtime.findnull to calculate the lengths.

Fixes #4994.

R=rsc, rminnich, ality, dvyukov, rminnich, r
CC=golang-dev
https://golang.org/cl/7567043
2013-03-08 00:54:44 +01:00
Joel Sing
1b36bcc3b5 syscall: handle getsockname for unix sockets on openbsd 5.2
On OpenBSD 5.2, calling getsockname on an unbound Unix domain socket
results in a successful syscall, however the AF is unset and the length
is returned as zero. This has been changed to more portable behaviour,
which will be included in the OpenBSD 5.3 release.

For now, work around this by treating a successful getsockname() call
that returns a family of AF_UNSPEC and length of zero as a AF_UNIX
socket.

Makes TestPassFD work on OpenBSD 5.2.

Fixes #4956.

R=golang-dev, minux.ma, rsc, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/7449046
2013-03-05 21:40:37 +11:00
Russ Cox
418dd410db syscall: disable TestPassFD on openbsd
Update #4956.

R=golang-dev
CC=golang-dev
https://golang.org/cl/7417048
2013-03-01 11:51:32 -05:00
Akshat Kumar
f0a8b610e7 net, os, syscall: Plan 9: adjust error handling
syscall: Use NewError for all system errors and introduce
        some new errors for compatibility with other packages
        and proper error handling in net. Also introduce
        Temporary and Timeout methods on ErrorString.

net: Make errors from dial, accept, listen functions follow the
        OpError standard and discern whether the underlying
        error came from syscall. Since Plan 9 uses a correspondence
        between file and network operations, all system error
        reporting happens through the underlying file operation.
        In Go code, we go through package os for file operations,
        so there is another level of indirection in error types.
        This change allows us to compare the errors with those in
        package syscall, when appropriate.

os: Just use the error string already present in package os,
        instead of calling out to package syscall.

R=rsc, ality, rminnich, bradfitz
CC=golang-dev
https://golang.org/cl/7398054
2013-02-28 06:43:21 +01:00
Akshat Kumar
1f62a784f4 syscall: Plan 9: keep a consistent environment array
Map order is non-deterministic. Introduce a new
environment string array that tracks the env map.
This allows us to produce identical results for
Environ() upon successive calls, as expected by the
TestConsistentEnviron test in package os.

R=rsc, ality, rminnich, bradfitz, r
CC=golang-dev
https://golang.org/cl/7411047
2013-02-28 06:39:02 +01:00
Brad Fitzpatrick
abf5700a15 syscall: add MSG_FASTOPEN to Linux
Update #4842

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7369060
2013-02-27 15:51:51 -08:00
Matthew Dempsky
f853e9aa4e syscall: Fix FD passing on OpenBSD
Fixes #3349.

R=bradfitz, dave, minux.ma
CC=golang-dev
https://golang.org/cl/7383056
2013-02-27 15:19:23 +11:00
Dave Cheney
98d44d140d syscall: fix FD passing on FreeBSD and NetBSD
Fixes #3348.

R=devon.odell, minux.ma, bradfitz, mdempsky
CC=golang-dev
https://golang.org/cl/7406050
2013-02-27 09:13:15 +11:00
Alex Brainman
26498684cb os: use windows ReadConsole to read from console
Fixes #4760.

R=golang-dev, minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/7312053
2013-02-26 14:18:48 +11:00
Akshat Kumar
d2326febd5 syscall, runtime: Plan 9: use nanotime syscall on amd64
Separates the implementation of nanotime on 64-bit
version of Plan 9 from that on the 32-bit version.
The former uses a syscall.

R=rsc, rminnich, ality
CC=golang-dev
https://golang.org/cl/7379051
2013-02-26 01:56:08 +01:00
Akshat Kumar
b6e322dcf5 syscall: Plan9, amd64: fix syscall error handling in assembly
Syscalls return `-1' on error and the representation is always
32-bits. The `$-1' literal in 64-bit assembly is always the
64-bit representation. So this change makes sure that we
always do a 32-bit comparison when checking for error.
Also makes sure that in the error case, we return a 64-bit
`-1' from runtime.seek.

Fixes the arithmetic for handling the error-string in
runtime.Syscall6.

R=golang-dev, rminnich, rsc, ality, minux.ma
CC=golang-dev
https://golang.org/cl/7399052
2013-02-25 22:40:14 +01:00
Mikio Hara
c5f5df4d98 syscall: add network interface announce support on BSD variants
This CL allows to receive network interface arrival and depature
notifications through routing sockets on BSD variants. So far
Darwin doesn't support this feature.

Also does small simplification.

Update #4866.

R=golang-dev, lucio.dere, dave
CC=golang-dev
https://golang.org/cl/7365055
2013-02-24 12:36:44 +09:00
Mikio Hara
6a41b9983c syscall: add if_announce support for openbsd
Update #4866.

R=golang-dev
CC=golang-dev
https://golang.org/cl/7382053
2013-02-24 12:07:20 +09:00
Mikio Hara
d41dede280 syscall: add if_announce support for netbsd
Update #4866.

R=golang-dev, bradfitz, dave
CC=golang-dev
https://golang.org/cl/7382052
2013-02-24 12:06:24 +09:00
Mikio Hara
b1d51c63d6 syscall: add if_announce support for freebsd
Update #4866.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/7398047
2013-02-24 12:04:48 +09:00