1
0
mirror of https://github.com/golang/go synced 2024-10-05 14:11:22 -06:00
Commit Graph

124 Commits

Author SHA1 Message Date
Shenghou Ma
3925a7c5db all: switch to the new deprecation convention
While we're at it, move some misplaced comment blocks around.

Change-Id: I1847d7f1ca1dbb8e5de737203c4ed6c66e112508
Reviewed-on: https://go-review.googlesource.com/10188
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2015-06-18 19:16:23 +00:00
Russ Cox
7bc3e58806 all: extract "can I exec?" check from tests into internal/testenv
Change-Id: I7b54be9d8b50b39e01c6be21f310ae9a10404e9d
Reviewed-on: https://go-review.googlesource.com/10753
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-16 18:07:36 +00:00
Ian Lance Taylor
6f0e427298 syscall: fix TestCloneNEWUSERAndRemapNoRootDisableSetgroups the right way
The problem was not the kernel version as I thought before, it was
that the test used the same number for both the UID and the GID.
Thanks to Chris Siebenmann for debugging this.

Fixes #11220.

Change-Id: Ib5077e182497155e84044683209590ee0f7c9dde
Reviewed-on: https://go-review.googlesource.com/11124
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
2015-06-15 19:55:22 +00:00
Ian Lance Taylor
0ee92cf9c5 syscall: correct comment on where compileCallback is defined
Fixes #11216.

Change-Id: Iad1f4894c2258909484eaf975b08e0f47a82788e
Reviewed-on: https://go-review.googlesource.com/11098
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-06-15 03:10:52 +00:00
Ian Lance Taylor
6b24da6ae8 syscall: skip TestCloneNEWUSERAndRemapNoRootDisableSetgroups before 3.19
The test fails on Ubuntu Trusty for some reason, probably because of
some set of kernel patches.

Change-Id: I52f7ca50b96fea5725817c9e9198860d419f9313
Reviewed-on: https://go-review.googlesource.com/11055
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
2015-06-14 01:52:54 +00:00
Alexander Morozov
f5c60ff2da syscall: add GidMappingsEnableSetgroups to Linux SysProcAttr
Linux 3.19 made a change in the handling of setgroups and the 'gid_map' file to
address a security issue.
The upshot of the 3.19 changes is that in order to update the 'gid_maps' file,
use of the setgroups() system call in this user namespace must first be disabled
by writing "deny" to one of the /proc/PID/setgroups files for this namespace.

Also added tests for remapping uid_map and gid_map inside new user
namespace.

Fixes #10626

Change-Id: I4d2539acbab741a37092d277e10f31fc39a8feb7
Reviewed-on: https://go-review.googlesource.com/10670
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-12 23:38:59 +00:00
Ainar Garipov
7f9f70e5b6 all: fix misprints in comments
These were found by grepping the comments from the go code and feeding
the output to aspell.

Change-Id: Id734d6c8d1938ec3c36bd94a4dbbad577e3ad395
Reviewed-on: https://go-review.googlesource.com/10941
Reviewed-by: Aamir Khan <syst3m.w0rm@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-06-11 14:18:57 +00:00
Austin Clements
2774b37306 all: use RET instead of RETURN on ppc64
All of the architectures except ppc64 have only "RET" for the return
mnemonic. ppc64 used to have only "RETURN", but commit cf06ea6
introduced RET as a synonym for RETURN to make ppc64 consistent with
the other architectures. However, that commit was never followed up to
make the code itself consistent by eliminating uses of RETURN.

This commit replaces all uses of RETURN in the ppc64 assembly with
RET.

This was done with
    sed -i 's/\<RETURN\>/RET/' **/*_ppc64x.s
plus one manual change to syscall/asm.s.

Change-Id: I3f6c8d2be157df8841d48de988ee43f3e3087995
Reviewed-on: https://go-review.googlesource.com/10672
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
2015-06-06 00:07:23 +00:00
Brad Fitzpatrick
d4ed30612c syscall: don't run fcntl child process test on iOS
Fixes darwin-arm{,64} builds.
Child processes aren't allowed on iOS.

Change-Id: I9258ed4df757ec394ef6327dbda96f5b9705bcdd
Reviewed-on: https://go-review.googlesource.com/10142
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2015-05-15 16:41:12 +00:00
Shenghou Ma
ed8ae79282 syscall: add test for Flock_t roundtrip
See CL 9962 for the rationale.

Change-Id: I73c714fce258430eea1e61d3835f5c8e9014ca1f
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/9925
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-05-15 01:45:49 +00:00
Shenghou Ma
38631846bf syscall: add explicit build tags
Auto-generated using the following bash script:
for i in z*_*_*.go; do
        goosgoarch=`basename ${i/${i/_*/}_/} .go`
        goos=${goosgoarch/_*/}
        goarch=${goosgoarch/*_/}
        echo $i $goos $goarch
        [ "$goos" = "windows" ] && continue
        sed -i -e "/^package /i\/\/ +build $goarch,$goos\n" "$i"
done

Change-Id: I756fee551d1698080e4591fed8f058ae0450aaa5
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/10113
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-05-15 01:04:27 +00:00
Shenghou Ma
5069452d6d syscall: fix F_SETLK{,W} on linux/ppc64
Change-Id: Ia81675b0f01ceafada32bdd2bc59088016a7421e
Reviewed-on: https://go-review.googlesource.com/10043
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-05-15 00:28:49 +00:00
Ian Lance Taylor
08ba7dbdfd syscall: mkerrors.sh: don't define _FILE_OFFSET_BITS if __LP64__
If __LP64__ is defined then the type "long" is 64-bits, and there is
no need to explicitly request _FILE_OFFSET_BITS == 64.  This changes
the definitions of F_GETLK, F_SETLK, and F_SETLKW on PPC to the values
that the kernel requires.  The values used in C when _FILE_OFFSET_BITS
== 64 are corrected by the glibc fcntl function before making the
system call.

With this change, regenerate ppc64le files on Ubuntu trusty.

Change-Id: I8dddbd8a6bae877efff818f5c5dd06291ade3238
Reviewed-on: https://go-review.googlesource.com/9962
Reviewed-by: Minux Ma <minux@golang.org>
2015-05-13 00:40:49 +00:00
Ian Lance Taylor
1828d03ad5 syscall: mksysnum_linux.pl: run syscall numbers through GCC
This will skip system call numbers that are ifdef'ed out in unistd.h,
as occurs on PPC.

Change-Id: I88e640e4621c7a8cc266433f34a7b4be71543ec9
Reviewed-on: https://go-review.googlesource.com/9966
Reviewed-by: Minux Ma <minux@golang.org>
2015-05-12 22:01:25 +00:00
Andrew Williams
9b379d7e04 syscall: relocate linux death signal code
Fix bug on Linux SysProcAttr handling: setting both Pdeathsig and
Credential caused Pdeathsig to be ignored. This is because the kernel
clears the deathsignal field when performing a setuid/setgid
system call.

Avoid this by moving Pdeathsig handling after Credential handling.

Fixes #9686

Change-Id: Id01896ad4e979b8c448e0061f00aa8762ca0ac94
Reviewed-on: https://go-review.googlesource.com/3290
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-05-12 19:34:46 +00:00
Shenghou Ma
7bbd4f780b syscall: fix running mkall.sh on linux/{ppc64,ppc64le}
Change-Id: I58c6e914d0e977d5748c87d277e30c933ed86f99
Reviewed-on: https://go-review.googlesource.com/9924
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-05-12 01:54:37 +00:00
Shenghou Ma
3475362011 syscall: fix InotifyInit on linux/arm64
There is no SYS_INOTIFY_INIT on linux/arm64, only SYS_INOTIFY_INIT1.

Change-Id: I97f430f2c2b910fb19dce495ff1adf591b8634fc
Reviewed-on: https://go-review.googlesource.com/9870
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-05-09 20:38:53 +00:00
Aram Hăvărneanu
92e959a414 syscall, net: use sendfile on Solaris
Updates #5847.

Change-Id: Ic93f2e5f9a6aa3bd49cf75b16474ec5e897d17e1
Reviewed-on: https://go-review.googlesource.com/7940
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2015-05-06 12:26:35 +00:00
Aram Hăvărneanu
fe5ef5c9d7 runtime, syscall: link Solaris binaries directly instead of using dlopen/dlsym
Before CL 8214 (use .plt instead of .got on Solaris) Solaris used a
dynamic linking scheme that didn't permit lazy binding. To speed program
startup, Go binaries only used it for a small number of symbols required
by the runtime. Other symbols were resolved on demand on first use, and
were cached for subsequent use. This required some moderately complex
code in the syscall package.

CL 8214 changed the way dynamic linking is implemented, and now lazy
binding is supported. As now all symbols are resolved lazily by the
dynamic loader, there is no need for the complex code in the syscall
package that did the same. This CL makes Go programs link directly
with the necessary shared libraries and deletes the lazy-loading code
implemented in Go.

Change-Id: Ifd7275db72de61b70647242e7056dd303b1aee9e
Reviewed-on: https://go-review.googlesource.com/9184
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-05-06 11:38:50 +00:00
Mikio Hara
fe3446bda2 syscall: fix TestSCMCredentials
Fixes #10703.

Change-Id: I55c0f07625a0847fb27defa9891af6db6eb21f82
Reviewed-on: https://go-review.googlesource.com/9714
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-05-06 00:29:36 +00:00
Shenghou Ma
62bc2e4c2d syscall: fix little-endian assumptions
Change-Id: Ia38256998e544d620a342dabedd9289d61fb0551
Reviewed-on: https://go-review.googlesource.com/9672
Reviewed-by: Dave Cheney <dave@cheney.net>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-05-03 04:11:28 +00:00
Shenghou Ma
e2cb9beb90 syscall: darwin/arm64 support
Change-Id: I3b3f80791a1db4c2b7318f81a115972cd2237f04
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/8783
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-04-16 12:43:44 +00:00
David du Colombier
7d3f81a9f3 syscall: ignore getwd errors when fixing working directory on Plan 9
In Plan 9, goroutines can run in different processes,
which don't share their working directory. However,
Go expects the working directory to be program-wide.

We use a Fixwd function to fix the working directory
before calling system calls which depend on the
working directory.

In fixwdLocked, the working directory is not fixed
when getwd returns an error. However, an error can
happen is some cases, notably when the directory
has been previously removed in another process.

Fixes #10422.

Change-Id: Ie0c36f97c4b5ebe27ff0ead360987c5b35f825e4
Reviewed-on: https://go-review.googlesource.com/8800
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-04-12 17:37:30 +00:00
David Crawshaw
2d8748eb8b syscall: skip fork test on darwin/arm64
Just like darwin/arm.

Change-Id: Iadc30b7307ae56fd4f8a681d49672bed7ca6966f
Reviewed-on: https://go-review.googlesource.com/8810
Reviewed-by: Minux Ma <minux@golang.org>
2015-04-12 11:52:31 +00:00
Dmitry Vyukov
53a8ee5011 syscall: correct code for cover cmd
Fixes #10378

This is clumsy, but currently cover tool fails as:

$ go test -run=none -cover syscall
syscall_linux_amd64.go:15: can only use //go:noescape with external func implementations
FAIL	syscall [build failed]

This happens because cover tool mishandles //go: comments.
r and gri said that fixing cover is infeasible due to go/ast limitations.

So at least fix the offending code so that coverage works.
This come up in context of coverage-guided fuzzing which works best
with program-wide coverage.

Change-Id: I142e5774c9f326ed38cb202693bd4edae93879ba
Reviewed-on: https://go-review.googlesource.com/8723
Reviewed-by: Rob Pike <r@golang.org>
2015-04-10 16:59:06 +00:00
Anthony Martin
b9ba4ed22b syscall: reduce the set of architecture-dependent files on Plan 9
Change-Id: I98b172181c2fd85aa385341e28bc661dbc274252
Reviewed-on: https://go-review.googlesource.com/2167
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-04-09 13:55:13 +00:00
Alex Brainman
32e75bace0 all: fix race when allocating buffer for some windows syscalls
Fixes #9753

Change-Id: I6c641ed7ef4f687a108e7d937ab4b9c24d5baf5d
Reviewed-on: https://go-review.googlesource.com/4940
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-04-08 02:06:31 +00:00
Brad Fitzpatrick
dde5b56c91 syscall: apply the errno allocation fix to other operating systems
The previously-submitted https://go-review.googlesource.com/#/c/6701
didn't include dragonfly, freebsd, nacl, netbsd, openbsd, or solaris.
(or things like darwin/arm or ppc64 or arm64)

So do them all.

Note I had to copy the function into tables_nacl.go. I found that
preferable to creating a new file just to have suitable build
tags. It's likely this function will be mirrored to plan9 and windows
later too, each of the 4 with their own policy of which error values
are common.

The corresponding x/sys CL for this CL is https://golang.org/cl/8190
but it excludes nacl (not in x/sys) and solaris (already broken).

Update Issue #8859

Change-Id: I91902615692b29b69c905edd9e126a26337294f6
Reviewed-on: https://go-review.googlesource.com/8192
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-03-27 16:58:02 +00:00
Brad Fitzpatrick
6bf00075ad syscall: don't allocate when boxing common Errno values into errors
Fixes #8859

Change-Id: If8098e6edad1f83dc35fa84f4431689e8ee97678
Reviewed-on: https://go-review.googlesource.com/6701
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-03-27 06:47:27 +00:00
Ian Lance Taylor
28074d5baa syscall: change Dup,Dup2,Dup3 to use Syscall, not RawSyscall
This avoids hanging when a Go program uses a FUSE filesystem and the
dup system call has to close a file descriptor.  When dup uses
RawSyscall then the goroutine calling dup will occupy a scheduler slot
(a p structure) during the call, and may block waiting for some other
goroutine to respond to the close call on the FUSE filesystem.
Changing to Syscall avoids the problem.  This makes Dup a tiny bit
slower but is quite unlikely to make a difference for any real
programs.

Fixes #10202.

Change-Id: If6490a8f9b3c9cfed6acbfb4bfd1eaeac62ced17
Reviewed-on: https://go-review.googlesource.com/8095
Reviewed-by: Rob Pike <r@golang.org>
2015-03-26 17:29:08 +00:00
Ian Lance Taylor
222f371118 syscall: regenerate zsyscall_darwin_arm.go
This is mostly straightforward but it does introduce an odd change to
Fchflags and adds the Mlock related functions.  These changes look
correct to me but I don't know why they weren't in the original file.

Change-Id: I1a01e075566d327a78b77e7354c9fb85b6ad1f22
Reviewed-on: https://go-review.googlesource.com/8062
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2015-03-26 14:52:01 +00:00
Shenghou Ma
003dccfac4 runtime, syscall: use the new get_random_bytes syscall for NaCl
The SecureRandom named service was removed in
https://codereview.chromium.org/550523002. And the new syscall
was introduced in https://codereview.chromium.org/537543003.

Accepting this will remove the support for older version of
sel_ldr. I've confirmed that both pepper_40 and current
pepper_canary have this syscall.

After this change, we need sel_ldr from pepper_39 or above to
work.

Fixes #9261

Change-Id: I096973593aa302ade61f259a3a71ebc7c1a57913
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/1755
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2015-03-25 02:07:09 +00:00
Aram Hăvărneanu
41f9c430f3 runtime, syscall: fix Solaris exec tests
Also fixes a long-existing problem in the fork/exec path.

Change-Id: Idec40b1cee0cfb1625fe107db3eafdc0d71798f2
Reviewed-on: https://go-review.googlesource.com/8030
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2015-03-24 19:51:21 +00:00
Shenghou Ma
7a88c6465b syscall: use Getpgid to emulate Getpgrp on linux
Fixes newly introduced test on linux/arm64 because linux/arm64 doesn't
have the getpgrp syscall. Getpgid(0) is documented to be equivalent to
Getpgrp.

Change-Id: I8f30f4f8de8c32fe04a29c9c4a9330d4e4e6b46d
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/8022
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
Reviewed-by: Rob Pike <r@golang.org>
2015-03-24 19:47:20 +00:00
David Crawshaw
9ee6baa82a syscall: disable test that forks on darwin/arm
This test was introduced in cl/5130 and broke the darwin/arm builder.

Also check some errors, which was making the failure hard to decipher.

Change-Id: Ifb1d60b9971782cf8d2e979d83f8a81249d7ee9b
Reviewed-on: https://go-review.googlesource.com/7932
Reviewed-by: Rob Pike <r@golang.org>
2015-03-23 17:17:07 +00:00
Michael MacInnis
f7befa43a3 syscall: Add Foreground and Pgid to SysProcAttr
On Unix, when placing a child in a new process group, allow that group
to become the foreground process group. Also, allow a child process to
join a specific process group.

When setting the foreground process group, Ctty is used as the file
descriptor of the controlling terminal. Ctty has been added to the BSD
and Solaris SysProcAttr structures and the handling of Setctty changed
to match Linux.

Change-Id: I18d169a6c5ab8a6a90708c4ff52eb4aded50bc8c
Reviewed-on: https://go-review.googlesource.com/5130
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-03-23 15:35:53 +00:00
Aram Hăvărneanu
d0d9310df9 syscall: add support for GOARCH=arm64
Change-Id: Ia817e78d9678a365a76fea5e4dbe8f8a5aab0bac
Reviewed-on: https://go-review.googlesource.com/7143
Reviewed-by: Russ Cox <rsc@golang.org>
2015-03-16 18:46:02 +00:00
Joel Sing
550149fb04 syscall: add support for openbsd/arm
Change-Id: I9fe15781f52e0d16707a9c021cf800319721a606
Reviewed-on: https://go-review.googlesource.com/4913
Reviewed-by: Minux Ma <minux@golang.org>
2015-03-15 04:07:54 +00:00
Joel Sing
3b1d692093 all: remove dragonfly/386 port
DragonFlyBSD dropped support for i386 in 4.0 and there is no longer a
dragonfly/386 - as such, remove the Go port.

Fixes #8951
Fixes #7580
Fixes #7421

Change-Id: I69022ab2262132e8f97153f14dc8c37c98527008
Reviewed-on: https://go-review.googlesource.com/7543
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Joel Sing <jsing@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-03-14 10:47:19 +00:00
Mikio Hara
b100216441 syscall: add missing Syscall9 for darwin/amd64
Fixes #10068.

Change-Id: I1f12225ee16b0090b87403931c0bc0157f068309
Reviewed-on: https://go-review.googlesource.com/6555
Reviewed-by: Minux Ma <minux@golang.org>
2015-03-14 00:21:11 +00:00
Dave Cheney
532bc5f11c syscall: exec_linux.go: support platforms without SYS_DUP2
Updates #9974

This change is in preparation for merging the arm64 platform.

Arm64 does not support SYS_DUP2 at all, so define a new constant to be
the minimum dup(2) version supported. This constant defaults to SYS_DUP2
on all existing platforms.

Change-Id: If405878105082c7c880f8541c1491970124c9ce4
Reviewed-on: https://go-review.googlesource.com/7123
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-03-10 22:52:09 +00:00
Mikio Hara
59cc5a197f syscall: fix parsing ipv6 address prefix on dragonfly
This change fixes a missing case that a routing address contains an
invalid address family label but it holds a valid length of address
structure.

Also makes test robust.

Fixes #10041.

Change-Id: I2480ba273929e859896697382d1a75b01a116b98
Reviewed-on: https://go-review.googlesource.com/6391
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-03-03 03:27:14 +00:00
David du Colombier
f0bd95b8b9 syscall: fix mount working directory on Plan 9
In CL 6350, Brad fixed the following system calls
to use the program-wide workding directory:

- bind
- chdir
- create
- open
- remove
- stat
- umount
- wstat

However, Russ Cox pointed out that the mount
system call should be fixed as well.

Change-Id: I6139ed11ba449f18c46e95269f4d0e51be7cec48
Reviewed-on: https://go-review.googlesource.com/6385
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-03-01 18:33:41 +00:00
Brad Fitzpatrick
bc9748ee6b syscall: make pwd process-wide on Plan 9
On Plan 9, the pwd is apparently per-thread not per process. That
means different goroutines saw different current directories, even
changing within a goroutine as they were scheduled.

Instead, track the the process-wide pwd protected by a mutex in the
syscall package and set the current goroutine thread's pwd to the
correct once at critical points.

Fixes #9428

Change-Id: I928e90886355be4a95c2be834f5883e2b50fc0cf
Reviewed-on: https://go-review.googlesource.com/6350
Reviewed-by: David du Colombier <0intro@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-02-28 18:17:35 +00:00
Dave Cheney
e7a7352e52 syscall: Reimplement linux syscalls in terms of their *at replacements.
Updates #9974

This proposal tackles the body of syscalls which have been replaced,
and are now deprecated in linux. This is needed for the arm64 port as
arm64 is the first linux architecture to remove the "legacy" forms of
these syscalls.

The *AT variants were added in kernel 2.6.16, so well before our 2.6.23
cutoff (hey, it'll even work on RHEL5).

Discussion: https://groups.google.com/forum/#!topic/golang-dev/zpeFtN2z5Fc

Change-Id: I473a7c9a295d6f776fcdc75dcce06cbe9e3564ee
Reviewed-on: https://go-review.googlesource.com/5837
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-02-26 23:30:10 +00:00
David Crawshaw
a3c59779ff syscall: exclude Go tool test on darwin/arm
Change-Id: I44c1911beceaedaa35dad71d8be8a814528dce67
Reviewed-on: https://go-review.googlesource.com/6192
Reviewed-by: Minux Ma <minux@golang.org>
2015-02-26 23:10:18 +00:00
Dave Cheney
c123a80063 syscall: generate AT_* constants and regenerate ztypes_linux_*.go
Updates #9974

The *at family of syscalls requires some constants to be defined in the
syscall package for linux. Add the necessary constants and regenerate
the ztypes_linux_*.go files.

Change-Id: I6df343fef7bcacad30d36c7900dbfb621465a4fe
Reviewed-on: https://go-review.googlesource.com/5836
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-02-25 02:45:02 +00:00
Dave Cheney
1fda57ba72 syscall: split implementation of Dup2 per linux GOOS
Updates #9974

This proposal moves the definition of Dup2 from the generic syscall_linux.go
to the GOOS specific variants. This is in preparation for the arm64 port.

For all existing platforms Dup2 is not affected. When arm64 is added we'll use
either a forwarding method to Dup3 or

	//sysnb        Dup2(oldfd int, newfd int) (err error) = SYS_DUP3

Because mksycall.pl does not sort symbols before generating the output file
the diff includes some unavoidable code moves as Dup2 is processed latter in
the run.

Discussion: https://groups.google.com/forum/#!topic/golang-dev/zpeFtN2z5Fc

Change-Id: Icdedf55bb29e749c4230e1ee371bf9d0bd0cfb38
Reviewed-on: https://go-review.googlesource.com/5835
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Dave Cheney <dave@cheney.net>
2015-02-25 00:52:03 +00:00
Dave Cheney
9b3ccc082f syscall: split implementation of Pipe/Pipe2 per GOOS
Updates #9974

This proposal moves the definition of Pipe an Pipe2 from the generic
syscall_linux.go to the GOOS specific variants. This is in preparation
for the arm64 port.

For platforms where pipe2(2) is not supported in the minimum 2.6.23 kernel,
amd64 and 386, we retain pipe(2). For all other platforms pipe(2) is removed
and Pipe forwards to pipe2(2).

Because mksycall.pl does not sort symbols before generating the output file
the diff includes some unavoidable code moves as Pipe and Pipe2 are processed
latter in the run.

Discussion: https://groups.google.com/forum/#!topic/golang-dev/zpeFtN2z5Fc

Change-Id: Ie26d6761eeb9760dbaff974ee8bc0d57a9ceaee4
Reviewed-on: https://go-review.googlesource.com/5833
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2015-02-25 00:19:40 +00:00
Dave Cheney
42289a4f39 syscall: rebuild zsyscall_linux_*.go
Rebuild the zsyscall_linux_*.go files in preperation for #9974

The only change is the ppc64/ppc64le files which were not rebuilt when
syscall.use was added.

Change-Id: I804c63731e4900c782025de04ea3585d99688958
Reviewed-on: https://go-review.googlesource.com/5831
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-02-24 22:07:00 +00:00