Commit Graph

961 Commits

Author SHA1 Message Date
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
Bryan C. Mills
d923437fa5 unix: use a type equivalent to reflect.SliceHeader to manipulate slices
The regression test included in this change verifies that the type is,
in fact, equivalent, while allowing the actual header definitions to
avoid importing the (relatively heavy) "reflect" package itself.

This change is loosely based on Keyan Pishdadian's draft in CL 230557.

For golang/go#37805

Change-Id: I998c69cdeb852154cd66ab5fdaa542a6f19666a2
Reviewed-on: https://go-review.googlesource.com/c/sys/+/231177
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2020-04-30 20:27:03 +00:00
Maxim Pugachev
1f56873058 unix: add support for timerfd syscalls on Linux
timerfd_create, timerfd_gettime and timerfd_settime syscalls have been added.
Fixes golang/go#38733

Change-Id: I306d68103b6efb2515c74f384646210c4b68f66e
Reviewed-on: https://go-review.googlesource.com/c/sys/+/230798
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2020-04-30 08:24:07 +00:00
Maxim Pugachev
593003d681 unix: switch to Ubuntu 20.04 in Dockerfile
ubuntu:19.04 is not supported anymore and update repos are unavailable, so
build process on Linux just fails. Latest stable ubuntu:20.04 works fine.
Also, DEBIAN_FRONTEND=noninteractive env variable has been added to prevent
unneeded questions during installation of tzdata package.

Fixes golang/go#38724

Change-Id: I2d7730d83fc051de2879d4f97fc7942090d2574c
Reviewed-on: https://go-review.googlesource.com/c/sys/+/230577
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-28 20:04:54 +00:00
Tobias Klauser
3771e69a9a unix: on linux-arm64, prefer prlimit to {g,s}etrlimit
Do the same as CL 230339 did for package syscall:

Reportedly some Docker images accept the prlimit64 system call,
used by syscall.prlimit, but prohibit the getrlimit and setrlimit
system calls.

Updates golang/go#38604

Change-Id: I4fc9197d7b037c2f375e50b149701316a36023f3
Reviewed-on: https://go-review.googlesource.com/c/sys/+/230478
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2020-04-28 19:36:00 +00:00
Tobias Klauser
29b5707901 unix: add SockaddrUnix tests on darwin and *bsd
Change-Id: I65b4c1073208079ea5ac28d21c829ecf28e28d84
Reviewed-on: https://go-review.googlesource.com/c/sys/+/229878
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2020-04-27 17:57:16 +00:00
Tobias Klauser
1957bb5e6d unix: add SockaddrUnix tests on linux
Follow the existing examples of the SockaddrTIPC and SockaddrL2TPIP{,6}
tests.

Handling of abstract socket addresses is different on linux than on
other platforms, thus these are currently linux-specific.

Change-Id: I66686d979e1dd317ab7a8a6dd85f98e670ad89b6
Reviewed-on: https://go-review.googlesource.com/c/sys/+/228764
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2020-04-20 16:35:11 +00:00
Andrew Bonventre
669c56c373 Revert "unix: add openat2 for linux"
This reverts CL 227280.

Reason for revert: causes failures on ARM builders

Fixes golang/go#38357

Change-Id: Ie80ff37205ff12c3b74d00ff46b7222e34363d86
Reviewed-on: https://go-review.googlesource.com/c/sys/+/227846
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2020-04-13 16:56:38 +00:00
Tobias Klauser
59c9f1ba88 unix: update Dockerfile to Go 1.14.2
Go 1.14.2 fixes golang/go#37621 which allows the Go types to be
generated properly again.

Change-Id: I556c7dd37713d68ef6aad79adc33b2d227e8bbd3
Reviewed-on: https://go-review.googlesource.com/c/sys/+/227678
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-09 09:22:40 +00:00
Neeilan Selvalingam
ea54a3c99b unix: fix name of generated zerrors_*.go in README
Change-Id: I31b9003abfe67ca2cbb9fc8ed68f612bf24cbfc0
Reviewed-on: https://go-review.googlesource.com/c/sys/+/227539
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-04-08 04:01:46 +00:00
Tobias Klauser
e3b113bbe6 unix: add nexthop types and consts
Fixes golang/go#38249

Change-Id: Ie8149ac16d09e76d6c5aa4d47edd947a647c381f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/227357
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-04-06 15:51:08 +00:00
Kir Kolyshkin
c6e801f48b unix: add openat2 for linux
openat2 is a new syscall added to Linux 5.6. It provides a superset
of openat(2) functionality, providing a way to extend it in the future,
and (for now) adding flags telling the kernel how to resolve the path.

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

A primitive test case is added to check that Openat2 works as
it should. Tested to skip on kernel 5.5 and pass on 5.6.

Change-Id: Ib8bbd71791762f043200543cecdea16d2fd3c81d
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Reviewed-on: https://go-review.googlesource.com/c/sys/+/227280
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2020-04-06 11:34:30 +00:00
Tobias Klauser
c3d8025017 unix: update Dockerfile to Linux 5.6, and Go 1.13.9
We cannot update to Go 1.14 yet, since cgo code generation for certain
types is broken due to golang/go#37621.

Change-Id: I7b60d23ff4e79a7bb7fa4f0e0625893e4eff81f1
Reviewed-on: https://go-review.googlesource.com/c/sys/+/226577
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2020-03-31 12:40:33 +00:00
Tobias Klauser
9dae0f8f57 unix: add fs-verity consts and types
See https://www.kernel.org/doc/html/latest/filesystems/fsverity.html for
details.

Change-Id: I5b02d0ef84f21d05ea3f1ac8e905232733ea3739
Reviewed-on: https://go-review.googlesource.com/c/sys/+/225698
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-03-27 17:32:47 +00:00