Commit Graph

324 Commits

Author SHA1 Message Date
Tobias Klauser
bcc62b628a unix: remove unused function syscallMode
The unexported function syscallMode was added in CL 47290 but was never
used anywhere. Remove it.

FWIW this should also fix the build failure on plan9, as the file in
question was lacking build tags.

Change-Id: Icfd6b2dbcd66ceb2065c945d8a5a6d55e634fe5e
Reviewed-on: https://go-review.googlesource.com/76510
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-08 17:06:27 +00:00
Tobias Klauser
75813c6472 unix: remove empty lines before first comment in block
Re-run tip gofmt to remove empty lines before the first comment in a
block (CL 71990).

Change-Id: I10bed93b88fd4fa4345f9f8f930c45db9f0d6e59
Reviewed-on: https://go-review.googlesource.com/76191
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-07 16:15:30 +00:00
Tobias Klauser
a22539bf85 unix: add vmsockets ioctl constant on Linux
To be used e.g. in github.com/mdlayher/vsock

Change-Id: I52148a6e6c53c022c07e2cc8bf7348a96445c17b
Reviewed-on: https://go-review.googlesource.com/76193
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2017-11-07 15:03:14 +00:00
Tobias Klauser
d4266bc12a unix: add ioctl functions on NetBSD
Add IoctlGetInt/IoctlSetInt, IoctlGetTermios/IoctlSetTermios and
IoctlGetWinsize/IoctlSetWinsize on NetBSD. These are similar to the
already existing implementations on Linux, Darwin and Solaris.

Change-Id: I6c38d946b9f461c8e4c6c5e044aaff9b37e4b02f
Reviewed-on: https://go-review.googlesource.com/76171
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-06 15:25:25 +00:00
Tobias Klauser
5404d63da1 unix: add ioctl functions on Dragonfly
Add IoctlGetInt/IoctlSetInt, IoctlGetTermios/IoctlSetTermios and
IoctlGetWinsize/IoctlSetWinsize on Dragonfly. These are similar to the
already existing implementations on Linux, Darwin and Solaris.

Change-Id: I5a5a7ef69f02e01a4216779df5c927f241e5cec0
Reviewed-on: https://go-review.googlesource.com/76170
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-06 15:25:04 +00:00
Tobias Klauser
eae8a563e8 unix: add ioctl functions on OpenBSD
Add IoctlGetInt/IoctlSetInt, IoctlGetTermios/IoctlSetTermios and
IoctlGetWinsize/IoctlSetWinsize on OpenBSD. These are similar to the
already existing implementations on Linux, Darwin and Solaris.

Change-Id: I99e9434fa50338a0b5d825490513e9383539727d
Reviewed-on: https://go-review.googlesource.com/75791
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-06 15:24:42 +00:00
Tobias Klauser
8413e589a2 unix: regenerate for macOS 10.13/iOS 11.1
Update the syscall numbers and error constants on macOS 10.13 with iOS
SDK 11.1.

The removed syscalls are all removed or marked as deprecated/old in the
following list

  https://opensource.apple.com/source/xnu/xnu-4570.1.46/bsd/kern/syscalls.master

which according to

  https://opensource.apple.com/release/macos-1013.html

is the kernel version used for macOS 10.13.

The poll function was moved around because I missed to regenerate the
zsyscall_darwin_*.go files in CL 74290.

Change-Id: I747c8c842f78f3db8d25b46759265aa99da9d739
Reviewed-on: https://go-review.googlesource.com/75972
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-06 15:14:41 +00:00
Tobias Klauser
8eb05f94d4 windows: fix go vet warning
Now that go tip runs vet during go test	(CL 74356), the x/sys/windows
test fails due to the following vet error:

  syscall_windows_test.go:84: Fatal call has possible formatting directive %x

Fix it by using Fatalf instead.

Change-Id: I02536312c00bc9002400b29b5b5acef879a0e51a
Reviewed-on: https://go-review.googlesource.com/75973
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-04 19:33:50 +00:00
Tobias Klauser
4fe5d79250 unix: use keyed composite literal in TestSelect
Fixes the following vet error:

  syscall_linux_test.go:181: golang.org/x/sys/unix.Timeval composite literal uses unkeyed fields

Change-Id: I6973ad4ecd54b542074610a755573f98eb23f343
Reviewed-on: https://go-review.googlesource.com/75790
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-03 17:53:29 +00:00
Tobias Klauser
7e31d873de unix: add missing err checks in tests
Change-Id: I7b1ff99b46273ad32c26247a2435e674c9e42789
Reviewed-on: https://go-review.googlesource.com/75810
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-03 17:52:41 +00:00
Tobias Klauser
46eaec7899 unix: use setattrlist for UtimesNanoAt on Darwin
Use to setarrlist to implement UtimesNanoAt with nanosecond precision
(on Mac OS 10.13 with APFS). Translate AT_SYMLINK_NOFOLLOW to
FSOPT_NOFOLLOW correspondingly.

Change-Id: I1468a1f4eecb53b2280ff6329b1ec64e204701f1
Reviewed-on: https://go-review.googlesource.com/75650
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-02 21:26:49 +00:00
Tobias Klauser
feaf45c67f unix: use setattrlist for UtimesNano on Darwin for ns resolution
Follow CL 74952 for x/sys/unix.

Update golang/go#22528

Change-Id: Id146da75b80a64cfa4eac28e9bb7b3befe944718
Reviewed-on: https://go-review.googlesource.com/75610
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-02 20:14:56 +00:00
Tobias Klauser
95c6576299 unix: enable TestPoll for all unix systems
Poll is now supported for all unix systems. Also enable TestPoll for all
of them.

Change-Id: Id6250702bf0d29c49fbeeed4cca21d232b72666a
Reviewed-on: https://go-review.googlesource.com/74310
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-31 08:18:56 +00:00
Tobias Klauser
af4555b109 unix: move Poll implementation for BSDs into syscall_bsd.go
Now that all BSD flavors support Poll, move the common implementation
into syscall_bsd.go

Change-Id: Id62a6163d41ef24e33f96540b661002b095a2fa1
Reviewed-on: https://go-review.googlesource.com/74290
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-31 08:18:28 +00:00
Tobias Klauser
4da7545edf unix: convert Utsname members from {u,}int8 array to byte array
In order to make conversion to string easier, change the Utsname
members from int8 array to byte array.

Also add a test on Linux for Uname and the string conversion of the
Utsname members.

Fixes golang/go#20753

Change-Id: Iec793dfb4a6dd8f3523cf0b6284a6162074f2e9e
Reviewed-on: https://go-review.googlesource.com/74331
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-31 08:17:53 +00:00
Tobias Klauser
661970f62f unix: add Poll function on Solaris
Tested with TestPoll extracted from syscall_linux_test.go.

Now that Poll is supported on all unix flavors, TestPoll can be moved
to syscall_unix_test.go in a successive CL.

Change-Id: Ibd5ff3f45198008464522c3b165f2af7865ce81e
Reviewed-on: https://go-review.googlesource.com/73881
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-28 10:13:51 +00:00
Tobias Klauser
b98136db33 unix: add Poll function on OpenBSD
Tested with TestPoll extracted from syscall_linux_test.go. Once Poll is
supported on all OSes this test can be moved to syscall_unix_test.go.

Change-Id: Ic7ad2e749039e2e81612c2085d6fab73581d59f9
Reviewed-on: https://go-review.googlesource.com/73872
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-27 13:59:02 +00:00
Tobias Klauser
52c393dd0c unix: update Dockerfile to go 1.9.2
Update go to 1.9.2 in the Dockerfile used to generate the Linux go files.

The update also changes some zerror definitions: RLIM_INFINITY is
assigned to Rlimit.{Cur,Max} which are both uint64 on all architectures.
PR_SET_PTRACER_ANY is used with Prctl which expects an uintptr.

With the current version, an "constant -1 overflows uint64" error would
result if these constants were used directly without type conversion.

Change-Id: Iefd23a44e983b4fcf210121776531df225014112
Reviewed-on: https://go-review.googlesource.com/73873
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-27 13:58:47 +00:00
Tobias Klauser
833991df06 unix: omit success message if generation of ptrace definition fails
If generating ptrace definitions for a particular pair fails for any
reason, a success message would still be shown. Avoid it in case there
was a failure.

Change-Id: Ica59c888586c055e8ef333a0db00bde2c4d15145
Reviewed-on: https://go-review.googlesource.com/73874
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-27 13:58:17 +00:00
Tobias Klauser
80ad69fa32 unix: remove _SC_PAGESIZE on linux/sparc64
CL 62111 removed the _SC_PAGESIZE definition from the types_*.go files
but did not re-generate ztypes_linux_sparc64.go. Remove the definition
manually because linux/spar64 is not yet covered by the new Docker-based
build system.

Change-Id: I1ddebc3efa0d9d23c925ca84de31f63a3a883a99
Reviewed-on: https://go-review.googlesource.com/73876
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-27 13:04:07 +00:00
Tobias Klauser
5adf374967 unix: document and move Time{spec,val} methods
Add godoc comments for Time{spec,val} methods Unix and Nano.
Also move them to timestruct.go to the other Time{spec,val} related
functionality.

Change-Id: I3b18c5d1bfb235ea4fea25a18fc34b85c21bb365
Reviewed-on: https://go-review.googlesource.com/73871
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-27 13:03:45 +00:00
Tobias Klauser
30ef8ff723 unix: single space after period in generated zptrace header
Fix the header in the generated zptrace*_linux.go files to consistently
use single space after a period.

Change-Id: I527f27a68e14bc103639b1dd5734ec06ae267e01
Reviewed-on: https://go-review.googlesource.com/73875
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-27 12:34:53 +00:00
Tobias Klauser
0649f9fe46 unix: add Poll function on NetBSD
Tested with TestPoll extracted from syscall_linux_test.go. Once Poll is
supported on all OSes this test can be moved to syscall_unix_test.go.

Change-Id: I61ec50c5ea7d6db43f7688ed925d6ed26a6bbc3a
Reviewed-on: https://go-review.googlesource.com/73650
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-27 07:17:55 +00:00
Christopher Koch
164713f0df unix: remove unnecessary use of unsafe.Pointer.
Change-Id: I7ae67ce410ae2816c2f3e8ecb26e46265aa11d7f
Reviewed-on: https://go-review.googlesource.com/73771
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-10-26 20:47:33 +00:00
Ian Lance Taylor
3e3646d2c7 unix: add ptrace definitions for compatible GOARCH pairs
For pairs of GOARCH values that can execute each other's binaries on
the same system, such as 386 and amd64, add the definitions and
functions required to fetch and set registers when debugging either
variant.

Fixes golang/go#9739

Change-Id: I7896ddef7d341ffaee56614ebd080dc38c708ed4
Reviewed-on: https://go-review.googlesource.com/73555
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2017-10-26 07:26:40 +00:00
Alex Brainman
176de74134 windows: change 'more then' to 'more than'
Copy CL 17488 into golang.org/x/sys/windows.

Change-Id: I4c6bf14982dd1fc2b8aa70ec16ad7b7c18e76bae
Reviewed-on: https://go-review.googlesource.com/73353
Reviewed-by: Tim Cooper <tim.cooper@layeh.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-26 00:44:44 +00:00
Kieran Colford
5d0dd06d1c windows: document panics in LazyProc
Some of LazyProc's methods will panic if the procedure cannot be
found. This patch documents that fact.

Change-Id: If446a61e001ae04eaba0ff08b512df4def8a00b7
Reviewed-on: https://go-review.googlesource.com/73450
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2017-10-25 22:41:41 +00:00
Tobias Klauser
9e4fff1f4d all: single space after period
Follow CL 20022 and consistently use single space after a period in
documentation.

Generated with:

$ perl -i -npe 's,^(\s*// .+[a-z]\.)  +([A-Z]),$1 $2,' $(git grep -l -E '^\s*//(.+\.)  +([A-Z])')

Change-Id: Ia29ad823668f060e81293e848a79fc4b4857d94b
Reviewed-on: https://go-review.googlesource.com/73530
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-10-25 20:39:07 +00:00
Tobias Klauser
607525c0eb unix: add Poll function on Dragonfly
Tested with TestPoll extracted from syscall_linux_test.go. Once Poll is
supported on all OSes this test can be moved to syscall_unix_test.go.

Change-Id: I03f4396be2e190770abb219c1c5324ca55bcfa27
Reviewed-on: https://go-review.googlesource.com/73430
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-25 19:14:39 +00:00
Tobias Klauser
92ac112afc unix: add Poll function on FreeBSD
Tested with TestPoll extracted from syscall_linux_test.go. Once Poll is
supported on all OSes this test can be moved to syscall_unix_test.go.

Change-Id: I56ee0124a04c64e3ea51a1653901f2f4277983e6
Reviewed-on: https://go-review.googlesource.com/73370
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-25 15:18:35 +00:00
Tobias Klauser
f0d39a4bd5 unix: add Poll function on Darwin
Tested with TestPoll extracted from syscall_linux_test.go. Once Poll is
supported on all OSes this test can be moved to syscall_unix_test.go.

Change-Id: Ia57e3a92e6a50cb22edde8a31e1c4e70d894dc4c
Reviewed-on: https://go-review.googlesource.com/73310
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-10-25 12:55:06 +00:00
Tobias Klauser
e825973668 unix: 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.

Follow CL 30826 which did the same for syscall.

Change-Id: Id6c6f4fef8450251447d1a5b01f35c2a36b5aeb1
Reviewed-on: https://go-review.googlesource.com/73170
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-25 08:56:33 +00:00
Tobias Klauser
bb1b7fe501 unix: add test for UtimesNanoAt on Linux
Add a test for UtimesNanoAt which makes sure the timestamp of a symlink
is updated.

Change-Id: I819e43db1d390fb37f011b34e58ff9d3d06595f1
Reviewed-on: https://go-review.googlesource.com/72377
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-25 08:55:50 +00:00
Tobias Klauser
a1a1f1746d unix: unify TimespecToNsec and TimevalToNsec
All implementations of these functions are identical.

Follow CL 30819 which did the same for syscall.

Change-Id: I3c78f05ea12251306f3e100a006d266154a5238e
Reviewed-on: https://go-review.googlesource.com/72378
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-23 17:51:51 +00:00
Michael Stapelberg
a57a2b53a1 unix: add watchdog constants on Linux
To be used e.g. in
2e60d5b8c8

Change-Id: If79ffec9021dc79375c861a0ddd9dd443adb4692
Reviewed-on: https://go-review.googlesource.com/72375
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-10-23 17:49:30 +00:00
Tobias Klauser
ff8cd6cb4f unix: add UTIME_* constants on Linux
They might be used as special values in struct Timespec. See
http://man7.org/linux/man-pages/man2/utimensat.2.html for details.

Change-Id: I1c2d6d7731ca7f077d033e51ee6421a4f2cfbb89
Reviewed-on: https://go-review.googlesource.com/72376
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-23 17:48:59 +00:00
Hilko Bengen
8dbc5d05d6 windows: add GetProcAddressByOrdinal
The current GetProcAddress implementation only resolves functions in
DLLs by name. Add GetProcAddressByOrdinal that allows resolving
functions by ordinal number, using the same GetProcAddress call from
kernel32.dll in the background.

This is particularly useful for some functions (e.g. IsOS from
shlwapi.dll in some older versions of Windows) that cannot be found by
name.

Fixes golang/go#16507

Change-Id: Ib5fba7568c365a0aa2491c1261876b3a3929ec3d
Reviewed-on: https://go-review.googlesource.com/70690
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-10-17 06:39:10 +00:00
Tobias Klauser
686000749e unix: correct type for timeout argument to Select on linux/{arm64,mips64x}
Follow CL 70590 which did the same for syscall.

unix.Select uses SYS_PSELECT6 on arm64 and mipx64x, however this
syscall expects its 5th argument to be of type Timespec (with seconds
and nanoseconds) instead of type Timeval (with seconds and microseconds)
This leads to the timeout being too short by a factor of 1000.

This CL fixes this by adjusting the timeout argument accordingly,
similarly to how glibc does it for architectures where neither
SYS_SELECT nor SYS__NEWSELECT are available. It also makes Pselect
generaly available on linux.

Updates golang/go#22246

Change-Id: I69f8821a40c59ee469b8a986d784a4db8727ee9a
Reviewed-on: https://go-review.googlesource.com/70610
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-13 13:55:06 +00:00
Tobias Klauser
43eea11bc9 unix: add MNT_* flags on FreeBSD
Add the MNT_* flags to be used e.g. with Getfsstat on FreeBSD.

Change-Id: I1afb50f715f447f85b4ece3d3fead8b9ce79c4f6
Reviewed-on: https://go-review.googlesource.com/70250
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-10-12 16:43:49 +00:00
Tobias Klauser
ebfc5b4631 unix: generate GOARCH specific zsysctl files on OpenBSD
Since CL 10087 build tags for GOOS and GOARCH are emitted by
mksysctl_openbsd.go but the generated file is always written to
zsysctl_openbsd.go.

Adjust mkall.sh to write to GOOS/GOARCH specific files and create a
zsysctl_openbsd_${GOARCH}.go file for each GOARCH supported on openbsd.

Change-Id: Id2a7b2815081f024de0ca87ba870a672bab32d24
Reviewed-on: https://go-review.googlesource.com/68870
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-10-06 17:50:12 +00:00
Kevin Burke
314a259e30 README: add better links, Markdown
Move the README to README.md so Gerrit can render it; currently
Gerrit only renders files named exactly "README.md" (for example at
https://go.googlesource.com/go).

Add more links to the README explaining how to file issues,
how to submit code changes, where to download the code to and
how to get it. Hopefully this should help people who go to
https://go.googlesource.com/sys or https://github.com/golang/sys
figure out how to get started with development.

Change-Id: I2b3b9cb1021292c3cb4b5eb3a84b5c17eb8429da
Reviewed-on: https://go-review.googlesource.com/49911
Reviewed-by: Kevin Burke <kev@inburke.com>
2017-09-27 05:46:21 +00:00
Carlos Eduardo Seo
429f518978 unix: update Select to use newselect on ppc64x
Analog to the runtime package, Select should be using newselect
instead of select. This change addresses this problem and regenerates
zsyscall_linux_* for ppc64 and ppc64le.

Updates golang/go#21946

Change-Id: I7ed5c2490ba2ce556f143f8e8377572ab345f7b8
Reviewed-on: https://go-review.googlesource.com/65091
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
2017-09-22 12:34:23 +00:00
Tobias Klauser
2320a9c158 unix: fix TestMmap crash on openbsd/386
When adding Mprotect to TestMmap in CL 56172, PROT_WRITE was implicitly
assumed to also include PROT_READ. This is not necessarily true on all
OSes and makes TestMmap crash on openbsd/386.

As suggested my Mikio Hara fix it by also setting PROT_READ on the
memory mapping.

Fixes golang/go#21962

Change-Id: Ia789ab8b31f8dec0c3db23cc950ccdd4aab3db05
Reviewed-on: https://go-review.googlesource.com/65230
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-09-21 19:16:43 +00:00
Tobias Klauser
b6e1ae2164 unix: remove _SC_PAGESIZE on Solaris
CL 62111 removed the _SC_PAGESIZE definition from the types_*.go files
but did not re-generate ztypes_solaris_amd64.go. Do so now to get rid of
_SC_PAGESIZE there as well.

Change-Id: Icde4366f4b7a92e8a89170ad00ff2b807e7655e1
Reviewed-on: https://go-review.googlesource.com/64350
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-09-19 00:13:38 +00:00
Tobias Klauser
1f337fdb7f unix: add Major, Minor and Mkdev functions on Solaris
Add Major, Minor and Mkdev functions for converting device numbers to
their major/minor components and vice versa.

Use the respective functions provided by the Solaris libc instead of
reimplementing them.

Test the conversion function with some well-known static device numbers
for devices which should be present on any Solaris system.

Re-generated files on OpenIndiana Hipster 2017.04 (SunOS 5.11) which
also added some previously missing error constants.

Change-Id: Ief9ea973d91c24956571eb8fafc8a4525b0f5b90
Reviewed-on: https://go-review.googlesource.com/64390
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-09-18 21:40:44 +00:00
Tobias Klauser
b8ca6dd53d unix: add Msync function on Solaris
Add the Msync function on solaris/amd64.

Change-Id: Idde0f9e693f924fef471acb42afb84e83c4cee76
Reviewed-on: https://go-review.googlesource.com/64370
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-09-18 21:34:02 +00:00
Jeet Parekh
062cd7e4e6 windows: fix NewCallback function
It has been suggested to migrate from syscall to golang.org/x/sys
The NewCallback function works in syscall. But the golang.org/x/sys/windows NewCallback function did not work.

Since golang.org/x/sys/windows already imports syscall, the NewCallback function now calls syscall.NewCallback.

Fixes golang/go#21831

Change-Id: I5cabd8540777b398a288308a66ae20896ed4a1db
Reviewed-on: https://go-review.googlesource.com/63250
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2017-09-12 23:54:04 +00:00
Tobias Klauser
033028a6b4 unix: add Major, Minor and Mkdev functions on OpenBSD
Add Major, Minor and Mkdev functions for converting devices numbers to
their major/minor components and vice versa.

The functions follow the behavior of the macros defined in OpenBSD's
sys/types.h header. However, the parameter and return types are changed
to match the existing implementations of these functions.

Test the conversion macros with some well-known device numbers.

Updates golang/go#8106

Change-Id: Ia50b7ccab18ff7c7e9dd77ddc7e4aa6cf5c79963
Reviewed-on: https://go-review.googlesource.com/63070
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-09-12 22:26:33 +00:00
Tobias Klauser
804a9fee62 unix: convert major/minor to uint64 before shifting in Mkdev on Darwin/*BSD
Follow CL 63090 and change the Makedev function on Darwin and *BSD to
convert to uint64 before shifting/masking. This avoids a potential
overflow.

Change-Id: I5b566329695cc5edcf82f0ff2366033011b0625b
Reviewed-on: https://go-review.googlesource.com/63112
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-09-12 19:57:40 +00:00
Tobias Klauser
7a85bfad8b unix: fix potential overflow in Mkdev on Linux
Daniel Swarbrick reports the following go vet warning after CL 50550:

  .../dev_linux.go:38: (major & 0xfffff000) (32 bits) too small for shift of 32

Fix it by converting major and minor to uint64 before the bitwise-and.

Change-Id: If37540be81f2c78a58fd5e5dcce7b770ce7b8afe
Reviewed-on: https://go-review.googlesource.com/63090
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-09-12 14:41:02 +00:00