Commit Graph

974 Commits

Author SHA1 Message Date
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
Tobias Klauser
ed371f2e16 unix: adjust statfs_freebsd11_t member types on freebsd/arm
Follow-up for CL 239060.

Otherwise the types don't match when copy()'ing in (*Statfs_t).convertFrom

Change-Id: I8b05247d01e1ac120ea378806793dc1c996f9a4b
Reviewed-on: https://go-review.googlesource.com/c/sys/+/239397
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-06-22 21:40:17 +00:00
Tobias Klauser
4b0db7f3f7 unix: adjust Statfs_t member types on freebsd/arm
CL 223698 changed the types of the Fstypename, Mntfromname and Mntonname
fields of type Statfs_t on freebsd/{386,amd64,arm64}, but didn't do so
on freebsd/arm. Since reverting that change now would probably cause
more harm than good, at least make the type consistent on all supported
freebsd/$GOARCH combinations.

Change-Id: I66ba3cdb0290177898237a47d305abb9adc97954
Reviewed-on: https://go-review.googlesource.com/c/sys/+/239060
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-06-22 18:24:13 +00:00
Tobias Klauser
981b61492c unix: check secondary group membership for Faccessat(..., AT_EACCESS) on Linux
Follow glibc's implementation and check secondary group memberships
using Getgroups.

No test since we cannot easily change file permissions when not running
as root and the test is meaningless if running as root.

Fixes golang/go#39660

Change-Id: Idb841242cbd1d8859f4e3c2c26b64a5e9523f9a4
Reviewed-on: https://go-review.googlesource.com/c/sys/+/238722
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-06-20 08:12:46 +00:00
Tobias Klauser
f1bc736245 cpu: adjust godoc comment for hostByteOrder
This was changed in CL 194646 to no longer depend on the encoding/binary
package. Adjust the godoc comment as well.

Change-Id: I1f23dc83a4c1256ebce8a283623f79e1bd00da51
Reviewed-on: https://go-review.googlesource.com/c/sys/+/238037
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-06-15 20:00:32 +00:00
Tobias Klauser
2780627062 cpu: add all GOARCHes supported by gccgo
Extend hostByteOrder to return the correct byte order for all GOARCHes
currently supported by gccgo.

Change-Id: I019de33aa598c58fe75cd7ad55479e6fce82dd8e
Reviewed-on: https://go-review.googlesource.com/c/sys/+/237897
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-06-15 19:00:26 +00:00
Awn Umar
226ff32320 windows: add process working size system calls
Fixes golang/go#39422
Related to https://github.com/awnumar/memcall/issues/3

Change-Id: Idf3eec42c3077b39fe033091eea6d62b6a9d8d32
GitHub-Last-Rev: 7f57085a5f
GitHub-Pull-Request: golang/sys#72
Reviewed-on: https://go-review.googlesource.com/c/sys/+/236680
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2020-06-10 11:11:08 +00:00
Ingo Gottwald
6fdc65e7d9 unix: add ioctl wrappers for RTC wake alarm on Linux
Add wrappers to set and get RTC wake alarm on Linux via the
RTC_WKALM_SET and RTC_WKALM_RD ioctls.

Change-Id: I98c36b2252b2fe65cfaba5dde879f6019ff1ae91
GitHub-Last-Rev: a78d0f4193
GitHub-Pull-Request: golang/sys#71
Reviewed-on: https://go-review.googlesource.com/c/sys/+/236140
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-06-02 22:51:09 +00:00
Tobias Klauser
8d3cce7afc unix: update Dockerfile to Linux 5.7 and Go 1.14.4
Some BPF related macros were converted to enum values, so add them to
linux/types.go

Change-Id: I6fa9cc17b6ff3be91f3aa0b7ef2cfe19faf069bd
Reviewed-on: https://go-review.googlesource.com/c/sys/+/236097
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2020-06-02 10:08:48 +00:00
Benny Siegert
0598657881 cpu: avoid illegal instruction on netbsd/arm64
On NetBSD, this package tries to read a privileged register,
which results in a SIGILL. Use the same workaround as Android and
iOS. In the future, we could use sysctl(3) instead.

Update golang/go#30824

Change-Id: Ifd9aa2a2cf4dac43341d013602d1ccb4b8d6eb6d
Reviewed-on: https://go-review.googlesource.com/c/sys/+/235097
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-05-23 22:24:54 +00:00
Yaroslav Vorobiov
fe76b779f2 windows: fix -d=checkptr slice failures
This CL fixes unsafe casts to slices that are missing length or capacity.

Running tests with -d=checkptr enabled may panic on casting unsafe.Pointer to a static array of large predefined length, that is most likely much bigger than the size of the actual array in memory. Checkptr check is not satisfied if slicing operator misses length and capacity arguments `(*[(1 << 30) - 1]uint16)(unsafe.Pointer(p))[:]`, or when there is no slicing at all `(*[(1 << 30) - 1]uint16)(unsafe.Pointer(p))`.

To find all potential cases I used `grep -nr ")(unsafe.Pointer(" ./windows`, then filtered out safe casts when object size is always static and known at compile time.

To reproduce the issue run tests with checkptr enabled `go test -a -gcflags=all=-d=checkptr ./windows/...`.

Updates golang/go#34972
Fixes golang/go#38355

Change-Id: I9dd2084b4f9fb7618cdb140fb2f38b56b6d6cc04
GitHub-Last-Rev: 73288ad18a
GitHub-Pull-Request: golang/sys#65
Reviewed-on: https://go-review.googlesource.com/c/sys/+/225418
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2020-05-19 10:57:57 +00:00
Clément Chigot
1151b9dac4 cpu: add support for gccgo on aix
Change-Id: Icb963d94baf7a1876ce89d0c5fe8cee04bb50629
Reviewed-on: https://go-review.googlesource.com/c/sys/+/233717
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2020-05-15 09:58:57 +00:00
Tobias Klauser
417ce2331b unix: add kern.ncpuonline sysctl on openbsd
This is available since OpenBSD 6.4

Generated using mksysctl_openbsd.go on OpenBSD 6.6. but only added
kern.ncpuonline for now.

Change-Id: I092f980180154c2d0fe3f67ab747af64b58c28db
Reviewed-on: https://go-review.googlesource.com/c/sys/+/233757
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2020-05-13 11:23:37 +00:00
Zhang Boyang
7e40ca221e windows: implement GetsockoptInt
Change-Id: If0b17ccaba5c5d1e07499c222eb3f4c45a094636
GitHub-Last-Rev: a0fb2fc43d
GitHub-Pull-Request: golang/sys#70
Reviewed-on: https://go-review.googlesource.com/c/sys/+/233200
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-05-11 23:29:37 +00:00
ly303550688
6aff5f38e5 windows: add (*DLL).FindProcByOrdinal
Change-Id: I0b0ef2c62994fad4d89bf15c8c6c95fa660190c3
GitHub-Last-Rev: 379ab4a0f5
GitHub-Pull-Request: golang/sys#69
Reviewed-on: https://go-review.googlesource.com/c/sys/+/227439
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2020-05-09 04:47:56 +00:00
Tobias Klauser
3aab700007 unix: call gettimeofday libc function directly
This also works when invoking the raw syscall on Go ≤ 1.11

Fixes golang/go#38925

Change-Id: I137532da92b457a6853ed1be87c0aa72d2b2c886
Reviewed-on: https://go-review.googlesource.com/c/sys/+/232803
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-05-08 21:44:44 +00:00
Tobias Klauser
bc7a7d42d5 internal/unsafeheader: fix typos in comments
The typos in the package godoc comment were pointed out in CL 231223
which added similar functionality to the main Go repository. Also
correct the name in the godoc comment for type String.

Change-Id: I69910f3e24b1222190e1adf7fc3d425f0006f96e
Reviewed-on: https://go-review.googlesource.com/c/sys/+/231517
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-05-01 14:52:40 +00:00
Elias Naur
10377860bb unix: replace blocked dup2 calls with dup3 on Android
Android O and newer blocks access to the dup2 syscall. Route calls
to Dup2 to Dup3.

Change-Id: I76c0180db260ece4840b8ebf2736fb3f8c7ff9eb
Reviewed-on: https://go-review.googlesource.com/c/sys/+/231277
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-05-01 05:29:02 +00:00