Commit Graph

163 Commits

Author SHA1 Message Date
Alex Brainman
a646d33e2e windows: make "go generate" command work on any OS
See issue golang/go#16368 for details.

Updates golang/go#16368

Change-Id: Ic3294385a350aee41887f59cbcf5b0af7742ff3b
Reviewed-on: https://go-review.googlesource.com/24952
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-07-17 07:19:31 +00:00
Alex Brainman
b518c298ac windows: use //go:uintptrescapes comment
CL 24551 introduced //go:uintptrescapes comment to make
syscall.Proc.Call and syscall.LazyProc.Call parameters escape.
Use new comment in this package too.

Updates golang/go#16035.

Change-Id: I57ec3b4778195ca4a1ce9a8eec331f0f69285926
Reviewed-on: https://go-review.googlesource.com/24870
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-07-12 23:56:41 +00:00
Mikio Hara
a408501be4 unix: fix missing use of use function in Getfsstat and Getwd
Updates golang/go#13372.

Change-Id: I623de97eb19880356148cbcb7d17759df82684aa
Reviewed-on: https://go-review.googlesource.com/24751
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-07-04 03:17:55 +00:00
kortschak
62bee03759 unix: fix Ppoll for arm64
Fixes golang/go#16065.

Change-Id: I97d06b7038e7c7507e765736899cfa243f45805c
Reviewed-on: https://go-review.googlesource.com/24121
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-06-15 01:27:01 +00:00
kortschak
5a8c7f28c1 unix: add Ppoll support for linux
Use a shim for Poll on arm64.

Fixes golang/go#16052.

Change-Id: I929e7a2293561bddb9355bf65f98bc68b91905b2
Reviewed-on: https://go-review.googlesource.com/24062
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-06-14 16:43:59 +00:00
kortschak
7f918dd405 unix: add Poll for linux
Change-Id: I273bd852f85d204694872a1615be51dc027b97ee
Reviewed-on: https://go-review.googlesource.com/23661
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-06-11 01:26:39 +00:00
Jess Frazelle
b44883b474 unix: add CLONE_NEWCGROUP for linux kernel >=4.6
Change-Id: I827a97ad2b43f9b33281d0da36fe4cfdf24b928f
Reviewed-on: https://go-review.googlesource.com/23965
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-06-10 01:22:07 +00:00
kortschak
076b546753 unix: fix typo
Change-Id: Ic7bd0c26cd4ac63861c2ed3541560919d133cd14
Reviewed-on: https://go-review.googlesource.com/23621
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-06-01 13:32:25 +00:00
Michael Munday
d4feaf1a7e unix: add build tags to s390x files
Needed for old versions of the compiler.

Fixes golang/go#15697.

Change-Id: I913a4baef537775f037b736252b093a87e3b1015
Reviewed-on: https://go-review.googlesource.com/23130
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-16 13:23:47 +00:00
Mikio Hara
f78f5183ff unix: fix missing use of use function in sysctl
Updates golang/go#13372.

Change-Id: Idfd5001f4ad7bc80a4283df1c310f97612eba85c
Reviewed-on: https://go-review.googlesource.com/23124
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-15 20:56:54 +00:00
Michael Munday
33267e036f unix: add s390x support
This commit adds linux/s390x support to the unix package. It is
based on the changes made to the syscall package in
https://golang.org/cl/20961/. It also adds mkpost.go which is
used to cleanup the API generated by cgo -godefs.

The biggest departure that is made with the syscall package is
the use of the -fsigned-char flag to force signed chars. We
couldn't do this in the syscall package because of the need to
maintain compatibility with the gccgo implementation of the syscall
package (gccgo has supported s390x for a longer time than the Go
toolchain). The unix package does not have this constraint.

Using the -fsigned-char flag makes the API look more like the one
generated on amd64 and arm64 and also more consistent with itself
(the syscall package represents chars using both int8 and uint8
types, the sys package will only ever use int8). Unfortunately it
also means that applications transitioning from the syscall package
to the unix package will see a different API on s390x which might
be confusing. I think the tradeoff is worth it though.

Change-Id: I40b90c18ed787e74ba7a2ebd004bd6bd1ba6279a
Reviewed-on: https://go-review.googlesource.com/23045
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-05-13 18:30:25 +00:00
Alex Brainman
e82cb4d7df windows: remove non-existing now mksyscall_windows.go -xsys flag
Updates golang/go#15167

Change-Id: I58bd7e4e6ba88a2ffba11506e5ac0495de303b5b
Reviewed-on: https://go-review.googlesource.com/23023
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
2016-05-12 03:25:10 +00:00
Brad Fitzpatrick
806cb00533 unix: remove dragonfly/386 support
It was removed from Go (and Dragonfly) already.

Fixes golang/go#10840

Change-Id: If7a86123f2a6120f99946dbd57a5e62a72f30af5
Reviewed-on: https://go-review.googlesource.com/23050
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2016-05-11 18:08:12 +00:00
Christy Perez
b776ec39b3 unix: fix epoll and missing syscalls for ppc64x
The epoll_event struct was not correct for ppc64* arches. This has
been fixed in the syscall package by CL 22207. This patch makes
the same change, in addition to adding some missing syscalls needed
by fsnotify.

See the following for more info:
https://github.com/fsnotify/fsnotify/issues/130
https://github.com/golang/go/issues/15393

Fixes #15393

Change-Id: Iedad28274ec1d3e48787c34991a725690f3b204d
Signed-off-by: Christy Perez <christy@linux.vnet.ibm.com>
Reviewed-on: https://go-review.googlesource.com/22605
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-04-29 19:32:39 +00:00
Damien Neil
c8bc69bc2d unix: fix uint64->int cast of control message header
Change-Id: I533233a08472b686d03573bcbae664c76919b18e
Reviewed-on: https://go-review.googlesource.com/22527
Run-TryBot: Damien Neil <dneil@google.com>
Reviewed-by: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-27 20:20:20 +00:00
Riku Voipio
f64b50fbea unix: fix Pause on linux-arm64
Pause is a legacy syscall not available on linux-arm64. Use ppoll with
all args as 0 to emulate - this is the way musl libc does Pause when the
pause syscall isn't available.

With the changes in syscall_linux* and regenerating zsyscall_linux*,
this calling Pause on linux-arm64 works and returns EINTR as expected.

Change-Id: I88236290313f18c742d826e759e86ff260a8b383
Reviewed-on: https://go-review.googlesource.com/22014
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-15 13:58:44 +00:00
Riku Voipio
324e137580 unix: fix EpollWait for arm64
epoll_wait syscall doesn't exist on arm64. Implement it with
by callign epoll_pwait(). According to man epoll_pwait,
calling epoll_pwait with sigmask of NULL is identical to
epoll_wait.

Testing exposed that EpollEvent needs padding on arm64
like on arm.

This changeset is to fix:
https://github.com/fsnotify/fsnotify/issues/130

Testcase: go test with fsnotify ported from syscall to x/sys:
https://github.com/suihkulokki/fsnotify/tree/go-sys

Change-Id: I76136bf4c82c2ee597549133848f490da46dd488
Reviewed-on: https://go-review.googlesource.com/21971
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-04-13 20:47:32 +00:00
Alexander Neumann
9eef40adf0 unix: Add FADV_* constants
These constants are used for fadvise() on Linux and were missing from
the ztypes_linux_*.go files.

Including the bluetooth headers is necessary so that cgo can resolve
struct sockaddr_hci.

Fixes golang/go#15114

Change-Id: I1538b5a7b9b24f910c0520d446b2fa5bd8a09013
Reviewed-on: https://go-review.googlesource.com/21753
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-04-09 16:46:36 +00:00
Tzu-Jung Lee
a80ff226bd unix: add sockaddr_hci support for linux.
Change-Id: Ic2eb52d4e9f7b80992707b125c11be54d7973314
Reviewed-on: https://go-review.googlesource.com/21674
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-08 05:48:20 +00:00
Brad Fitzpatrick
8fdfb00a6a unix: skip failing test on freebsd-386
Updates golang/go#15186

Change-Id: I02403cbc9b3f1c786ee8093e1480edff891ecf13
Reviewed-on: https://go-review.googlesource.com/21676
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-04-08 01:25:32 +00:00
Tzu-Jung Lee
8aa0c605e5 syscall: add bluetooth constants for linux
Tried to generate them with mkerrors.sh by including
bluetooth/bluetooth.h, but it introduces way much more
than necessary stuff.

Change-Id: I380f66892f55dbe4cbfc76a0e3f9817f81d269b9
Reviewed-on: https://go-review.googlesource.com/21675
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-08 01:02:42 +00:00
Alex Brainman
042a8f53ce windows: add NewLazySystemDLL and use it in zsyscall_windows.go
If we want new secure DLL approach to be adopted, we should make
conversion as simple as possible to explain and implement.
I think that replacing

syscall.NewLazyDLL(...) -> windows.NewLazySystemDLL(...)

is easier than

syscall.NewLazyDLL(...) -> &windows.LazyDLL{Name: ..., System: true}

So I propose we introduce convenience function NewLazySystemDLL.

$GOROOT/src/mksyscall_windows.go changes in the following CL.

Change-Id: If3432aff301c347cb355e4e837834696191b2219
Reviewed-on: https://go-review.googlesource.com/21592
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-06 06:33:47 +00:00
Alex Brainman
b323466d0b windows: remove unused asm.s
Change-Id: I1a2b96f71c9f39a46827e9414e1058894fd2a5e1
Reviewed-on: https://go-review.googlesource.com/21523
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-05 06:12:01 +00:00
Brad Fitzpatrick
a60af9cbbc windows: make all files in the package require windows
env_unset.go didn't have a the windows build tag (or filename), so it
was compiling for all operating systems and as a result had weird docs
at https://godoc.org/golang.org/x/sys/windows showing only Unsetenv.

Updates golang/gddo#188

Change-Id: I58f2c27c3d267660c97fce5a1b28da24988c62c8
Reviewed-on: https://go-review.googlesource.com/21460
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2016-04-02 02:39:15 +00:00
Brad Fitzpatrick
3dff6e19a5 windows: add LoadLibraryEx, add LazyDLL.System
Updates golang/go#14959

Change-Id: Ib91c359c3df919df0b30e584d38e56f79f3e3dc9
Reviewed-on: https://go-review.googlesource.com/21388
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-02 00:33:28 +00:00
Michael Matloob
320cb01ddb windows: Add windows build tag to asm.s
This allows linux binaries to have bazel-style dependencies on x/sys/windows.

Change-Id: I248fe62e045705f409e5d96842ed52d0764ae68f
Reviewed-on: https://go-review.googlesource.com/21081
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-25 02:06:15 +00:00
Brad Fitzpatrick
afce3de575 unix: make TimevalToNsec available everywhere
It wasn't in linux/arm.

Tested with:

$ for x in $(go tool dist list ) ; do \
     export GOOS=$(echo $x | cut -d/ -f1); \
     export GOARCH=$(echo $x | cut -d/ -f2); \
     echo "$GOOS; $GOARCH"; go install  .; done

... which all pass, except openbsd/arm which is still broken exactly
how it was broken previously.

Fixes golang/go#14643

Change-Id: Ie7ae861b581b539178de26f15ba3f4bdd0e9b785
Reviewed-on: https://go-review.googlesource.com/21013
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-03-22 23:22:43 +00:00
Caio Marcelo de Oliveira Filho
23999e87b4 x/sys/unix: add support for O_TMPFILE in Linux
Since Linux 3.11, O_TMPFILE flag can be used in open syscall to create
an unnamed file in a directory. The file occupies space in the
filesystem, and can be given a name using linkat syscall. If the file is
closed without being given a name, its contents are deleted.

See the manpage open(2) in Linux for details.

Exports O_TMPFILE for Linux in 386 and amd64 (other architectures
already had it). Exports Linkat syscall and AT_SYMLINK_FOLLOW (used for
giving a name to the file) for all Linux in all architectures.

Fixes golang/go#7830.

Change-Id: Ib82e44f405b227e227b9cbf317c2657b32e046f5
Reviewed-on: https://go-review.googlesource.com/21003
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-22 23:15:03 +00:00
Riku Voipio
9d4e42a206 x/sys/unix: add Dup2 wrapper for arm64/ppc64
arm64 doesn't have a Dup2 syscall, instead Dup3 is supposed
to be used. Since Dup3 is linux-specific, provide a wrapper
to make writing portable code easier.

    Updates golang/go#10235

To verify it, added a testcase for Dup and Dup2.

Change-Id: I066bb60d62b2bd64d7ba0fdfbb334ce2213c78e9
Reviewed-on: https://go-review.googlesource.com/20178
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Riku Voipio <riku.voipio@linaro.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-15 15:33:18 +00:00
Riku Voipio
7a56174f00 x/sys/unix: fix time/utime/utimes on arm64
In commit "7e44b69 x/sys/unix: fix invalid syscall on linux/arm"
a test was added for time/utime syscall. This test exposed that
neither time/utime work on arm64, because they call the legacy
syscall "utimes". As a new architecture, arm64 doesn't implement
any legacy syscalls.

Implement by first calling utimensat, using UtimesNano as exampple.

Change-Id: Iffed410730c06ac4c8184241d16eebf08c367524
Reviewed-on: https://go-review.googlesource.com/20174
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2016-03-03 15:45:59 +00:00
Benoit Sigoure
54535356f1 x/sys/unix: Add support for the setns system call.
This system call is used to reassociate the current thread with a Linux
namespace (e.g. a network namespace or a mount namespace).  This system
call is key to interacting with the primitives enabling Linux containers.
The users of this system call will most likely want to wrap their calls
with a pair of LockOSThread / UnlockOSThread calls.  Here is an example
that is a reasonably close approximation of the `ns_exec' program given
as an example in `man 2 setns':

	package main

	import (
		"log"
		"os"
		"os/exec"
		"runtime"

		"golang.org/x/sys/unix"
	)

	func main() {
		if len(os.Args) < 3 {
			log.Fatalf("%s /proc/PID/ns/FILE cmd args...", os.Args[0])
		}
		fd, err := unix.Open(os.Args[1], unix.O_RDONLY, 0)
		if err != nil {
			log.Fatalf("open: %s", err)
		}
		runtime.LockOSThread()
		defer runtime.UnlockOSThread()
		if err = unix.Setns(fd, 0); err != nil {
			log.Fatalf("setns: %s", err)
		}
		cmd := exec.Command(os.Args[2], os.Args[3:]...)
		cmd.Stdin = os.Stdin
		cmd.Stdout = os.Stdout
		cmd.Stderr = os.Stderr
		err = cmd.Run()
		if err != nil {
			log.Fatalf("exec: %s", err)
		}
	}

Fixes golang/go#5968.

Change-Id: I78dc54667cfaef4f9e99a08d48f6e423686f1b22
Reviewed-on: https://go-review.googlesource.com/20054
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-02-29 17:26:46 +00:00
Hiroshi Ioka
7e44b69d78 x/sys/unix: fix invalid syscall on linux/arm
Some system calls are obsolete and no longer available for EABI.
This CL replace such system call usages.

Updates golang/go#14524

Change-Id: Ib99b239455ca677e46d7097911904c45119051bd
Reviewed-on: https://go-review.googlesource.com/19945
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-02-28 22:21:53 +00:00
Yao Zhang
19ced1583f x/sys/unix: added linux/mips64{,le} support
Change-Id: I4bf8d5e7ebc41b5152ce181c83dc3ff94bddae57
Reviewed-on: https://go-review.googlesource.com/16994
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
2016-02-28 04:28:12 +00:00
David du Colombier
5eaf0df67e plan9: add mount and bind flags
Thanks Skip Tavakkolian.

Fixes golang/go#14452.

Change-Id: I0a4ef49edae61bb37f49b1071dd5c31e88ad6c04
Reviewed-on: https://go-review.googlesource.com/19729
Reviewed-by: Rob Pike <r@golang.org>
2016-02-22 20:26:01 +00:00
Matthew Dempsky
50c6bc5e42 unix: skip broken test on OpenBSD
OpenBSD (and likely NetBSD, but it's not enabled for these tests
anyway) use a different sysctl API for fetching process information
than FreeBSD and its derivatives.

Change-Id: Id2ab10f170b788ba4d9bd45d3347f530555da23b
Reviewed-on: https://go-review.googlesource.com/19232
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-02-04 22:58:17 +00:00
Ian Lance Taylor
eb2c74142f unix: add flags parameter to Unlinkat
The flags parameter was added in https://golang.org/cl/7917.  In that CL
the reviewers discussed adding UnlinkAt and changing Unlinkat, and opted
for the latter.

Unfortunately, I then undid that in https://golang.org/cl/10032, which
was a backport of (among others) https://golang.org/cl/5837.  I didn't
notice that in the syscall package 5837 removed Unlinkat with two
parameters, but the port to the x/sys/unix package removed Unlinkat with
three parameters.  Argh.

This CL effectively restores 7917, by adding the parameter back.

Fixes golang/go#9923.

Change-Id: I8fe218ac637d0eb0346b63b596666671374bd19f
Reviewed-on: https://go-review.googlesource.com/18981
Reviewed-by: Rob Pike <r@golang.org>
2016-01-27 15:07:42 +00:00
Nick Petroni
20457ee8ea x/sys/windows/svc/mgr: allow other ServiceType values in CreateService
Preserves SERVICE_WIN32_OWN_PROCESS as the default.

Fixes golang/go#14019

Change-Id: I764016c1b5ec5e1fe88ed39b9803754af966b2f3
Reviewed-on: https://go-review.googlesource.com/18760
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
2016-01-21 06:23:56 +00:00
Alex Brainman
442cd60086 windows: copy latest changes from internal/syscall/windows
Copy of CL 4310, 6140, 17412, 17997 and 17998.

Change-Id: I7db8722a1c37f033d5ce6644859ef15c58289a46
Reviewed-on: https://go-review.googlesource.com/18552
Reviewed-by: Rob Pike <r@golang.org>
2016-01-13 01:14:10 +00:00
Ian Lance Taylor
833a04a105 plan9: fix duplicated copyright header in mksysnum_plan9.sh
Fixes golang/go#13569.

Change-Id: I8af36bc81afa6b8bc0e80b3f35f0b60707bfb91b
Reviewed-on: https://go-review.googlesource.com/17713
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-12-11 03:36:51 +00:00
Nick Patavalis
2bacc619e3 unix: Fix Termios type definition
- types_linux.go: Use the kernel-defined termios structure, *not* the
  LIBC-defined one. The LIBC termios structure cannot be safely used
  to do tty-related ioctls on all architectures (e.g. ppc64,
  ppc64le). The kernel termios structure, and the associated
  macros/constants, are defined in: "asm/termbits.h" which is included
  by "linux/termios.h". The LIBC termios structure is defined in
  "bits/termios.h" which is included by "termios.h". These structures
  are *not* the same.

  For systems that have both "struct termios" and "struct termios2"
  use the latter to define the Termios type. This is ok, since the
  "struct termios2" memory layout is compatible with "struct termios"
  (with a couple of fields added at the end). This way, type Termios
  can be used with both: the "old-style" TCSETS[FW], TCGETS ioctls,
  *and* with the new TCSETS[FW]2, TCGETS2 ioctls. The new ioctls allow
  configuring arbitrary baudrates.

  The new Termios definitions (kernel-compatible) have the same fields
  as the old ones (LIBC-derived) so there should be no user-code
  compatibility issues.

Change-Id: I3c1484c60f45b28e13404765c01616c33063afd5
Reviewed-on: https://go-review.googlesource.com/17185
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-11-24 18:47:04 +00:00
Nick Patavalis
7486f8ece0 unix: additional termios-related constants
- mkerrors.sh: Included several termios-related constants that were
  missing. Also included definitions of tty-related ioctl numbers for
  linux.

- zerrors_linux_*: the files have been generated using
  "./mkerrors.sh". After their automatic generation the files have
  been manually edited to remove changes that were not due to this
  patch.

Change-Id: I0463112542a5c1c41583007003b652375f9ce572
Reviewed-on: https://go-review.googlesource.com/17184
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-11-23 20:52:33 +00:00
Steven Hartland
d9157a9621 unix: add custom Sysctl args and methods SysctlUint64, SysctlRaw
Add support for optional sysctl arguments which is required to support
sysctls that require more than the mib identifer args as returned from
nametomib such as kern.proc.pid.

Add SysctlUint64 which allows sysctls that return 64 bit ints to be
queried.

Add SysctlRaw which allows sysctls that return structs or other
unsupported types to be queried.

Change-Id: If0fa23935ee09496f2df210364d8988ccd0f3db6
Reviewed-on: https://go-review.googlesource.com/14955
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-10-29 18:30:43 +00:00
Matthew Dempsky
354f231ae1 unix: fix vet warning in UnixRights
Same fix as golang.org/cl/15608 for package syscall.

Change-Id: I8de2369220e58140596325d7ea16c015aab90d1b
Reviewed-on: https://go-review.googlesource.com/15609
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-10-09 04:16:36 +00:00
Dave Cheney
18d75a3b5e unix: add Prctl for linux platforms
Adds Prctl syscall for linux platforms. syscall and x/sys/unix already
defined the PR_ series of constants.

See discussion: https://groups.google.com/forum/#!topic/golang-nuts/rG6xShds2Dc

Change-Id: Ida5562b46abef574a3f9ac31911142f1e8d7fb4f
Reviewed-on: https://go-review.googlesource.com/15520
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-10-08 03:55:53 +00:00
Steven Hartland
342d6a85aa unix: update FreeBSD generated types and errors
Update the generated types and errors for FreeBSD by running mkall.sh
and ensuring no values where removed.

Change-Id: I5b82b1896b64f1b33d569dcaa477bb88641dfa8d
Reviewed-on: https://go-review.googlesource.com/15011
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-25 17:03:07 +00:00
Steven Hartland
72bfb9c4e8 unix: default CC in mkerrors.sh to cc not gcc
Clang is much more common now so use the OS cc instead of forcing gcc
by default.

Change-Id: I1dd34c7ba56c91794ee57042dd8ac024fdd649d8
Reviewed-on: https://go-review.googlesource.com/15010
Reviewed-by: Rob Pike <r@golang.org>
2015-09-25 16:59:38 +00:00
Kim Shrier
584c5fee74 x/sys/unix: add type specific ioctl functions for termios on solaris
The existing code has no way to manipulate termios or winsize structures
on solaris.  This change adds IoctlGetXXX and IoctlSetXXX functions for
int, termios, termio, and winsize.  The embedded awk script in
mkerrors.sh has additional patterns to generate the needed ioctl
constants for these calls.

Fixes golang/go#12574

Change-Id: Ic62a8c698d42c8ca379c90f71e9f27635e7d03b5
Reviewed-on: https://go-review.googlesource.com/14587
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
2015-09-24 17:12:55 +00:00
Shawn Walker-Salas
68a71b6be5 unix: add various missing syscalls available on Linux
Various syscalls offered by x/sys/unix on Linux are not available on
Solaris and should be, such as Mkfifo, Getwd(), Futimes() and others.
In particular, all of the *at() variants of existing functions were
added where appropriate.

Getgroups() was fixed to use the correct value for its sanity check on
the maximum number of groups.

Utimesnano() was updated to use the native Solaris utimensat function
for setting nanosecond-precision time.

Utimes() was updated to have the same error semantics and checking as
other platforms.

Getgroups(), anysocktoaddr(), and Recvmsg() were fixed to check the
return value before assuming syscall failure instead of relying solely
on errno being set.

mksyscall_solaris.pl needed some updates to better match the output of
the one found in syscall.

mkerrors.sh needed some updates to work out of the box on Solaris,
matching those recently done to the one in syscall.

The signatures (names) of some function parameters were changed to be
consistent with other platforms for the sake of documentation.

Fixes #8609

Change-Id: I9e4e2fee6d3ecfad9f4d845a5702ffde5166e804
Reviewed-on: https://go-review.googlesource.com/14643
Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
2015-09-17 18:12:33 +00:00
Shawn Walker-Salas
131454b560 unix: fix Getpagesize to return actual system value on Solaris
In preparation for issues such as #10180, Getpagesize() needs to be
fixed to return the actual system's page size instead of assuming it's
always 4096.

This is particularly important for future platform support on Solaris.

Fixes #12076

Change-Id: I78205165909529215fe93ed6ba56e9c3ee1c2abb
Reviewed-on: https://go-review.googlesource.com/14483
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-10 21:42:51 +00:00
Alex Brainman
16e60ce682 windows/registry: do not panic when data is large
Allow registry blobs to be as large as 500MB

Copy of CL 14287.

Fixes golang/go#12493

Change-Id: I37b82fcf90ff2acef83c66016375fcae15e6eefc
Reviewed-on: https://go-review.googlesource.com/14288
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-09 02:29:49 +00:00