Commit Graph

694 Commits

Author SHA1 Message Date
Joel Sing
9e5cf931a0 [release-branch.go1.14-cmd] unix: provide linux/riscv64 assembly for syscalls
While the linux/riscv64 port is not yet upstream, most of the syscalls package
already has linux/riscv64 support and this will make testing and development
easier.

Updates golang/go#27532

Change-Id: I6e505be55fdbb2942fb6e4f34c040e7b82809630
Reviewed-on: https://go-review.googlesource.com/c/sys/+/177799
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
(cherry picked from commit 4c3a928424)
Reviewed-on: https://go-review.googlesource.com/c/sys/+/217300
Run-TryBot: Filippo Valsorda <filippo@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-01-31 23:33:51 +00:00
Gernot Vormayr
a43fa875dd unix: add missing tpacket block (sub)header
This adds the missing tpacket_hdr_v1 struct, which is needed to read
tpacket_block_desc (hdr member, which is a union and therfore defined as
[40]byte). This doesn't modify block_desc so existing implementations
keep working.
Caveat: Although TpacketBDTS has a usec member, this will contain nsec
in case of tpacket v2 or v3.

Change-Id: I772939fe56cf56fc09cf4acf4013b23beb6e03c7
Reviewed-on: https://go-review.googlesource.com/c/sys/+/174861
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-05-02 17:53:42 +00:00
Brad Fitzpatrick
3ef323f4f1 unix: add illumos case
From CL 174457 which modified this file's vendored copy in the "go"
repo.

Updates golang/go#20603

Change-Id: Ic89b2e772120a08ac0fa3a56acb93a8ee96ba337
Reviewed-on: https://go-review.googlesource.com/c/sys/+/174958
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-05-02 14:57:24 +00:00
Tobias Klauser
c0b26311cb unix: support generating netbsd/arm64 files in mkall.sh
CL 155738 added the generated files but didn't update mkall.sh. Do so
now.

Change-Id: I8681ef175547750bea94b06827ef5f4512dc6de3
Reviewed-on: https://go-review.googlesource.com/c/sys/+/174860
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
2019-05-02 14:30:02 +00:00
Tobias Klauser
050d976686 unix: drop reference to mkunix.pl from comment
mkunix.pl doesn't exist in x/sys/unix, so drop the reference to it from
the _zero godoc comment.

Change-Id: I7a638a5248b72c4dffc83da1514e5d861c532127
Reviewed-on: https://go-review.googlesource.com/c/sys/+/174858
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-05-02 14:15:30 +00:00
Brad Fitzpatrick
d89cdac9e8 windows: don't return EINVAL on zero Chmod mode
To match CL 174320

Updates golang/go#20858

Change-Id: Ic4e332c8a84b7d427fc7057aa5b0c2877cc9f7ea
Reviewed-on: https://go-review.googlesource.com/c/sys/+/174321
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-04-29 19:08:28 +00:00
Jason A. Donenfeld
2cc0cad0ac windows: document new ProcessId field
Change-Id: I761f962f30eb48471a0f033cf30ea6c428d3ce49
Reviewed-on: https://go-review.googlesource.com/c/sys/+/174237
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2019-04-29 09:44:11 +00:00
Visweswara R
804c0c7841 unix: replace "mksysctl_openbsd.pl" script with a Go program
Port mksysctl_openbsd.pl Perl script to mksysctl_openbsd.go.
mkall.sh script is modified to run mksysctl_openbsd.go. Running
mkall.sh does not generate any git diff besides the command
name in comments of generated files. Any missing build tag is
also added in generated files.

Fixes golang/go#27779

Change-Id: I9f946d2818feb31e710029927f089904c5e272cf
Reviewed-on: https://go-review.googlesource.com/c/sys/+/174127
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
Run-TryBot: Benny Siegert <bsiegert@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-04-28 18:31:49 +00:00
Ian Lance Taylor
a129542de9 unix: skip TestOpenByHandleAt if name_to_handle_at not supported
Updates golang/go#30537

Change-Id: Ica526a4bc689af594b0e91c988631bf9987a6119
Reviewed-on: https://go-review.googlesource.com/c/sys/+/174077
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-26 13:52:47 +00:00
Jason A. Donenfeld
1607263960 windows: allow querying service ProcessId
The two functions have the same levels of compatibility, but this latter
one gives us access to the process ID, which is important for things
like WFP whitelisting. The change required is fairly trivial too.

Change-Id: Ifb6b3ee3e897202b9cffa1388c53c25cbcfede61
Reviewed-on: https://go-review.googlesource.com/c/sys/+/173666
Run-TryBot: Jason Donenfeld <Jason@zx2c4.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-25 14:56:19 +00:00
Brad Fitzpatrick
9f0b1ff7b4 unix: add FileHandle, NewFileHandle, NameToHandleAt, OpenByHandleAt
This adds wrappers around name_to_handle_at and open_by_handle_at.

Requires root (or CAP_DAC_READ_SEARCH, rather) to run tests, which at
least some of our builders have.

bradfitz@go:~/src/golang.org/x/sys/unix$ go test -c && sudo ./unix.test -test.run=OpenBy -test.v=true
=== RUN   TestOpenByHandleAt
=== RUN   TestOpenByHandleAt/clone=false
=== RUN   TestOpenByHandleAt/clone=true
--- PASS: TestOpenByHandleAt (0.00s)
    syscall_linux_test.go:546: mountID: 22, handle: size=8, type=1, bytes="\x9e\x1e\b\x00~\x8c\xe5\x9d"
    --- PASS: TestOpenByHandleAt/clone=false (0.00s)
        syscall_linux_test.go:568: opened fd 3
    --- PASS: TestOpenByHandleAt/clone=true (0.00s)
        syscall_linux_test.go:568: opened fd 3
PASS

Fixes golang/go#30537

Change-Id: Ia48a8faab2fee665d88a16d81a3a0c1504b129ce
Reviewed-on: https://go-review.googlesource.com/c/sys/+/173357
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-04-25 04:54:58 +00:00
Matt Layher
18eb32c0e2 unix: add Linux crypto configuration API constants and types
Change-Id: I447150cb60b5580cee77d23c0dae2244803e92ef
Reviewed-on: https://go-review.googlesource.com/c/sys/+/173660
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-24 17:57:32 +00:00
Joel Sing
4347357a82 unix: add support for openbsd/arm64
Generated on OpenBSD 6.5.

Updates golang/go#31656

Change-Id: Ie8b5a8ae5ed25517aae2712fa27e62d385813f21
Reviewed-on: https://go-review.googlesource.com/c/sys/+/173678
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-04-24 16:06:41 +00:00
Joel Sing
82968946f5 unix: remove arch specific build for openbsd_pledge.go
The pledge code is platform specific, but in no way architecture specific.
As such, drop the +build rule that ties it to specific architectures.

While here also rename openbsd_pledge.go and openbsd_unveil.go so we can
drop the openbsd specific build tags.

Change-Id: I7d83796c8f9b46afe2a6790620205df5f7f3d738
Reviewed-on: https://go-review.googlesource.com/c/sys/+/173677
Reviewed-by: Elias Naur <mail@eliasnaur.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Elias Naur <mail@eliasnaur.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-04-24 16:00:12 +00:00
Brad Fitzpatrick
953cdadca8 unix: add unexported name_to_handle_at and open_by_handle_at types & wrappers
No usable change for users in this CL; just auto-generated syscall
wrapper funcs & types.

The next CL will have hand-written code adding the nice Go API around
these unexported symbols. (as outlined in the comment at
https://golang.org/issue/30537#issuecomment-470284573)

Updates golang/go#30537

Change-Id: I5e34df517efcf509fff97f670425500cc6608d59
Reviewed-on: https://go-review.googlesource.com/c/sys/+/172584
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-04-22 16:51:55 +00:00
Clément Chigot
e8e3143a4f unix: add Unmount syscall for AIX
Change-Id: I86f33df28b844746617a47b01fb888f4b434564a
Reviewed-on: https://go-review.googlesource.com/c/sys/+/172897
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-04-19 15:35:24 +00:00
Clément Chigot
f0ce4c0180 unix: add Select syscall on AIX
As select is a keyword of Go, C.select cannot be used on gccgo files.
Therefore, select call is transformed into c_select.

Change-Id: Ic68a7ffa03dc5a5d70514876b5f6afb565691a4a
Reviewed-on: https://go-review.googlesource.com/c/sys/+/172739
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-04-18 15:33:12 +00:00
chigotc
d20716ef9d unix: use nsendmsg and nrecvmsg on AIX
This is the x/sys/unix patch of CL 170537.

This patches has regenerated some files which have been therefore
updated. That's why Getsystemcfg is also added in zsyscall_aix_ppc.go

Change-Id: I4aade3e0e2e29cef13b1c8018a57100712eabb50
Reviewed-on: https://go-review.googlesource.com/c/sys/+/172259
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-04-18 15:05:32 +00:00
Tobias Klauser
12500544f8 unix: fix cmsg alignment on aix
This was missing from CL 171941.

Change-Id: I14f16355b2fe18103d2713faf2bebf004248fc0c
Reviewed-on: https://go-review.googlesource.com/c/sys/+/172257
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-04-16 15:28:02 +00:00
chigotc
ebb4019f01 unix: move helper handler before AIX handler in TestPassFD
The AIX special handler which skips this test if unix network isn't
supported, doesn't need to be called inside the helper process.

Change-Id: I102d0f180a4f0204f107db900f2134c5af1d52c3
Reviewed-on: https://go-review.googlesource.com/c/sys/+/172258
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-04-16 12:42:37 +00:00
Tobias Klauser
3fd5a3612c unix: enable TestPassFD on AIX 7.2 TL >= 2
Follow CL 171339 and enable TestPassFD for AIX 7.2 TL >= 2

Change-Id: Icf781798a6f9fe99a57c23bc7f7e7c1361bdcec2
Reviewed-on: https://go-review.googlesource.com/c/sys/+/171941
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-15 14:56:33 +00:00
James Nugent
16da32be82 windows: add GetFileInformationByHandleEx function
Change-Id: I950762ef59c665d027641b4410ac30697edad22d
Reviewed-on: https://go-review.googlesource.com/c/sys/+/171939
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-04-15 08:10:28 +00:00
Jason A. Donenfeld
9773273309 windows: add missing error constants
While the types_windows file previously had a small handful of types,
this forced application code to have an awkward mixture of artisanal
error constants and factory-ready ones. This commit adds the missing
ones and separates them into a new file, since they are quite numerous.

These also preserve the order of winerr.h, which should make it somewhat
easier to import new ones in the future.

Fixes golang/go#31360

Change-Id: If2abc507a8884ec1641f0b17fe0c612a950d3644
Reviewed-on: https://go-review.googlesource.com/c/sys/+/170918
Reviewed-by: Jason Donenfeld <Jason@zx2c4.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Jason Donenfeld <Jason@zx2c4.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-04-12 21:31:03 +00:00
Matt Layher
b44545bcd3 unix: add missing rtnetlink IFLA_* constants on Linux
A number of IFLA_* constants have been added since the last time this
list was generated. In addition, IFLA_INFO_* is a different enum, so
we'll add the missing values for there as well.

Change-Id: Ie20b1f49a95cbc10daf0be2e5b5d719782eda68f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/171698
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-11 18:56:58 +00:00
Jeroen Simonetti
0ad05ae300 unix: add missing rtnetlink neighbor constants on Linux
Change-Id: Ie261a6f149b7bc531f80726c016bf8f63c9210a7
Reviewed-on: https://go-review.googlesource.com/c/sys/+/171537
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-04-10 23:58:45 +00:00
Matt Layher
cc4d4f5062 unix: add missing rtnetlink IFA_* constants on Linux
A few additional constants are now available since the last time
this list was updated.

Change-Id: I81cd07f8c6e7acb03ef67764ab783cea89ba3868
Reviewed-on: https://go-review.googlesource.com/c/sys/+/171318
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-04-10 17:00:21 +00:00
Tobias Klauser
4b34438f7a unix: allow empty string argument to SetsockoptString
Don't panic with "index out of range" on empty string argument.

Follows CL 170937 which did the sane for package syscall.

Updates golang/go#31277

Change-Id: I4feb796d0d58d3637428ae69997cfa3ec28a6b01
Reviewed-on: https://go-review.googlesource.com/c/sys/+/170957
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-05 15:42:28 +00:00
Tobias Klauser
81d4e9dc47 unix: don't generate raw syscall wrapper for ClockGettime on darwin
Follow-up for CL 170299

CL 170297 erroneously introduced a raw syscall wrapper for ClockGettime
on darwin. Make sure it isn't generated by mistake again.

Change-Id: Ie9ecdc950e5ab6cc85937008cd140847cffac42f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/170301
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-03 15:24:47 +00:00
Tobias Klauser
baf5eb976a unix: remove ClockGettime for darwin/amd64 on Go 1.11
This was erroneously introduced by CL 170297

SYS_CLOCK_GETTIME is not defined on darwin.

Fixes golang/go#31203

Change-Id: I39b1f19c4c9d7e9cb67569c4cb2764d64f158c0f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/170299
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-02 14:25:45 +00:00
Tobias Klauser
e4093980e8 unix: add SysctlClockinfo on darwin
Add type Clockinfo and the SysctlClockinfo function to query clock rate
information from the kernel.

Change-Id: Ic29edcacee3b3f6125bb218b82c2a2496c39213a
Reviewed-on: https://go-review.googlesource.com/c/sys/+/170297
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-04-02 05:46:13 +00:00
Matt Layher
9eb1bfa1ce unix: add GetsockoptUint64 and SetsockoptUint64
The AF_VSOCK address family on Linux uses unsigned long long (uint64
in Go) values for getting and setting some socket options.

Change-Id: If28f6a5d04c0c988b7cbcaf2bf8d184a69329882
Reviewed-on: https://go-review.googlesource.com/c/sys/+/169959
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-03-29 04:47:33 +00:00
Jason A. Donenfeld
f49334f85d windows: add GetOverlappedResult function for async I/O
We already have all the structs and constants for async I/O, and the
various functions of x/sys/windows take the right parameters. But we're
missing the final step of any ordinary async I/O routine: getting the
result of overlapped I/O. Without this, the rest of the plumbing
supported by this module isn't actually so useful. So add this small
oversight.

Change-Id: I0ce1a71bce06bc81a83f3b0ca10ad9c4b67af726
Reviewed-on: https://go-review.googlesource.com/c/sys/+/168521
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-03-22 08:03:09 +00:00
Jason A. Donenfeld
f7bb7a8bee windows: add missing file flags to types
The previous selection was a bit haphazard, and defining random
constants in an application and combining those with existing constants
in this library looks kind of weird. So instead let's add the actual set
of flags, instead of the strange prior assortment.

Change-Id: I6ca266cd80aa7a43e93e969e1dbb09c8c7bf12c7
Reviewed-on: https://go-review.googlesource.com/c/sys/+/168520
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-03-21 05:22:20 +00:00
Tobias Klauser
6c81ef8f67 unix: add SysctlClockinfo on OpenBSD
OpenBSD (like NetBSD) uses sysctl with struct clockinfo to get clock
rate information from the kernel. Add type Clockinfo and the
SysctlClockinfo function to query this information.

Change-Id: I35070a82b8de23dcd7592e8654dcc5eeee143b5b
Reviewed-on: https://go-review.googlesource.com/c/sys/+/168057
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2019-03-18 19:57:19 +00:00
Jason A. Donenfeld
a2f829d7f3 windows: add support for creating well known SIDs
The security API is already quite extensive, but for some strange
reason, this essential and useful function was left out of the initial
port. So, we add it here, along with the relevant constants and a test
case.

Change-Id: I99568703565addf15603480f11b0edafdfc1718f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/167378
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-03-16 08:23:40 +00:00
Tobias Klauser
fead790013 cpu: use unix.Getsystemcfg to detect POWER8/POWER9 on aix/ppc64
Tested on an aix-ppc64 gomote builder.

Fixes golang/go#30732

Change-Id: I8e74dcde8bd4ded0f425c90eefe799970ebd325c
Reviewed-on: https://go-review.googlesource.com/c/sys/+/166466
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-03-12 06:12:37 +00:00
Tobias Klauser
c8c8c57fd1 unix: run mkasm independent of mktypes in mkall.sh
Move the $mkasm invocation out of the if [ -n "$mktypes" ]

Change-Id: I6fd34703e2f438b23adceada3161fc4b40ba4fce
Reviewed-on: https://go-review.googlesource.com/c/sys/+/166467
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-11 15:21:10 +00:00
Tobias Klauser
7c207b7624 unix: add Getsystemcfg on aix
This will be used to detect POWER8/POWER9 support in x/sys/cpu

Updates golang/go#30732

Change-Id: I10ad6e440920c34c378bf6783417bc09421ff500
Reviewed-on: https://go-review.googlesource.com/c/sys/+/166465
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Clément Chigot <clement.chigot@atos.net>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-11 15:20:45 +00:00
Jason A. Donenfeld
10058d7d4f windows: use proper system directory path in fallback loader
The %WINDIR% variable is an odd choice and not even entirely reliable.
Since Windows 2000, there has been a specific function for determining
this information, so let's use it. It's also a useful function in its
own right for folks who want to launch system tools in a somewhat safe
way, like netsh.exe.

Updates golang/go#14959
Updates golang/go#30642

Change-Id: Ic24baf37d14f2daced0c1db2771b5a673d2c8852
Reviewed-on: https://go-review.googlesource.com/c/sys/+/165759
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2019-03-10 05:46:46 +00:00
Andrei Tudor Călin
980fc434d2 unix, unix/linux: add additional Linux perf API bits
Add sample_max_stack field to struct perf_event_attr.

Add the missing PERF_FLAG_FD_CLOEXEC flag, the missing
PERF_COUNT_SW_BPF_OUTPUT constant, missing PERF_RECORD_*
constants, and missing PERF_SAMPLE_BRANCH_* constants.

Change-Id: I44c5e37ff36420b35e56c97e7fc190cd0af95e21
Reviewed-on: https://go-review.googlesource.com/c/sys/+/166457
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-03-09 12:25:39 +00:00
Ian Lance Taylor
584f3b12f4 cpu: add build tag to cpu_wasm.go
Fixes the build for Go versions before 1.11.

Fixes golang/go#30668

Change-Id: I0dfb2eafcbcbe7e466a3b0b5d20656be3e6f4982
Reviewed-on: https://go-review.googlesource.com/c/sys/+/166137
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-03-08 02:30:53 +00:00
Tobias Klauser
572b51eaf7 unix: add SetsockoptPacketMreq on Linux
Add SetsockoptPacketMreq to set packet socket options used to
configure physical-layer multi‐casting and promiscuous mode
(PACKET_ADD_MEMBERSHIP, PACKET_DROP_MEMBERSHIP).

Change-Id: I0f292315ad1c57e6a3d1dd12f5f29be70d8bfd54
Reviewed-on: https://go-review.googlesource.com/c/sys/+/165977
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-07 16:26:37 +00:00
Bryan C. Mills
b294cbcfc5 all: add go directive to go.mod
Go 1.12 adds this line automatically, so let's just go with it.

Change-Id: I0ac156a58f0f107e019a8c06ebf189b819a3651d
Reviewed-on: https://go-review.googlesource.com/c/sys/+/165751
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-06 22:07:23 +00:00
Bryan C. Mills
b354f8bf4d cpu: define cacheLineSize and doinit for WASM
This fixes a build break when compiling this package with
GOOS=js / GOARCH=wasm.

Updates golang/go#30241

Change-Id: I0b35aa50a69370ed0d83c522e12ce7613c4c3ec4
Reviewed-on: https://go-review.googlesource.com/c/sys/+/165749
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-06 22:02:34 +00:00
Jason A. Donenfeld
70f5298506 windows/svc: safely load system DLLs
These DLLs, well advapi32.dll in particular, are vulnerable to classic
DLL directory injection attacks. The rest of x/sys/windows moved over to
the safe system loader, but apparently the svc package was forgotten.
This tidies up that oversight.

Change-Id: I330fa752cf2d49ccc5cf1bd60fb4bd612bd2b6b0
Reviewed-on: https://go-review.googlesource.com/c/sys/+/165758
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-06 17:15:55 +00:00
Tobias Klauser
3e9a981b8d unix: add functions to get/set tpacket socket options
Add GetsockoptTpacketStats and GetsockoptTpacketStatsV3 to get tpacket
statistics (for TPACKET_V2 and TPACKET_V3).

Add SetsockoptTpacketReq and SetsockoptTpacketReq3 to set up tpacket
v2/v3 ring buffers.

Change-Id: Ic2870be22be7d74141f682e515a682df28e1c814
Reviewed-on: https://go-review.googlesource.com/c/sys/+/165558
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-03-06 15:53:19 +00:00
Tobias Klauser
a98ae47d97 unix: on ARM GNU/Linux let Pipe fall back to pipe
Follow CL 165217 which did this for package syscall.

Android O seems to require Pipe to call the pipe2 system call.
But kernel version 2.6.23 only supports pipe, not pipe2.
So try pipe2 first, then fall back to pipe.

Updates golang/go#30549

Change-Id: Icf21433fa046ff137c0265fa96410229def482f7
Reviewed-on: https://go-review.googlesource.com/c/sys/+/165297
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-06 07:15:16 +00:00
Tobias Klauser
30e92a19ae unix: add Lutimes
Add Lutimes wrapping UtimesNanoAt.

Updates golang/go#30487

Change-Id: Ic5bb3b4d88be5806522eaef9bd9b8b0f5c1c8f42
Reviewed-on: https://go-review.googlesource.com/c/sys/+/164662
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-03-05 06:45:18 +00:00
Tobias Klauser
e844e0132e unix: update Dockerfile to Go 1.12 and Linux 5.0
Also enable KexecFileLoad on linux/{arm64,riscv64} now that they have
SYS_KEXEC_FILE_LOAD.

Change-Id: I1c52d09a1a617794f2df697e4966c4c24a166611
Reviewed-on: https://go-review.googlesource.com/c/sys/+/164997
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-03-04 15:46:30 +00:00
Dominik Honnef
c2f5717e61 unix: add fanotify API on Linux
This teaches unix/mksyscall.go about mapping uint64 to syscall
arguments, similar to existing handling of int64.

Change-Id: I536b4b09bbf6a8e3016565a4a04d2b9d32cbc624
Reviewed-on: https://go-review.googlesource.com/c/164664
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-03-03 19:25:50 +00:00