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

80 Commits

Author SHA1 Message Date
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
Russ Cox
c72a21189b [dev.cc] runtime, syscall: add names to FP offsets in freebsd, netbsd arm assembly
Makes them compatible with the new asm.
Applied mechanically from vet diagnostics.

Manual edits: the names for arguments in time·now(SB) in runtime/sys_*_arm.s.

Change-Id: Ib295390d9509d306afc67714e3f50dc832256625
Reviewed-on: https://go-review.googlesource.com/5576
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
2015-02-23 16:52:33 +00:00
Russ Cox
b4a7806724 [dev.cc] all: merge master (5868ce3) into dev.cc
This time for sure!

Change-Id: I7e7ea24edb7c2f711489e162fb97237a87533089
2015-02-20 10:28:36 -05:00
Mikio Hara
69275eef5e net, syscall: more accurate parsers for routing messages on BSD variants
This changes fixes two issues with regard to handling routing messages
as follows:
- Misparsing on platforms (such as FreeBSD) supporting multiple
  architectures in the same kernel (kern.supported_archs="amd64 i386")
- Misparsing with unimplemented messages such as route, interface
  address state notifications

To fix those issues, this change implements all the required socket
address parsers, adds a processor architecture identifying function to
FreeBSD and tests.

Fixes #9707.
Fixes #8203.

Change-Id: I7ed7b4a0b6f10f54b29edc681a2f35603f2d8d45
Reviewed-on: https://go-review.googlesource.com/4330
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-02-20 04:33:28 +00:00
Rob Pike
c21f1d5ef3 [dev.cc] runtime,syscall: quiet some more vet errors
Fix many incorrect FP references and a few other details.

Some errors remain, especially in vlop, but fixing them requires semantics. For another day.

Change-Id: Ib769fb519b465e79fc08d004a51acc5644e8b259
Reviewed-on: https://go-review.googlesource.com/5288
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-20 00:20:54 +00:00
Rob Pike
218ff3f9a4 [dev.cc] runtime,syscall: add symbols for FP and SP references in darwin-arm
Maybe fix build.

Change-Id: I99ea76f0e6e472f0e88405bf5d77f72d4b097abd
Reviewed-on: https://go-review.googlesource.com/5287
Reviewed-by: Russ Cox <rsc@golang.org>
2015-02-19 21:29:21 +00:00
Alex Brainman
f20826692b syscall: make mksyscall_windows.go to work even when output does not uses unsafe package
Fixes #9900

Change-Id: I5dd401e8d2040e84ccb97c2fe9f5c5a28095b538
Reviewed-on: https://go-review.googlesource.com/5005
Reviewed-by: Minux Ma <minux@golang.org>
2015-02-17 08:31:38 +00:00
mattn
e77fbd598f syscall: Readlink doesn't handle junction on windows
Fixes #9190

Change-Id: I22177687ed834feed165454019d28c11fcbf0fa2
Reviewed-on: https://go-review.googlesource.com/2307
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2015-02-12 02:03:25 +00:00
Brad Fitzpatrick
a35181ba7f os, syscall: revert Yosemite readdir workaround
Reverts https://golang.org/cl/119530044 (OS X 10.10 Yosemite beta
14A299l workaround), since it was fixed in the final Yosemite release.

I verified that the C program http://swtch.com/~rsc/readdirbug.c
passes on Yosemite.

Adds a new test to the os package too, to verify that reading a
regular file as a directory fails.

Fixes #9789 (ReadDir: no error if dirname is a file)

Change-Id: I75286cef88fbb2ebccf045b479e33c810749dcbc
Reviewed-on: https://go-review.googlesource.com/4164
Reviewed-by: Dave Cheney <dave@cheney.net>
2015-02-08 21:04:15 +00:00
Mikio Hara
01fe149271 syscall: gofmt
And the silence of the git-codereview.

Change-Id: If3f7fe2de2ab4c1756f3cef8267199049d468b31
Reviewed-on: https://go-review.googlesource.com/3983
Reviewed-by: Minux Ma <minux@golang.org>
2015-02-06 06:06:20 +00:00
Shenghou Ma
b64dedabea syscall: darwin/arm support
Change-Id: Id6f7fa12084204bc3a200f423c7966ce2a0b63a0
Reviewed-on: https://go-review.googlesource.com/2123
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-02-06 05:49:25 +00:00
David Crawshaw
695a0fb4ef syscall: use name+(NN)FP on linux/amd64
Generated from a modified go vet.

Change-Id: Ibe82941283da9bd4dbc7fa624a33ffb12424daa2
Reviewed-on: https://go-review.googlesource.com/2817
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-01-21 19:04:38 +00:00
David Crawshaw
01295d7912 syscall: use name+(NN)FP on linux/386
Generated from go vet.

Change-Id: I8fee4095e43034b868bfd2b07e21ac13d5beabbb
Reviewed-on: https://go-review.googlesource.com/2816
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-01-21 18:54:27 +00:00
Bill Thiede
e9ce76b0ec runtime, syscall: use SYSCALL instruction on FreeBSD.
This manually reverts 555da73 from #6372 which implies a
minimum FreeBSD version of 8-STABLE.
Updates docs to mention new minimum requirement.

Fixes #9627

Change-Id: I40ae64be3682d79dd55024e32581e3e5e2be8aa7
Reviewed-on: https://go-review.googlesource.com/3020
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-01-18 23:51:50 +00:00
David Crawshaw
e10e913d08 syscall: use name+(NN)FP on linux/arm
Generated with a modified version of go vet and tested on android.

Change-Id: I1ff20135c5ab9de5a6dbf76ea2991167271ee70d
Reviewed-on: https://go-review.googlesource.com/2815
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-01-16 16:12:41 +00:00
Brad Fitzpatrick
ee3a1ff6fd all: update old comments referencing *.goc files
Change-Id: Ibf05e55ffe3bb454809cd3450b790e44061511c7
Reviewed-on: https://go-review.googlesource.com/2890
Reviewed-by: Alan Donovan <adonovan@google.com>
2015-01-15 16:31:52 +00:00
David Crawshaw
094a054bd0 syscall: match seek argument size to signature
Caught by go vet:
asm_linux_arm.s:110: [arm] seek: wrong argument size 32; expected $...-28

Change-Id: I62ec5327a25bff9ef501c42cc1e28ea7ec78510f
Reviewed-on: https://go-review.googlesource.com/2810
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-01-14 17:08:00 +00:00
David Crawshaw
318947c645 syscall: use name+(NN)FP for darwin
Generated from a script using go vet then read by a human.

Change-Id: Ie5f7ab3a1075a9c8defbf5f827a8658e3eb55cab
Reviewed-on: https://go-review.googlesource.com/2746
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-01-14 14:14:29 +00:00
Shenghou Ma
a6cb053026 syscall: fix nacl builds
Please see golang.org/cl/2588 for reasons behind the name change.
We also need NO_LOCAL_POINTERS for assembly function with non-zero
local frame size.

Change-Id: Iac60aa7e76f4c2ece3726e28878fd539bfebf7a4
Reviewed-on: https://go-review.googlesource.com/2589
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-01-12 21:45:58 +00:00
Alex Brainman
d00024bd60 syscall: use go generate to build zsyscall_windows.go
I would like to create new syscalls in src/internal/syscall,
and I prefer not to add new shell scripts for that.

Replacement for CL 136000043.

Change-Id: I840116b5914a2324f516cdb8603c78973d28aeb4
Reviewed-on: https://go-review.googlesource.com/1940
Reviewed-by: Russ Cox <rsc@golang.org>
2015-01-08 06:07:56 +00:00
Mikio Hara
13e16b39fc syscall: fix the deprecated way of parsing routing message on openbsd
OpenBSD 5.5 changed its kernel ABI and OpenBSD 5.6 enabled it.
This CL works on both 5.5 and 5.6.

Fixes #9102.

Change-Id: I4a295be9ab8acbc99e550d8cb7e8f8dacf3a03c5
Reviewed-on: https://go-review.googlesource.com/1932
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2014-12-22 23:42:33 +00:00
Joe Shaw
11779ef420 syscall: update go.sys doc reference to golang.org/x/sys
Change-Id: Ie5a36dbcd809fc165f4198d47641d5a95878460c
Reviewed-on: https://go-review.googlesource.com/2000
Reviewed-by: Russ Cox <rsc@golang.org>
2014-12-22 22:41:17 +00:00
David Crawshaw
401b20234c syscall: check recorded version of ppid instead of 1
Handles the case where the parent is pid 1 (common in docker
containers).

Attempted and failed to write a test for this.

Fixes #9263.

Change-Id: I5c6036446c99e66259a4fab1660b6a594f875020
Reviewed-on: https://go-review.googlesource.com/1372
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2014-12-22 21:21:10 +00:00
Peter Armitage
47c7cf4357 syscall: fs_nacl: Unlock() should be deferred.
Change-Id: Iea08b8f4e74a8cd4b4d317273046457c8db956a1
Reviewed-on: https://go-review.googlesource.com/1640
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2014-12-22 19:36:22 +00:00
Russ Cox
09d92b6bbf all: power64 is now ppc64
Fixes #8654.

LGTM=austin
R=austin
CC=golang-codereviews
https://golang.org/cl/180600043
2014-12-05 19:13:20 -05:00
Russ Cox
50e0749f87 [dev.cc] all: merge default (e4ab8f908aac) into dev.cc
TBR=austin
CC=golang-codereviews
https://golang.org/cl/179040044
2014-11-20 11:48:08 -05:00
Russ Cox
2d53d6b5d5 undo CL 131750044 / 2d6d44ceb80e
Breaks reading from stdin in parent after exec with SysProcAttr{Setpgid: true}.

package main

import (
        "fmt"
        "os"
        "os/exec"
        "syscall"
)

func main() {
        cmd := exec.Command("true")
        cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
        cmd.Run()

        fmt.Printf("Hit enter:")
        os.Stdin.Read(make([]byte, 100))
        fmt.Printf("Bye\n")
}

In go1.3, I type enter at the prompt and the program exits.
With the CL being rolled back, the program wedges at the
prompt.

««« original CL description
syscall: SysProcAttr job control changes

Making the child's process group the foreground process group and
placing the child in a specific process group involves co-ordination
between the parent and child that must be done post-fork but pre-exec.

LGTM=iant
R=golang-codereviews, gobot, iant, mikioh.mikioh
CC=golang-codereviews
https://golang.org/cl/131750044

»»»

LGTM=minux, dneil
R=dneil, minux
CC=golang-codereviews, iant, michael.p.macinnis
https://golang.org/cl/174450043
2014-11-19 14:16:12 -05:00
Russ Cox
599199fd9f [dev.power64] all: merge default (dd5014ed9b01) into dev.power64
Still passes on amd64.

LGTM=austin
R=austin
CC=golang-codereviews
https://golang.org/cl/165110043
2014-10-29 11:45:01 -04:00
Russ Cox
96e9e81b5f syscall: fix ParseRoutingSockaddr with unexpected submessages
No easy way to test (would have to actually trigger some routing
events from kernel) but the code is clearly wrong as written.
If the header says there is a submessage, we need to at least
skip over its bytes, not just continue to the next iteration.

Fixes #8203.

LGTM=r
R=r
CC=golang-codereviews, mikioh.mikioh, p
https://golang.org/cl/164140044
2014-10-28 11:35:00 -04:00
Russ Cox
1c534714e1 syscall: accept pre-existing directories in nacl zip file
NaCl creates /tmp. This lets the zip file populate it.

LGTM=adg
R=adg
CC=golang-codereviews
https://golang.org/cl/159600043
2014-10-27 20:45:16 -04:00
Austin Clements
062e354c84 [dev.power64] runtime: power64 fixes and ports of changes
Fix include paths that got moved in the great pkg/ rename.  Add
missing runtime/arch_* files for power64.  Port changes that
happened on default since branching to
runtime/{asm,atomic,sys_linux}_power64x.s (precise stacks,
calling convention change, various new and deleted functions.
Port struct renaming and fix some bugs in
runtime/defs_linux_power64.h.

LGTM=rsc
R=rsc, dave
CC=golang-codereviews
https://golang.org/cl/161450043
2014-10-27 17:27:03 -04:00
Austin Clements
f0bd539c59 [dev.power64] all: merge default into dev.power64
This brings dev.power64 up-to-date with the current tip of
default.  go_bootstrap is still panicking with a bad defer
when initializing the runtime (even on amd64).

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/152570049
2014-10-22 15:51:54 -04:00
Austin Clements
2bd616b1a7 build: merge the great pkg/ rename into dev.power64
This also removes pkg/runtime/traceback_lr.c, which was ported
to Go in an earlier commit and then moved to
runtime/traceback.go.

Reviewer: rsc@golang.org
          rsc: LGTM
2014-10-22 13:25:37 -04:00
David du Colombier
70896a78fa syscall: don't cache environment variables on Plan 9
Fixes #8849.

LGTM=bradfitz, aram
R=bradfitz, rsc, aram
CC=golang-codereviews
https://golang.org/cl/158970045
2014-10-16 22:30:14 +02:00
Ron Hashimoto
3114bd6f97 net: disable SIO_UDP_CONNRESET behavior on windows.
Fixes #5834.

LGTM=alex.brainman
R=golang-codereviews, bradfitz, alex.brainman, mikioh.mikioh, in60jp, iant
CC=golang-codereviews
https://golang.org/cl/149510043
2014-10-10 09:21:32 +11:00
Russ Cox
ab724f928f os, syscall: test Chtimes on directories, fix on Windows
Fixes #8090.

LGTM=alex.brainman
R=alex.brainman
CC=golang-codereviews
https://golang.org/cl/154020043
2014-10-06 19:22:48 -04:00
Alex Brainman
ee8e28d328 syscall: another attempt to keep windows syscall pointers live
This approach was suggested in
https://golang.org/cl/138250043/#msg15.
Unlike current version of mksyscall_windows.go,
new code could be used in go.sys and other external
repos without help from asm.

LGTM=iant
R=golang-codereviews, iant, r
CC=golang-codereviews
https://golang.org/cl/143160046
2014-10-05 13:15:13 +11:00
Alex Brainman
c65a47f890 undo CL 138250043 / 4eda5e4001fd
I will use different approach to solve this problem.
See CL 143160046 for details.

««« original CL description
syscall: keep Windows syscall pointers live too

Like https://golang.org/cl/139360044

LGTM=rsc, alex.brainman
R=alex.brainman, rsc
CC=golang-codereviews
https://golang.org/cl/138250043
»»»

LGTM=r
R=golang-codereviews, bradfitz, r
CC=golang-codereviews
https://golang.org/cl/147440043
2014-10-03 10:36:54 +10:00
Mrunal Patel
f9d7e13955 syscall: support UID/GID map files for Linux user namespaces
Fixes #8447.

LGTM=iant
R=golang-codereviews, bradfitz, iant
CC=golang-codereviews
https://golang.org/cl/126190043
2014-10-02 11:37:06 -07:00
Nicolas Owens
e9d5fca9f3 syscall: fix Setenv for plan 9
envi needs to be updated during Setenv so the key can be correctly deleted later with Unsetenv.

Update #8849.

LGTM=0intro
R=bradfitz, 0intro
CC=golang-codereviews
https://golang.org/cl/149300046
2014-10-02 10:25:56 +02:00
Brad Fitzpatrick
85cdc49e8a os, syscall: add Unsetenv
Also address a TODO, making Clearenv pass through to cgo.

Based largely on Minux's earlier https://golang.org/cl/82040044

Fixes #6423

LGTM=iant, alex.brainman, r, rsc
R=rsc, iant, r, alex.brainman
CC=golang-codereviews
https://golang.org/cl/148370043
2014-10-01 11:17:15 -07:00
Russ Cox
193daab988 cmd/cc, cmd/ld, runtime: disallow conservative data/bss objects
In linker, refuse to write conservative (array of pointers) as the
garbage collection type for any variable in the data/bss GC program.

In the linker, attach the Go type to an already-read C declaration
during dedup. This gives us Go types for C globals for free as long
as the cmd/dist-generated Go code contains the declaration.
(Most runtime C declarations have a corresponding Go declaration.
Both are bss declarations and so the linker dedups them.)

In cmd/dist, add a few more C files to the auto-Go-declaration list
in order to get Go type information for the C declarations into the linker.

In C compiler, mark all non-pointer-containing global declarations
and all string data as NOPTR. This allows them to exist in C files
without any corresponding Go declaration. Count C function pointers
as "non-pointer-containing", since we have no heap-allocated C functions.

In runtime, add NOPTR to the remaining pointer-containing declarations,
none of which refer to Go heap objects.

In runtime, also move os.Args and syscall.envs data into runtime-owned
variables. Otherwise, in programs that do not import os or syscall, the
runtime variables named os.Args and syscall.envs will be missing type
information.

I believe that this CL eliminates the final source of conservative GC scanning
in non-SWIG Go programs, and therefore...

Fixes #909.

LGTM=iant
R=iant
CC=golang-codereviews
https://golang.org/cl/149770043
2014-09-24 16:55:26 -04:00
Russ Cox
a07a57b00e syscall: mark ECONNRESET, ECONNABORTED as temporary network errors
Fixes #6163.

LGTM=adg
R=golang-codereviews, adg, dvyukov
CC=golang-codereviews
https://golang.org/cl/141600043
2014-09-18 23:07:36 -04:00
Russ Cox
ab76638cdc syscall: fix infinite recursion in itoa
Fixes #8332.

LGTM=dvyukov
R=golang-codereviews, dvyukov
CC=golang-codereviews
https://golang.org/cl/138650044
2014-09-18 19:40:06 -04:00
Russ Cox
653fb6d872 liblink: make GO_ARGS the default for functions beginning with ·
If there is a leading ·, assume there is a Go prototype and
attach the Go prototype information to the function.
If the function is not called from Go and does not need a
Go prototype, it can be made file-local instead (using name<>(SB)).

This fixes the current BSD build failures, by giving functions like
sync/atomic.StoreUint32 argument stack map information.

Fixes #8753.

LGTM=khr, iant
R=golang-codereviews, iant, khr, bradfitz
CC=golang-codereviews, r, rlh
https://golang.org/cl/142150043
2014-09-16 17:39:55 -04:00