Commit Graph

706 Commits

Author SHA1 Message Date
Jason A. Donenfeld
cedb8e16d1 windows: add token group adjustment function
We have the useful AdjustTokenPrivileges, but we don't have the equally
as useful AdjustTokenGroups function. So this CL adds it.

Change-Id: Ic09b4688ee5ec7f1a626a21216a85b075961aad5
Reviewed-on: https://go-review.googlesource.com/c/sys/+/176859
Run-TryBot: Jason Donenfeld <Jason@zx2c4.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2019-05-16 10:27:23 +00:00
Yuval Pavel Zholkover
cab07311ab unix: fix TestStatFieldNames on aix and TestUtimesNanoAt on darwin
Following CL 175157 which renames Stat_t time fields to [AMCB]tim.

Updates golang/go#31735

Change-Id: I0791c59bab307d237b315c1b919265902f7d9917
Reviewed-on: https://go-review.googlesource.com/c/sys/+/177437
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-05-16 01:48:33 +00:00
Yuval Pavel Zholkover
87c872767d unix: rename Stat_t time fields to [AMCB]tim
Birthtime/Birthtimespec was renamed to Btim to match the others.
Also unexport the [ACMB]tim_ext fields on freebsd 386.
Update mkpost.go to do the renames.

Ran the following on the existing ztypes_*.go files:

  #!/bin/sh
  set -e

  for f in ztypes_*.go; do
      cat $f | go run mkpost.go | gofmt > $f.tmp
      mv $f.tmp $f
  done;

  cat ztypes_freebsd_386.go | env GOOS=freebsd GOARCH=386 go run mkpost.go | gofmt > ztypes_freebsd_386.go.tmp
  mv ztypes_freebsd_386.go{.tmp,}

Fixes golang/go#31735

Change-Id: I15765d690ee8d2be6bbb37f465322bc019722e08
Reviewed-on: https://go-review.googlesource.com/c/sys/+/175157
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-05-15 19:05:49 +00:00
Jason A. Donenfeld
06a5c49444 windows: add token environment functions
This brings the x/sys package into parity with the capabilities provided
indirectly in CL 176619, and adds a helper to make it useful.

Change-Id: I81f2d205bbb0c2b2c530b2bd991c1e6ff30cc94e
Reviewed-on: https://go-review.googlesource.com/c/sys/+/176620
Run-TryBot: Jason Donenfeld <Jason@zx2c4.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2019-05-15 12:05:40 +00:00
Jason A. Donenfeld
f91f9b37d0 windows: add basic WTS functions for windows/svc usage
The svc package exposes svc.SessionChange, but it's impossible to do
anything with them without these structures, and without being able to
enumerate them prior to events, the events themselves aren't useful, so
we add the enumeration functions as well.

Change-Id: I14c932dfe97c6712fd4868c1b3a0e3a61a6a562c
Reviewed-on: https://go-review.googlesource.com/c/sys/+/176623
Run-TryBot: Jason Donenfeld <Jason@zx2c4.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2019-05-15 10:53:50 +00:00
Jason A. Donenfeld
24a5b2278f windows: add service notification support
This lays the groundwork for service notification and tracking by adding
the required API functions. Users can make notifiers directly using it,
or later if we're feeling ambitious, we can see if we can come up with a
generalized solution in x/windows/svc.

Change-Id: I80503cc27970fbb23bf17cd8bc50eaa7787aa6bd
Reviewed-on: https://go-review.googlesource.com/c/sys/+/176624
Run-TryBot: Jason Donenfeld <Jason@zx2c4.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2019-05-15 10:31:49 +00:00
Jason A. Donenfeld
3a4b5fb9f7 windows: add token manipulation functions and constants
These are extremely useful functions and core to the Windows security
API. They are so useful, in fact, that most of these were taken right
out of the Go repo's internal/syscall/windows package.

Change-Id: I13e34b830dd60f59fcae8085ae2be189d9cc9282
Reviewed-on: https://go-review.googlesource.com/c/sys/+/176625
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-05-14 13:59:07 +00:00
Tobias Klauser
a5b02f93d8 windows: add "generate" build tag
cmd/go supports the "generate" build tag as of CL 175983. Add it to the
files which are just used for generating errors and syscall wrappers.

Also see golang/go#31920

Change-Id: Ib26c90af0ac1fb7bae81366a46dedf028b787566
Reviewed-on: https://go-review.googlesource.com/c/sys/+/175899
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-05-09 14:14:14 +00:00
Matt Layher
2d0786266e unix: add IoctlGetUint32 on Linux
Because the size of int varies on different architectures,
IoctlGetInt is unsuitable for ioctl APIs which explicitly deal with
fixed size integers, such as uint32.

Change-Id: I5a8dc397b713027c4ef9f9a91490f177ac8342e2
Reviewed-on: https://go-review.googlesource.com/c/sys/+/175982
Run-TryBot: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-05-08 22:02:29 +00:00
Lehner Florian
12bbe5a7a5 unix: add BPF constants on Linux
Change-Id: Ie43daa8ba56ad1e57ddbb8ddd47f83b363fe75b4
Reviewed-on: https://go-review.googlesource.com/c/sys/+/174978
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2019-05-08 10:04:23 +00:00
Tobias Klauser
ecd444e865 unix: export KexecFileLoad on linux/arm
CL 175158 added the generated kexecFileLoad wrapper but forgot to add
the exported KexecFileLoad and the corresponding //sys line.

Change-Id: Ic94ce83dbb1ecc3d07080b4b4dfe35934ec54d57
Reviewed-on: https://go-review.googlesource.com/c/sys/+/175657
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-05-07 16:07:41 +00:00
Tobias Klauser
2953c62de4 unix: update Dockerfile to Linux 5.1
Also add KexecFileLoad on linux/arm now that is has SYS_KEXEC_FILE_LOAD.

Change-Id: I519bc2f611b511af994e1c7bbaa07f68cd615ef4
Reviewed-on: https://go-review.googlesource.com/c/sys/+/175158
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-05-07 05:39:17 +00:00
Jason A. Donenfeld
ca7f33d411 windows: CreateFile's templatefile parameter has always been a HANDLE
This fixes a bug in the declaration. The documentation involving this
parameter is at:
https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-createfilew

Change-Id: I650c54b3110d29921627b08d47be4fa41d60bbf4
Reviewed-on: https://go-review.googlesource.com/c/sys/+/175159
Run-TryBot: Jason Donenfeld <Jason@zx2c4.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
2019-05-06 11:50:46 +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