Tom Thorogood
b80eb88b80
unix: add HIDRAW ioctls
...
This change adds (most) of the ioctl API for the Linux HIDRAW interface.
Reading and writing non-numbered HID reports is done using the read and
write system calls respectively.
Some of the HIDIOC* request numbers are exported directly while others
are kept unexported. This is because some of the #defines require a len
attribute that doesn't have a specific well defined value.
Wrapper types are added for most of the request numbers as is standard.
No wrapper is added for HIDIOCGRDESCSIZE as it would just be
IoctlGetUint32.
The HIDIOC[GS]FEATURE, HIDIOC[GS]INPUT and HIDIOC[GS]OUTPUT request
numbers, which are required for numbered HID reports, are entirely
ommitted as the len attribute has to be a runtime variable. These could
be added later by doing something like
`HIDIOCGFEATURE(0) | (len << _IOC_SIZESHIFT)`,
with care taken that len doesn't overflow _IOC_XSIZEMASK.
Outdated documentation for the HIDRAW interface is available at:
https://www.kernel.org/doc/Documentation/hid/hidraw.txt .
Change-Id: I2ae5060f0f46150f6fb52959c2e55f50927c1f69
Reviewed-on: https://go-review.googlesource.com/c/sys/+/289169
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-02-23 08:53:22 +00:00
Tobias Klauser
d8cc79f4ae
unix: drop pre-1.10 compatibility in TestSCMCredentials
...
The last pre-1.10 release - Go 1.9 - was release 2017-08-24 and is no
longer supported since Go 1.11 was released 2018-08-24.
This effectively reverts https://golang.org/cl/80275
Updates golang/go#22899
Change-Id: Id7ab3f6b6d6430977db9345def383d875396e1e7
Reviewed-on: https://go-review.googlesource.com/c/sys/+/292969
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-02-23 08:51:55 +00:00
Russ Cox
9a76102bfb
all: go fmt ./...
...
Make all our package sources use Go 1.17 gofmt format
(adding //go:build lines).
Not strictly necessary but will avoid spurious changes
as files are edited.
Part of //go:build change (#41184 ).
See https://golang.org/design/draft-gobuild
Change-Id: I01667f826428426a39c84717d02efa25fa44553c
Reviewed-on: https://go-review.googlesource.com/c/sys/+/294490
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Keith Randall <khr@golang.org >
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com >
Reviewed-by: Matt Layher <mdlayher@gmail.com >
Trust: Josh Bleecher Snyder <josharian@gmail.com >
Trust: Russ Cox <rsc@golang.org >
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com >
Run-TryBot: Russ Cox <rsc@golang.org >
2021-02-20 05:07:31 +00:00
Bryan C. Mills
57ea560cfc
windows: comment on fields omitted from the win32finddata1 struct
...
Updates golang/go#42637
Change-Id: I2e8c95af3cf2172c55bda6a15a749afcc6c45581
Reviewed-on: https://go-review.googlesource.com/c/sys/+/284172
Trust: Bryan C. Mills <bcmills@google.com >
Trust: Jason A. Donenfeld <Jason@zx2c4.com >
Trust: Alex Brainman <alex.brainman@gmail.com >
Run-TryBot: Bryan C. Mills <bcmills@google.com >
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com >
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
2021-02-19 17:28:41 +00:00
Boshi LIAN
3351caf150
windows: add CertFindCertificateInStore, CertFindChainInStore and CryptAcquireCertificatePrivateKey
...
add cert loading related syscall
CertFindCertificateInStore [1]
CertFindChainInStore [2]
CryptAcquireCertificatePrivateKey [3]
[1] https://docs.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-certfindcertificateinstore
[2] https://docs.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-certfindchaininstore
[3] https://docs.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-cryptacquirecertificateprivatekey
Change-Id: I179bffd06d714d729f3afd83687336edecae6b37
GitHub-Last-Rev: 58a8c666c8
GitHub-Pull-Request: golang/sys#94
Reviewed-on: https://go-review.googlesource.com/c/sys/+/281012
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com >
Trust: Jason A. Donenfeld <Jason@zx2c4.com >
Trust: Alex Brainman <alex.brainman@gmail.com >
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com >
2021-02-19 17:27:56 +00:00
Tobias Klauser
8ebf48af03
unix: check gid in TestGetsockoptXucred
...
macOS (and the BSDs) report all groups in Xucred, the first one being
the GID.
Also use Socketpair/Close from golang.org/x/sys/unix instead of package
syscall.
Change-Id: I9319ff2b5258f66afc24e3e80c704d816e995dbf
Reviewed-on: https://go-review.googlesource.com/c/sys/+/293569
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-02-18 15:57:24 +00:00
Jason A. Donenfeld
beda7e5e15
windows: port to ARM64
...
This also fixes up some spaces->tabs issues and moves build tags from
the file contents to the file name.
Updates golang/go#36439 .
Change-Id: Iafa03e26575603a802832e587bb18ebd16fd176b
Reviewed-on: https://go-review.googlesource.com/c/sys/+/289449
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 >
Reviewed-by: Russ Cox <rsc@golang.org >
2021-02-18 14:52:45 +00:00
Tobias Klauser
9555bcde0c
unix: add Pipe2 on netbsd
...
Re-submit after CL 283593 broke the dragonfly builders.
Change-Id: Ifdeb7642be32f5d3d3862aacdff90a0da4886365
Reviewed-on: https://go-review.googlesource.com/c/sys/+/283599
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-02-18 08:51:08 +00:00
Tobias Klauser
e8e29180ff
unix: fix Pipe2 on dragonfly
...
Also move TestPipe2 into a separate file, enabling it for all platforms
where Pipe2 is available.
Change-Id: I9c554a53fc9d7610aaa732c0ceba864963fad542
Reviewed-on: https://go-review.googlesource.com/c/sys/+/283598
Trust: Tobias Klauser <tobias.klauser@gmail.com >
Reviewed-by: Ian Lance Taylor <iant@golang.org >
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com >
2021-02-18 08:40:38 +00:00
Tobias Klauser
b926d437f3
unix/linux: update Dockerfile to Kernel 5.11, glibc 2.33, Go 1.16
...
The FS_POLICY_FLAGS_VALID const is kernel-internal and was removed from
the UAPI headers in
3ceb6543e9
Change-Id: I21b1efe895fbd7f640a7604805cf7ce39c5a43f4
Reviewed-on: https://go-review.googlesource.com/c/sys/+/291637
Trust: Tobias Klauser <tobias.klauser@gmail.com >
Trust: Matt Layher <mdlayher@gmail.com >
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com >
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Matt Layher <mdlayher@gmail.com >
2021-02-17 10:54:51 +00:00
Tobias Klauser
ed5674b6da
unix/linux: adjust comment regarding riscv64 support
...
The riscv64 port is supported since Go 1.14, adjust the comment in
mkall.go accordingly.
Change-Id: I4b3f218abe9c864c855e89f132e67e9d86754a53
Reviewed-on: https://go-review.googlesource.com/c/sys/+/288333
Trust: Tobias Klauser <tobias.klauser@gmail.com >
Reviewed-by: Ian Lance Taylor <iant@golang.org >
2021-02-17 09:06:53 +00:00
Tobias Klauser
21e18009e2
unix: add Sysconf on solaris
...
This wraps sysconf(3) on solaris.
Change-Id: Ie5dd32bfa98bf900cadce6f20cefd553fdf80e29
Reviewed-on: https://go-review.googlesource.com/c/sys/+/286593
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-02-17 09:05:18 +00:00
Tobias Klauser
1d4d2d3355
unix: small fixes for TestPipe
...
Check error returned by Pipe, use %v to format error values and strip
trailing newlines from Errorf messages. Also move TestPipe above the
test helper functions.
Change-Id: Id431c8ffbcf525347cb4c138df69f92cc730f54a
Reviewed-on: https://go-review.googlesource.com/c/sys/+/283592
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-02-17 09:00:31 +00:00
Tobias Klauser
73548a7a48
unix: consistently use tabs in //sys and //sysnb lines
...
There is some inconsistent use of tabs and spaces in the //sys and
//sysnb lines. However, the large majority is using tabs, so use these
consistently.
Also change the regexp in mksyscall*.go to only accept tabs going
forward.
Change-Id: I78944e88b5fec11c1bd1d103cea894bc5109da56
Reviewed-on: https://go-review.googlesource.com/c/sys/+/283596
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-02-17 08:59:31 +00:00
Brad Fitzpatrick
f992740a1b
unix: add Xucred, GetsockoptXucred on darwin
...
Test adapted from CL 134535 from Tyler Julian (@APTy).
For posterity, the auto-generated parts were updated with:
GOARCH_TARGET=amd64 go tool cgo -godefs types_darwin.go | GOOS=darwin GOARCH_TARGET=amd64 go run mkpost.go > ztypes_darwin_amd64.go
GOARCH_TARGET=arm64 go tool cgo -godefs types_darwin.go | GOOS=darwin GOARCH_TARGET=arm64 go run mkpost.go > ztypes_darwin_arm64.go
GOOS=darwin GOARCH=amd64 ./mkerrors.sh -m64 > zerrors_darwin_amd64.go ; gofmt -w zerrors_darwin_amd64.go
GOOS=darwin GOARCH=arm64 ./mkerrors.sh -m64 > zerrors_darwin_arm64.go ; gofmt -w zerrors_darwin_arm64.go
perl -i -npe 's,( cgo -godefs(?: -- -m64)? )/.+/(\S+.go),$$1$$2,' zerrors_darwin_amd64.go zerrors_darwin_arm64.go ztypes_darwin_amd64.go ztypes_darwin_arm64.go
Fixes golang/go#27613
Change-Id: Ie41b3da840cb9c8c140c57ecfb78e7abc4f70bea
Reviewed-on: https://go-review.googlesource.com/c/sys/+/292330
Trust: Brad Fitzpatrick <bradfitz@golang.org >
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org >
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com >
2021-02-16 22:45:49 +00:00
Brad Fitzpatrick
f7da38b97c
unix: re-generate darwin output on Big Sur (11.2.1)
...
For posterity, I ran:
GOARCH_TARGET=amd64 go tool cgo -godefs types_darwin.go | GOOS=darwin GOARCH_TARGET=amd64 go run mkpost.go > ztypes_darwin_amd64.go
GOARCH_TARGET=arm64 go tool cgo -godefs types_darwin.go | GOOS=darwin GOARCH_TARGET=arm64 go run mkpost.go > ztypes_darwin_arm64.go
GOOS=darwin GOARCH=amd64 ./mkerrors.sh -m64 > zerrors_darwin_amd64.go ; gofmt -w zerrors_darwin_amd64.go
GOOS=darwin GOARCH=arm64 ./mkerrors.sh -m64 > zerrors_darwin_arm64.go ; gofmt -w zerrors_darwin_arm64.go
perl -i -npe 's,( cgo -godefs(?: -- -m64)? )/.+/(\S+.go),$$1$$2,' zerrors_darwin_amd64.go zerrors_darwin_arm64.go ztypes_darwin_amd64.go ztypes_darwin_arm64.go
Change-Id: I17e8fc3bd66f4766d0f5f731151f0b85758c01b0
Reviewed-on: https://go-review.googlesource.com/c/sys/+/292329
Trust: Brad Fitzpatrick <bradfitz@golang.org >
Trust: Tobias Klauser <tobias.klauser@gmail.com >
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org >
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com >
2021-02-16 16:36:48 +00:00
Brad Fitzpatrick
c4c1ae6d18
unix: fix typo in test
...
Change-Id: I80b28a28a9e6133a7c8a9340ce5914498ff6bf0f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/292331
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com >
Trust: Brad Fitzpatrick <bradfitz@golang.org >
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org >
2021-02-16 15:53:14 +00:00
Jason A. Donenfeld
22da62e12c
windows: correct struct name and bool type
...
This fixes the name of a struct to match Microsoft's documentation.
It also reverts a change I made in the last patchset of CL 285714. The
idea there was that a Go bool would suffice for a win32 BOOL, because of
little endian. But in fact, a value of 0xff000000 would be treated as
false by Go but true by C, which is a problem. So this changes to using
a vanilla int32 type, which matches the C "int" used in the Microsoft
headers.
Change-Id: Id7cd306e916b3754e8dfe32bf11ec30cad3a13b4
Reviewed-on: https://go-review.googlesource.com/c/sys/+/285717
Trust: Jason A. Donenfeld <Jason@zx2c4.com >
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com >
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
2021-01-24 15:45:48 +00:00
Jason A. Donenfeld
1d476976d1
windows: add support for DPAPI
...
DPAPI allows machine or user-based blob encryption, using APIs from
crypt32:
https://docs.microsoft.com/en-us/windows/win32/api/dpapi/nf-dpapi-cryptunprotectdata
https://docs.microsoft.com/en-us/windows/win32/api/dpapi/nf-dpapi-cryptprotectdata
Change-Id: I57fb4f1877a5fb7629809e79111cbfa02b11cca3
Reviewed-on: https://go-review.googlesource.com/c/sys/+/285716
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com >
TryBot-Result: Go Bot <gobot@golang.org >
Trust: Jason A. Donenfeld <Jason@zx2c4.com >
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
2021-01-23 23:11:50 +00:00
Jason A. Donenfeld
07034700bc
windows: add WinVerifyTrustEx function
...
This commit adds the function and the required structs for it. This is
the same as the WinVerifyTrust function but has the more correct
signature.
https://docs.microsoft.com/en-us/windows/win32/api/wintrust/nf-wintrust-winverifytrustex
Change-Id: I43ae20302ba85a6ae1fc32ad4c34b59bee0a6a35
Reviewed-on: https://go-review.googlesource.com/c/sys/+/285715
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com >
TryBot-Result: Go Bot <gobot@golang.org >
Trust: Jason A. Donenfeld <Jason@zx2c4.com >
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
2021-01-23 23:11:35 +00:00
Jason A. Donenfeld
4df39788e6
windows: add missing crypt/cert API functions for examining certificate objects
...
This adds these functions and the various enums and constants required
to use them:
https://docs.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-cryptdecodeobject
https://docs.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-cryptqueryobject
https://docs.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-certgetnamestringw
https://docs.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-certfindextension
We also use this opportunity to clean up formatting of the previous
crypt APIs added: a few lines slipped in that used "//sys ", with
spaces, instead of "//sys\t" with a tab. This fixes that up for
consistency.
Change-Id: I925d3d29b5255f70ee2368e8906c45b8b22115ce
Reviewed-on: https://go-review.googlesource.com/c/sys/+/285714
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com >
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
Trust: Jason A. Donenfeld <Jason@zx2c4.com >
2021-01-23 23:10:56 +00:00
Tobias Klauser
9b0068b266
execabs: disable tests on ios and js/wasm
...
TestCommand and TestLookPath fail on the js/wasm builder and likely
fail on ios as well.
Like the tests in internal/execabs, skip them for these platforms.
This fixes the js/wasm builder after CL 284753.
For golang/go#11811
Change-Id: I1038128bd4c7bd410ac1357dedda5e3eef5c7bbb
Reviewed-on: https://go-review.googlesource.com/c/sys/+/285712
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-01-23 11:12:55 +00:00
Jason A. Donenfeld
a8b976e07c
windows: add Find*ChangeNotification APIs for file and directory monitoring
...
https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-findfirstchangenotificationw
https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-findnextchangenotification
https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-findclosechangenotification
Change-Id: If7abfd63cd7a60e7f95ffad9aca2b7b7b74c94f0
Reviewed-on: https://go-review.googlesource.com/c/sys/+/285713
Trust: Jason A. Donenfeld <Jason@zx2c4.com >
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com >
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
2021-01-22 23:57:52 +00:00
Jason A. Donenfeld
04d7465088
windows: correct signature of recently added GetWindowThreadProcessId
...
This function returns 0 and sets last error on failure. While this isn't
said explicitly on MSDN, there's no PID 0, and trivial reverse
engineering shows that this is the case. For example:
.text:00000001800035ED loc_1800035ED: ; CODE XREF: GetWindowThreadProcessId+23↑j
.text:00000001800035ED ; GetWindowThreadProcessId+3D↑j ...
.text:00000001800035ED mov ecx, 578h ; LastError
.text:00000001800035F2 call cs:__imp_RtlSetLastWin32Error
.text:00000001800035F9 nop dword ptr [rax+rax+00h]
.text:00000001800035FE
.text:00000001800035FE loc_1800035FE: ; CODE XREF: GetWindowThreadProcessId+65↑j
.text:00000001800035FE xor eax, eax
.text:0000000180003600 jmp short loc_1800035AA
This function was also just added by a user who is likely its only
consumer, so this error is not too late to fix.
Change-Id: I5dd24e78c006686bb8f1288ad0fe63cd67df56a6
Reviewed-on: https://go-review.googlesource.com/c/sys/+/285272
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-01-22 09:31:01 +00:00
Roland Shoemaker
b64e53b001
execabs: create execabs package
...
This package provides an alternative to os/exec that guarantees
never to satisfy a PATH lookup using an executable in the current
directory.
Change-Id: Id978f8039fe21687059c788836c79ae8e0930e92
Reviewed-on: https://team-review.git.corp.google.com/c/golang/go-private/+/949732
Reviewed-by: Katie Hockman <katiehockman@google.com >
Reviewed-by: Russ Cox <rsc@google.com >
Reviewed-on: https://go-review.googlesource.com/c/sys/+/284753
Trust: Roland Shoemaker <roland@golang.org >
Run-TryBot: Roland Shoemaker <roland@golang.org >
Reviewed-by: Russ Cox <rsc@golang.org >
Reviewed-by: Katie Hockman <katie@golang.org >
TryBot-Result: Go Bot <gobot@golang.org >
2021-01-19 21:28:57 +00:00
Tobias Klauser
4bcb84eeeb
Revert "unix: add Pipe2 on netbsd"
...
This reverts CL 283593.
Reason for revert: breaks DragonflyBSD builders and was submitted during code freeze.
Change-Id: I784f58ae56f7259d5176921d7a61070e0ac7cb52
Reviewed-on: https://go-review.googlesource.com/c/sys/+/283597
Trust: Tobias Klauser <tobias.klauser@gmail.com >
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com >
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org >
2021-01-13 18:17:07 +00:00
Tobias Klauser
ba0562f347
unix: re-generate linux consts after CL 283413
...
ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF was removed from linux/types.go and
mkerrors.sh will catch it instead.
Change-Id: I76e063cbfee4411e5ea9f2e0e5359e169d56b195
Reviewed-on: https://go-review.googlesource.com/c/sys/+/283595
Trust: Tobias Klauser <tobias.klauser@gmail.com >
Trust: Matt Layher <mdlayher@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-01-13 13:13:15 +00:00
Tobias Klauser
3196cb8d8e
unix: add Pipe2 on netbsd
...
Also move TestPipe2 into a separate file, enabling it for all platforms
where Pipe2 is available.
Change-Id: I1a31e9563f5f60ef0e994abc1db57b7f1c58fe88
Reviewed-on: https://go-review.googlesource.com/c/sys/+/283593
Trust: Tobias Klauser <tobias.klauser@gmail.com >
Trust: Benny Siegert <bsiegert@gmail.com >
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com >
Reviewed-by: Benny Siegert <bsiegert@gmail.com >
TryBot-Result: Go Bot <gobot@golang.org >
2021-01-13 11:20:37 +00:00
Matt Layher
eaf3bda374
unix: add ethtool constants for Linux
...
The ethtool generic netlink interface also uses these constants
in addition to the ones I previously added.
For more information about this interface, see:
https://www.kernel.org/doc/html/latest/networking/ethtool-netlink.html .
Change-Id: I8861e5faa23bfc0179725314fc5a528486e328b2
Reviewed-on: https://go-review.googlesource.com/c/sys/+/283413
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-01-13 00:00:19 +00:00
Alex Brainman
59c308dcf3
windows: use HWND type in MessageBox, GetShellWindow and GetWindowThreadProcessId
...
This matches usual win32api conventions. While we're at it, we
group together user32.dll functions together.
This CL was based on CL 282634 with all but MessageBox, GetShellWindow
and GetWindowThreadProcessId changes removed to prevent compatibility
break.
Change-Id: I7e17c581723c41580a49c5612cabc7a5c13c0f15
Reviewed-on: https://go-review.googlesource.com/c/sys/+/282972
Run-TryBot: Alex Brainman <alex.brainman@gmail.com >
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
Trust: Alex Brainman <alex.brainman@gmail.com >
2021-01-12 09:13:31 +00:00
Tobias Klauser
489259a850
unix: add Pipe2 for solaris
...
We already implement Pipe2 for illumos and it seems solaris provides the
pipe2 syscall as well, see
https://docs.oracle.com/cd/E88353_01/html/E37841/pipe2-2.html .
Fixes golang/go#40613
Change-Id: I135cb1e78e6c67567d30d7eed266d00ef8fd6c3a
Reviewed-on: https://go-review.googlesource.com/c/sys/+/283032
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-01-12 08:05:10 +00:00
Matt Layher
789bb1bd40
unix: add ethtool generic netlink constants for Linux
...
For more information about this interface, see:
https://www.kernel.org/doc/html/latest/networking/ethtool-netlink.html .
Change-Id: I4fe37e7dce3c52d72286bee047de2b49fe559b13
Reviewed-on: https://go-review.googlesource.com/c/sys/+/282812
Run-TryBot: Matt Layher <mdlayher@gmail.com >
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com >
Trust: Tobias Klauser <tobias.klauser@gmail.com >
Trust: Matt Layher <mdlayher@gmail.com >
2021-01-10 05:19:26 +00:00
Alex Brainman
0df2131ae3
windows: add GetShellWindow and GetWindowThreadProcessId
...
I am trying to implement
https://devblogs.microsoft.com/oldnewthing/20190425-00/?p=102443
so I need these functions.
Change-Id: Id5082e4cc450569ffd021f4a300d56de325e4952
Reviewed-on: https://go-review.googlesource.com/c/sys/+/280717
Trust: Alex Brainman <alex.brainman@gmail.com >
Trust: Brad Fitzpatrick <bradfitz@golang.org >
Run-TryBot: Alex Brainman <alex.brainman@gmail.com >
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
2021-01-08 17:29:13 +00:00
Artyom Pervukhin
16f7687f50
unix: don't call testing.T.Fatalf in a background goroutine
...
> Those methods [...] must be called only from the goroutine running the
> Test function.
For golang/go#43498
Change-Id: I847067936ade613a21b059c90219bd285425f0aa
Reviewed-on: https://go-review.googlesource.com/c/sys/+/280622
Reviewed-by: Keith Randall <khr@golang.org >
Run-TryBot: Keith Randall <khr@golang.org >
TryBot-Result: Go Bot <gobot@golang.org >
Trust: Ian Lance Taylor <iant@golang.org >
2021-01-05 21:07:32 +00:00
Keith Randall
6f8348627a
unix: fix darwin pipe implementation
...
The raw syscall returned the two pipes whereas the libc call
takes a pointer to a location to write the two pipes.
When we switched over from raw syscalls to libc calls, this
change in behavior was missed.
Fixes golang/go#43498
Change-Id: Icee2204dcb8be8fc94be0df106e1ff061cafa446
Reviewed-on: https://go-review.googlesource.com/c/sys/+/281432
Trust: Keith Randall <khr@golang.org >
Run-TryBot: Keith Randall <khr@golang.org >
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Ian Lance Taylor <iant@golang.org >
2021-01-04 20:47:34 +00:00
Boshi LIAN
2d18734c60
windows: add PFXImportCertStore and CertDuplicateCertificateContext
...
add 2 new cert related dll call
PFXImportCertStore [1]
CertDuplicateCertificateContext [2]
also, add missing flags for CertCloseStore [3]
[1] https://docs.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-pfximportcertstore
[2] https://docs.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-certduplicatecertificatecontext
[3] https://docs.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-certclosestore
Change-Id: Ia44100ddb2cac1c2a817932c859926e8183dcda0
GitHub-Last-Rev: f3cd41859d
GitHub-Pull-Request: golang/sys#93
Reviewed-on: https://go-review.googlesource.com/c/sys/+/273907
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com >
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 >
2020-12-31 18:44:35 +00:00
Tobias Klauser
0d417f6369
unix: don't use ptrace on ios
...
Follow CL 279481 which did the same for package syscall.
For golang/go#43302 .
Change-Id: I9fa7bec5712cf43fd7485225d4c21665c151defc
Reviewed-on: https://go-review.googlesource.com/c/sys/+/279393
Trust: Tobias Klauser <tobias.klauser@gmail.com >
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com >
Reviewed-by: Cherry Zhang <cherryyz@google.com >
TryBot-Result: Go Bot <gobot@golang.org >
2020-12-23 07:45:33 +00:00
Tobias Klauser
bc327ba9c2
unix/linux: update Dockerfile to Go 1.16beta1
...
Change-Id: Iee6d0bdbbb4f36adb8e963e482c0d62c7a3fb147
Reviewed-on: https://go-review.googlesource.com/c/sys/+/279113
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 >
2020-12-21 09:36:33 +00:00
Tobias Klauser
7d0127a747
unix: add SizeofIovec on aix, dragonfly, *bsd and solaris
...
Change-Id: Ib981ad3f745a2566d0a12eba5e54c7da53b69d6e
Reviewed-on: https://go-review.googlesource.com/c/sys/+/279112
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 >
2020-12-18 08:43:10 +00:00
Tobias Klauser
f9fddec55a
unix/linux: update Dockerfile to kernel 5.10 and Go 1.15.6
...
Also include some newly added consts.
Change-Id: Iaf9fad92a4cbbf9f1e97ed544116bd93525dddde
Reviewed-on: https://go-review.googlesource.com/c/sys/+/277254
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 >
2020-12-14 21:06:02 +00:00
Tobias Klauser
aec9a39092
unix: use Time{spec,val}.Nano in Time{spec,val}ToNsec
...
Follow what CL 188397 did in package syscall:
Call the Nano methods of Timespec and Timeval in TimespecToNsec and
TimevalToNsec respectively, instead of duplicating the implementation.
Change-Id: I50f1958c0f7bca92fc4990684f1de9c148ae5859
Reviewed-on: https://go-review.googlesource.com/c/sys/+/277253
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 >
2020-12-14 09:51:26 +00:00
Tobias Klauser
8c39875709
unix: drop references to Unix epoch in Timeval/Timespec docs
...
Follow what CL 277073 did for package syscall:
The various conversion functions just change the format of time values.
They don't use the Unix epoch. Although in practice the values are often
times since the Unix epoch, they aren't always, so referring to the
epoch can be confusing.
Updates golang/go#43010
Change-Id: Icb9953e20d7cab8e36ddfb467dc2380ee181f18b
Reviewed-on: https://go-review.googlesource.com/c/sys/+/277252
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 >
2020-12-14 09:51:18 +00:00
Meng Zhuo
8ad439b19e
windows: remove ErrorControl value check in CreateService
...
ErrorIgnore is 0 which means we shouldn't rely on zero value checking.
Fixes golang/go#43094
Change-Id: I7af3132cfe58d73c7abab92203fb02a0ada15218
Reviewed-on: https://go-review.googlesource.com/c/sys/+/276572
Trust: Meng Zhuo <mzh@golangcn.org >
Trust: Alex Brainman <alex.brainman@gmail.com >
Trust: Jason A. Donenfeld <Jason@zx2c4.com >
Run-TryBot: Meng Zhuo <mzh@golangcn.org >
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com >
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com >
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
2020-12-11 09:08:39 +00:00
Josh Bleecher Snyder
1f0c578a6b
windows: add RegNotifyChangeKeyValue notifyFilter flags
...
Copied with permission (and CLA) from
https://git.zx2c4.com/wireguard-go/tree/tun/wintun/registry/registry_windows.go?id=5ca1218a5c16fb9b5e99b61c0b5758f66087e2e4
Change-Id: I42c1657b603f8494dadedacc8f7d719d39df9dc0
Reviewed-on: https://go-review.googlesource.com/c/sys/+/277153
Trust: Josh Bleecher Snyder <josharian@gmail.com >
Trust: Jason A. Donenfeld <Jason@zx2c4.com >
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com >
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com >
2020-12-11 00:26:50 +00:00
Josh Bleecher Snyder
7e3030f880
windows: add RegNotifyChangeKeyValue syscall
...
Change-Id: If1a1b6ad1935bfaacb9e6a99fb9ade056169ccb2
Reviewed-on: https://go-review.googlesource.com/c/sys/+/277152
Trust: Josh Bleecher Snyder <josharian@gmail.com >
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com >
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
2020-12-10 22:38:39 +00:00
Julie Qiu
d4d67f95c6
README.md: add badge to pkg.go.dev
...
Change-Id: I961972a89cfb5ae5aa71c6b8ba034d8b23b43876
Reviewed-on: https://go-review.googlesource.com/c/sys/+/275888
Trust: Julie Qiu <julie@golang.org >
Run-TryBot: Julie Qiu <julie@golang.org >
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org >
TryBot-Result: Go Bot <gobot@golang.org >
2020-12-07 22:35:42 +00:00
Jason A. Donenfeld
ed752295db
windows/svc/mgr: report exit status when querying services
...
One thing the newer notification API does not do is automatically
provide the service exit code in its notifier response. It requires
querying manually. Unfortunately, we weren't propagating this
information up from the lower level struct, so this commit copys that
information over.
Change-Id: I70c683007ce34ffab6196329acefc8443f921ebe
Reviewed-on: https://go-review.googlesource.com/c/sys/+/274577
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com >
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
Trust: Alex Brainman <alex.brainman@gmail.com >
Trust: Jason A. Donenfeld <Jason@zx2c4.com >
2020-12-04 22:54:14 +00:00
Jason A. Donenfeld
c9906e3070
windows: add SubscribeServiceChangeNotifications for service tracking
...
Windows 8+ introduced SubscribeServiceChangeNotifications for simpler
and more reliable service event tracking. This commit adds the function
and related constants:
https://docs.microsoft.com/en-us/windows/win32/services/subscribeservicechangenotifications
Since these functions are only available on Windows 8+, and Go supports
Windows 7+, we mark them with "?" so that the caller can handle graceful
degradation.
Change-Id: Ibb9708bbe797408701c70b4b1c715381f33cb8ee
Reviewed-on: https://go-review.googlesource.com/c/sys/+/274576
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com >
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Alex Brainman <alex.brainman@gmail.com >
Trust: Alex Brainman <alex.brainman@gmail.com >
Trust: Jason A. Donenfeld <Jason@zx2c4.com >
2020-12-04 22:54:10 +00:00
Jason A. Donenfeld
9a0d5dbcff
windows/mkwinsyscall: account for non-"err" return values when processing "?"
...
The "?" code assumed that the error value was always called "err", when
in reality it might be called something different (like "ret") or even
entirely absent. This commit makes the templating robust to that. At the
same time, we move a lot of the complexity out of the actual templates
and into helper functions, so that this remains easy to read.
Change-Id: I939d56413a24f0e3e1bbf13da5adf13e9401747a
Reviewed-on: https://go-review.googlesource.com/c/sys/+/275472
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 >
2020-12-04 22:54:03 +00:00
Tobias Klauser
69691e4674
unix: remove ineffectual //go:linkname directives
...
For golang/go#42938
Change-Id: I9d68a2436f3ce7402b3c6517a630d0272cf39071
Reviewed-on: https://go-review.googlesource.com/c/sys/+/274573
Trust: Tobias Klauser <tobias.klauser@gmail.com >
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com >
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Matthew Dempsky <mdempsky@google.com >
2020-12-02 21:35:21 +00:00