Commit Graph

1045 Commits

Author SHA1 Message Date
Jason A. Donenfeld
83cfaa298f windows: add DLLError.Unwrap function
Because we're expecting for future functions to be unavailable, we
should add an Unwrap() function to the DLLError struct, so that people
can test for this situation easily via:

    if errors.Is(err, windows.ERROR_PROC_NOT_FOUND) { ... }

DLLError already was wrapping the underlying Errno error, but never got
the Go 1.13 helper method.

Update golang/go#42584

Change-Id: Ib916ddd55a2de29f988edaaf82f2ae0ce1b18e3b
Reviewed-on: https://go-review.googlesource.com/c/sys/+/269937
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2020-11-13 22:15:40 +00:00
Tamir Duberstein
0a15ea8d9b *: use more precise build tags
s/!gccgo/gc/ in files which use gc-syntax assembly.

Change-Id: Iafc006cd60ad0e429cff182a05c790d80c380802
Reviewed-on: https://go-review.googlesource.com/c/sys/+/269717
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Than McIntosh <thanm@google.com>
2020-11-13 13:57:34 +00:00
Jason A. Donenfeld
5cba982894 windows: add missing error constants from setupapi.h
While most of our constant gathering can be automated, some win32 error
constants come from unusual corners of the WDK, such as setupapi.h. We
add those constants to a new file, so that they can be referenced as
constants by Go programs.

Change-Id: I9bce7fddf7aaa00204e6048b53f14e6ba18d5f13
Reviewed-on: https://go-review.googlesource.com/c/sys/+/268358
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Trust: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Simon Rozman <simon@rozman.si>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2020-11-12 07:39:58 +00:00
Jason A. Donenfeld
35f3e6cf4a windows: cleanup mkwinsyscall argument list
CL 258038 improperly added a weird custom type to mkwinsyscall, rather
than doing the norm with wrapper functions. So, we revert the change to
mkwinsyscall and add the proper wrapper function to do the type
conversion.

Change-Id: I98134e4ce6bf4b52e1384fe84bddeedb00e18c0b
Reviewed-on: https://go-review.googlesource.com/c/sys/+/268777
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Trust: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2020-11-10 21:10:18 +00:00
Tobias Klauser
215b40eba5 unix/linux: update Dockerfile to Go 1.15.4
No changes in generated files.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Change-Id: Ibbb81f8ef48d43d7fb620fec57c3ac779ebf0e11
Reviewed-on: https://go-review.googlesource.com/c/sys/+/268357
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2020-11-09 16:54:25 +00:00
Jason A. Donenfeld
4d91cf3a1a windows: add missing page flag constants
We already have some of the most basic ones, but there are some notable
gaps that make coding programs that poke at page permissions a bit more
cumbersome to write.

Reference: https://docs.microsoft.com/en-us/windows/win32/memory/memory-protection-constants

Change-Id: Ib7d1ef2e2f6d92f6eec230b7785f579e4a26fbae
Reviewed-on: https://go-review.googlesource.com/c/sys/+/268137
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Trust: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Simon Rozman <simon@rozman.si>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2020-11-07 08:05:50 +00:00
Alex Brainman
db71ae6646 windows/svc/mgr: rename service in TestMyService
TestMyService uses the same service name as service in
golang.org/x/sys/windows/svc.TestExample.

https://build.golang.org sometimes schedules TestMyService and
TestExample to run at the same time. If that happens, tests fail,
because they were not designed to run in parallel.

This CL renames service in TestMyService, so it does not clash with
TestExample.

Fixes golang/go#42211

Change-Id: I928c2ebbae77de3540f5ce16948fb96eeeed836d
Reviewed-on: https://go-review.googlesource.com/c/sys/+/267604
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-11-06 08:11:18 +00:00
Alex Brainman
1dbcb44a4e windows/svc: stop service before deletion in TestExample
TestExample normally stops and deletes test service at the end of the
test. But, if TestExample does not complete for some reason, test
service might remain running and installed.

There is some code that deletes "left over" test service before starting
the test. But that code fails, if service is running. Deletion only
works, if service is not running. This CL adds code to stop the "left
over" service so it can be deleted.

Update golang/go#42211

Change-Id: I826dd587063265c5b96076668c3704c0a7eaa3d8
Reviewed-on: https://go-review.googlesource.com/c/sys/+/267603
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-11-06 07:48:44 +00:00
Daniel Kessler
80594f20fa windows: add CertDeleteCertificateFromStore
https://docs.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-certdeletecertificatefromstore

Change-Id: I59c6e9c75de91176b064c0e16eeb6ea2fda7ffcd
Reviewed-on: https://go-review.googlesource.com/c/sys/+/267601
Trust: Alex Brainman <alex.brainman@gmail.com>
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2020-11-06 07:34:44 +00:00
Lehner Florian
da207088b7 unix: update IFLA consts on linux
Update the IFLA_* consts from /usr/include/linux/if_link.h

Change-Id: I8a751f9237c78737691fb425dcbc4be6e52364d9
Reviewed-on: https://go-review.googlesource.com/c/sys/+/266977
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Trust: Tobias Klauser <tobias.klauser@gmail.com>
2020-11-01 10:28:59 +00:00
Joel Sing
201ba4db24 cpu: make x/sys/cpu build on non-linux mips64x
Update golang/go#40995

Change-Id: Icab9865e59350c11da32bf8af2d0830001e41323
Reviewed-on: https://go-review.googlesource.com/c/sys/+/265959
Trust: Joel Sing <joel@sing.id.au>
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
2020-10-29 08:09:32 +00:00
Meng Zhuo
3518587229 windows: add GetFinalPathNameByHandleW
https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfinalpathnamebyhandlew

Fixes #41686

Change-Id: I207676364a3abc8658498bcd060c8f9694161867
Reviewed-on: https://go-review.googlesource.com/c/sys/+/264577
Trust: Meng Zhuo <mzh@golangcn.org>
Run-TryBot: Meng Zhuo <mzh@golangcn.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-10-29 02:06:03 +00:00
Tobias Klauser
c5abc1b1d3 unix: revert zsysnum_darwin_*.go deletion from CL 250437
CL 250437 removed the zsysnum_darwin_*.go files containing the SYS_*
contants for macOS. This was done assuming that users should migrate
away from direct syscalls to libSystem wrappers. Let's not force users
of this package on when they want to do that and re-add the
zsysnum_darwin_*.go files and mark the consts as deprecated.

We can still remove these once macOS actively prevents use of direct
syscalls.

Fixes golang/go#41868

Change-Id: Ie5edf135154f24e3efa4811ef2253ad1353ba132
Reviewed-on: https://go-review.googlesource.com/c/sys/+/265857
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-10-28 21:52:40 +00:00
Bill O'Farrell
708e7fb298 cpu: add support for zos/s390x
This adds feature detection that works on the s390x running zos.
There are some differences with Linux (no hwcap, facilities vector available in-memory).
These changes should not affect other platforms.

Fixes golang/go#41984.

Change-Id: Ieabbfafd07367a346a4d279dde0f00aa3fc4321b
Reviewed-on: https://go-review.googlesource.com/c/sys/+/262477
Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
Trust: Martin Möhrmann <moehrmann@google.com>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
2020-10-28 09:49:53 +00:00
Ben Cartwright-Cox
0fcbb8f492 unix: add linux constants and types for PPS devices ioctl's
After trying to implement Pulse Per Second devices
in go, I found that the ioctl values and structs
where not in the unix package yet:

~# strace ppstest /dev/pps0 |& grep ioctl
ioctl(3, PPS_GETPARAMS, 0xbee63b18)     = 0
ioctl(3, PPS_GETCAP, 0xbee63b84)        = 0
ioctl(3, PPS_GETPARAMS, 0xbee63b18)     = 0
ioctl(3, PPS_SETPARAMS, 0xbee63b18)     = 0
ioctl(3, PPS_FETCH, 0xbee63b00)         = 0
ioctl(3, PPS_FETCH, 0xbee63b00)         = 0
ioctl(3, PPS_FETCH, 0xbee63b00)         = 0
ioctl(3, PPS_FETCH, 0xbee63b00)         = 0
ioctl(3, PPS_FETCH, 0xbee63b00)         = 0

This commit should add them.

Change-Id: If1225ab7c4c38aad5d8ae841d1fdebfa45055549
GitHub-Last-Rev: c1469112b8
GitHub-Pull-Request: golang/sys#90
Reviewed-on: https://go-review.googlesource.com/c/sys/+/265217
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2020-10-27 14:07:54 +00:00
Tobias Klauser
9d1ec526b7 unix: add anyToSockaddrGOOS on dragonfly
CL 264638 forgot to add func anyToSockaddrGOOS on dragonfly which breaks
the build.

Change-Id: I35d28a972c8c541dea8db0349b7e1440f5ec2fd7
Reviewed-on: https://go-review.googlesource.com/c/sys/+/265377
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2020-10-27 13:05:17 +00:00
Tobias Klauser
e1471140ff unix: implement AF_SYSTEM/AF_SYS_CONTROL sockets on darwin
See https://developer.apple.com/documentation/kernel/sockaddr_ctl for
details.

AF_SYSTEM is darwin-specific, so the BSD-specific anyToSockaddr func
needs to call GOOS-specific funcs which return nil, EAFNOSUPPORT on all
BSD platforms but darwin.

For golang/go#41868

Change-Id: Id7794aba5988dd9511053b76be5efeb66c104a26
Reviewed-on: https://go-review.googlesource.com/c/sys/+/264638
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2020-10-27 09:04:13 +00:00
Tobias Klauser
119d4633e4 unix: add Ioctl{Get,Set}IfreqMTU on darwin
For golang/go#41868

Change-Id: I9fb8f5eee933488e4c63aaa757059b8cea4d9629
Reviewed-on: https://go-review.googlesource.com/c/sys/+/264637
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
2020-10-26 17:38:27 +00:00
Tobias Klauser
e075d93706 unix: deflake TestPselect and TestSelect on linux
On some platforms (namely Linux), Select and Pselect update the
passed-in timeval/timespec, which might lead to failing tests in
case of an EINTR. Fix this by always resetting the timeval/timespec
before calling Select/Pselect.

Also change accept timeouts within 2/3 margin of the expected timeout,
like already done in TestSelect. While at it, fix the failure log to use
the common "got X, expected Y" message.

Fixes golang/go#42210

Change-Id: Id0efbbecc9c0bf44c102d5d1880b1bae32980ad1
Reviewed-on: https://go-review.googlesource.com/c/sys/+/265020
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-10-26 16:32:16 +00:00
Tobias Klauser
418715ba6f unix: compare Stat_t members when checking Stat vs. Fstatat in TestFstatat
TestFstatat regularly fails on the dragonfly-amd64 builder due to
mismatching Stat_t info returned by the calls to Fstatat vs. Stat (most
likely due to Atime changing). Fix the test by just comparing some well
known members. This was already fixed for the Lstat call in CL 212417.

Fixes golang/go#42208

Change-Id: I3e241470d373338b9716bb9ce0265a105db2720d
Reviewed-on: https://go-review.googlesource.com/c/sys/+/265018
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-10-26 13:34:11 +00:00
Alex Brainman
9f70ab9862 windows/mkwinsyscall: use global variable to avoid allocation in errnoErr
Change-Id: I6f089ea96bfbad6390c50a63e9d2fb290cc8654a
Reviewed-on: https://go-review.googlesource.com/c/sys/+/264578
Trust: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-10-24 23:29:16 +00:00
Tobias Klauser
ef9fd89ba2 cpu: read ARM64 registers using sysctl(3) on netbsd/arm64
Use sysctl("machdep.cpu0.cpu_id") to retrieve the ARM64 cpu_id
information on netbsd/arm64. This includes the ISAR0, ISAR1 and PFR0
registers which can be parsed using existing functionality.

In order to use sysctl(3) without depending on x/sys/unix, some
functionality needed to be copied and slightly adjusted.

Change-Id: Ic9a133917ae5da516e6794f375bd7602d9bd3aa6
Reviewed-on: https://go-review.googlesource.com/c/sys/+/264378
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Trust: Benny Siegert <bsiegert@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
2020-10-24 13:24:49 +00:00
Tobias Klauser
fb209a7c41 cpu: refactor parsing of ARM64 registers into separate function
This will allow to re-use the implementation when adding support for
netbsd/arm64 which will retreive these register values using sysctl(3).

Change-Id: I2414cc4c6d1a91fff946466e4bf6d95d07f30137
Reviewed-on: https://go-review.googlesource.com/c/sys/+/264377
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
2020-10-22 20:17:47 +00:00
Jason A. Donenfeld
6e5568b54d unix,windows,plan9: add Byte{Slice,Ptr}ToString functions
We already provide ByteSliceFromString and BytePtrFromString, and on
Windows we provide UTF16FromString, UTF16PtrFromString, UTF16ToString,
and UTF16PtrToString. So this commit fills in the remaining two
Byte-oriented functions: ByteSliceToString and BytePtrToString. Since
the existing two are available on windows, unix, and plan9, we add the
remaining two to the same places. This helps eliminate unsafe pointer
options in addition to triggering checkptr in Go 1.15, by eliminating
the use of prior idioms for these types of casts.

Change-Id: I85ae49f2756e142c2462fe8b2428216b6992e089
Reviewed-on: https://go-review.googlesource.com/c/sys/+/263757
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Brad Fitzpatrick <bradfitz@golang.org>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
2020-10-20 23:07:47 +00:00
Tobias Klauser
eeed37f84f unix: add IoctlCtlInfo on darwin
For golang/go#41868

Change-Id: I0f4dbeacfe10b9614caf05633a1de3a98a1fc85f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/262959
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2020-10-18 23:04:17 +00:00
Tobias Klauser
98379d014c cpu: avoid illegal instruction on openbsd/arm64
On OpenBSD, this package tries to read a privileged register, which
results in a SIGILL. Use the same workaround as Android, iOS and NetBSD.

Update golang/go#31746

Change-Id: I981249310169bc30b018c1a157529a4e46597d81
Reviewed-on: https://go-review.googlesource.com/c/sys/+/263337
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Joel Sing <joel@sing.id.au>
2020-10-18 12:10:11 +00:00
Clément Chigot
b09fb700fb unix: add missing syscalls on AIX
Access, Chmod, Chown and Creat were forgotten when porting the package
on AIX.

Fixes golang/go#42001

Change-Id: I1ab8c5198240421b31db8b447fe37ce5d80e5ce8
Reviewed-on: https://go-review.googlesource.com/c/sys/+/262897
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-10-17 00:35:18 +00:00
Tobias Klauser
f659759dc4 unix: add support for ptrace on macOS/ARM64
Same as CL 260718 did for package syscall.

Updates golang/go#38485

Change-Id: I7b282b7c823dd79eb1fe8b172a78da8dfe9acd1c
Reviewed-on: https://go-review.googlesource.com/c/sys/+/262957
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-10-16 16:01:50 +00:00
Ian Lance Taylor
e3ed0017c2 unix/linux: update to Go 1.15.3 release
Does not cause any changes to generated files.

Change-Id: I635230441d4c48d1f649ca5c7cca073974e36b60
Reviewed-on: https://go-review.googlesource.com/c/sys/+/262457
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Trust: Ian Lance Taylor <iant@golang.org>
2020-10-15 00:08:50 +00:00
Tobias Klauser
cc95f250f6 unix: add FIORDCHK on solaris/illumos
Change-Id: Ib789b19d45f1ca3d5628e53e68b9ab732d6f8200
Reviewed-on: https://go-review.googlesource.com/c/sys/+/261797
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2020-10-14 08:05:44 +00:00
Tobias Klauser
9029056a59 unix: refresh types and error consts on solaris/illumos
Generated on SunOS 5.11

Change-Id: Ia3a00e9fa4267a748e1d8434ae8a53ffe44494be
Reviewed-on: https://go-review.googlesource.com/c/sys/+/261461
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-10-14 08:05:34 +00:00
Tobias Klauser
2da7054afa unix: remove stray TODO comment
This was addressed by CL 2816 for package syscall and the same comment
was deleted from asm_linux_386.s.

Same as CL 261458 for package syscall.

Change-Id: Ib5d86dbafb6766f9d8d523c6035e1f095f18e6ed
Reviewed-on: https://go-review.googlesource.com/c/sys/+/261460
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2020-10-13 13:26:46 +00:00
Tobias Klauser
a5aeffabbd unix: move build constraints comment below copyright message
Make fcntl_linux_32bit.go consistent with all other files in the
package.

Change-Id: If2e21027b0f31ac27d434806c18d9223ee55992f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/261459
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2020-10-13 13:26:27 +00:00
Alex Brainman
0aaa271806 windows/mkwinsyscall: sort by dll names and dll function names
Otherwise generated file changes every time //sys lines are moved
around, or when mkwinsyscall command parameters are reordered.

Change-Id: Ie4bdbee2ba50f9cea36ec78ce9951c57bd5da8a7
Reviewed-on: https://go-review.googlesource.com/c/sys/+/260900
Trust: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-10-13 08:18:32 +00:00
Tobias Klauser
56aa3af1a1 unix: update Dockerfile to Linux 5.9 and Go 1.15.2
Also add some newly added IFLA_* and PERF_* consts and adjust the
renamed NFTA_LIST_UNPEC const (see torvalds/linux@da9125df85).

Change-Id: Ic37f39e5b5bfe063ae6d7701de05ced07e62abfb
Reviewed-on: https://go-review.googlesource.com/c/sys/+/261457
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
2020-10-13 06:48:17 +00:00
Sebastiaan van Stijn
dfb3f7c4e6 windows: errnoErr(): return ENOENT to reduce code duplication
Change-Id: I51c08a4add9c2b31c4bb7c4421dde227b4fff489
GitHub-Last-Rev: ef8ef8646c
GitHub-Pull-Request: golang/sys#89
Reviewed-on: https://go-review.googlesource.com/c/sys/+/259537
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Alex Brainman <alex.brainman@gmail.com>
2020-10-09 02:54:20 +00:00
Sebastiaan van Stijn
c1f3e3309c windows/mkwinsyscall: simplify generated code for booleans
Change-Id: I31ca4f93924a593e7952c483084616141998a03c
GitHub-Last-Rev: d4fd0c7eca
GitHub-Pull-Request: golang/sys#88
Reviewed-on: https://go-review.googlesource.com/c/sys/+/259302
Trust: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2020-10-08 06:45:18 +00:00
Alex Brainman
280f808b4a windows/svc: add IsWindowsService function
CL 244958 includes isWindowsService function that determines if a
process is running as a service. The code of the function is based on
public .Net implementation.

IsAnInteractiveSession function implements similar functionality, but
is based on an old Stackoverflow post., which is not as authoritative
as code written by Microsoft for their official product.

This change copies CL 244958 isWindowsService function into svc package
and makes it public. The intention is that future users will prefer 
IsWindowsService to IsAnInteractiveSession.

Also this change adds "Deprecated" comment to IsAnInteractiveSession to
point future users to IsWindowsService.

Call to IsAnInteractiveSession is also replaced with IsWindowsService
in golang.org/x/sys/windows/svc/example package.

Change-Id: I4a33b7f590ee8161d1134d8e83668e9da4e6b434
Reviewed-on: https://go-review.googlesource.com/c/sys/+/259397
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Brad Fitzpatrick <bradfitz@golang.org>
Trust: Alex Brainman <alex.brainman@gmail.com>
2020-10-08 06:31:27 +00:00
Ian Lance Taylor
a893ed343c unix: sync with DragonFly 5.8
Change-Id: I258e86b502957d76aeeead286bcc9c5e22b53834
Reviewed-on: https://go-review.googlesource.com/c/sys/+/260001
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2020-10-07 16:58:08 +00:00
Ian Lance Taylor
cec0259cc9 unix: update Darwin ztype files
The main effect is to change some fields of Statfs_t from arrays of int8
to arrays of byte. This makes the types of those fields correspond to the
types used on most other BSD systems.

Change-Id: If7e80fd53d6369a0f7c979c0bf36ffe530dc5d8d
Reviewed-on: https://go-review.googlesource.com/c/sys/+/259903
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2020-10-07 16:57:53 +00:00
Sebastiaan van Stijn
8445cc04cb windows: add SetConsoleCursorPosition
Relates to https://github.com/gotestyourself/gotestsum/pull/115#issuecomment-629785089

For details see: https://docs.microsoft.com/en-us/windows/console/SetConsoleCursorPosition

Change-Id: I512428b64af253916c81187cb644e40a6ba418b5
GitHub-Last-Rev: c6c7ba0ad0
GitHub-Pull-Request: golang/sys#87
Reviewed-on: https://go-review.googlesource.com/c/sys/+/258038
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Trust: Alex Brainman <alex.brainman@gmail.com>
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
2020-10-07 08:21:16 +00:00
Matt Layher
ac719f4daa unix: fix typo in PERF_TYPE_HARDWARE introduced in CL 259477
Change-Id: Iee2a067673309abc6b80d3cc96ac49d9d6b52865
Reviewed-on: https://go-review.googlesource.com/c/sys/+/259799
Trust: Matt Layher <mdlayher@gmail.com>
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-10-06 15:56:30 +00:00
Tobias Klauser
097ba2fa90 unix: fix build on solaris after CL 259637
The build on illumos and solaris currently fails with:

  unix/syscall_solaris.go:558:6: no new variables on left side of :=

Fix this by dropping the named return value.

Change-Id: Ie29956ba08fd107f380fe432cc85f120d66057b5
Reviewed-on: https://go-review.googlesource.com/c/sys/+/259581
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2020-10-06 15:36:26 +00:00
Matt Layher
9971236665 unix: use runtime.KeepAlive in Solaris IoctlSetTermio
This ensures that value remains live for the duration of the ioctl system call.
This pattern is used in all other IoctlSet* functions but appears to have been
forgotten here.

Change-Id: I2b26a5c4e7c862f779427b839327b36c1bc78c82
Reviewed-on: https://go-review.googlesource.com/c/sys/+/259637
Trust: Matt Layher <mdlayher@gmail.com>
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-10-05 17:22:24 +00:00
Matt Layher
935f906f17 unix: fix typos and reflow comments on IoctlFile* functions
Change-Id: I9be66514d6b5c8c85e7e424c4aa7856d0f4d884d
Reviewed-on: https://go-review.googlesource.com/c/sys/+/259557
Trust: Matt Layher <mdlayher@gmail.com>
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Johan Brandhorst <johan.brandhorst@gmail.com>
2020-10-05 17:05:23 +00:00
Lehner Florian
765f4ea38d unix: update PERF consts on linux
Update the PERF_* consts from /usr/include/linux/perf_event.h.

Change-Id: I2dfa09445547682fa7ed99b385476319e8493c27
Reviewed-on: https://go-review.googlesource.com/c/sys/+/259477
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2020-10-05 06:50:44 +00:00
Matt Layher
f6757f2700 unix: add Linux watchdog structures and missing constants
This CL also adds the type-safe wrappers IoctlGetWatchdogInfo
and IoctlWatchdogKeepalive around the raw ioctl interface.

Change-Id: I98e3970807b28832e49524700b17b6b6f75d91ed
Reviewed-on: https://go-review.googlesource.com/c/sys/+/259497
Run-TryBot: Matt Layher <mdlayher@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Terin Stock <terinjokes@gmail.com>
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Trust: Tobias Klauser <tobias.klauser@gmail.com>
2020-10-04 23:06:29 +00:00
Ian Lance Taylor
fdedc70b46 unix: use package path in name of C functions
For onsi/ginkgo#725

Change-Id: Iff5f98cb85aabd9c675c0519c30009ed96c2f6be
Reviewed-on: https://go-review.googlesource.com/c/sys/+/258358
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2020-09-30 18:57:26 +00:00
Tobias Klauser
e293359b92 unix: use correct cmsg alignment for netbsd/arm64
netbsd/arm64 requires 128-bit alignment for cmsgs.

Change-Id: I49d7a4dc223f15322c795569292b24200cedd389
Reviewed-on: https://go-review.googlesource.com/c/sys/+/258457
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Trust: Benny Siegert <bsiegert@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
2020-09-30 18:24:49 +00:00
Tobias Klauser
4d22bbb62b unix: remove darwin support from mksysnum.go
Since CL 250437 this package no longer supports non-libc, direct
syscalls on darwin. Thus support for generating zsysnum_*.go files on
darwin can be removed from the generating mksysnum.go program.

Change-Id: I8916ddcd028a60d876ad43b8ce18a1c0925ce272
Reviewed-on: https://go-review.googlesource.com/c/sys/+/258058
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-09-29 08:30:18 +00:00