Commit Graph

1178 Commits

Author SHA1 Message Date
Cherry Mui
30e306a8bb unix: delete darwin/386 and darwin/arm code
This repo supports two Go releases, Go 1.15 and 1.16 (and tip).
The darwin/386 and darwin/arm ports are dropped in Go 1.15.
And these ports already do not build even with Go 1.14. Delete
them.

Change-Id: Ib15e7c35059967803a1d5f086b00fbfed53a9b33
Reviewed-on: https://go-review.googlesource.com/c/sys/+/316769
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-05-07 01:43:57 +00:00
Bryan C. Mills
0981d6026f go.mod: upgrade to go 1.17
This change was produced using 'go mod tidy -go=1.17'
with a go command built at CL 315210.

This activates lazy loading, and updates the go.mod file to maintain
the lazy-loading invariants (namely, including an explicit requirement
for every package transitively imported by the main module).

Note that this does *not* prevent users with earlier go versions from
successfully building packages from this module.

(This has little to no effect for the sys module today because it does
not itself have any module dependencies.)

For golang/go#36460.

Change-Id: I0d278e13e54f961a42cd890ee248ddef811f1a1c
Reviewed-on: https://go-review.googlesource.com/c/sys/+/316111
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2021-05-03 17:37:54 +00:00
Song Lim
8803ae5d13 windows/svc/mgr: fix misspelled word in service.go
fix misspelled word "service" in line 62

Change-Id: I646f073d5604c36775d27c478a7b4b007f70ff62
GitHub-Last-Rev: 79901a6ca3
GitHub-Pull-Request: golang/sys#107
Reviewed-on: https://go-review.googlesource.com/c/sys/+/314573
Trust: Alex Brainman <alex.brainman@gmail.com>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2021-05-03 08:07:04 +00:00
Vaughn Iverson
b677753862 cpu: fix AVX512 support detection on Darwin
Summary: On darwin/amd64, it is not adequate to use OSXSAVE
bits to determine AVX512 availabilty. The reason is involved.
See github issue for details.

The fix consists of implementing Apple's recommended approach
using the process commpage cpu_capabilities bits to determine
availability of AVX512.

Fixes golang/go#43089

Change-Id: I1ba89965498863d268fbf2e427dbfd6429c7409f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/285572
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>
2021-05-03 07:37:44 +00:00
billofarrell
71e4cd670f unix: augment support for zos/s390x
This augments sys/unix support for zos/s390x by
adding a small number of syscalls:
Errno2
Err2ad
W_Getmntent_A (pure ascii version of W_Getmntent)
Select

It also makes Mount and Unmount more Linux-like.
A few necessary constants and types are added,
and some tests.

These changes do not affect other platforms in any way.

Fixes golang/go#45838

Change-Id: I5783784a79b6c80a47cca74f3352bc07ea4ca682
Reviewed-on: https://go-review.googlesource.com/c/sys/+/314950
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
2021-05-02 18:08:10 +00:00
Tobias Klauser
d19ff857e8 unix: on linux use accept4 in Accept, fall back to accept
Android seems to block the accept syscall in newer versions. Use accept4
instead on kernel versions that support it (Linux 2.6.28 and newer) and
fall back to accept on ENOSYS.

Updates golang/go#45767

Change-Id: If557eaaaa0b69112bbe66ed820fbb382afb53b04
Reviewed-on: https://go-review.googlesource.com/c/sys/+/313690
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>
2021-04-26 23:07:00 +00:00
Tobias Klauser
413ae7eecf unix/linux: update Dockerfile to Kernel 5.12, Go 1.16.3
Change-Id: I4e98e902508ad8bf0dede6c571bffed92611e02e
Reviewed-on: https://go-review.googlesource.com/c/sys/+/313391
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>
2021-04-26 23:06:21 +00:00
Tobias Klauser
8feff5de77 cpu: add //go:build lines to assembly files
Change-Id: I44c0bab1cc8a3b7ce59a1c690cb22046bca32bac
Reviewed-on: https://go-review.googlesource.com/c/sys/+/313689
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-04-26 21:46:56 +00:00
Nahum Shalman
c94f62235c unix: add more illumos ioctl wrappers
Expose Strioctl and Lifreq structs
Add helpers for working with them
Add additional wrapper functions

This work is in support of wireGuard/wireguard-go#39

Change-Id: I7a4d919f986ec977e2cd393eaf237d8c43bbc1cb
Reviewed-on: https://go-review.googlesource.com/c/sys/+/302831
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Trust: Ian Lance Taylor <iant@golang.org>
2021-04-26 08:06:07 +00:00
Tobias Klauser
09eb48e85f unix: add //go:build lines to assembly files
The zsyscall_darwin*.s files were regenerated using mksyscall.go. The
rest were updated manually, go fmt doesn't support formatting assembly
files.

Change-Id: I5efa23cb988300257de6bba4769e78c49a6382f1
Reviewed-on: https://go-review.googlesource.com/c/sys/+/312411
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>
2021-04-23 18:55:35 +00:00
Tobias Klauser
04245dca01 unix: add IPMreqn and {Get,Set}sockoptIPMreqn on darwin
Change-Id: Id145cc8d86b71ff3ef603b5d0aae4bdd0e4c3f2b
Reviewed-on: https://go-review.googlesource.com/c/sys/+/312410
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>
2021-04-23 08:28:22 +00:00
Ben Hutchings
33663a62ff unix/linux: add ppc system call definitions, for use with gccgo
Add system call definitions for 32-bit PowerPC (ppc).  These are
expected to be used with gccgo, as gc does not have a suitable code
generator.

These definitions are largely copied from ppc64x, with some 32-bit
specific wrappers copied from arm.

The glibc definitions of epoll_event and sockaddr_un structures need
to be overridden on ppc, similarly to some other architectures.

For golang/go#18031
Fixes golang/go#37443

Change-Id: I061ac2b8fa452dd37c2239a0b09dff2f3e9d50da
GitHub-Last-Rev: aada37a10b
GitHub-Pull-Request: golang/sys#106
Reviewed-on: https://go-review.googlesource.com/c/sys/+/312349
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-04-21 22:16:51 +00:00
Tobias Klauser
ac73e9fd89 unix: fix TestSCMCredentials after CL 272226
After CL 42765 (*net.UnixConn).ReadMsgUnix returns flags with
MSG_CMSG_CLOEXEC set. Adjust TestSCMCredentials accordingly.

Change-Id: Id7da35bbd94c51433f5f27a0e04827795826c02e
Reviewed-on: https://go-review.googlesource.com/c/sys/+/311390
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>
2021-04-20 20:58:09 +00:00
Tobias Klauser
93ed5bcd2b unix: split linux ioctl wrappers into separate file
Split all ioctl wrappers on linux into ioctl_linux.go and reorder them
so related ioctls are grouped together.

Change-Id: Iaf80993001ba3b4d4fa3096fed522cd9d339d21c
Reviewed-on: https://go-review.googlesource.com/c/sys/+/311389
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>
2021-04-20 07:25:15 +00:00
Tobias Klauser
37df388d1f unix: add MCAST_* on zos
Copied from golang.org/x/net/ipv6. This will allow to replace the
socket option constants in that package with constants from x/sys/unix.

Change-Id: Ie0ce8ac7a927418df6f6e793d626c425a1cf48ec
Reviewed-on: https://go-review.googlesource.com/c/sys/+/307670
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>
2021-04-19 17:01:43 +00:00
Tobias Klauser
66c3f26030 unix: don't defer close raw Socketpair fds in tests on darwin, freebsd and zos
Follow up on three occurences missed in CL 309689.

The raw fds are successively wrapped using os.NewFile and will be closed
by (*os.File).Close. Avoids a double close, in the worst case closing an
unrelated fd.

Change-Id: Iffe4cc4f77db10237547915c362c4aeb20cc9630
Reviewed-on: https://go-review.googlesource.com/c/sys/+/310010
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-04-15 04:56:47 +00:00
Tobias Klauser
fe65e336ab unix: don't defer close raw Socketpair fds in tests
The raw fds are successively wrapped using os.NewFile and will be closed
by (*os.File).Close. Avoids a double close, in the worst case closing an
unrelated fd.

Same as CL 309353 does for package syscall.

Change-Id: I26dffc3fefa90d636cb67a904df0bfc3b131f702
Reviewed-on: https://go-review.googlesource.com/c/sys/+/309689
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>
2021-04-14 05:50:47 +00:00
Tobias Klauser
f1c623a9e7 unix: add EthtoolDrvinfo and IoctlGetEthtoolDrvinfo on linux
Add type EthtoolDrvinfo and the type-safe IoctlGetEthtoolDrvinfo ioctl
wrapper func to retrieve it.

Change-Id: Ia514df89175939d9b0c2c4ddace621882e86b21a
Reviewed-on: https://go-review.googlesource.com/c/sys/+/308989
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-04-12 22:04:55 +00:00
Tobias Klauser
46babdb380 unix: add flags to SockaddrVM
The Flags member was added to struct sockaddr_vm in Linux kernel 5.11
and successively into RawSockaddrVM when updating to that kernel version
in CL 291637. Add the flags to SockaddrVM as well.

While at it, also update the list of CID values with VMADDR_CID_LOCAL.

Change-Id: I08828136f4c5ded3cca2fd07aefac066b9977b13
Reviewed-on: https://go-review.googlesource.com/c/sys/+/308990
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>
2021-04-12 22:03:33 +00:00
Jason A. Donenfeld
5e06dd20ab windows: ensure SECURITY_DESCRIPTOR allocation is large enough
Self-relative security descriptors can sometimes be smaller than the
header size of the SECURITY_DESCRIPTOR struct, which is fine in C, but
checkptr complains about it, so instead, ensure that the allocation is
at least the size of the SECURITY_DESCRIPTOR struct.

This fixes this splat:

fatal error: checkptr: converted pointer straddles multiple allocations

goroutine 36 [running]:
runtime.throw(0x761c5f, 0x3a)
        /usr/lib/go/src/runtime/panic.go:1117 +0x79 fp=0xc00005dd90 sp=0xc00005dd60 pc=0x5fb8d9
runtime.checkptrAlignment(0xc0001a4020, 0x741860, 0x1)
        /usr/lib/go/src/runtime/checkptr.go:20 +0xc9 fp=0xc00005ddc0 sp=0xc00005dd90 pc=0x5c7729
golang.org/x/sys/windows.(*SECURITY_DESCRIPTOR).copySelfRelativeSecurityDescriptor(0x1b9ad638190, 0x2)
        /home/zx2c4/Projects/golang-dev/sys/windows/security_windows.go:1359 +0x1b7 fp=0xc00005de50 sp=0xc00005ddc0 pc=0x6f0077
golang.org/x/sys/windows.SecurityDescriptorFromString(0x754f2b, 0x2, 0x0, 0x0, 0x0)
        /home/zx2c4/Projects/golang-dev/sys/windows/security_windows.go:1371 +0xde fp=0xc00005deb8 sp=0xc00005de50 pc=0x6f019e

Change-Id: I552017a93d4ca6f6debc6f8f445dac5c6717fed1
Reviewed-on: https://go-review.googlesource.com/c/sys/+/307129
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2021-04-03 16:11:42 +00:00
Jason A. Donenfeld
700132347e windows: allocate SECURITY_DESCRIPTOR with uintptr alignment
This struct has pointers in it, which means checkptr expects for it to
be aligned properly. When we're copying a Windows-allocated struct to a
Go-allocated one, make sure that the Go allocation is aligned to the
pointer size.

This fixes the following checkptr splat:

goroutine 29 [running]:
runtime.throw(0x4f8dd9, 0x3a)
	C:/hostedtoolcache/windows/go/1.16.2/x64/src/runtime/panic.go:1117 +0x79 fp=0xc000041c50 sp=0xc000041c20 pc=0x2f9879
runtime.checkptrAlignment(0xc00009c180, 0x4d8a00, 0x1)
	C:/hostedtoolcache/windows/go/1.16.2/x64/src/runtime/checkptr.go:20 +0xc9 fp=0xc000041c80 sp=0xc000041c50 pc=0x2c4d09
golang.org/x/sys/windows.(*SECURITY_DESCRIPTOR).copySelfRelativeSecurityDescriptor(0x227284caa00, 0x2)
	C:/Users/runneradmin/go/pkg/mod/golang.org/x/sys@v0.0.0-20210309040221-94ec62e08169/windows/security_windows.go:1347 +0x11f fp=0xc000041ce8 sp=0xc000041c80 pc=0x467f9f
golang.org/x/sys/windows.SecurityDescriptorFromString(0x4ebfb0, 0x2, 0x0, 0x0, 0x0)

Change-Id: I7eb9c07e7afb7f139473b660f82a23541663ec50
Reviewed-on: https://go-review.googlesource.com/c/sys/+/306889
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
2021-04-02 19:21:33 +00:00
Tobias Klauser
43e1dd70ce unix: add ICMP6_FILTER on solaris
Also add IP_RECVTOS and O_DIRECT which were generated when running
mkall.sh on SunOS openindiana 5.11.

The change in mkerrors.h is necessary to avoid lots of unnecessary
ICMP6_* consts being added on solaris.

Change-Id: Ica9a4b67f2d2d7916e65bcb600a5b2fa98edb80a
Reviewed-on: https://go-review.googlesource.com/c/sys/+/306249
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>
2021-03-31 17:51:45 +00:00
Tobias Klauser
4fbd30eecc unix: add MCAST_* consts on freebsd/arm
Change-Id: Iad1299fd440054c4522f0c7c96d2e0fb481685a6
Reviewed-on: https://go-review.googlesource.com/c/sys/+/305810
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>
2021-03-30 21:06:17 +00:00
Tobias Klauser
9b9b09a01a unix: add ICMP6_FILTER on zos
Copied from golang.org/x/net/ipv6. This will allow to replace the
socket option constants in that package with constants from x/sys/unix.

Change-Id: I92a6ee9ffb4fbfcc66f1644b7677ac5bdf202367
Reviewed-on: https://go-review.googlesource.com/c/sys/+/305811
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>
2021-03-30 21:06:03 +00:00
Tobias Klauser
49726bf1d1 unix: add ICMPV6_FILTER_* consts on linux
Change-Id: If626dab3c708d78768ae593b7b3f8bff280ee641
Reviewed-on: https://go-review.googlesource.com/c/sys/+/305049
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>
2021-03-26 22:08:04 +00:00
Tobias Klauser
47abb65194 unix: add RFC3542 IPv6 socket option constants on darwin
Change-Id: I7056c1d8805c080e50d832b5d6a3e3323f692525
Reviewed-on: https://go-review.googlesource.com/c/sys/+/303929
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>
2021-03-24 05:16:08 +00:00
Tobias Klauser
1e4c9ba3b0 unix: add ICMP_FILTER constant on linux
Change-Id: I9ce0932c28ae8634270d69b0bd23216e963cc105
Reviewed-on: https://go-review.googlesource.com/c/sys/+/303369
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>
2021-03-20 14:08:29 +00:00
Nahum Shalman
635bc2c913 unix: add Getmsg and Putmsg on illumos
Change-Id: Id1f2a2797e56a45584f70ee5e9202647a595a031
Reviewed-on: https://go-review.googlesource.com/c/sys/+/302830
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Trust: Ian Lance Taylor <iant@golang.org>
2021-03-19 07:12:55 +00:00
Nahum Shalman
193893d61a unix: expose ioctl returns with ioctlRet on solaris and illumos
Change-Id: Ide2beea5182b3ef35f1f04f429dc8f9327457c8d
Reviewed-on: https://go-review.googlesource.com/c/sys/+/302829
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: David Anderson <dave@natulte.net>
Trust: Ian Lance Taylor <iant@golang.org>
2021-03-19 07:07:19 +00:00
Hanlin He
c4fcb01b22 unix: fix setsockopt syscall arguments on linux/s390x
Pass vallen to setsockopt syscall.

Change-Id: Ibf5b2d8c1d48ac0966631f648de6d043feb53cc4
GitHub-Last-Rev: 70805e15eb
GitHub-Pull-Request: golang/sys#99
Reviewed-on: https://go-review.googlesource.com/c/sys/+/297969
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Trust: Ian Lance Taylor <iant@golang.org>
2021-03-17 22:57:23 +00:00
Nahum Shalman
390168757d unix: create types_illumos.go
create a new types_illumos.go for illumos specific constants
and structs, bring in those needed for wireguard-go

Change-Id: I68117abcae66127b617faea1f4cc2568b8b28d58
GitHub-Last-Rev: 3003e04e7e
GitHub-Pull-Request: golang/sys#100
Reviewed-on: https://go-review.googlesource.com/c/sys/+/301713
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2021-03-17 09:18:45 +00:00
Tobias Klauser
77fc1eacc6 unix: unify Syscall{,6,9} and RawSyscall{,6} on BSD
These all just jump to the respective implementation in package syscall.

Change-Id: Ie1c0438d983c8d78dc780487bb866760460f1ce1
Reviewed-on: https://go-review.googlesource.com/c/sys/+/301490
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-03-16 16:44:54 +00:00
Tobias Klauser
0b90fd5c4c unix/linux: update Dockerfile to Go 1.16.2
Change-Id: I263e0ed034ded3ef8cf9bd9745d9095067cc3a25
Reviewed-on: https://go-review.googlesource.com/c/sys/+/301689
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>
2021-03-16 09:29:37 +00:00
Tobias Klauser
c6e025ad80 windows: add IP_HDRINCL, IP_PKTINFO, IPV6_PKTINFO
These will be used to replace the respective local definitions in
the golang.org/x/net package.

Change-Id: Ieae8908a87ee7df1ca43683e7e921128bff90b8d
Reviewed-on: https://go-review.googlesource.com/c/sys/+/301690
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>
2021-03-15 16:08:23 +00:00
Yaroslav Vorobiov
07df6a1414 unix: fix -d=checkptr slice failures on aix
Fix unsafe conversions to slices that are missing length or capacity.

Change-Id: I3a1f4d57e0884b647b4c3819ff014d09b87a1ce5
GitHub-Last-Rev: 9b6895a08d
GitHub-Pull-Request: golang/sys#66
Reviewed-on: https://go-review.googlesource.com/c/sys/+/225617
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Trust: Ian Lance Taylor <iant@golang.org>
2021-03-14 19:57:30 +00:00
Matt Layher
bd2e13477e unix: add NLMSGERR constants for netlink extended acknowledgement
Change-Id: I8d23fc227d1f61b823abcf610479005356c52088
Reviewed-on: https://go-review.googlesource.com/c/sys/+/286072
Trust: Matt Layher <mdlayher@gmail.com>
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2021-03-13 20:20:42 +00:00
Kir Kolyshkin
8e9fff1a3a unix: add CloseRange
The close_range(2) syscall is available since Linux kernel v5.9,
with additional functionality of CLOSE_RANGE_CLOEXEC since v5.11.

No tests are required since this is a bare syscall.

Change-Id: I410470e3713e2005cc7acf24d1347938fe05ef63
Reviewed-on: https://go-review.googlesource.com/c/sys/+/301409
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
2021-03-13 11:07:37 +00:00
Tobias Klauser
68d13333fa unix: add //go:build lines when generating files
The //+go:build lines were added by running Go 1.17 gofmt in CL 294490.
Make sure to retain them when re-generating files in this package.

For golang/go#41184.

Change-Id: Ia418b8c0eb4291a0db3f4bb97685bde78d0ff016
Reviewed-on: https://go-review.googlesource.com/c/sys/+/296889
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>
2021-03-09 07:47:19 +00:00
Jason A. Donenfeld
94ec62e081 windows: add SetNamedPipeHandleState
I added GetNamedPipeHandleState before but forgot the setter function,
which winds up being useful for namedpipe's tests.

Change-Id: Iefeabb2ac9584ec15e18e2ae7e4a72fbb46cbe7c
Reviewed-on: https://go-review.googlesource.com/c/sys/+/299209
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>
2021-03-09 04:02:21 +00:00
Tobias Klauser
88b6017d06 unix: don't fail TestPoll on EINTR from Poll
Occassionaly TestPoll fails on some builders due to Poll getting
interrupted:

--- FAIL: TestPoll (0.00s)
    syscall_unix_test.go:516: Poll: unexpected error: interrupted system call
FAIL
FAIL	golang.org/x/sys/unix	0.956s

Fix this by retrying Poll in case of EINTR, same as CL 207861 did in
TestSelect.

Change-Id: I78ada14d7409e6cde852d76abd5a9a1b1bb645d2
Reviewed-on: https://go-review.googlesource.com/c/sys/+/298189
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Trust: Matt Layher <mdlayher@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2021-03-08 17:07:21 +00:00
Jason A. Donenfeld
8fe3ee5dd7 windows: return ERROR_ALREADY_EXIST for non-nil handle in Create* functions
These functions sometimes return a non-nil value, while indicating
ERROR_ALREADY_EXISTS through GetLastError. In this case, return the
error along with the handle, to indicate the case.

Fixes golang/go#44539.

Change-Id: Id18e64724e57f62a34d6562511d9eafa8e6f9a3e
Reviewed-on: https://go-review.googlesource.com/c/sys/+/297332
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2021-03-05 23:01:14 +00:00
Jason A. Donenfeld
5cdee2b1b5 windows: correct NT definitions and add more resolution
Alex pointed out that some of these original types were incomplete, so
this commit fills things out a bit more. We also add more to the test
case.

Change-Id: Iff7bd9ea6e0d021ba997c6d7351fe7c4a46187a9
Reviewed-on: https://go-review.googlesource.com/c/sys/+/299189
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>
2021-03-05 21:54:15 +00:00
Alex Brainman
d6cf4ab887 windows/svc: use ioutil.WriteFile instead of os.WriteFile
os.WriteFile is not available on Go 1.15. But we still need to
support Go 1.15.

Fixes broken Go 1.15 build

https://build.golang.org/log/07b89b007d0aca2e97bc01cdf4c6a1d90e6732f9

Change-Id: I18433985ec82477160058ef96c160345304ba1ad
Reviewed-on: https://go-review.googlesource.com/c/sys/+/299309
Trust: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2021-03-05 21:05:45 +00:00
Jason A. Donenfeld
7844c3c200 windows/svc: rewrite IsWindowsService
Alex copied this from a temporary thing I had written for the runtime
package. In runtime, you can't really access other packages like
syscall, so everything has to be very manual. But in x/sys, we can do
things properly. So this reimplements the function in a more straight
forward way.

Change-Id: I1634904bb1e10f33252954ce02d4b17ae56592e5
Reviewed-on: https://go-review.googlesource.com/c/sys/+/298830
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>
2021-03-05 03:40:16 +00:00
Jason A. Donenfeld
61f932b4c6 windows: add QueryFullProcessImageName
This will be useful for reworking the IsWindowsService function in
svc/.

Change-Id: Ie1f7a560d7e81ee4ac3055e04748b6f9c8234edb
Reviewed-on: https://go-review.googlesource.com/c/sys/+/298829
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2021-03-05 03:01:59 +00:00
Jason A. Donenfeld
0d6cb8bd5a windows: add ole32 instantiation functions
These are basic functions for getting function pointers to instantiated
OLE objects.

Change-Id: I5a3d179d6da2af006b6e11def18280959bb9bd98
Reviewed-on: https://go-review.googlesource.com/c/sys/+/298469
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>
2021-03-05 02:34:07 +00:00
Jason A. Donenfeld
f9bc61c02a windows: add resource extraction functions
These functions make it possible to read executable resource information
at runtime.

Change-Id: I00f260199ecda8daeb3417eaa9c02198663063b7
Reviewed-on: https://go-review.googlesource.com/c/sys/+/298173
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Trust: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-03-05 02:33:59 +00:00
Jason A. Donenfeld
7b4935edff windows: add pipe creation win32 APIs
These remaining APIs will make it possible to implement a win32 pipe
library using x/sys/windows.

Change-Id: If0cacedb7857c013c03e15cb6330b474cc010581
Reviewed-on: https://go-review.googlesource.com/c/sys/+/298172
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>
2021-03-04 20:38:40 +00:00
Jason A. Donenfeld
1243437a8e windows: add various NT APIs
In anticipation of the next commit which adds win32 pipe APIs, add some
of the foundational NT APIs for that, which will be required for making
a robust Go pipe library. Also add a simple test case.

Change-Id: I898bd6c5265a8939a7f05a24c4d9b22941dc56b7
Reviewed-on: https://go-review.googlesource.com/c/sys/+/298171
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>
2021-03-04 20:34:36 +00:00
Jason A. Donenfeld
444254391f windows: treat proc thread attribute lists as unsafe.Pointers
It turns out that the proc thread update function doesn't actually
allocate new memory for its arguments and instead just copies the
pointer values into the preallocated memory. Since we were allocating
that memory as []byte, the garbage collector didn't scan it for pointers
to Go allocations and freed them. We _could_ fix this by requiring that
all users of this use runtime.KeepAlive for everything they pass to the
update function, but that seems harder than necessary. Instead, we can
just do the allocation as []unsafe.Pointer, which means the GC can
operate as intended and not free these from beneath our feet. In order
to ensure this remains true, we also add a test for this.

Updates golang/go#44662.

Change-Id: Iaa8b694a6682cc1876879632c7ba068e47b8666d
Reviewed-on: https://go-review.googlesource.com/c/sys/+/297331
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-03-04 19:59:27 +00:00