Граф коммитов

991 Коммитов

Автор SHA1 Сообщение Дата
Tobias Klauser e10f822d58 unix: import accept4 from libsocket.so on illumos
The accept4 symbol is provided in libsocket.so on illumos. Follow-up fix
for CL 254717.

Change-Id: Iad70e998ea4ab80763288a300797eae8bed7de1a
Reviewed-on: https://go-review.googlesource.com/c/sys/+/256277
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-09-22 07:02:05 +00:00
Tobias Klauser cb7fb32132 unix: allow overriding GOOS using GOOS_TARGET in mksyscall.go
The syscall wrapper generator utility is platform independent and can in
principle be run on a GOOS other than the one we're generating the
syscall wrappers for. Allow overriding GOOS by setting GOOS_TARGET,
similar to other generator programs in the repo.

Also remove the unused GOARCH_TARGET override in the same file.

Change-Id: I91459113af9f662f12a99b99c581c7f2615cb394
Reviewed-on: https://go-review.googlesource.com/c/sys/+/256278
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-09-22 07:01:10 +00:00
Tobias Klauser af09f7315a unix: add FcntlFstore on darwin
This allows to perform a fcntl syscall with the F_PREALLOCATE command.
See man fcntl(2) on macOS for details.

Change-Id: I21f95b91269513064859425ab7adc42a73d6adb5
Reviewed-on: https://go-review.googlesource.com/c/sys/+/255917
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-09-18 17:44:21 +00:00
Tobias Klauser efd3b9a0ff unix: skip TestClonefile* on ENOSYS or ENOTSUP
The clonefile syscalls added by CL 254757 might fail on certain macOS
versions and/or file systems according to the clonefile(2) manpage. Skip
the corresponding tests in these cases.

This fixes the test failure on the darwin-amd64-10_12 builder.

Change-Id: Iae1d2b6d8e2fcddc129d639f003fbb1817b45006
Reviewed-on: https://go-review.googlesource.com/c/sys/+/255198
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-09-17 07:31:48 +00:00
Tobias Klauser 648f2a0390 unix: add clonefile flags for clonefile syscalls on darwin
These are used with the flags parameter of
Clonefile/Clonefileat/Fclonefileat added by CL 254757.

Change-Id: Ia869315f319003c366f201f82a04b5801be08993
Reviewed-on: https://go-review.googlesource.com/c/sys/+/255197
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-09-17 06:19:48 +00:00
Tobias Klauser dbad9cb7cb unix: add Pipe2 on illumos
Change-Id: Ib8d259c16b2ea4081f5ee8d927ef8658315268b8
Reviewed-on: https://go-review.googlesource.com/c/sys/+/254979
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-09-16 08:47:44 +00:00
Stan Hu 2334cc1a13 unix: add Darwin support for clonefile syscalls
This commit adds support for three Darwin-specific calls that accelerate
the copying of files:

* clonefile()
* clonefileat()
* fclonefileat()

Fixes golang/go#41366

Change-Id: I7e6c525fc23d8474ea85feff24314d3d672d87ed
Reviewed-on: https://go-review.googlesource.com/c/sys/+/254757
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>
Trust: Tobias Klauser <tobias.klauser@gmail.com>
2020-09-16 03:07:50 +00:00
Lewis Waddicor 288bc346aa windows: support service PreShutdown service control signal
This adds support for the PreShutdown signal indicating the system will
be shutting down. This allows services which need time to shutdown
gracefully to use SERVICE_ACCEPT_PRESHUTDOWN to register for
SERVICE_CONTROL_PRESHUTDOWN events.

https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nc-winsvc-lphandler_function_ex?redirectedfrom=MSDN

Change-Id: I380d366d49ff380972c1efe83f43610b30432f35
GitHub-Last-Rev: db8ea88b25
GitHub-Pull-Request: golang/sys#85
Reviewed-on: https://go-review.googlesource.com/c/sys/+/253477
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Daniel Martí <mvdan@mvdan.cc>
2020-09-15 08:46:02 +00:00
Tobias Klauser 6d893a6b69 unix: add Accept4 on illumos
Wrap the accept syscall which is available on illumos.

Also use tabs instead of spaces in the //sys comments in
syscall_illumos.go

Change-Id: Ic7fbfe29b44c6a168b9be4d4679a6321cc891bf1
Reviewed-on: https://go-review.googlesource.com/c/sys/+/254717
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Trust: Tobias Klauser <tobias.klauser@gmail.com>
2020-09-15 05:08:20 +00:00
Kir Kolyshkin eff7692f90 unix: add openat2 for linux
openat2 is a new syscall added to Linux 5.6. It provides a superset of
openat(2) functionality, extending it with flags telling the kernel how
to resolve the paths.

For more info, see https://lwn.net/Articles/803237/

NOTE that this is a second attempt to add the call; the previous one
(https://golang.org/cl/227280) was reverted
(https://golang.org/cl/227846) due to the test case failure on ARM
(https://golang.org/issue/38357).

This CL has the test case reworked to be less assumptive to the testing
environment. In particular, it first tries if the most simplistic
openat2() call succeeds, and skips the test otherwise. It is done that
way because CI can be under under different kernels and in various
envrionments -- in particular, Docker+seccomp can result in EPERM from a
system call (which is not expected otherwise).

For previous discussions about the test case, see
https://golang.org/cl/227865.

Change-Id: I4276cf13dc29ecbdbdc9c58da0f76270f585a67f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/253057
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2020-09-09 08:10:42 +00:00
Tobias Klauser d2e65c121b unix: update Dockerfile to Go 1.15.1
Change-Id: Ia1a7cecc953968e04e710b065668ec9d06c2c1d3
Reviewed-on: https://go-review.googlesource.com/c/sys/+/253437
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2020-09-08 13:41:30 +00:00
Alex Brainman be1d3432aa windows: add TestJobObjectInfo
Add test for CL 251197.

Updates golang/go#41001

Change-Id: I6317678057eb8b18a1f7564842a92682c0c9930f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/253097
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-09-05 00:46:54 +00:00
Ian Lance Taylor e0c6998df7 windows: use GOARCH-specific JOBOBJECT_BASIC_LIMIT_INFORMATION
The Windows compilers appear to align JOBOBJECT_BASIC_LIMIT_INFORMATION
to an 8-byte boundary, which on 32-bit systems means adding 32 bits of
padding. Unfortunately we can't always add a padding field, because
no padding is required on a 64-bit system. So use different versions
of the struct for different targets.

Fixes golang/go#41001

Change-Id: I38d14edfd3f3a80da22825455f20e1f7de136638
Reviewed-on: https://go-review.googlesource.com/c/sys/+/251197
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Marc-Antoine Ruel <maruel@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2020-09-05 00:46:41 +00:00
Tobias Klauser 196b9ba873 unix: re-add SYS___SYSCTL on darwin
CL 250437 removed all SYS_* consts on darwin as direct syscalls are no
longer supported on this platform. However, some external packages (e.g.
github.com/shirou/gopsutil) still seem to rely on SYS___SYSCTL being
defined to implement their own sysctl wrappers. Re-add SYS___SYSCTL to
avoid breaking these packages.

Change-Id: I1ef1c05ba47a4b89be61ee8919d1651b7531d9c7
Reviewed-on: https://go-review.googlesource.com/c/sys/+/251738
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2020-08-31 18:03:12 +00:00
Tobias Klauser 157a740278 unix: fix build with Go 1.12 on darwin
CL 250437 broke the build with Go 1.12 on darwin, due to
SYS_GETDIRENTRIES64 being removed. However, this is still needed to
implement Getdirentries for Go 1.12 because it does not provide
syscall_syscallPtr for fdopendir. Thus, add _SYS_GETDIRENTRIES64 as an
unexported const.

Change-Id: I52b420095deeb50d7fac002702dfce01cbf34bb7
Reviewed-on: https://go-review.googlesource.com/c/sys/+/251317
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2020-08-28 19:40:41 +00:00
Tobias Klauser c663848e9a unix: remove darwin direct syscall special case from mksyscall.go
Since CL 250437 this package no longer supports non-libc, direct
syscalls. Thus the corresponding special cases can be removed from
the generating mksyscall.go program.

Change-Id: I54be144de8ffd483f10c7b3a69b0761b83542c55
Reviewed-on: https://go-review.googlesource.com/c/sys/+/251318
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-08-28 16:14:17 +00:00
Stephan Klatt 8dfe04af21 unix: add constants for raw CAN sockets
Fixes golang/go#41091

Change-Id: Icae9ad639599474144b286510f744f4a283aba06
GitHub-Last-Rev: 541bdb97bb
GitHub-Pull-Request: golang/sys#83
Reviewed-on: https://go-review.googlesource.com/c/sys/+/251357
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-08-28 15:00:25 +00:00
Stephan Klatt 131dc92a58 unix: add CAN error constants
Fixes golang/go#41067

Change-Id: I110ed054074c9173911ce36009087bf1d0dc9499
GitHub-Last-Rev: 2309ec0882
GitHub-Pull-Request: golang/sys#82
Reviewed-on: https://go-review.googlesource.com/c/sys/+/251037
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2020-08-28 08:12:04 +00:00
Tobias Klauser 6fcdbc0bbc unix: drop support for pre-1.12 direct syscalls on darwin
Go 1.12 and newer are using libSystem for syscalls on darwin.
Go 1.11 is the last release to use direct syscalls. It hasn't been
supported since the release of Go 1.13 in September 2019, so drop
support for direct syscalls.

Change-Id: I2baf6f3d1031de8e474dc770369a25147e5efe2a
Reviewed-on: https://go-review.googlesource.com/c/sys/+/250437
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2020-08-28 08:09:24 +00:00
Joel Sing f9321e4c35 unix: add support for openbsd/mips64
Update golang/go#40995

Change-Id: Ic5cbeea2a4b54bd047a8bffab8eb84579854fce3
Reviewed-on: https://go-review.googlesource.com/c/sys/+/250119
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2020-08-26 17:35:25 +00:00
Tobias Klauser c12d262b63 unix: cap RLIMIT_NOFILE soft limit in TestRlimit on darwin
On some machines, kern.maxfilesperproc is 4096. If Rlimit.Cur is larger
than that, Setrlimit will get an errEINVAL.

Same as CL 246658 did in package syscall.

Updates golang/go#40564

Change-Id: I8c45a23352fa2039772e04205680640e8a0e1840
Reviewed-on: https://go-review.googlesource.com/c/sys/+/250000
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2020-08-24 13:15:25 +00:00
Tobias Klauser 2bddbd2f0c unix: make IoctlSetPointerInt available on all platforms
This may be used with unix.TIOCSPGRP which is available on platforms
other than linux.

Fixes golang/go#40986

Change-Id: Ic96b119e68395e5b6c5f33504ad40f3dfd4804f7
Reviewed-on: https://go-review.googlesource.com/c/sys/+/250001
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2020-08-24 13:14:58 +00:00
Stephan Klatt fda516888d unix: fix AF_CAN tests for big endian systems
see discussion in https://go-review.googlesource.com/c/sys/+/248977

Change-Id: I25dff34d2a6587d0b02836d7e2c9c40e08378731
GitHub-Last-Rev: 33cf644d65
GitHub-Pull-Request: golang/sys#81
Reviewed-on: https://go-review.googlesource.com/c/sys/+/249743
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: Matt Layher <mdlayher@gmail.com>
2020-08-21 14:05:26 +00:00
Shengjing Zhu 1fb7954272 unix: fix redefinition of seek func on arm and gccgo
Change-Id: Ia23cb723766e9d76d51c24ace0157f47cb5b34ae
Reviewed-on: https://go-review.googlesource.com/c/sys/+/249617
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2020-08-20 21:24:57 +00:00
Joel Sing e2d4c690b9 unix: remove pim sysctl/headers from mksysctl_openbsd.go
PIM support was removed from OpenBSD in 2016 and as such, the referenced headers
and sysctl names no longer exist.

Change-Id: I7f3e63741b0d4acb8a43e3615b86381f8071e836
Reviewed-on: https://go-review.googlesource.com/c/sys/+/249618
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2020-08-20 21:17:46 +00:00
Joel Sing d785dc2583 cpu: add missing build tag for linux
The code in this file is specific to linux and does not build on other
mips64x platforms.

Change-Id: Ic27eedf06f39a7d2c51f5b261d957eed04e5df0b
Reviewed-on: https://go-review.googlesource.com/c/sys/+/249318
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-08-19 17:11:15 +00:00
Ricardo Pchevuzinske Katz 7c7a221682 unix: add nftables_compat defines and types
Some types from nftables compatibility header are missing
in unix package and this change adds those missing types

Fixes golang/go#40898

Change-Id: I9a33aa4e4c6e1938fa40900ac74c1fc07ed00df2
GitHub-Last-Rev: 57a6fa7ca7
GitHub-Pull-Request: golang/sys#80
Reviewed-on: https://go-review.googlesource.com/c/sys/+/249237
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2020-08-19 14:11:00 +00:00
Stephan Klatt 39769834ee unix: extend AF_CAN socket support
Fixes golang/go#40842

Change-Id: Icbb8f89e241d6990c06ee805e3dabeeb99750c8e
GitHub-Last-Rev: 3609620203
GitHub-Pull-Request: golang/sys#78
Reviewed-on: https://go-review.googlesource.com/c/sys/+/248977
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2020-08-19 09:14:47 +00:00
Paweł Szulik 9a32b3aa38 unix: add missing PERF_SAMPLE values
This adds missing `sample_type` options from: https://man7.org/linux/man-pages/man2/perf_event_open.2.html

Change-Id: Icc17151f973d9a9f327bd6ca064e94ccc29e741c
GitHub-Last-Rev: 46e519b84c
GitHub-Pull-Request: golang/sys#79
Reviewed-on: https://go-review.googlesource.com/c/sys/+/249157
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-08-19 03:55:08 +00:00
Matt Layher 9781c653f4 unix: remove duplicate comment regarding sockaddr conversions
Change-Id: Ib916857732274ec4a7e425a9038b8435bccd5d9a
Reviewed-on: https://go-review.googlesource.com/c/sys/+/248779
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2020-08-17 15:53:16 +00:00
Christian Svensson cc1be6b9e0 unix: allow non-padded SockaddrIUCV
This was the intention from the start, but due to a logic error in the
handling of slices the implementation only handled minimum 8 character
strings.

This commit also improves the tests.

Change-Id: I6b0ed00bbd8a2faf90ca4a3ebe6218d3c5d6e8bf
GitHub-Last-Rev: 5b6dbc0682
GitHub-Pull-Request: golang/sys#77
Reviewed-on: https://go-review.googlesource.com/c/sys/+/248778
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-08-17 15:41:07 +00:00
Christian Svensson 3ff754bf58 unix: add AF_IUCV and SockaddrIUCV
On z series machines the IUCV address family is used to communicate
between parts of the machine and other VMs that may be running.

This adds support for addressing these services using AF_IUCV.

Fixes golang/go#40826

Change-Id: I3aba3beb5cb98d9c548d7abc874ca86fb25c8a52
GitHub-Last-Rev: b964d186b4
GitHub-Pull-Request: golang/sys#76
Reviewed-on: https://go-review.googlesource.com/c/sys/+/248777
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2020-08-17 08:59:35 +00:00
Anatol Pomozov 3d37ad5750 unix: add dm-ioctl constants and types
This interface is used by devicemapper framework to manage its block
devices.

Change-Id: If86a679461867dac18b56bdf005567ffc4b7f951
Reviewed-on: https://go-review.googlesource.com/c/sys/+/247437
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-08-14 20:00:57 +00:00
Tobias Klauser 6a926be9bd unix: update Dockerfile to Go 1.15
Change-Id: Ic3deb101db06686ccecdda679e715782df11b895
Reviewed-on: https://go-review.googlesource.com/c/sys/+/248137
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-08-12 15:58:32 +00:00
Tobias Klauser 1b9f1253b3 unix: update Dockerfile to Go 1.15rc2
Change-Id: I830933bb7d6b2e6683f6f7b135d015f54fbcaded
Reviewed-on: https://go-review.googlesource.com/c/sys/+/247657
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2020-08-10 15:15:05 +00:00
Tobias Klauser 1030fc2bf1 unix: update BPF consts to Linux kernel 5.8
Change-Id: I81fe749808d48bfafdaf55c266168f9d3a773294
Reviewed-on: https://go-review.googlesource.com/c/sys/+/247158
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2020-08-08 12:01:58 +00:00
Tobias Klauser 5acd03effb unix: update Dockerfile to glibc 2.32
Change-Id: Ia5ebb34a743c6e676d3cb2febaefc55afa9fc7ac
Reviewed-on: https://go-review.googlesource.com/c/sys/+/247157
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2020-08-06 12:55:47 +00:00
Tobias Klauser a37d78b922 unix: check Faccessat2 returning EPERM in Faccessat
Some systems (e.g. the linux-arm and linux-arm64-packet builders) return
EPERM instead of ENOSYS on unimplemented syscalls. Fall back to the
existing glibc-like implementation in Faccessat in this case as well.

This fixes tests on the linux-arm and linux-arm64-packet builders after
CL 246537.

Change-Id: I7d7598f9694a2db19bd17e79f333d5de3a31c6e2
Reviewed-on: https://go-review.googlesource.com/c/sys/+/246817
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-08-06 06:09:01 +00:00
Tobias Klauser fcf3340312 unix: add SI_LOAD_SHIFT on Linux
This is used to convert the loadavg values read using Sysinfo into
float.

Change-Id: I3866c17c908a463373db89690152acc720c73ef3
Reviewed-on: https://go-review.googlesource.com/c/sys/+/246897
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-08-06 06:08:41 +00:00
Polina Osadcha 0cf7623e9d cpu: add GODEBUG options to disable use of instruction set extensions
The GODEBUG environment variable can be used to disable usage of
specific processor features of Go programs that use the sys/cpu package.
This is useful for testing and benchmarking different code paths that
are guarded by sys/cpu variable checks.

Use of processor features can not be enabled through GODEBUG.

To disable usage of AVX and SSE41 cpu features on GOARCH amd64 use:
GODEBUG=cpu.avx=off,cpu.sse41=off

The special "all" option can be used to disable all options:
GODEBUG=all=off

This aligns the support of GODEBUG for sys/cpu with existing support
for GODEBUG in the Go standard library package internal/cpu.

Fixes golang/go#33963

Change-Id: I618b71af397bf06c57a49b2a300d032a16d05664
Reviewed-on: https://go-review.googlesource.com/c/sys/+/245237
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2020-08-05 06:55:43 +00:00
Tobias Klauser 64077c9b56 unix: add Faccessat2 and use it in Faccessat if available
Linux kernel 5.8 added the faccessat2 syscall taking a flags argument.
Attempt to use it in Faccessat and fall back to the existing
implementation mimicking glibc faccessat.

Tested on Debian Buster with manually built Linux kernel 5.8

Suggested by Ian Lance Taylor.

Change-Id: Ia14f744a63dde7ff2dea34935cabc62937de9cb5
Reviewed-on: https://go-review.googlesource.com/c/sys/+/246537
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-08-03 21:05:38 +00:00
Tobias Klauser fd5f0c170a unix: update Dockerfile to Linux 5.8
Change-Id: If6643e7e092c5d482f9cefe838640ebcec22188e
Reviewed-on: https://go-review.googlesource.com/c/sys/+/246417
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2020-08-03 15:09:36 +00:00
Alex Brainman 4b90ce9b60 windows/svc: align stack in servicemain before calling syscall
I noticed that we call syscall in servicemain without aligning stack.
That is against Windows rules, so align the stack as required.

I tried running this code with specifically non-aligned stack (I aligned
stack, and then subtracted 1 from SP) on my Windows 10 to test this
change. But it makes no difference on my Windows 10 PC - I built and run
golang.org/x/sys/windows/svc/example, and it runs successfully
regardless of stack alignment. But alignment might make difference on
other computers.

Maybe fixes golang/go#40160

Change-Id: I351f7f730fba4aa6dc409a79de4ad737b4a0a7d4
Reviewed-on: https://go-review.googlesource.com/c/sys/+/246317
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-08-02 09:19:54 +00:00
Tobias Klauser 3e129f6d46 unix: add CPU states constants on netbsd
Generated on NetBSD 9.0

Also add the sys/sched.h include in includes_FreeBSD in mkerrors.sh
which was missing in CL 244518.

Change-Id: I257e103849f9e0c6bbf1061eaaa187e277188f84
Reviewed-on: https://go-review.googlesource.com/c/sys/+/245217
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
2020-07-28 10:24:40 +00:00
Tobias Klauser 2d971f7391 unix: update Dockerfile to Go 1.15rc1
This verifies that go tool cgo -godefs in Go 1.15 is able to generate all
consts and types in this package.

Change-Id: Ic63d15427f27527d7a6f8dc780ab560cde434bc8
Reviewed-on: https://go-review.googlesource.com/c/sys/+/244977
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2020-07-27 15:44:30 +00:00
Tobias Klauser 0e2f3a6983 unix: add CPU states constants on freebsd
Generated on FreeBSD 12.1

Change-Id: Ieb622638b85b930d748a04d92efeeaef0502eb33
Reviewed-on: https://go-review.googlesource.com/c/sys/+/244518
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2020-07-24 16:12:37 +00:00
Tobias Klauser 76b94024e4 unix: add SysctlTimeval on *bsd and darwin
Change-Id: I18daa353d101e6636a732288c8276d9f68d25f90
Reviewed-on: https://go-review.googlesource.com/c/sys/+/244237
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2020-07-22 17:55:00 +00:00
Tobias Klauser a8459c1583 unix: add CPU states constants on openbsd
Generated on OpenBSD 6.6

Change-Id: I1b9f609efe186fc2af5252613556a48eeacbe975
Reviewed-on: https://go-review.googlesource.com/c/sys/+/244217
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2020-07-22 17:53:23 +00:00
Tadeo Kondrak cb9d2d5c56 unix: add ProcessVMReadv and ProcessVMWritev on linux
These are Linux-specific system calls for efficiently reading and
writing memory in foreign processes.

A new RemoteIovec type is added for use in these wrappers, as Iovec's
Base field is a pointer, and creating invalid pointers is invalid in
Go.

Change-Id: I329501ab7b4df9d0aebe289369d3a5f77120af02
GitHub-Last-Rev: 262aabed02
GitHub-Pull-Request: golang/sys#74
Reviewed-on: https://go-review.googlesource.com/c/sys/+/243497
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-07-20 21:16:30 +00:00
Tobias Klauser ddb9806d33 unix: add FS_IOC_SETFLAGS on linux
Change-Id: I455c008a114a017a6ecedb134f9af17d14dd249b
Reviewed-on: https://go-review.googlesource.com/c/sys/+/240037
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2020-06-25 21:21:54 +00:00