Commit Graph

891 Commits

Author SHA1 Message Date
Sergey Ivanov
e047566fdf unix: add new setfsuid/setfsgid wrappers
Added SetfsgidRetGid and SetfsuidRetUid wrappers for corresponding
syscalls, both returning previous gid or uid set.

Fixes golang/go#36649

Change-Id: I95176f4442258ca68db79cf967fbf0bbf0a57acf
Reviewed-on: https://go-review.googlesource.com/c/sys/+/215579
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-01-22 13:43:26 +00:00
Tobias Klauser
34d275377b unix: correct PtraceIoDesc and define PtraceIoDesc per GOARCH on freebsd
CL 179099 introduced ptrace support for freebsd but it seems the
PtraceIoDesc type was not generated by cgo -godefs through mkall.sh
as it contains an uint member. Regenerate the type and adjust
PtraceIoDesc to deal with the type difference on 32-bit vs. 64-bit.

Change-Id: I1ec9662aa8e1b199ebe557387aa27827f23d9d40
Reviewed-on: https://go-review.googlesource.com/c/sys/+/215242
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-01-21 08:24:15 +00:00
Tobias Klauser
655fe14d74 unix: test (*FdSet).Clear in TestFdSet
Follow-up for CL 205397 so all *FdSet functionality is tested.

Change-Id: Ieb5dce6ad020ce1252cae7f3fe96ba6bf0069f5e
Reviewed-on: https://go-review.googlesource.com/c/sys/+/215241
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2020-01-20 15:18:20 +00:00
Brad Fitzpatrick
c1edf53553 Revert "unix: fix Setfsuid and Setfsgid return values"
This reverts commit 94506bca4f.

Reason for revert: breaking API change; I want more discussion before we do this.
 
e.g. it breaks https://github.com/search?utf8=%E2%9C%93&q=unix.Setfsuid+filename%3A*.go&type=Code&ref=advsearch&l=&l= ... like 351481c720/src/LinuxBoot/github.com/u-root/u-root/cmds/core/fusermount/fusermount_linux.go

Change-Id: I474195047f080d0b2c2178578c5f45520af96c53
Reviewed-on: https://go-review.googlesource.com/c/sys/+/215518
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2020-01-20 15:04:07 +00:00
Sergey Ivanov
94506bca4f unix: fix Setfsuid and Setfsgid return values
setfsuid(2) and setfsgid(2) both return an int value that indicates the
previous fsuid or fsgid set. This change makes unix.Setfsgid() and
unix.Setfsuid() return these values too instead of returning only an
error.

Fixes golang/go#36649

Change-Id: I56cbb49d7485023b6b04f7b95e8f675473241d8c
Reviewed-on: https://go-review.googlesource.com/c/sys/+/215240
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2020-01-20 14:57:06 +00:00
Tobias Klauser
59e60aa80a cpu: don't read ARM64 registers on Android
It seems like on Android we're not allowed in all cases to read the
registers ISAR0, ISAR1 and PFR0 to detect CPU features.

Fixes golang/go#36622

Change-Id: I577bd928a5a4dcd6e908cf059faa15fc0c80e3e5
Reviewed-on: https://go-review.googlesource.com/c/sys/+/215237
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2020-01-17 14:54:32 +00:00
maltalex
b77594299b windows: add missing network-related constants
Change-Id: I75c432e527c42bdf3c91e07590a143c67d9a97a3
GitHub-Last-Rev: d738e281e2
GitHub-Pull-Request: golang/sys#53
Reviewed-on: https://go-review.googlesource.com/c/sys/+/214997
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-01-16 00:19:09 +00:00
Tobias Klauser
86b910548b unix: add missing chtmpdir in TestPpoll on openbsd
This ensures the the fifos are created in a temporary directory.

Change-Id: I744122207700e77a7a180d4f61336a93f3e5efca
Reviewed-on: https://go-review.googlesource.com/c/sys/+/214479
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2020-01-13 16:29:24 +00:00
Tobias Klauser
548cf772de unix: add SysctlClockinfo on dragonfly and freebsd
Change-Id: I0d439b5c59c79594c6ecfebe0375971e1344cc09
Reviewed-on: https://go-review.googlesource.com/c/sys/+/213400
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-01-07 16:21:24 +00:00
Tobias Klauser
ef85f5a75d unix: add Inet4Pktinfo type on solaris
Change-Id: I4f18b5d98697120a16b56657a012d7ab5fe1b83c
Reviewed-on: https://go-review.googlesource.com/c/sys/+/213399
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-01-07 14:46:01 +00:00
Tobias Klauser
b016eb3dc9 unix: test UtimesNanoAt on *bsd and solaris
Move TestUtimesNanoAt to syscall_unix_test.go. All BSDs and
solaris/illumos provide UtimesNanoAt. The implementations on linux and
darwin are already the same and the type conversions of Timespec members
on aix should no longer be necessary since CL 177838.

Change-Id: If0d03a92b3167da08191b6e98888eec92f27c3c9
Reviewed-on: https://go-review.googlesource.com/c/sys/+/213398
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2020-01-06 16:20:15 +00:00
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