1651 Commits

Author SHA1 Message Date
Ian Lance Taylor
fe16172d11 unix: define IfMsghdr2, IfData64, and RtMsghdr2 on darwin
Change-Id: I6943f6b5bd9f7d0ef5bad24ed638b8cf5dd0353d
Reviewed-on: https://go-review.googlesource.com/c/sys/+/633077
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
v0.28.0
2024-12-03 18:44:20 +00:00
Mauri de Souza Meneguzzo
0a57dbcf35 unix: update to kernel Linux 6.12
Change-Id: I7c8157d5f1b597b6ae249b20866bbad918b46fa4
GitHub-Last-Rev: 0bbc2efbab
GitHub-Pull-Request: golang/sys#238
Reviewed-on: https://go-review.googlesource.com/c/sys/+/629075
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-11-18 19:38:36 +00:00
Tobias Klauser
3cf1e67d0c unix: don't fail TestPpoll on EINTR
TestPpoll sometimes fails builders due to Ppoll getting interrupted and
returning EINTR:

--- FAIL: TestPpoll (0.00s)
    syscall_linux_test.go:299: Ppoll: unexpected error: interrupted system call

Fix this by retrying Ppoll in case of EINTR, same as CL 298189 in
TestPoll.

Fixes golang/go#66324

Change-Id: I8ce4e2c00fe3b7a078cd75b4b15bb076d3a87fb2
Reviewed-on: https://go-review.googlesource.com/c/sys/+/627395
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-11-13 21:52:06 +00:00
MOHAN KUMAR R
d2cea7095f windows: add functions to get named pipe process IDs
Fixes https://github.com/golang/go/issues/70086

Change-Id: I0cd188f075490b1ea630b26b74aa201796d60d3a
GitHub-Last-Rev: 498fe730f2
GitHub-Pull-Request: golang/sys#235
Reviewed-on: https://go-review.googlesource.com/c/sys/+/626215
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-11-13 05:11:24 +00:00
MOHAN KUMAR R
a13946c675 windows: regenerate zsyscall_windows.go
Change-Id: I714d13f534520a444dd9601d280d32c4427a8e69
GitHub-Last-Rev: 861daf25d8
GitHub-Pull-Request: golang/sys#236
Reviewed-on: https://go-review.googlesource.com/c/sys/+/626379
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-11-12 17:28:48 +00:00
Quim Muntal
e0753d4694 Revert "windows/mkwinsyscall: use syscall.SyscallN instead of syscall.Syscall{6,9,12,15}"
This reverts CL 614082.

Reason for revert: syscall.SyscallN allocates more than its syscall.SyscallX counterparts, producing perf-related test failures across the board.

Updates #70197

Change-Id: I51107d909fcdbef4e65ee3f84932b2a0e7804f1b
Reviewed-on: https://go-review.googlesource.com/c/sys/+/625375
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
v0.27.0
2024-11-05 15:28:52 +00:00
database64128
c29efe38de windows: add iphlpapi functions for change notifications
The NotifyIpInterfaceChange and NotifyUnicastIpAddressChange functions
register a user-defined callback function for receiving network
interface and IP address change notifications. The GetIfEntry2Ex and
GetUnicastIpAddressEntry functions can be called to retrieve complete
information about the changed interface or address.

The CancelMibChangeNotify2 function deregisters for change
notifications.

Change-Id: Iee29405ffa135c6aa0120f9aa046e3706e2bac47
GitHub-Last-Rev: a8309cd81a
GitHub-Pull-Request: golang/sys#211
Reviewed-on: https://go-review.googlesource.com/c/sys/+/603755
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
2024-11-05 07:10:30 +00:00
Vaughn Iverson
8f2aa9fb48 cpu: conditionally re-enable AVX512 support on darwin/amd64
Darwin opmask clobbering bug was fixed in kernel version 21.3.0
as released in MacOS 12.2.0. This commit resolves issue by
checking for Darwin AVX512 support via a sysctl call with the
addition of a kernel minimum version check.

The kernel version check is completed without adding new
dependencies to x/sys/cpu. A sysctl call is accomplished by
copying a minimal amount of code from x/sys/unix, to retrieve
only the needed KERN_OSRELEASE value. This code is structured
in the same manner as an existing analogous AIX/PPC64 syscall.

The resulting dotted version string value is then parsed for
numeric comparison with a dependency free function.

All code in this contribution is structured to ease removal of
the special darwin/amd64 codepaths when that OS/arch combination
is eventually no longer supported by golang.

Resolves issue: golang/go#49233, reinstates fix for issue: golang/go#43089

Change-Id: I4755fc8b3865eb6562b0959ecc910e2c46ac6cb4
Reviewed-on: https://go-review.googlesource.com/c/sys/+/620256
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: vsivsi@yahoo.com <vsivsi@yahoo.com>
2024-11-04 23:17:32 +00:00
Ian Lance Taylor
054f1fcdf7 README: don't recommend go get
These days people will just import the packages and the go tool will
do the right thing. We don't need to explain it.

Add a pointer to the git repo, though.

For golang/go#62645

Change-Id: I94cd9c588a68d92c61d00be05740248509a2ae6e
Reviewed-on: https://go-review.googlesource.com/c/sys/+/624078
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-11-02 04:18:59 +00:00
Mac Malainey
ca0404159d unix: extend z/OS support
extend support for z/OS target by adding the following syscalls:
- Sendfile (library implementation)
- Fcntl
- MmapPtr
- MunmapPtr

Change-Id: I098748802c2b275c15758e9d0132fca0490e9b70
GitHub-Last-Rev: 5aafd0b757
GitHub-Pull-Request: golang/sys#223
Reviewed-on: https://go-review.googlesource.com/c/sys/+/620375
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bill O'Farrell <billotosyr@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-29 15:10:58 +00:00
Tobias Klauser
18e038c8ee unix: move NETLINK_* consts to own section
This makes it easier to distinguish them from the IFLA_* and add new
entries. Also refresh the IFLA_* consts while at it.

Change-Id: I94aa56c9f99d0714668d8150cb6185d57e2d789c
Reviewed-on: https://go-review.googlesource.com/c/sys/+/622515
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2024-10-28 15:03:49 +00:00
qmuntal
d045236a8d windows: implement Ftruncate using a single syscall on Windows
Ftruncate can be implemented on Windows using a single syscall. This
makes the implementation more efficient and less prone to races when
used in combination with other Seek calls.

Note that this is the x/sys counterpart for CL 618835.

Change-Id: Ie9be356bd953ccce85c0dd87a5dcc6ccf4fec464
Reviewed-on: https://go-review.googlesource.com/c/sys/+/621935
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Auto-Submit: Quim Muntal <quimmuntal@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
2024-10-28 14:49:53 +00:00
Dmitri Shuralyov
cff53d5a33 unix: gofmt after CL 610296
Also remove a few unhelpful blank lines.

Change-Id: I4001a25ec409406855b7800afd88738c43f60b90
Reviewed-on: https://go-review.googlesource.com/c/sys/+/621921
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
2024-10-25 18:35:15 +00:00
Joon Lee
123459f096 unix: update z/OS implementation of fcntl and mmap
- Add a wrapper function around fcntl to handle different operation
  types and new fcntl implementation that accepts uintptr as an arg.
- Add support for calling mmap/munmap with address pointers.
- Add accompanying tests for new functions.

Change-Id: If5e77aa4cf2cccfd431de4f3bd0c5014a761e167
GitHub-Last-Rev: 07e32a4ab7
GitHub-Pull-Request: golang/sys#216
Reviewed-on: https://go-review.googlesource.com/c/sys/+/610296
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Bypass: Dmitri Shuralyov <dmitshur@golang.org>
2024-10-25 15:27:13 +00:00
Tobias Klauser
df4a4da00c unix/linux: adjust Dockerfile ENV key value format
This fixes the following warnings emitted when running mkall.sh on
GOOS=linux with a recent Docker version:

 6 warnings found (use --debug to expand):
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 4)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 24)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 25)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 26)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 33)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 56)

Also see https://docs.docker.com/reference/build-checks/legacy-key-value-format/

Change-Id: Icdf05cbe7b8650fc2fec84e010c7401807f5f75f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/621956
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-10-24 15:42:44 +00:00
Tobias Klauser
696d3420cc unix: gofmt after CL 621375
Change-Id: Ibcd776913317d3b38b418190fa93c6eae52ffc0d
Reviewed-on: https://go-review.googlesource.com/c/sys/+/621955
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-10-24 15:37:41 +00:00
Yaroslav Kolomiiets
60d787735c unix: add PTP_PF_* constants on Linux
These represent valid values for PtpPinDesc.Func.
They are defined as enum, thus not emitted from mkerrors.sh.

Change-Id: Ibac22d56214fa0f64a4095dfc000692a5e5e994a
GitHub-Last-Rev: e7990b0882
GitHub-Pull-Request: golang/sys#229
Reviewed-on: https://go-review.googlesource.com/c/sys/+/621735
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-10-23 15:19:30 +00:00
Yaroslav Kolomiiets
256d1dfe8f unix: add PTP IOCTLs on Linux
The IOCTLs are used for interacting with PTP-specific functions of NIC and time card drivers.

Description:
https://netdevconf.info/0x18/docs/netdev-0x18-paper39-talk-slides/netdev-intro-ptp-api.pdf

Change-Id: If50d605958e5cee451146cf68cc95a3704917512
GitHub-Last-Rev: 44fac1cb1a
GitHub-Pull-Request: golang/sys#225
Reviewed-on: https://go-review.googlesource.com/c/sys/+/621375
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-10-21 18:42:12 +00:00
mertakman
adbb8bbcaf windows/mkwinsyscall: use syscall.SyscallN instead of syscall.Syscall{6,9,12,15}
Replace syscall.Syscall6, Syscall9, Syscall12, and Syscall15 with syscall.SyscallN for Go 1.18+. This simplifies system calls by allowing the exact number of arguments needed, eliminating zero padding and reducing potential errors.

Updated TestSyscallXGeneration to TestSyscallNGeneration to verify correct SyscallN generation for different argument counts.

Change-Id: Icd6662b591d7548e367b88f34243f5529e177eab
GitHub-Last-Rev: c06fca1aa4
GitHub-Pull-Request: golang/sys#219
Reviewed-on: https://go-review.googlesource.com/c/sys/+/614082
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
2024-10-21 13:42:39 +00:00
Yaroslav Kolomiiets
a57fdb8507 unix: add IoctlGetHwTstamp/IoctlGetHwTstamp on Linux
Add the ioctls to get/set the hardware timestamping configuration
(SIOCSHWTSTAMP and SIOCGHWTSTAMP) along with relevant symbols.

The usage is described in
https://www.kernel.org/doc/Documentation/networking/timestamping.txt

Change-Id: Ib7509feaf28218aeae497eff9ca6c0a532aa73c0
GitHub-Last-Rev: 47dc9dfec2
GitHub-Pull-Request: golang/sys#224
Reviewed-on: https://go-review.googlesource.com/c/sys/+/620376
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-10-16 17:41:25 +00:00
Guoqi Chen
3932916d5c unix: switch to Ubuntu 24.10 in Dockerfile
ubuntu 24.04 introduced support for qemu-loongarch64, and ubuntu 24.10
introduced support for the cross-compiler gcc-loongarch64-linux-gnu, so
we can temporarily switch to ubuntu 24.10 to discard the extra links
introduced by loong64 and switch to it when the next ubuntu LTS version
is released.

Change-Id: I96de123df0cf50d6ba0331eeb02fc1e8c48ce304
Reviewed-on: https://go-review.googlesource.com/c/sys/+/618075
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-10-14 16:58:48 +00:00
cuishuang
2dfefb6832 all: execute gofmt
Change-Id: I55aef760145df773be30d567c9e989f46a3e79dc
Reviewed-on: https://go-review.googlesource.com/c/sys/+/618898
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2024-10-11 18:38:43 +00:00
Yaroslav Kolomiiets
e5eee7e480 unix: add IoctlGetEthtoolTsInfo on Linux
The function fetches ethtool timestamping and PHC association for a
network interface. Its primary usage is to query the mapping between
the interface and its corresponding PTP clock number in /dev/ptp𝑛.

Change-Id: Id09466b3b43056c628593d4d2e05d77ec8d8082b
GitHub-Last-Rev: 3743a3a650
GitHub-Pull-Request: golang/sys#222
Reviewed-on: https://go-review.googlesource.com/c/sys/+/619335
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
2024-10-11 16:50:38 +00:00
Yaroslav Kolomiiets
fe162bad74 unix: add ClockSettime on Linux
The syscall clock_settime(3) is used to set the time on the specified
clock. It is a counterpart to clock_gettime(3) which is already
exposed as ClockGettime here.

Fixes golang/go#69830

Change-Id: I6145c915754f31e3c50f6a11568eb9d5ba12a778
GitHub-Last-Rev: 5b15f129cc
GitHub-Pull-Request: golang/sys#221
Reviewed-on: https://go-review.googlesource.com/c/sys/+/619255
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-10 19:53:43 +00:00
qmuntal
7143f4a4e1 windows: manually initialize NewNTUnicodeString
The `RtlInitUnicodeString` syscall can be avoided by manually
initializing the `NTUnicodeString`.

The process is described in [WdmlibRtlInitUnicodeStringEx](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdmsec/nf-wdmsec-wdmlibrtlinitunicodestringex).

The less syscalls, the better. It also makes the function faster:

```
goos: windows
goarch: amd64
pkg: golang.org/x/sys/windows
cpu: Intel(R) Core(TM) i7-10850H CPU @ 2.70GHz
                      │    old.txt    │               new.txt                │
                      │    sec/op     │    sec/op     vs base                │
NewNTUnicodeString-12   181.05n ± 15%   96.32n ± 11%  -46.80% (p=0.000 n=10)
```

Change-Id: Iaf079acdcc2024cdca6b6b649a711f6be99c5b87
Reviewed-on: https://go-review.googlesource.com/c/sys/+/618175
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-10-07 19:17:02 +00:00
Mateusz Poliwczak
23b0dabe63 unix: mark vgetrandom as non-escaping
For golang/go#69577

Change-Id: Id1942d252c813126aa2f110e3f426714db73b9c7
GitHub-Last-Rev: 10e6a30b78
GitHub-Pull-Request: golang/sys#220
Reviewed-on: https://go-review.googlesource.com/c/sys/+/616795
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Jason Donenfeld <Jason@zx2c4.com>
v0.26.0
2024-10-01 18:16:15 +00:00
John Troy
cbf0eb65e7 unix: fix grep syntax to work on non-GNU greps
CL 432835 changed two grep commands in unix/mkerrors.sh in such a way
that is incompatible with AIX's grep, which, unlike GNU grep, does not
support extended regular expressions without the -E flag. The intent of
this PR is to restore the egrep behavior by invoking grep as grep -E.
My assumption is that GNU grep is not meant to be a requirement to run
mkerrors.sh, and given that, grep -E looks like the most cross-platform
approach.

Example of current (incorrect) behavior on AIX:

bash-5.2$ printf 'SIGHUP\nSIGMAX64\nSIGTERM' | grep -v 'SIGSTKSIZE\|SIGSTKSZ\|SIGRT\|SIGMAX64'
SIGHUP
SIGMAX64
SIGTERM

Behavior before CL 432835:

bash-5.2$ printf 'SIGHUP\nSIGMAX64\nSIGTERM' | egrep -v '(SIGSTKSIZE|SIGSTKSZ|SIGRT|SIGMAX64)'
SIGHUP
SIGTERM

Behavior of proposed change:

bash-5.2$ printf 'SIGHUP\nSIGMAX64\nSIGTERM' | grep -E -v '(SIGSTKSIZE|SIGSTKSZ|SIGRT|SIGMAX64)'
SIGHUP
SIGTERM

OpenBSD's grep behaves the same as AIX for the above commands, which is
why I cast this as GNU vs. non-GNU. I haven't tested any other
implementations.

Fixes golang/go#69365

Change-Id: I009353ee630463475a5c131d019f59c5e69efd34
GitHub-Last-Rev: e1166046e1
GitHub-Pull-Request: golang/sys#217
Reviewed-on: https://go-review.googlesource.com/c/sys/+/615755
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-09-30 12:38:50 +00:00
Mauri de Souza Meneguzzo
e7397b9a65 unix: update to Linux 6.11
Change-Id: I1cc777822da1b557e69634faade8e24d06c00ce8
GitHub-Last-Rev: d09238ecd0
GitHub-Pull-Request: golang/sys#218
Reviewed-on: https://go-review.googlesource.com/c/sys/+/613855
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2024-09-30 12:37:56 +00:00
Jason A. Donenfeld
981de40f5c unix: use vDSO for getrandom() on linux
With CL 614835 adding support in the runtime for calling into the
getrandom() vDSO function, wire up x/sys/unix's Getrandom() function to
it, so that callers can benefit from the increased speed and shared
vDSO state with the runtime.

Updates golang/go#69577.

Change-Id: I17734409982c51bb984a6337f4ffa8f60414ebee
Reviewed-on: https://go-review.googlesource.com/c/sys/+/615335
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-28 01:26:00 +00:00
Leo Antunes
48aad76ed3 linux: add tcp_cc_info and its related types
Add the ability to retrieve congestion control information from a socket via TCP_CC_INFO.

Fixes golang/go#68232

Change-Id: I2ea15928ec0e3192b670759bab4b659e62be553b
GitHub-Last-Rev: b8b8c44f1f
GitHub-Pull-Request: golang/sys#200
Reviewed-on: https://go-review.googlesource.com/c/sys/+/595676
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-09-17 15:50:50 +00:00
cuishuang
d58f986c89 all: fix some typos in comment
Change-Id: I40f9866661bad30ee2f4be2e9d0beee54db860b3
Reviewed-on: https://go-review.googlesource.com/c/sys/+/611775
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-09 19:33:19 +00:00
Tobias Klauser
30de3524c2 unix: fix Test{Fd,}Xattr failure on NetBSD
On NetBSD the namespace of an xattr is stored separately from the name
and isn't returned by Listxattr and Flistxattr. Like on FreeBSD, strip
the namespace before checking the returned xattrs.

Fixes golang/go#69313
Fixes golang/go#69314

Change-Id: I7f2393cc63f9860332c0e07a51f3b9d32911e892
Cq-Include-Trybots: luci.golang.try:x_sys-gotip-netbsd-arm64
Reviewed-on: https://go-review.googlesource.com/c/sys/+/611695
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-09-09 01:37:35 +00:00
Dmitri Shuralyov
68ed59b20b windows/svc: fix printf(var) mistake detected by latest printf checker
For golang/go#69267.

Change-Id: Ie240b5c826bb96c0e2021a7e99a3c0f973f0a0e1
Reviewed-on: https://go-review.googlesource.com/c/sys/+/610940
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-09-06 16:31:18 +00:00
Tobias Klauser
c08bc6e187 unix: update Go to 1.23.0
Change-Id: Ifd0f3aefd3699871fc875c8628aa4105b2c85f13
Reviewed-on: https://go-review.googlesource.com/c/sys/+/610016
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-09-06 13:14:59 +00:00
James Tucker
a43b625d3c windows: add SIO_UDP_NETRESET constant
In order to get BSD like behavior with regard to ICMP, it is necessary
to set SIO_UDP_NETRESET as well as SIO_UDP_CONNRESET.

Updates golang/go#68614

Change-Id: Ibdf5b6ea6bc08a9d3a0aeac9037864670cf765c0
Reviewed-on: https://go-review.googlesource.com/c/sys/+/609295
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Funda Secgin <fundasecgin38@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
v0.25.0
2024-09-04 13:19:09 +00:00
Ayman Bagabas
ed67b1566a windows: add console codepage api
Add setter/getter for console input/output codepages. This is useful to set the console expected codepage instead of converting it to UTF-16 before writing.

Change-Id: Ie0465708e7cf68d776e23dbbeeca7bcb4db7d2bf
GitHub-Last-Rev: 93c06e27a0
GitHub-Pull-Request: golang/sys#206
Reviewed-on: https://go-review.googlesource.com/c/sys/+/599395
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
2024-08-28 07:55:29 +00:00
Ian Lance Taylor
9cb830b23e unix: add missing import to syscall_hurd.go
CL 471119 added a reference to the unsafe package,
but didn't add the import.

Change-Id: Ibb8097df0444d8e83ba08e4ca2b5df98844fccf4
Reviewed-on: https://go-review.googlesource.com/c/sys/+/607976
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-08-23 19:08:35 +00:00
Eli Lindsey
71132f5fbd unix: add POLLRDHUP to FreeBSD
POLLRDHUP is a poll(2) event applicable to stream sockets that notifies
when a remote peer closes a connection.

Change-Id: I03a192426f89bbd08fb27dda2716ffb888043c92
Reviewed-on: https://go-review.googlesource.com/c/sys/+/607797
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-08-23 18:12:53 +00:00
Mark Ryan
3283fc3f61 cpu: add support for detecting RISC-V extensions
Add a RISCV64 variable to cpu that indicates both the presence
of RISC-V extensions and performance information about the underlying
RISC-V cores.  The variable is only populated with non false values on
Linux.  The detection code first attempts to use the riscv_hwprobe
syscall introduced in Linux 6.4, falling back to HWCAP if riscv_hwprobe
is not supported.  The patch can detect the C, V, Zba, Zbb and Zbs
extensions.  V, Zba, Zbb and Zbs can only be detected on a 6.5 kernel
or later (without backports).

Updates golang/go#61416

Change-Id: I40f92724ee3d337c06bdc559ff0b18a8f6bfda9f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/605815
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Joel Sing <joel@sing.id.au>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
2024-08-23 10:43:34 +00:00
Ian Lance Taylor
29e55b2fd3 unix: use os.Executable rather than os.Args[0] in tests
Change-Id: I67a063d747c6e34dcd0292fdb3a9a0d965a6e133
Reviewed-on: https://go-review.googlesource.com/c/sys/+/607875
Commit-Queue: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-08-22 21:01:30 +00:00
Ian Lance Taylor
a8c5219b5e unix: rename XDPUmemReg field back to Size
When the Linux-specific XDPUmemReg struct was originally added
(CL 136695) the only field with a prefix was chunk_size,
so cgo rewrote the field to Size. Later Linux added a tx_metadata_len
field, which caused cgo to to leave the chunk_size field as Chunk_size
(CL 577975).

However, existing code, specifically gvisor, refers to the field
as Size. So go back to Size so that existing code will continue
to work.

This does unfortunately mean that people who used the struct since CL
577975 in April, 2024 will have to adapt. There doesn't seem to be a
perfect solution here. But we've had Size since September, 2018,
so let's stick with that.

Change-Id: Ib11edfbf98ce3a9e1a909194f200a39ddfe6f8e0
Reviewed-on: https://go-review.googlesource.com/c/sys/+/607876
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2024-08-22 21:00:49 +00:00
database64128
59665e5b43 unix: add Connectx for darwin
connectx(2) can be used to initiate a connection with TCP Fast Open.

Change-Id: I113ee4dede7df1c01e16a0c07fec2b384b266cb0
GitHub-Last-Rev: 31665b9ad3
GitHub-Pull-Request: golang/sys#215
Reviewed-on: https://go-review.googlesource.com/c/sys/+/606155
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-08-20 16:08:27 +00:00
Joon Lee
a0c72efe2d unix: add f_flag member flags on z/OS
This change adds the constants `ST_RDONLY` and `ST_NOSUID` to a z/OS-specific file.

Change-Id: Ifb78124d93b60a10f10b8169d1bb73dce074e760
GitHub-Last-Rev: 952cf1bc7f
GitHub-Pull-Request: golang/sys#214
Reviewed-on: https://go-review.googlesource.com/c/sys/+/606877
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-08-19 21:41:29 +00:00
Meng Zhuo
c64c51db65 unix: update riscv64 hwprobe to Linux kernel 6.10
Change-Id: Ic74816df459b17302a3ba746060b49e987e5da5c
Reviewed-on: https://go-review.googlesource.com/c/sys/+/604435
Reviewed-by: Mark Ryan <markdryan@rivosinc.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-08-16 23:42:36 +00:00
Mauri de Souza Meneguzzo
da77c6b1d1 unix: sync minimum Linux Kernel version with requirements page
Change-Id: I306728f5bf19955177365fd9afcc4c8678b6f81f
GitHub-Last-Rev: cf6f9c7b19
GitHub-Pull-Request: golang/sys#213
Reviewed-on: https://go-review.googlesource.com/c/sys/+/604136
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-08-12 17:41:49 +00:00
Mauri de Souza Meneguzzo
914deed708 unix: add missing ETHTOOL_FLAG_ constants
Some constants were removed in CL 600516 that included changes for the
Linux kernel 6.10.

This kernel version moved C defines to an enum ethtool_header_flags that
was not picked up by the mkall.sh script.

For enums, there is a perl script that needs to be run manually, and the
output must be added by hand to the list of constants in unix/linux/types.go.

See https://elixir.bootlin.com/linux/v6.10.3/source/include/uapi/linux/ethtool_netlink.h#L120

Fixes golang/go#68761

Change-Id: Idb189886d257d0fe66a4e832757a469e17f86c34
GitHub-Last-Rev: 08b8ef571d
GitHub-Pull-Request: golang/sys#212
Reviewed-on: https://go-review.googlesource.com/c/sys/+/604098
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
v0.24.0
2024-08-07 23:18:19 +00:00
database64128
4c7077ec60 windows: add enums for IpAdapterUnicastAddress
These are for the enum fields in IpAdapterUnicastAddress.

Change-Id: Ibcb6ce674ab41a94dbe46d394f035208a94b6dae
GitHub-Last-Rev: 1837ff9c32
GitHub-Pull-Request: golang/sys#204
Reviewed-on: https://go-review.googlesource.com/c/sys/+/598895
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: David Chase <drchase@google.com>
2024-08-07 08:50:18 +00:00
Alex Brainman
29298aaa6a windows: delete TestGetKeyboardLayout
According to
https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getforegroundwindow
GetForegroundWindow can return nil in some circumstances. So
GetForegroundWindow cannot be used in the TestGetKeyboardLayout.
Just delete the test for now.

Fixes golang/go#68671

Change-Id: I7e05ac2f19b1a6310a3f7f690c6d02b0d1f5571e
Reviewed-on: https://go-review.googlesource.com/c/sys/+/602335
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ayman Bagabas <ayman.bagabas@gmail.com>
2024-08-05 20:31:40 +00:00
Joel Sing
aa1c4c8554 unix: provide Mount on openbsd
Note that Mount is already provided for both darwin and linux, with
differing signatures.

Change-Id: Iaddae1769e436aad5125b78e31b2d62d22e45b16
Reviewed-on: https://go-review.googlesource.com/c/sys/+/595735
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
v0.23.0
2024-08-03 07:06:10 +00:00
Mauri de Souza Meneguzzo
cde4660eb9 unix: add linux mseal system call
The mseal system call was added in Linux 6.10.

See https://lwn.net/Articles/954936.

Change-Id: Ic812a5d784effbc1f362045ffeb6f7e50ee5f8bb
GitHub-Last-Rev: de3924e954
GitHub-Pull-Request: golang/sys#209
Reviewed-on: https://go-review.googlesource.com/c/sys/+/600518
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
2024-07-29 14:24:59 +00:00