Commit Graph

932 Commits

Author SHA1 Message Date
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
Tobias Klauser
85ca7c5b95 unix: allocate signalNameMap with enough space
Avoid re-allocations while filling signalNameMap.

Change-Id: I3017e856c2724debccad43324cbe2e60b68d869c
Reviewed-on: https://go-review.googlesource.com/c/sys/+/225017
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2020-03-23 22:24:14 +00:00
Araragi Hokuto
328b4cd54a unix: add readv/writev for illumos
iovec read/writes (readv, writev, preadv, pwritev) are present on
illumos, but they weren't added to the package. This commit adds
those missing features.

Updates golang/go#36201

Change-Id: Iecf2bab7ef846f5ca5d693e833491d819618c15d
GitHub-Last-Rev: 81a479f4c5
GitHub-Pull-Request: golang/sys#64
Reviewed-on: https://go-review.googlesource.com/c/sys/+/224238
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2020-03-21 13:42:03 +00:00
Yannic Bonenberger
af34d8274f gitignore: remove obsolete reference to .hgignore in comment
Change-Id: Id56bd12269c24fd29c83d17bc61e5189713ffee9
Reviewed-on: https://go-review.googlesource.com/c/sys/+/224337
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-03-20 18:12:52 +00:00
Ed Schouten
5766fd39f9 unix: regenerate all definitions on FreeBSD 12.1 on {386,amd64,arm64}
I just created a couple of virtual machines/QEMU instances containing
stock copies of FreeBSD 12.1-RELEASE. On these systems I ran mkall.sh,
thereby bringing the definitions in sync with that version of FreeBSD.

I also attempted to bring the GOOS=freebsd GOARCH=arm port up to date,
but was unfortunately not able to do so. There doesn't seem to be any
documentation on how to bring this port of FreeBSD up on an emulator.
The only option seems to be to use physical hardware.

Change-Id: I54c9f5d15587996ad5fbb535480ab0aa0e723260
GitHub-Last-Rev: ad79b1bda1
GitHub-Pull-Request: golang/sys#63
Reviewed-on: https://go-review.googlesource.com/c/sys/+/223698
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2020-03-17 11:33:12 +00:00
Ed Schouten
a7d97aace0 unix: add disk ioctl constants for FreeBSD
These ioctls make it possible to obtain information on the geometry of
disk devices, such as their sector size and total size in bytes.

Change-Id: I16449fb1a68b84d266b3fdfda9905cb448676968
GitHub-Last-Rev: 3742e7aec2
GitHub-Pull-Request: golang/sys#61
Reviewed-on: https://go-review.googlesource.com/c/sys/+/223537
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2020-03-16 23:05:53 +00:00
Ed Schouten
08c61614be unix: only declare PtraceGetFsBase() on x86-based platforms
Only x86-based CPUs have an FSBASE. The current code happens to build
on FreeBSD/aarch64 and FreeBSD/arm, but that's only because we
incorrectly declare PTRACE_GETFSBASE on those platforms.

Change-Id: I128c91bcdb0704a210af13806c1cd285470b5eda
GitHub-Last-Rev: 5e88573c0f
GitHub-Pull-Request: golang/sys#62
Reviewed-on: https://go-review.googlesource.com/c/sys/+/223697
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2020-03-16 21:47:34 +00:00
Tom Parkin
9a0dfc3c55 unix: implement L2TPIP socket address on Linux
Add constants and types to support IP-encapsulated L2TP/RFC3931
tunnels on Linux systems.

The L2TP subsystem for IP encapsulated tunnels hooks into the inet
kernel code using a specific IP protocol value.  In order to handle
this, anyToSockaddr now has to query the socket protocol type using
GetsockoptInt for the AF_INET and AF_INET6 address families.

Although this change is reasonably simple, unit tests have been added
to validate handling of the new types.

Fixes golang/go#37787

Change-Id: I16ae1e24dcced4ccc6ce6a79a90a5a2f6a560967
GitHub-Last-Rev: ca554ad1b6
GitHub-Pull-Request: golang/sys#60
Reviewed-on: https://go-review.googlesource.com/c/sys/+/223157
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-03-16 20:21:46 +00:00
Tobias Klauser
5c8b2ff675 unix: update BPF consts on linux
Update the BPF_* consts from include/uapi/linux/bpf.h as of Linux 5.5.

Change-Id: I5098fc9e4fc1fb3e6cc2e2f85a8e65b369b6a81c
Reviewed-on: https://go-review.googlesource.com/c/sys/+/221797
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2020-03-02 15:01:41 +00:00
Tobias Klauser
062a44052d cpu: add mips64x feature detection
Follow CL 200579

Change-Id: Ibedd6569bda3d7836ccb77a7746ed0e5df13c633
Reviewed-on: https://go-review.googlesource.com/c/sys/+/221698
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-02 08:32:56 +00:00
Johan Jansson
5d559ad92b unix: merge duplicate code in ztypes_linux_*.go
Run mkmerge.go on ztypes_linux_*.go to merge duplicate consts, funcs,
and types into ztypes_linux.go

Please see https://gist.github.com/jupj/639b5cda305d251161fec2304c27c9b9
for a script to validate these changes.

Fixes golang/go#33059

Change-Id: Ic272869fed6bf6bbf3018d3919ae5a6b6bc15bbb
Reviewed-on: https://go-review.googlesource.com/c/sys/+/221320
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-03-01 20:44:00 +00:00
Johan Jansson
2f85c7ec1e unix: merge duplicate code in zsyscall_linux_*.go
Run mkmerge.go on zsyscall_linux_*.go to merge duplicate consts, funcs,
and types into zsyscall_linux.go

Also, run mkmerge.go on zsysnum_linux_*.go; currently there is nothing
to merge.

Please see https://gist.github.com/jupj/639b5cda305d251161fec2304c27c9b9
for a script to validate these changes.

Updates golang/go#33059

Change-Id: I715ada044ee957475669d94b16de059ebb9162d1
Reviewed-on: https://go-review.googlesource.com/c/sys/+/221319
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-03-01 15:39:31 +00:00
Johan Jansson
c5d0d7b4ec unix: merge duplicate code in zerrors_linux_*.go
Run mkmerge.go on zerrors_linux_*.go to merge duplicate consts, funcs,
and types into zerrors_linux.go

Please see https://gist.github.com/jupj/639b5cda305d251161fec2304c27c9b9
for a script to validate these changes.

Updates golang/go#33059

Change-Id: I168b5efc7fd6d2fcf7fc8dfe1ef5eea07f07f9c2
Reviewed-on: https://go-review.googlesource.com/c/sys/+/221318
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-03-01 04:06:27 +00:00
Johan Jansson
6b2465a022 unix: add tool for merging duplicate code
mkmerge.go parses generated code (z*_GOOS_GOARCH.go) and merges
duplicate consts, funcs, and types, into one file per GOOS (z*_GOOS.go).

Updates golang/go#33059

Change-Id: I1439f260dc8c09e887e5917a3101c39b080f2882
Reviewed-on: https://go-review.googlesource.com/c/sys/+/221317
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-03-01 02:57:34 +00:00
Nikson Kanti Paul
d5e6a3e2c0 unix: add adjtimex return constants
Fixes golang/go#37234

Change-Id: I6deda79bc0b8f34c7bb210b64adabbfff5fe675e
Reviewed-on: https://go-review.googlesource.com/c/sys/+/219697
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2020-02-23 17:06:10 +00:00
Caleb Spare
cb0a6d8edb unix: mark capget/capset as non-blocking
Change-Id: Ifd3a1ab6f6ec9136e77440a484f933dc243f645d
Reviewed-on: https://go-review.googlesource.com/c/sys/+/219940
Run-TryBot: Caleb Spare <cespare@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2020-02-19 09:19:48 +00:00
Tobias Klauser
9197077df8 unix: gofmt after CL 218799
CL 218799 wasn't properly gofmt'ed. Also move InotifyInit before Poll so
it matches the position in other syscall_linux_*.go files which
implement InotifyInit using InotifyInit1 (e.g. arm64).

Change-Id: If517ea2450c83ce39919992193592609f7e1e478
Reviewed-on: https://go-review.googlesource.com/c/sys/+/219798
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2020-02-17 22:08:22 +00:00
Tobias Klauser
2d4d9931dc unix: add RTMGRP_* consts from rtnetlink.h
Change-Id: I50fe62020e539df0ada577b71e87fb67b7e43973
Reviewed-on: https://go-review.googlesource.com/c/sys/+/219797
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2020-02-17 22:08:02 +00:00
Doorer
12a6c2dcc1 unix: add InotifyInit for mips64
Change-Id: If58ee4692cd7b22c293556fc320fb013cdb78bb6
GitHub-Last-Rev: 2b5b171559
GitHub-Pull-Request: golang/sys#58
Reviewed-on: https://go-review.googlesource.com/c/sys/+/218799
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2020-02-12 09:16:48 +00:00
Tobias Klauser
d101bd2416 unix: update Dockerfile to Linux 5.5, glibc 2.31, Go 1.13.7
Change-Id: I6bcbf93132861fb2896c6884e2c7e1c42672ece4
Reviewed-on: https://go-review.googlesource.com/c/sys/+/217477
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2020-02-02 16:47:22 +00:00
Aaron Bieber
9fbb57f87d unix: use pipe2 syscall on OpenBSD
pipe2 has been available on OpenBSD for some time, all currently
supported versions of OpenBSD have an implementataion of it.

Change-Id: I740da07139541084f99a4fa4efcf67a591eed9e5
Reviewed-on: https://go-review.googlesource.com/c/sys/+/216244
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-24 20:44:21 +00:00
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