Commit Graph

1387 Commits

Author SHA1 Message Date
Pure White
20c2bfdbfe cpu: fix cpu cacheLineSize for arm64 darwin(a.k.a. M1)
The existing value for M1 is 64, which is the same as other arm64 cpus.
But the correct cacheLineSize for M1 should be 128, which can be
verified using the following command:

$ sysctl -a hw | grep cachelinesize
hw.cachelinesize: 128

Fixes golang/go#53075

Change-Id: I555716ed412cdc02941c8b1d9767952f7ad6678c
Reviewed-on: https://go-review.googlesource.com/c/sys/+/408614
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Joedian Reid <joedian@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
2022-08-23 22:43:34 +00:00
Abirdcfly
2296e01440 windows: remove duplicate words from comments
Change-Id: I94748559cc75c052ad3b70f7db4ec330b8a7226d
GitHub-Last-Rev: 43926d3c98
GitHub-Pull-Request: golang/sys#132
Reviewed-on: https://go-review.googlesource.com/c/sys/+/424474
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: hopehook <hopehook@qq.com>
Reviewed-by: hopehook <hopehook@qq.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-08-18 16:13:05 +00:00
Joel Sing
5a390386f1 unix: convert openbsd/arm to direct libc calls
The current code has continued to work on OpenBSD, since it has been using
syscall(2) via libc. However, the system call numbers are still hardcoded in
golang.org/x/sys/unix. Various system call changes have been made in OpenBSD,
resulting in changes to the system call numbers and arguments, which now
fail when this package is used.

Switch to calling various system calls directly via libc, rather than calling
via libc using syscall(2).

Updates golang/go#36435

Change-Id: If8e403f0fda7a8b68da71c1f4efba7785b14edf5
Reviewed-on: https://go-review.googlesource.com/c/sys/+/421800
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Joel Sing <joel@sing.id.au>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-08-17 07:08:43 +00:00
Joel Sing
fbc7d0a398 unix: convert openbsd/386 to direct libc calls
The current code has continued to work on OpenBSD, since it has been using
syscall(2) via libc. However, the system call numbers are still hardcoded in
golang.org/sys/unix. Various system call changes have been made in OpenBSD,
resulting in changes to the system call numbers and arguments, which now
fail when this package is used.

Switch to calling various system calls directly via libc, rather than calling
via libc using syscall(2).

Updates golang/go#36435

Change-Id: Ib42d5415ef35c7f7b9cbc55adaf7ca15973ab287
Reviewed-on: https://go-review.googlesource.com/c/sys/+/421798
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-08-11 17:12:46 +00:00
Joel Sing
5f8f0205e4 unix: convert openbsd/amd64 to direct libc calls
The current code has continued to work on OpenBSD, since it has been using
syscall(2) via libc. However, the system call numbers are still hardcoded in
golang.org/sys/unix. Various system call changes have been made in OpenBSD,
resulting in changes to the system call numbers and arguments, which now
fail when this package is used.

Switch to calling various system calls directly via libc, rather than calling
via libc using syscall(2).

Updates golang/go#36435

Change-Id: Iadd5734fd4a2421d758883293bd8a6759fc52ca7
Reviewed-on: https://go-review.googlesource.com/c/sys/+/421797
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-08-11 17:12:45 +00:00
Joel Sing
74508daebc unix: convert openbsd/arm64 to direct libc calls
The current code has continued to work on OpenBSD, since it has been using
syscall(2) via libc. However, the system call numbers are still hardcoded in
golang.org/sys/unix. Various system call changes have been made in OpenBSD,
resulting in changes to the system call numbers and arguments, which now
fail when this package is used.

Switch to calling various system calls directly via libc, rather than calling
via libc using syscall(2).

Updates golang/go#36435

Change-Id: I836a484b14e0a427ac565315e27f0de1e9a5d021
Reviewed-on: https://go-review.googlesource.com/c/sys/+/421796
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2022-08-11 17:12:43 +00:00
Joel Sing
1c4a2a72c6 unix: make mkasm_darwin.go usable with other operating systems
Rename mkasm_darwin.go to mkasm.go and pass the operating system as an
argument. This will allow mkasm to be used to generate assembly for
OpenBSD.

Updates golang/go#36435

Change-Id: I42f54f5c6edc3a18a156e0e8e3c38d07ecf26d0b
Reviewed-on: https://go-review.googlesource.com/c/sys/+/421795
Run-TryBot: Joel Sing <joel@sing.id.au>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-08-08 15:51:32 +00:00
Joel Sing
3d627bb497 cpu: implement CPU feature detection for openbsd/arm64
OpenBSD 7.1 onwards expose the aarch64 ISAR0 and ISAR1 registers via sysctl:

  $ sysctl machdep
  machdep.compatible=apple,j274
  machdep.id_aa64isar0=153421459058925856
  machdep.id_aa64isar1=1172796674562

Implement CPU feature detection for openbsd/arm64 based on this information.

Updates golang/go#31746

Change-Id: I6dc473d93ccff720582c05b75456de51269bc3e5
Reviewed-on: https://go-review.googlesource.com/c/sys/+/421799
Run-TryBot: Joel Sing <joel@sing.id.au>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-08-08 15:39:00 +00:00
Joel Sing
e9af53b607 unix: improve and simplify mkasm_darwin.go
Rather than reading in multiple files and concatenating into a string,
pass the list of file names to the function, which in turn can read and
process the list before generating output.

Use sort.Strings rather than handrolling a sort function. Nest errors
where applicable and add usage when run without sufficient arguments
(rather than panicing).

Change-Id: I179fd5a3b98ddbdb7b39fe7df87bc767a82598fa
Reviewed-on: https://go-review.googlesource.com/c/sys/+/421794
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Joel Sing <joel@sing.id.au>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2022-08-08 15:37:49 +00:00
Tobias Klauser
8e32c043e4 unix: add missing IFLA_* consts on linux
Add these based on uapi/linux/if_link.h as of Linux kernel 5.19.

Change-Id: I56be6e6178aad3d10194a45f774ccf307ed461b5
Reviewed-on: https://go-review.googlesource.com/c/sys/+/420694
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-08-04 21:44:06 +00:00
Clayton Townsend II
e052cef7d3 unix/linux: run each mkall.go target in a seperate goroutine
Each target within mkall.go is now within a seperate goroutine,
except for making headers which have artifacts in their respective
folders that overlap and conflict during their make target.

Fixes golang/go#54009

Change-Id: I04dad7ffdb772029e62a34a1197577c718b533e1
Reviewed-on: https://go-review.googlesource.com/c/sys/+/419517
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
2022-08-04 18:27:31 +00:00
Florian Lehner
6e608f9ce7 unix: update perf_event_attr_go
Fix issues when using PerfEventOpen() with PERF_ATTR_SIZE_VER6 or PERF_ATTR_SIZE_VER7
by updating struct perf_event_attr_go to include aux_sample_size and
sig_data.

Change-Id: I0192d59006ed6c67b19a448b797bf49894a24f72
Reviewed-on: https://go-review.googlesource.com/c/sys/+/420294
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2022-08-03 19:50:53 +00:00
Tobias Klauser
a90be44021 unix: fix sendmsgN return value for empty iovecs and non-empty oob
Don't shadow the empty var when determining whether to send a single
byte when iovecs are empty but oob is non-empty. This will lead to the
n value correctly being reset to 0 before return.

No test because it's not possible to trigger this case on all platforms,
e.g. darwin where sendmsg with empty buf and non-empty oob returns
EINVAL.

This was introduced by CL 412497 and CL 419396.

Updates golang/go#52885

Change-Id: Iafc5a4b22e10b396ba5f7d4f2ac1c50df195a125
Reviewed-on: https://go-review.googlesource.com/c/sys/+/419914
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Florian Lehner <lehner.florian86@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-07-31 17:44:39 +00:00
PumpkinSeed
66a0560e4e windows: support Windows SOCKADDR_BTH structure
Implements the Windows SOCKADDR_BTH structure so
it can be used as a parameter in windows.Connect.

Fixes: golang/go#53929
Change-Id: Ibe54071897b60ecd91f44c7c0c894d831e56fe56
Reviewed-on: https://go-review.googlesource.com/c/sys/+/419394
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2022-07-31 17:38:59 +00:00
awaw fumin
1609e554cd windows: add QueryWorkingSetEx
This change adds the QueryWorkingSetEx function for inspecting
the virtual memory details of pointers.

https://docs.microsoft.com/en-us/windows/win32/api/psapi/nf-psapi-queryworkingsetex

Change-Id: I2bc92bb0b65d34ed1caf88e4d368d64946dfcc5c
GitHub-Last-Rev: c5ac004352
GitHub-Pull-Request: golang/sys#124
Reviewed-on: https://go-review.googlesource.com/c/sys/+/402494
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-07-30 10:01:32 +00:00
Tobias Klauser
3c1f35247d unix: implement recvmsgRaw and sendmsgN on aix
This allows using RecvmsgBuffers and SendmsgBuffers on aix in x/net.

For golang/go#54099

Change-Id: Ib21c59244c9d74b826f4fc8ba3314e3602fd9a8a
Reviewed-on: https://go-review.googlesource.com/c/sys/+/419396
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-07-28 00:49:56 +00:00
Tobias Klauser
e65921a090 unix/linux: use Go 1.19rc2 instead of building gotip
CL 399336 added support for generating linux/loong64 types and constants
and CL 406794 switched it to use gotip after support for linux/loong64
was merged. The upcoming Go 1.19 release will support that platform, so
switch to use 1.19rc2.

Change-Id: Id3be69eb8f04bdf215f248df09bb5da9456494e7
Reviewed-on: https://go-review.googlesource.com/c/sys/+/419395
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-07-27 05:50:44 +00:00
Russ Cox
8c9f86f7a5 A+C: delete AUTHORS and CONTRIBUTORS
In 2009, Google's open-source lawyers asked us to create the AUTHORS
file to define "The Go Authors", and the CONTRIBUTORS file was in
keeping with open source best practices of the time.

Re-reviewing our repos now in 2022, the open-source lawyers are
comfortable with source control history taking the place of the
AUTHORS file, and most open source projects no longer maintain
CONTRIBUTORS files.

To ease maintenance, remove AUTHORS and CONTRIBUTORS from all repos.

For golang/go#53961.

Change-Id: Idc0002448db29c764256656d9ae3948ad7f1e6a0
Reviewed-on: https://go-review.googlesource.com/c/sys/+/418903
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: David Chase <drchase@google.com>
2022-07-22 15:52:57 +00:00
ianwoolf
c6bc011c0c unix: add socket constants
Fixes golang/go#53557

Change-Id: Ic3d57d9431d7c89f6650ff742888481bcabb23c6
Reviewed-on: https://go-review.googlesource.com/c/sys/+/417994
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-07-21 23:06:56 +00:00
Florian Lehner
c0bba94af5 unix: add constants for netlink/audit
Change-Id: Idaa02498b43360fa647d52423bc2f4c0cd5a9523
Reviewed-on: https://go-review.googlesource.com/c/sys/+/416754
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2022-07-15 15:14:00 +00:00
Meng Zhuo
0a85c31ab5 unix: add freebsd/riscv64 support
For golang/go#53466

Change-Id: If5a4dc674cb1856ac580fb87d8030d50fa7c95dd
Reviewed-on: https://go-review.googlesource.com/c/sys/+/416834
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Meng Zhuo <mzh@golangcn.org>
Reviewed-by: Yuval Pavel Zholkover <paulzhol@gmail.com>
Reviewed-by: Dmitri Goutnik <dgoutnik@gmail.com>
2022-07-12 01:45:10 +00:00
Meng Zhuo
5a0f0661e0 cpu: support non-linux OS for riscv64
Fixes golang/go#53698

Change-Id: Ia954aed4445a47fb8f8a2c0b9869aa8c50f2de15
Reviewed-on: https://go-review.googlesource.com/c/sys/+/416394
Auto-Submit: Meng Zhuo <mzh@golangcn.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Meng Zhuo <mzh@golangcn.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Joel Sing <joel@sing.id.au>
2022-07-08 08:52:39 +00:00
Yuval Pavel Zholkover
05e143d24a unix: regenerate on FreeBSD 12.3
Switch mksysnum to use https://cgit.freebsd.org/src/plain/sys/kern/syscalls.master?h=stable/12.
Also remove the SAL 2.0 annotations.

remove FreeBSD 11 and below 64bit inode compatibility shims

Drop the errors_freebsd_GOARCH.go files.

Drop PTRACE_* and additional (arch specific) consts added as part of golang.org/cl/179099 to types_freebsd.
Add <sys/ptrace.h> to mkerror.sh for FreeBSD instead.

Run mkall.sh on FreeBSD 12.3 on amd64 and arm64 hosts with i386 and armv7 jails
for all supported arches.

Updates golang/go#53280

Change-Id: Idd29056829013a1f6eb26376978632645e4018ef
Reviewed-on: https://go-review.googlesource.com/c/sys/+/415714
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2022-07-04 08:42:25 +00:00
Dan Kortschak
31831981b6 windows: add remaining IpAdapterAddresses fields
Change-Id: I373baee2c82c376f4718d9296ae19ba8a28a2693
Reviewed-on: https://go-review.googlesource.com/c/sys/+/415814
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Dan Kortschak <dan@kortschak.io>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-07-02 02:00:25 +00:00
Dan Kortschak
179beb0bd1 windows: add GetBestInterfaceEx
Change-Id: I56f9212420f96a0f275e79b4a9766b09b175254d
Reviewed-on: https://go-review.googlesource.com/c/sys/+/413495
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Dan Kortschak <dan@kortschak.io>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2022-07-01 22:57:01 +00:00
Joel Sing
f75cf1eec3 unix: provide Msghdr.SetIovlen on openbsd/mips64
Fixes golang/go#53575

Change-Id: Ie9bbe074f9adaf9c194e4458bbf2efb3acd8f110
Reviewed-on: https://go-review.googlesource.com/c/sys/+/414554
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: Joel Sing <joel@sing.id.au>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2022-06-27 19:12:45 +00:00
Ian Lance Taylor
87e55d7148 unix: add RecvmsgBuffers and SendmsgBuffers
Fixes golang/go#52885

Change-Id: I04b5be1ac9543a3791ebc4cd59b9e35e958e0ba2
Reviewed-on: https://go-review.googlesource.com/c/sys/+/412497
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-06-24 22:08:33 +00:00
Ian Lance Taylor
175b2fd9d6 unix: change Solaris Iovec.Base to *byte
Every other Iovec.Base field is *byte, and that is the only reasonable
value for Go. This is not backward compatible but we've made changes
like this before.

For golang/go#52885

Change-Id: I9a313a7931966a2483a322edd5c06c8cdca2557a
Reviewed-on: https://go-review.googlesource.com/c/sys/+/412496
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Alex Rakoczy <alex@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2022-06-22 16:19:53 +00:00
Tobias Klauser
4f61da869c unix: use ByteSliceToString in TestMountUnmount on zos
Use the existing ByteSliceToString implementation instead of duplicating
it in TestMountUnmount.

Change-Id: Ia47510ac1ac8094a7e9265edf8a452bcacf06032
Reviewed-on: https://go-review.googlesource.com/c/sys/+/411379
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2022-06-15 21:35:10 +00:00
Will Hawkins
ff8c426e75 unix: add support for TCP_CONNECTION_INFO on macOS
x/sys provides support for accessing TCP_INFO on Linux but does
not provide support for accessing the equivalent (TCP_CONNECTION_INFO)
on macOS. This patch adds that functionality.

Fixes golang/go#53330

Change-Id: Ia1c1bf79a8bbb76f3ccfe58c61e1a82e08735152
Reviewed-on: https://go-review.googlesource.com/c/sys/+/411734
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2022-06-15 21:25:26 +00:00
Tobias Klauser
bf31f56cad unix: add MemfdSecret on linux/riscv64
Now that SYS_MEMFD_SECRET is defined on linux/riscv64, CL 398514 can be
reverted to provide MemfdSecret on that platform as well.

Fixes golang/go#51547

Change-Id: I48e3e029fd2a3aeb860d69faf387bc10753759c7
Reviewed-on: https://go-review.googlesource.com/c/sys/+/411376
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-06-15 21:21:20 +00:00
Tobias Klauser
af78867b19 unix/linux: update to Linux kernel 5.19-rc2
Update to 5.19-rc2 instead of 5.18 for the following reasons:

- Support for LoongArch has been merged upstream. This allows to drop
  the loong64 specific kernel patches.
- Fixes [1] an issue encountered with when generating the
  SOCK_TXREHASH_DEFAULT constant from linux/socket.h on 5.18
- Contains a fix [2] to provide SYS_MEMFD_SECRET on linux/riscv64 as
  well, The underlying syscall was already available in earlier kernel
  versions. Also see golang/go#51547.

[1] https://lore.kernel.org/r/20220531094345.13801-1-tklauser@distanz.ch
[2] https://lore.kernel.org/r/20220505081815.22808-1-tklauser@distanz.ch

Change-Id: I6c3ec30a067eae339c443ee55962d94c84feffd9
Reviewed-on: https://go-review.googlesource.com/c/sys/+/411375
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2022-06-15 21:21:18 +00:00
Tobias Klauser
003f7fa1e2 unix: implement Fstat{,at} using Statx on linux/loong64
linux/loong64 doesn't provide the fstat and fstatat syscalls in the
upstream Linux kernel. Instead, solely the statx syscall is available.
Use it to implement Fstat and Fstatat.

This follows the implementation in package syscall.

Change-Id: I69eefc863a37bd76ef2ab1e7670d1724dc147aae
Reviewed-on: https://go-review.googlesource.com/c/sys/+/411378
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-06-15 21:19:32 +00:00
Guoqi Chen
6c1b26c550 unix: always zero the higher bits of return value on linux/loong64 syscalls
All loong64 syscalls return values only via R4/A0, and R5/A1 may contain
unrelated content. Always zero the second return value.

Change-Id: Ic889f33158c4e4999bd94bd768d1094e95bc6421
Reviewed-on: https://go-review.googlesource.com/c/sys/+/411634
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: David Chase <drchase@google.com>
2022-06-14 16:21:38 +00:00
Ian Lance Taylor
9f5ed59c13 cpu: use xgetbv intrinsic
Fixes golang/go#53302

Change-Id: I698ef44f90e2ec538ae4a057134c22c102a87ff8
Reviewed-on: https://go-review.googlesource.com/c/sys/+/411635
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-06-10 22:13:04 +00:00
Nahum Shalman
635b8c9b7f unix: add Getsid function on Solaris
Change-Id: I04446dc775a1d7f7c5f6184c389e5814dacb16eb
Reviewed-on: https://go-review.googlesource.com/c/sys/+/410370
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-06-08 16:42:50 +00:00
Kir Kolyshkin
bc2c85ada1 unix: update openbsd Statfs_t fields
This changes some fields of openbsd 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 (Darwin, FreeBSD, NetBSD),
and simplifies the conversion to Go string.

Similar changes: CL 359674, CL 259903, CL 74331.

Note that while this patches mkpost.go, the end result is obtained by
manual editing of ztypes_openbsd_*.go files. The reasons for this are:

1. automatic regeneration (tried on openbsd 6.9 / amd64) brings in way
   too many changes (5 files changed, 193 insertions, 45 deletions).

2. I could not figure out how to run openbsd on non-amd64.

Nevertheless, this change is sufficient, meaning if someone will
actually end up regenerating these (see e.g. CL 347649) after this
commit is merged, the fields will still be kept as arrays of byte.

Change-Id: I4520889f11f6ac2d9befe17c7a77186198c08cd2
Reviewed-on: https://go-review.googlesource.com/c/sys/+/407195
Run-TryBot: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: 谢致邦 <xiezhibang@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2022-05-20 15:13:02 +00:00
Tobias Klauser
f9599da83c unix: use ByteSliceToString in TestIoctlPtmget
Change-Id: I42cb5be80246af76cca9b6a09c6cb85bc07ab081
Reviewed-on: https://go-review.googlesource.com/c/sys/+/407254
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2022-05-20 15:11:50 +00:00
Kir Kolyshkin
dcacdad474 unix: use ByteSliceFromString in (*Ifreq).Name
CL 340370 introduced (*Ifreq).Name method which scans the Ifrn field
for \0 twice -- first explicitly, when by calling BytePtrToString.

It seems more straightforward to use ByteSliceToString instead. The
differences are:
 - simpler code;
 - no double scanning for \0;
 - in case there is no \0 in the Ifrn (unlikely), the full string
   (rather than an empty string) is now returned.

With the last item in mind, the test case with no \0 as input that
expects empty output fails, so drop it. Alternatively, we could test
that it returns the full string, but it will be essentially testing
ByteSliceToString, which is not the point.

Cc: Matt Layher <mdlayher@gmail.com>
Change-Id: I31d4f6dbe98aae5120f9b2246c93ceaa6a165395
Reviewed-on: https://go-review.googlesource.com/c/sys/+/407194
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
2022-05-19 14:10:25 +00:00
Tobias Klauser
5e4e11fc64 unix/linux: use gotip instead of patched Go 1.18
CL 399336 added support for generating linux/loong64 types and constants
by using a patched version of Go 1.18. The necessary changes have since
been submitted to gotip, so use Go build from the master branch to
generate types and consts.

The changes in the cgo -godefs generated comments are due to CL 396936,
also see go.dev/issue/52063

Change-Id: I314156675e79ba77b9eb1fa1845b20ca974ec77a
Reviewed-on: https://go-review.googlesource.com/c/sys/+/406794
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
2022-05-17 19:59:34 +00:00
Ed Schouten
45d2b4557a unix: add mount(2) for macOS
The 'data' argument of this method needs to point to a file system type
specific data structure. In the case of NFS (which I'm interested in
using), this needs to point to an XDR encoded message. The schema for
this message can be found here:

https://github.com/apple-oss-distributions/NFS/blob/main/mount_nfs/nfs_sys_prot.x

Change-Id: Ia49562ba6e8ab5d4c00eb961db6862fb1310b74e
GitHub-Last-Rev: 62c32df776
GitHub-Pull-Request: golang/sys#125
Reviewed-on: https://go-review.googlesource.com/c/sys/+/405494
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2022-05-13 21:02:49 +00:00
Bryan C. Mills
988cb79eb6 execabs: add legacy "//+build" constraints
Go releases before Go 1.17 are no longer supported, and Go 1.17
supports the newer "//go:build" syntax, so the older "//+build"
variation is no longer required by Go's support policy. However, the
x/sys module is very low-level and empirically some users are still on
unsupported Go releases, so there is little harm in adding the older
variations.

Fixes golang/go#52668.

Change-Id: Ieb8e64e450b9d795f2753fc5f99b36816a3dbff3
Reviewed-on: https://go-review.googlesource.com/c/sys/+/403695
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
2022-05-03 16:30:25 +00:00
Russ Cox
b6088ccd6c execabs: make safe for Go 1.19
To preserve the same errors that LookPath used to return,
LookPath needs to know to ignore the new Go 1.19 exec.ErrDot errors.

For golang/go#43724.

Change-Id: I8938813a1a4e14bf697f05879e3ab212611644da
Reviewed-on: https://go-review.googlesource.com/c/sys/+/403256
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-05-02 12:42:56 +00:00
Russ Cox
b5fbb4746d all: gofmt
Gofmt to update doc comments to the new formatting.

For golang/go#51082.

Change-Id: I9a1c4b671c06820a1c383ee515f7884965fefa54
Reviewed-on: https://go-review.googlesource.com/c/sys/+/399602
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
2022-04-29 23:34:32 +00:00
Aayush Agrawal
84afa8d3f7 windows: do not change stdio handle inheritance
This CL stops changing inheritance flag of stdint, stdout and stderr handles.

Fixes golang/go#52498

Change-Id: Ic786f660b457af99a0a975b357c35c36bc7f2b48
Reviewed-on: https://go-review.googlesource.com/c/sys/+/402714
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Peter Weinberger <pjw@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-04-29 12:10:18 +00:00
limeidan
9388b58f71 unix: add loong64 tag to endian_little.go
Updates golang/go#46229

Change-Id: I35b57e9158671b159a73b4eba4baa8bfebf2ce31
Reviewed-on: https://go-review.googlesource.com/c/sys/+/400774
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2022-04-22 01:37:27 +00:00
limeidan
88d2bb9c0c unix: add generate component files support for linux/loong64
Updates golang/go#46229

Change-Id: If0ee99997360608d7ba218880a1ef180ca6db551
Reviewed-on: https://go-review.googlesource.com/c/sys/+/399336
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
2022-04-22 01:37:25 +00:00
Damien Neil
33da011f77 unix: check correct group in Faccessat
The Faccessat call checks the user, group, or other permission bits of a
file to see if the calling process can access it. The test to see if the
group permissions should be used was made with the wrong group id, using
the process's group id rather than the file's group id. Fix this to use
the correct group id.

This change only affects Linux versions prior to 5.8. Linux 5.8 added
the faccessat2 system call, which we use in preference to the internal
implementation.

No test since we cannot easily change file permissions when not running
as root and the test is meaningless if running as root.

For golang/go#52313

Change-Id: I6fa64379a50c9380207eab9d095ef7fbd05a2d59
Reviewed-on: https://go-review.googlesource.com/c/sys/+/400074
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-04-12 21:12:40 +00:00
Alexey Perevalov
889880a91f unix: fsmount fspick fsopen linux syscall
Patches were submitted to Linux manpages:
https://lwn.net/Articles/802096/, but not yet applied.
Generated on linux kernel v5.16.

Fsconfig couldn't implemented by generator, it requires
special cases handling.

Change-Id: I7f9560f4bc5b4bbe1e00c63ce1bc25c781aa1293
Reviewed-on: https://go-review.googlesource.com/c/sys/+/398434
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
2022-04-12 07:17:39 +00:00
limeidan
83041a38b1 unix: provide linux/loong64 assembly for syscalls
Updates golang/go#46229

Change-Id: I0c0d9224312915fc3b86a0cd4abb344286449909
Reviewed-on: https://go-review.googlesource.com/c/sys/+/399335
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
2022-04-12 01:58:02 +00:00