Commit Graph

1225 Commits

Author SHA1 Message Date
Tobias Klauser
0a7ae4be8d unix: drop fallback to pipe in Pipe on linux/arm
Same as CL 347349 does for package syscall.

The minimum required Linux kernel version for Go 1.18 will be changed to
2.6.32, see golang/go#45964. The pipe2 syscall was added in 2.6.27, so
the fallback to use the pipe syscall in syscall.Pipe on linux/arm can
be removed.

For golang/go#45964

Change-Id: I8e222dc4b373b22f91bc1ddcc48f58a37dafcffa
Reviewed-on: https://go-review.googlesource.com/c/sys/+/347331
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-09-03 07:16:34 +00:00
Nahum Shalman
f475640dd0 unix: add more illumos Lifreq helpers
This work is in support of wireGuard/wireguard-go#39

Change-Id: Id205d28935b76b49ec6b29aba0a741659c5c01d7
Reviewed-on: https://go-review.googlesource.com/c/sys/+/345610
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Trust: Cherry Mui <cherryyz@google.com>
2021-09-02 05:02:50 +00:00
Tobias Klauser
164ac21ac1 unix: drop fallback to utimes in UtimesNano on Linux
Same as CL 346790 does for package syscall.

The minimum required Linux kernel version for Go 1.18 will be changed to
2.6.32, see golang/go#45964. The current minimum required version is
2.6.23 and utimensat was added in 2.6.22, so the fallback isn't even
necessary for the current minimum supported version. Remove the fallback
to utimes.

For golang/go#45964

Change-Id: Iaed782d182851c9ccff32f831e1704bae52662a6
Reviewed-on: https://go-review.googlesource.com/c/sys/+/346829
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: Brad Fitzpatrick <bradfitz@golang.org>
2021-09-02 05:02:39 +00:00
Tobias Klauser
f4d43177bf unix/linux: update Dockerfile to Kernel 5.14
Change-Id: Ie6b9521c70c0e91a507a923811f44f797b64e064
Reviewed-on: https://go-review.googlesource.com/c/sys/+/346029
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-08-31 04:25:30 +00:00
zhangyunhao
63515b42dc cpu: add support for detecting cmpxchg16b
Change-Id: I892de938e85205c0506aa82e31297b7a99e48e44
Reviewed-on: https://go-review.googlesource.com/c/sys/+/329450
Trust: Martin Möhrmann <martin@golang.org>
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Martin Möhrmann <martin@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Martin Möhrmann <martin@golang.org>
2021-08-23 07:06:55 +00:00
Matt Layher
41cdb8703e unix: add Ifreq.Inet4Addr methods for manipulating IPv4 addresses
ioctls such as SIOCGIFADDR deal with AF_INET sockaddr addresses, but none of
the fields aside from the embedded IPv4 address are used. To keep the interface
more simple, we directly expose Inet4Addr get and set methods which enable use
of these ioctls with the Ifreq wrapper.

Change-Id: Ia8b6ab9730f852cb99f4152e334a59d395476d2f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/343250
Trust: Matt Layher <mdlayher@gmail.com>
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2021-08-20 12:10:16 +00:00
Tobias Klauser
f52c844e1c unix: add RTF_GLOBAL on darwin
Fixes golang/go#45848

Change-Id: Iadd8499a66d5c5b7940df1477d88926f4b30cdb0
Reviewed-on: https://go-review.googlesource.com/c/sys/+/343509
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-08-19 13:52:13 +00:00
Mark Jeffery
bce67f0961 unix: add SetsockoptTCPRepairOpt on Linux
There is currently no function to allow for setting repair options for sockets in repair mode.
There are 4 options catered for in the linux implementation.

TCPOPT_WINDOW
TCPOPT_MAXSEG
TCPOPT_SACK_PERMITTED
TCPOPT_TIMESTAMP

Details of the patch to the kernel and the thinking behind it is here  https://lwn.net/Articles/495304

Work done in this commit
Included the tcp options type and length for inclusion in the Docker build
Added TCPOPT to the regular expression in mkerrors.sh. There was only TCP_ previously
Add the new function to syscall_unix.go

I have tested locally and verified each option with ss -i

I am not sure whether to commit tests because I don't know if socket creation is possible on the test runs in the offical pipeline.
I did check for existing tests but didn't see any that created sockets, only one that validated a string option.

Fixes golang/go#46984

Change-Id: Iade0434c05cebf2fbdfb5f04b2a7b51c8b358423
Reviewed-on: https://go-review.googlesource.com/c/sys/+/332709
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-08-19 07:21:35 +00:00
David Crawshaw
44f02d92fd windows: add WTSGetActiveConsoleSessionId
https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-wtsgetactiveconsolesessionid

Change-Id: I3c180bbb3a768beac6633e78514fac4e3837b69d
Reviewed-on: https://go-review.googlesource.com/c/sys/+/331909
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Trust: Jason A. Donenfeld <Jason@zx2c4.com>
Trust: Brad Fitzpatrick <bradfitz@golang.org>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-08-19 07:20:04 +00:00
Matt Layher
00dd8d7831 unix: gofmt with Go 1.17
Change-Id: I867e6e01c803fec1b5db464db0e88dfe5799cd43
Reviewed-on: https://go-review.googlesource.com/c/sys/+/343249
Trust: Matt Layher <mdlayher@gmail.com>
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2021-08-18 15:36:20 +00:00
Matt Layher
bfb29a6856 unix: export Ifreq and add IoctlIfreq function
This CL expands upon CL 340369 by exporting the Ifreq type along with methods
for setting and getting data to/from the ifreq union in a type-safe way.
ifreqData remains unexported as we can keep adding helpers similar to the
IoctlGetEthtoolDrvinfo to expose those operations in a less error-prone way.

A test is also added to verify interface index data using IoctlIfreq against
the modern rtnetlink API used by the standard library.

Change-Id: Ic6980cbcd3792cc341cd614061cce32fa1f851e7
Reviewed-on: https://go-review.googlesource.com/c/sys/+/340370
Trust: Matt Layher <mdlayher@gmail.com>
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-08-17 19:03:40 +00:00
Tobias Klauser
7d9622a276 unix/linux: update Dockerfile to Go 1.17
Change-Id: Ic711a44c7ecf5d0ab5237a910c920f4b76873c57
Reviewed-on: https://go-review.googlesource.com/c/sys/+/342829
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-08-17 14:26:37 +00:00
Nahum Shalman
fefb4affbe unix: expose solaris types needed for Event Ports
This work is in support of a cleanup of fsnotify/fsnotify#263

Change-Id: I2bc50036087a038c2aa8b6178687d1a870b9d1fd
Reviewed-on: https://go-review.googlesource.com/c/sys/+/324629
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-08-17 13:44:02 +00:00
Nahum Shalman
13f9c583af unix: create wrappers for solaris/illumos Event Ports
This work is in support of a cleanup of fsnotify/fsnotify#263

Change-Id: Ibd7500d20322765bfd50aa18333eb43ee7b659d7
Reviewed-on: https://go-review.googlesource.com/c/sys/+/324630
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-08-17 13:33:20 +00:00
Matt Layher
1e6c022a89 unix/linux: use HTTPS to git clone glibc in Dockerfile
This resolves a TODO to replace the insecure git protocol clone. There are no
changes to the generated code.

Change-Id: I66c83bcec572bf35a1206f8c82606cc122abb703
Reviewed-on: https://go-review.googlesource.com/c/sys/+/342553
Trust: Matt Layher <mdlayher@gmail.com>
Run-TryBot: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-08-16 18:31:51 +00:00
Tobias Klauser
fcbd12d029 unix/linux: update Dockerfile to glibc 2.34
No changes in generated files.

Change-Id: I83ffd002e070e350c2ec4026c9044a66a847e474
Reviewed-on: https://go-review.googlesource.com/c/sys/+/342569
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-08-16 17:40:21 +00:00
Mark Jeffery
15123e1e1f unix: add Send on Linux
Added Send function which in turn calls existing Sendto.

Fixes golang/go#47288

Change-Id: I5c928a19cc4f10961a9e6d2802e197cc3b799438
Reviewed-on: https://go-review.googlesource.com/c/sys/+/336569
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Matt Layher <mdlayher@gmail.com>
2021-08-16 07:42:44 +00:00
Tobias Klauser
b9628f2c71 unix: add missing RLIMIT_* consts on openbsd/{386,arm}
Change-Id: I7e978beec3d63d407ffb97fb526ad0bc4ae4a03b
Reviewed-on: https://go-review.googlesource.com/c/sys/+/341069
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-08-16 07:39:13 +00:00
Tobias Klauser
649d0fc2fc unix/linux: update Dockerfile to Go 1.17rc2
Change-Id: Idc623480fd6a4a2c733fa2eec05091112421af2b
Reviewed-on: https://go-review.googlesource.com/c/sys/+/334530
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-08-16 07:10:09 +00:00
Tobias Klauser
27a6752fd0 unix/linux: update Dockerfile to Kernel 5.13
Fixes golang/go#47057

Change-Id: I47bc7491ed46afd76d4955c2843f2bb1295c672b
Reviewed-on: https://go-review.googlesource.com/c/sys/+/332969
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-08-16 07:10:01 +00:00
Tobias Klauser
b1c119fd70 unix: move ICMP{,V6}_FILTER* const definitions
The C headers defining these constants pull in <netinet/in.h> which
leads to definition conflicts between kernel and glibc headers when
running mkerrors.sh for Linux kernel 5.13. Avoid these by moving this
const definitions to linux/types.go.

For golang/go#47057

Change-Id: I09a2391dfe4c6bb38b7069e952748070c10824e6
Reviewed-on: https://go-review.googlesource.com/c/sys/+/332929
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-08-16 07:09:50 +00:00
Kir Kolyshkin
30e4713e60 unix: make Prlimit public
glibc has a wrapper for it, so why shouldn't we?

Change-Id: I5c6e24c8e567e0198ea679f0be33e2eff056d5ed
Reviewed-on: https://go-review.googlesource.com/c/sys/+/332029
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Michael Knyszek <mknyszek@google.com>
2021-08-16 03:25:35 +00:00
Matt Layher
d867a43fc9 unix: remove runtime.KeepAlive calls for Linux ioctl wrappers
As of CL 340915 these should no longer be necessary.

Change-Id: I644595aa0594d3bdc9b8f2c349990e0311060fd6
Reviewed-on: https://go-review.googlesource.com/c/sys/+/340951
Trust: Matt Layher <mdlayher@gmail.com>
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2021-08-09 22:24:54 +00:00
Matt Layher
b4502255bf unix: generate ioctlPtr on Linux with unsafe.Pointer arg
The existing ioctl stubs for all UNIX-like platforms take a value of type
uintptr for the arg parameter. However, arguments which are cast from
unsafe.Pointer to uintptr technically violate the rules for package unsafe.
unsafe only allows a conversion from unsafe.Pointer to uintptr directly
within a call to Syscall.

ioctl is used on all UNIX-like operating systems and each one will have
to be updated accordingly where pointer arguments are passed to system
calls. To remedy this on Linux, we generate a new function called
ioctlPtr which takes a value of type unsafe.Pointer for arg. More
operating systems can be updated in future CLs by folks who have access
to those systems and can run the appropriate code generator.

Updates golang/go#44834

Change-Id: Ia9424be424b3dba91bb44d3a7a12bfb2179f0d86
Reviewed-on: https://go-review.googlesource.com/c/sys/+/340915
Trust: Matt Layher <mdlayher@gmail.com>
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2021-08-09 22:13:28 +00:00
Matt Layher
894668206c unix: run Linux code generator to tidy ifreq code
I moved the ifreq type declaration and forgot to re-run the generator before
submitting CL 340369.

Change-Id: I0486001b005a4adbc729a6bd18a4d436074f5a2d
Reviewed-on: https://go-review.googlesource.com/c/sys/+/340917
Trust: Matt Layher <mdlayher@gmail.com>
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2021-08-09 20:39:39 +00:00
Matt Layher
e5e7981a10 unix: add ifreq and ifreqData helpers for Linux
ifreq is difficult to use in Go due to the union field in particular. This
situation is made worse due to the need to comply with Go's unsafe.Pointer
rules. This CL generates the raw ifreq type and also adds an ifreqData type
of the same size which is specialized for use with unsafe.Pointer.

We also replace the existing ifreqEthtool (which was not padded to the correct
size) with the new APIs and add a test to verify that IoctlGetEthtoolDrvinfo
functions properly by checking the name of the driver for each network interface.

Future uses of ifreq in package unix can expand upon this type with additional
getter and setter methods to deal with the unsafe casts to and from the union
byte array. We may also consider exporting ifreq and ifreqData if necessary.

Change-Id: Ibf73a10e774b4336815c674bb867bbb7ec1b9c71
Reviewed-on: https://go-review.googlesource.com/c/sys/+/340369
Run-TryBot: Matt Layher <mdlayher@gmail.com>
Trust: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-08-06 18:45:41 +00:00
Jason A. Donenfeld
0f9fa26af8 windows: fix constant value of WTD_STATEACTION_VERIFY
A 0x01 was mistakenly changed to 0x10. This commit rectifies the issue,
while also adding a test to ensure this functionality is behaving as
expected.

Fixes golang/go#46906

Change-Id: I833fe03e69a71283b4f7abb6cf640574d03f5d24
Reviewed-on: https://go-review.googlesource.com/c/sys/+/331010
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-06-30 00:52:30 +00:00
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