Commit Graph

880 Commits

Author SHA1 Message Date
Tobias Klauser
5f8ca72cd6 unix: don't zero out extra registers on riscv64 syscalls
Follow the implementation in package syscall, see CL 204659.

Change-Id: Ib97f86958cbdb0135b7980faf23729543c68d42a
Reviewed-on: https://go-review.googlesource.com/c/sys/+/213397
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Joel Sing <joel@sing.id.au>
2020-01-06 11:46:38 +00:00
Tobias Klauser
a1369afcda unix: add flags argument in //sys comments for Fstatvfs1 and Statvfs1 on netbsd
Otherwise, these functions would not be generated correctly. Follow-up
for CL 209637.

Also regenerate the zsyscall_netbsd_*.go files, causing the definition
of sysctl to move.

Change-Id: I829e8c94a69b6aeb251b46bc4762f2a7bbc45a8e
Reviewed-on: https://go-review.googlesource.com/c/sys/+/212460
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
2020-01-03 14:33:44 +00:00
Tobias Klauser
c96a22e43c unix: add Dup3 on netbsd and openbsd
Change-Id: Id871d3d211d6d5896e41b673c7bfe3a1d8e756a6
Reviewed-on: https://go-review.googlesource.com/c/sys/+/212461
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-01-02 14:19:24 +00:00
Tobias Klauser
04cbcbbfee unix: correct build tag to define Getdirentries for darwin/arm with Go 1.11
Fixes golang/go#36300

Change-Id: I42692b47135870b52a26eb9662ca54648c9cfaf2
Reviewed-on: https://go-review.googlesource.com/c/sys/+/212459
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
2019-12-28 21:39:18 +00:00
maltalex
c709ea063b windows: added SO_RCVTIMEO and IPPROTO_ICMP constants
Added missing Windows constants SO_RCVTIMEO and IPPROTO_ICMP

Change-Id: I3a13fa0af2d085a7294b8d983a94d0d9c3c6ec31
GitHub-Last-Rev: cfafa03e60
GitHub-Pull-Request: golang/sys#50
Reviewed-on: https://go-review.googlesource.com/c/sys/+/211559
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2019-12-24 08:55:50 +00:00
Tobias Klauser
5a3cf8467b unix: compare Stat_t members in TestFstatat
TestFstatat occasionally fails on some builders due to mismatching
Stat_t info returned by the calls to Fstatat (most likely due to Atime
changing). Fix the test by just comparing some well known members.

Change-Id: I862957ad9d3632173a97d93692a6c672779ac508
Reviewed-on: https://go-review.googlesource.com/c/sys/+/212417
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-12-23 22:42:16 +00:00
Tobias Klauser
abf886d6f5 unix: unify definition of func fcntl
For linux and *bsd, implement func fcntl in fcntl.go instead of
generating it. Implement it using fcntl64Syscall, so SYS_FCNTL64 is used
on 32-bit linux.

For aix, darwin and solaris continue generate func fcntl as before.

Change-Id: I3750b88d1ee5573daaee2b75c369f723fde8834a
Reviewed-on: https://go-review.googlesource.com/c/sys/+/212337
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-12-23 22:40:30 +00:00
Ian Lance Taylor
0732a99047 unix: use correct file name in comment
Change-Id: Ib05fbd6f1dca630a3ac596f88373756797d8c27e
Reviewed-on: https://go-review.googlesource.com/c/sys/+/212298
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-12-20 22:00:14 +00:00
Axel Wagner
d4481acd18 unix: add Readv/Writev family of syscalls for linux
Fixes golang/go#36201

Change-Id: Ie3b197e18bc5d59fd222f3fa0100e1e0a3d11866
Reviewed-on: https://go-review.googlesource.com/c/sys/+/212157
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-12-20 14:29:24 +00:00
maltalex
af0d71d358 windows: fix recvfrom and sendto data types
Fixes wrong data type used in Windows recvfrom and sendto calls

In Windows, `int` refers to a 32-bit signed integer
(https://docs.microsoft.com/en-us/windows/win32/winprog/windows-data-types#int).
However, the current implementation (https://golang.org/cl/208321)
uses the `int` type, which can have a different size. This is especially
important when recvfrom` returns a 32bit value of `-1`, indicating an error,
since it is interpreted as the 64bit value 4294967295.

Change-Id: Ib966ff317b0be7e29e48ee373a794cd0267fb007
GitHub-Last-Rev: 9aad4c377f
GitHub-Pull-Request: golang/sys#51
Reviewed-on: https://go-review.googlesource.com/c/sys/+/211998
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-12-19 23:57:34 +00:00
Umang Parmar
4a24b40652 unix: add PrctlRetInt, a Prctl variant that returns (int, error)
Fixes golang/go#35978

Change-Id: I396f0c2c6443e000bcecc9081841cd55145c050b
GitHub-Last-Rev: d461448006
GitHub-Pull-Request: golang/sys#48
Reviewed-on: https://go-review.googlesource.com/c/sys/+/209969
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-12-18 08:49:08 +00:00
erifan01
ac6580df44 unix: move functions Ptrace{Get|Set}RegSetArm64 to a separate file
CL 204418 adds functions PtraceGetRegSetArm64 and PtraceSetRegSetArm64 to file
zptrace_armnn_linux.go, both of which depend on type Iovec. The definitions of type
Iovec on linux arm and arm64 are different, but file zptrace_armnn_linux.go is
shared by them. So these two functions cause compilation errors on linux arm. This
patch fixes this error by moving these two functions into a separate file.

Fixes golang/go#36032

Change-Id: Ia380bd863895900599c09d4631ed26f204955112
Reviewed-on: https://go-review.googlesource.com/c/sys/+/210322
Run-TryBot: eric fang <eric.fang@arm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-12-10 02:34:23 +00:00
Umang Parmar
eeba5f6aab unix: replace readlink in mkall.sh with portable shell commands
Fixes golang/go#35997

Change-Id: I1c489a126646a0ff4abf9e8b7ba357ff62cb66ac
GitHub-Last-Rev: e01b1c0e8b
GitHub-Pull-Request: golang/sys#49
Reviewed-on: https://go-review.googlesource.com/c/sys/+/210157
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-12-06 22:06:18 +00:00
erifan01
bc7efcf3b8 unix: add functions PtraceGetRegSetArm64 and PtraceSetRegSetArm64
Since arm64 GNU/Linux version 2.6.34, PTRACE_GETREGS was replaced by PTRACE_GETREGSET,
in order to get or set the general purpose and floating-point register values,
PTRACE_GETREGSET/PTRACE_SETREGSET request type and a proper "NT_XXX" constant values
should be used. For the sake of not breaking the existing API, we added two functions
PtraceGetRegSetArm64 and PtraceSetRegSetArm64, they take an additional argument "addr",
and use PTRACE_GETREGSET and PTRACE_SETREGSET request types respectively.

Change-Id: I14c55733e15cea4b7d775187b1018fcb2880d6a9
Reviewed-on: https://go-review.googlesource.com/c/sys/+/204418
Run-TryBot: eric fang <eric.fang@arm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-12-06 21:42:22 +00:00
Tobias Klauser
ce4227a45e unix: add Statvfs and Fstatvfs on NetBSD
NetBSD replaced statfs with statvfs in NetBSD 3.0. statfs is derived
from BSD4.4, while NetBSD (and Solaris) implement statvfs from POSIX
instead.

Generated and tested on NetBSD 8.0 (amd64). Also tested on NetBSD 7.0 (amd64).

Change-Id: I53738b77815d04c7774a6455b4a31cd4e9571f7b
Reviewed-on: https://go-review.googlesource.com/c/sys/+/209637
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
2019-12-04 07:23:24 +00:00
Tobias Klauser
85b82a3add cpu: support reading arm64 CPU feature registers
This allows to detect ARM64 CPU features on non-Linux systems. On Linux,
this is used in case /proc/self/auxv cannot be read.

Change-Id: I67d55e989f2beda0c05a97ca5e55781840a8e01c
Reviewed-on: https://go-review.googlesource.com/c/sys/+/209478
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-12-04 07:21:56 +00:00
maltalex
6d18c012ae windows: add Recvfrom and Sendto implementations
Added the missing `Sendto` and `Recvfrom` syscalls for Windows.
Fixes golang/go#7170

Change-Id: I794b4f631fad424400fec85ccecc3a3b3abe5465
GitHub-Last-Rev: 39ebe929ca
GitHub-Pull-Request: golang/sys#46
Reviewed-on: https://go-review.googlesource.com/c/sys/+/208321
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-11-28 01:58:09 +00:00
Eric Biggers
63cb32ae39 unix: add new fscrypt declarations from Linux v5.4
Create Go bindings for the updated fscrypt UAPI from Linux v5.4:

- Various new ioctls.  We use the regex FS_IOC_.*ENCRYPTION to match
  both the new and existing fscrypt ioctls.

- Various new structures for passing to the ioctls

- Various new constants named like FSCRYPT_*

- FscryptPolicy was renamed to FscryptPolicyV1.  (But the old name is
  still available for source compatibility.)

- The existing fscrypt-related constants named like FS_* (besides the
  ioctls) were renamed to FSCRYPT_*.  (But the old names are still
  available for source compatibility.)

For reference, see fscrypt.h:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/fscrypt.h?h=v5.4

Fixes golang/go#35856

Change-Id: I48ddd37cfa7c1e0e7eb227baa6f220c848ddc880
Reviewed-on: https://go-review.googlesource.com/c/sys/+/208898
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-11-27 02:17:46 +00:00
Matt Layher
8a8471f7e5 unix/linux: bump Linux and Go versions to latest stable releases
Attempting to upgrade to the Ubuntu 19.10 Docker image results in
failures due to Ubuntu/Debian removing the mips{,64}{,le} cross
compilers, so we stick with 19.04 for now.

Change-Id: Ie75057447889ea1648d638a410e1c35c047b579a
Reviewed-on: https://go-review.googlesource.com/c/sys/+/208737
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-11-26 13:16:56 +00:00
Tobias Klauser
bd437916bb unix: check number of ready file descriptors in TestPselect
Like in TestSelect, check the number of ready file descriptors returned
by Pselect.

Change-Id: I4a64720092132c5ba432d6d1274df8c68bb5b6bf
Reviewed-on: https://go-review.googlesource.com/c/sys/+/207862
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-11-20 15:59:48 +00:00
Tobias Klauser
76d669a226 unix: don't fail TestSelect on EINTR from Select
Change-Id: Ie162966c830ffd86947cf4f04532a7f6741a5587
Reviewed-on: https://go-review.googlesource.com/c/sys/+/207861
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-11-20 15:59:35 +00:00
Simon Rozman
6bfc516c86 windows: add Get*PreferredUILanguages
This commit adds the following MUI functions:
- GetUserPreferredUILanguages
- GetSystemPreferredUILanguages
- GetThreadPreferredUILanguages
- GetProcessPreferredUILanguages

Change-Id: I44f1c07245ab814935778c6b910b224d24cc753c
Reviewed-on: https://go-review.googlesource.com/c/sys/+/207860
Reviewed-by: Simon Rozman <simon@rozman.si>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-11-20 13:05:36 +00:00
Tobias Klauser
f068ffe820 unix: use same TestSelect on all Unices
Also change t.Error messages to use "got foo, expected bar" notation.

Change-Id: Ia0b452f96b08cbb69a0b64cc2a467b5cf94e72da
Reviewed-on: https://go-review.googlesource.com/c/sys/+/207858
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-11-19 19:55:28 +00:00
Tobias Klauser
e882bf8e40 unix: fix EINTR check in TestPselect
err == EINTR needs to be checked before err != nil for the interrupted
syscall to be retried properly.

Follow-up for CL 207284

Updates golang/go#35555

Change-Id: I76d569058b7985ec51f07909d86807a8b4911772
Reviewed-on: https://go-review.googlesource.com/c/sys/+/207292
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-11-19 06:07:38 +00:00
Clément Chigot
cf1e2d5771 unix: regenerate zerrors for AIX
Add "sys/select.h" in order to have NFDBITS on AIX and regenerate
zerrors_aix_ppc.go and zerrors_aix_ppc64.go at the same time.

Fixes: golang/go#35635

Change-Id: Iaad62ea1faf50f4b08364f288b3c63013ac4bc6e
Reviewed-on: https://go-review.googlesource.com/c/sys/+/207657
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-11-18 13:31:27 +00:00
Alex Brainman
b5d5184f72 windows: revert security_windows.go change of CL 202177
This change is golang.org/x/sys/windows copy of CL 204117.

Updates golang/go#34972

Change-Id: I338c91bfe3971a80cbf44c2a0f1807adaa00918d
Reviewed-on: https://go-review.googlesource.com/c/sys/+/207199
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-11-18 09:04:20 +00:00
Tobias Klauser
2f86c98f34 unix: don't fail TestPselect on EINTR from Pselect
Updates golang/go#35555

Change-Id: I3efb010c8edf92a75941c6b7ec749665235020d8
Reviewed-on: https://go-review.googlesource.com/c/sys/+/207284
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-11-18 07:38:50 +00:00
Tobias Klauser
6254a7c3ca unix: fix EINTR check in TestClockNanosleep
err == EINTR needs to be checked before err != nil for the interrupted
syscall to be retried properly.

Follow-up for CL 207285

Updates golang/go#35622

Change-Id: I0f8c1a75eb96e11aaba284eb75716db044257cbd
Reviewed-on: https://go-review.googlesource.com/c/sys/+/207290
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-11-18 01:35:47 +00:00
Tobias Klauser
81af7394a2 unix: don't fail TestClockNanosleep on EINTR from ClockNanosleep
Continue the test and log the time slept in case of EINTR.

Fixes golang/go#35622

Change-Id: I4444b2500a5ae492aad27f3bcbc5f77ef3944447
Reviewed-on: https://go-review.googlesource.com/c/sys/+/207285
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-11-17 21:15:29 +00:00
Tobias Klauser
52ab431487 unix: fix EpollEvent padding on mips64{,le}
Like on other 64-bit GOARCHes, EpollEvent needs padding before Fd for
mips64 and mips64le.

Change-Id: I934368ba22ef7bf3a25949649613c2a03928bf83
Reviewed-on: https://go-review.googlesource.com/c/sys/+/207278
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-11-15 15:19:21 +00:00
Tobias Klauser
4c7a9d0fe0 unix: check correct CPU for being enabled in old mask in TestSchedSetaffinity
When checking the old affinity mask with the fix introduced in CL
137675, the wrong CPU (5 instead of 1) is checked. Correct this and also
move the call to SchedGetaffinity closer to the SchedSetaffinity call in
order to reduce the time window for CPUs to go offline.

Updates golang/go#27875
Fixes golang/go#35184

Change-Id: Ie50320c82d1334aa26764281253dc9dde066a730
Reviewed-on: https://go-review.googlesource.com/c/sys/+/206863
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-11-13 16:50:36 +00:00
Tobias Klauser
344fec8e55 cpu: don't redeclare doinit on ppc64le
Follow-up fix for CL 206859. Also order the +build line alphabetically.

Change-Id: I568c8b3ee03161d4341c151e4ec7150cade51077
Reviewed-on: https://go-review.googlesource.com/c/sys/+/206864
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-11-13 16:50:28 +00:00
Tobias Klauser
fee6b63275 unix: accept time.Now()±1 as valid in TestTime
Fixes golang/go#33200

Change-Id: I7e6e62f09174f0b214e7d021a31f1ad2166f9db5
Reviewed-on: https://go-review.googlesource.com/c/sys/+/206861
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-11-13 15:49:46 +00:00
Tobias Klauser
2f3576d2c5 cpu: add basic support for GOARCH=riscv64
Updates golang/go#27532

Change-Id: I7250f272ff46f2765d498a97644fb570ae745a6c
Reviewed-on: https://go-review.googlesource.com/c/sys/+/206860
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-11-13 15:47:02 +00:00
Tobias Klauser
e43da5d1f2 cpu: move empty doinit to own file
Avoids each GOARCH having to define an empty doinit for GOOS=linux

Change-Id: Ic7cea1be4a35c31593c4f867478194b82dd53613
Reviewed-on: https://go-review.googlesource.com/c/sys/+/206859
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-11-13 15:46:56 +00:00
Tobias Klauser
8ad3422571 unix: skip TestPselect on EINTR
Some slow builders occassionally seem to fail with:

    syscall_linux_test.go:301: Pselect: interrupted system call

Just skip the test in these cases for now.

Fixes golang/go#35555

Change-Id: I8850634fc4000bf9d0d6cce27834febc53d3fcd6
Reviewed-on: https://go-review.googlesource.com/c/sys/+/206862
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-11-13 15:03:13 +00:00
Tobias Klauser
59a1497f0c unix: test returned fd in TestEpoll
Check the fd returned in EpollEvent to detect potential padding issues.

Also, fail the test if the number of events mismatches.

Updates golang/go#35479

Change-Id: I39f856ca2c336e849876a33acffb70b82aa83c3f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/206858
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-11-12 21:41:54 +00:00
Tobias Klauser
d32e6e3b99 windows: add empty.s to fix build with Go 1.11 and earlier
CL 199519 broke the build with Go 1.11. Even though this is not an
officially supported release anymore, people still seem to rely on it
and the fix is easy enough and won't break anyone using newer, supported
Go versions.

Change-Id: I632d6840bc1f49c01c372727c9a55d2daf98f4a8
Reviewed-on: https://go-review.googlesource.com/c/sys/+/206357
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-11-10 16:31:57 +00:00
Tobias Klauser
c1f44814a5 unix: add TestEpoll on linux
This tests the epoll functionality on linux and should hopefully help
catch GOARCHes where additional padding of EpollEvent is needed (see
e.g.  CL 189877).

Change-Id: Icd19746a60a63016a5d46535a2cc557ca7a0d474
Reviewed-on: https://go-review.googlesource.com/c/sys/+/205398
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-11-05 23:10:09 +00:00
Tobias Klauser
ac3223d801 unix: add methods to manipulate *FdSet
Add Set, Clear, IsSet and Zero methods to manipulate an *FdSet. These
implement the same functionality as the FD_SET, FD_CLR, FD_ISSET and
FD_ZERO macros in <sys/select.h>.

Change-Id: I6b7bccb98e58ee5e719096ed5743f6edcd232840
Reviewed-on: https://go-review.googlesource.com/c/sys/+/205397
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-11-05 14:28:33 +00:00
Tobias Klauser
e8c54fb511 windows: add EnumProcesses function
See https://docs.microsoft.com/en-us/windows/win32/api/psapi/nf-psapi-enumprocesses

Change-Id: Ibccb0c3d8e4f32857547ee6d072d0b1cb2430366
Reviewed-on: https://go-review.googlesource.com/c/sys/+/205197
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2019-11-04 09:48:58 +00:00
Alex Brainman
f43be2a459 windows/registry: make '-gcflags=all=-d=checkptr' flag work
Mostly replaced [:x] slice operation with [:x:x]. 

This change is copy of CL 203442.

Updates golang/go#34972

Change-Id: I9b725a39aea469bd5669cc1deb3d02a88912843e
Reviewed-on: https://go-review.googlesource.com/c/sys/+/204017
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-29 15:55:21 +00:00
Matt Layher
195ce5e7f9 unix: add devlink Linux generic netlink API constants
For more information on devlink, see: https://lwn.net/Articles/674867/.

Change-Id: I68815c94160864f4a3d2bb78b2e5d06949d27acf
Reviewed-on: https://go-review.googlesource.com/c/sys/+/203878
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-28 16:43:58 +00:00
Alexander Menzhinsky
b67d8b46d2 unix: add missing HCI_CHANNEL_LOGGING constant
For more information see: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth.git/commit/?id=ac71494934c475e3f51e5e3e64a12f57618d82a4

Change-Id: If67f020c5a4ed64726d6ef35ba03d5ed100cedc4
Reviewed-on: https://go-review.googlesource.com/c/sys/+/203610
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-28 14:51:28 +00:00
Jason A. Donenfeld
f8518d3b36 windows/registry: remove TestWalkFullRegistry due to false assumptions
This test's existence was predicated upon assumptions about the full
range of known data types and known data into those types. However,
we've learned from Microsoft that there are several undocumented secret
registry types that are in use by various parts of Windows, and we've
learned from inspection that many Microsoft uses of registry types don't
strictly adhere to the recommended value size. It's therefore foolhardy
to make any assumptions about what goes in and out of the registry, and
so this test is meaningless and error-prone.

Updates golang/go#35084

Change-Id: Ie545229afd8dc5bde90fffa0f735f7102cd4a6eb
Reviewed-on: https://go-review.googlesource.com/c/sys/+/203605
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-27 21:15:39 +00:00
Tobias Klauser
33540a1f60 unix: don't use non-existing uint128 type on freebsd/arm64
CL 179099 introduced type FpReg on freebsd, on freebsd/arm64 using a
type uint128. This type doesn't exist in Go.

Change-Id: Ie7f065f38f2cc2c163abdfa7dddad886b8edbe3b
Reviewed-on: https://go-review.googlesource.com/c/sys/+/203419
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-26 07:03:38 +00:00
Jason A. Donenfeld
53bf42e6b3 windows/registry: allow for non-null terminated strings
According to MSDN, "If the data has the REG_SZ, REG_MULTI_SZ or
REG_EXPAND_SZ type, this size includes any terminating null character or
characters unless the data was stored without them. [...] If the data
has the REG_SZ, REG_MULTI_SZ or REG_EXPAND_SZ type, the string may not
have been stored with the proper terminating null characters. Therefore,
even if the function returns ERROR_SUCCESS, the application should
ensure that the string is properly terminated before using it;
otherwise, it may overwrite a buffer."

It's therefore dangerous to pass it off unbounded as we do, and in fact
this led to crashes on real systems.

Change-Id: I2ab324e85f75dc3e4d6d62fec3b96937fec77510
Reviewed-on: https://go-review.googlesource.com/c/sys/+/202957
Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2019-10-25 09:01:51 +00:00
Tobias Klauser
6c3a3bfe00 unix: make convertFromDirents11 checkptr safe
Follow CL 202878 which did the same for package syscall.

Updates golang/go#35092

Change-Id: Id53d2cde0333581c98d13b096a48f2a602b2425f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/202959
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-10-25 02:14:31 +00:00
Cuong Manh Le
b4ff53e7a1 unix: remove un-used ptrSize
Same as CL 202881.

Change-Id: Idc85bd23574c437c711b40155b49621e35ef571b
Reviewed-on: https://go-review.googlesource.com/c/sys/+/203237
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-10-24 17:25:28 +00:00
Tobias Klauser
e66fe6eb8e unix: regenerate darwin libc trampolines after CL 202837
CL 202837 forgot to properly re-generate
zsyscall_darwin_{386,amd64,arm64}.s with the correct trampoline name.

Updates golang/go#35103
Updates golang/go#34133
Updates golang/go#35101

Change-Id: I98805988f97c7ff51da858fdc36c436aa680c8c7
Reviewed-on: https://go-review.googlesource.com/c/sys/+/202958
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
2019-10-24 07:30:52 +00:00