Commit Graph

1198 Commits

Author SHA1 Message Date
Tobias Klauser
7dc0b73dc9 unix: add SO_ORIGINAL_DST on linux
Change-Id: I243a05696e061f0f0e558518c8af596364aa3668
Reviewed-on: https://go-review.googlesource.com/c/sys/+/331609
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>
2021-06-29 17:03:31 +00:00
Ed Schouten
59db8d763f unix: add bindings for kinfo_proc on Darwin
On Linux, we can extract a list of all the processes on the system by
calling readdir() against /proc. On BSD-like systems, this information
needs to be extracted from sysctl in the form of kinfo_proc structures.

This change adds bindings for this structure and adds a method for
reading an array of these structures from sysctl.

Change-Id: Iaaed27cdbbf13d7c2cc6a6787667ac04d65bf41c
GitHub-Last-Rev: 34926f8474
GitHub-Pull-Request: golang/sys#111
Reviewed-on: https://go-review.googlesource.com/c/sys/+/328169
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>
2021-06-16 09:43:52 +00:00
Ed Schouten
e2b7044e8c unix: add SEEK_* constants on Darwin, FreeBSD, Linux
The Go "os" package already provides bindings for SEEK_CUR, SEEK_SET and
SEEK_END. Most operating systems also support SEEK_HOLE and SEEK_DATA,
which you can use to skip sparse regions in a file. Let's add bindings,
so we can also do this from within Go.

Change-Id: If9243b05a8f563b4bce2452aa4bff145d9442cc2
GitHub-Last-Rev: ac8aed2d4a
GitHub-Pull-Request: golang/sys#112
Reviewed-on: https://go-review.googlesource.com/c/sys/+/328170
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>
2021-06-16 04:58:30 +00:00
Tobias Klauser
665e8c7367 unix/linux: update Dockerfile to Go 1.17beta1
Running `GOOS=linux GOARCH=amd64 ./mkall.sh` produces no changes, as
expected.

Change-Id: I09ec5243376fe76792d2b5e4984d8e2409dc7ce3
Reviewed-on: https://go-review.googlesource.com/c/sys/+/327729
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-06-15 03:50:16 +00:00
Tobias Klauser
a4fc739902 unix: add AT_EACCESS and AT_REMOVEDIR on netbsd
Change-Id: I1ef10228c858df6c3efe6c7543ce27f1c7984f8e
Reviewed-on: https://go-review.googlesource.com/c/sys/+/326429
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-06-11 08:36:46 +00:00
Tobias Klauser
1a9c977f74 unix: add AT_EACCESS on freebsd
Change-Id: Ic6ac2335d5f831682ea61fc3b1276abd0a72a6af
Reviewed-on: https://go-review.googlesource.com/c/sys/+/326431
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-06-11 08:36:32 +00:00
Tobias Klauser
9f1793e2e2 unix: add AT_REMOVEDIR, AT_EACCESS and AT_SYMLINK_FOLLOW on dragonfly
Change-Id: I2a3f4fb12ed3af1789af6115aecae62e61792549
Reviewed-on: https://go-review.googlesource.com/c/sys/+/326430
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-06-11 08:36:19 +00:00
Tobias Klauser
aa57babbf1 unix: add AT_REMOVEDIR and AT_EACCESS on openbsd
Fixes golang/go#46342

Change-Id: Ia7d516b9024fed276e51f9b6f0d27025b89f59db
Reviewed-on: https://go-review.googlesource.com/c/sys/+/325431
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-06-08 05:33:32 +00:00
Tom Thorogood
9665404d36 unix: support Linux NFC Subsystem
This adds the constants and types needed for the Linux NFC Subsystem.
It also adds support for sockaddr_nfc and sockaddr_nfc_llcp to Connect.

The Linux NFC Subsystem is documented in:
https://www.kernel.org/doc/html/latest/networking/nfc.html.

Change-Id: Ic6a79afdba85e9b154ec46f191f27714b4b38a57
Reviewed-on: https://go-review.googlesource.com/c/sys/+/323551
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>
2021-06-03 12:58:02 +00:00
Tom Thorogood
ebe580a85c unix: fix minor typos in README.md
Change-Id: Ibf1ce4330e196578c933784b51fff7f6670e2fa5
Reviewed-on: https://go-review.googlesource.com/c/sys/+/324449
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2021-06-03 08:11:09 +00:00
Jason A. Donenfeld
7ecdf8ef09 windows: change CreateProcessAsUser from kernel32 to advapi32
While kernel32.dll works as a target, the documentation says advapi32,
so go with that to be safe:

https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessasuserw

Change-Id: I8e4a3693dad3759c3a094fa2476b89fb3d38b6bd
Reviewed-on: https://go-review.googlesource.com/c/sys/+/323789
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>
2021-06-01 08:02:50 +00:00
lhl2617
47163c9f4e unix: add missing const (MTDFILEMODE) from <mtd/mtd-user.h>
CL 318211 added constants from <mtd/mtd-user.h>. The regex was
too strict and as a result MTDFILEMODE was not included.

This CL relaxes the regex so that MTDFILEMODE is included.

Fixes golang/go#46448

Change-Id: I2667d1690782cf8ce98b26cb6305e7386cbd0d46
Reviewed-on: https://go-review.googlesource.com/c/sys/+/323391
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>
2021-05-31 22:56:29 +00:00
Tobias Klauser
fdfd190a65 unix: remove darwin build tags from asm_bsd_{386,arm}.s
CL 316769 dropped support for darwin/386 and darwin/arm. Remove the
respective build tags from asm_bsd_{386,arm}.s as well.

Change-Id: Ic7c64446aaf80298c2ae893e2103c394ace2b01c
Reviewed-on: https://go-review.googlesource.com/c/sys/+/323389
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>
2021-05-31 08:08:01 +00:00
Jason A. Donenfeld
35b2ab0089 windows: add CreateProcessAsUser
The syscall package already has this, but this one does not, so add this
simple companion to CreateProcess.

Change-Id: I8533f91245630dcf39705ae56a22c1217871f968
Reviewed-on: https://go-review.googlesource.com/c/sys/+/322489
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Trust: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2021-05-25 14:32:21 +00:00
lhl2617
0cec03c779 unix: add consts and structs for <mtd/mtd-user.h>
It would be convenient to have MTD user space consts and structs
in the package.

Checked that the regexes in unix/mkerrors.sh are not too general,
and that all the defined constants in <mtd/mtd-user.h> are included
in the generated code.

Checked that all structs and enums added in unix/linux/types.go
are complete.

Fixes golang/go#46063
Change-Id: I190ac290f3f32a4f817cc7506df0dddb24d881b8
Reviewed-on: https://go-review.googlesource.com/c/sys/+/318211
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-05-21 20:33:32 +00:00
Jason A. Donenfeld
6ca3eb03df windows: use Go-managed pointer list for ProcThreadAttributeList
It turns out that if you write Go pointers to Go memory, the Go compiler
must be involved so that it generates various calls to the GC in the
process. Letting Windows write Go pointers to Go memory violated this.

We fix this by having all the Windows-managed memory be just a boring
[]byte blob. Then, in order to prevent the GC from prematurely cleaning
up the pointers referenced by that []byte blob, or in the future moving
memory and attempting to fix up pointers, we copy the data to the
Windows heap and then maintain a little array of pointers that have been
used. Every time the Update function is called with a new pointer, we
make a copy and append it to the list.  Then, on Delete, we free the
pointers from the Windows heap.

Updates golang/go#44900.

Change-Id: I42340a93fd9f6b8d10340634cf833fd4559a5f4f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/300369
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>
2021-05-21 09:01:06 +00:00
Jason A. Donenfeld
e8d321eab0 windows: add command line escaping wrappers around EscapeArg and CommandLineToArgv
DecomposeCommandLine makes CommandLineToArgv usable in an ordinary way.
There's actually a pure-Go version of this available as the private
os.commandLineToArgv function, which we could copy, but given this is
x/sys/windows, it seems best to stick to the actual Windows primitives
which will always remain current. Then, ComposeCommandLine is just a
simple wrapper around EscapeArg (which has no native win32 substitute).

Change-Id: Ia2c7ca2ded9e5713b281dade34639dfeacf1171c
Reviewed-on: https://go-review.googlesource.com/c/sys/+/319229
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>
2021-05-14 08:44:01 +00:00
Tobias Klauser
b0526f3d87 cpu: set PPC64.IsPOWER8 for Power9 on aix
This is in line with the behavior on linux.

Fixes golang/go#46040

Change-Id: I01ba1896d879425d12096ae67250d7e60beb7a99
Reviewed-on: https://go-review.googlesource.com/c/sys/+/318549
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Trust: Bryan C. Mills <bcmills@google.com>
Trust: Martin Möhrmann <moehrmann@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
2021-05-11 11:38:59 +00:00
Tobias Klauser
977fb72620 windows: add //go:build line to empty.s
Change-Id: I715846360d6f889c64b59348e3483ecf8a99f428
Reviewed-on: https://go-review.googlesource.com/c/sys/+/318212
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-05-10 12:01:38 +00:00
Cherry Mui
a76c4d0a00 unix: take address in assembly for Darwin syscall wrappers
In Go 1.17 we will introduce a register-based ABI on some
platforms, as well as ABI wrappers to bridge the ABIs. For Darwin
syscall wrappers, it needs to be called directly, instead of
through wrappers. Currently, it is written as that the syscall
functions are defined in assembly and their addresses are taken
from Go using funcPC. In Go 1.17 this will result in the address
of the ABI wrapper, which is undesired.

In the syscall package in the standard library we changed to use
a compiler intrinsic internal/abi.FuncPCABI0 to take the address
of the syscall function. But that is not available to this repo
and not available in older versions of Go. Here we take a
different approach: taking the address directly from assembly.
This also ensures we get the address of the defined syscall
function, not the ABI wrapper.

Updates golang/go#45702.

Change-Id: Ia7480d0fb0ca4fb9bf2f36d2deb1e3e5e4eb8284
Reviewed-on: https://go-review.googlesource.com/c/sys/+/317894
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
2021-05-07 16:14:34 +00:00
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