Граф коммитов

24 Коммитов

Автор SHA1 Сообщение Дата
database64128 59665e5b43 unix: add Connectx for darwin
connectx(2) can be used to initiate a connection with TCP Fast Open.

Change-Id: I113ee4dede7df1c01e16a0c07fec2b384b266cb0
GitHub-Last-Rev: 31665b9ad3
GitHub-Pull-Request: golang/sys#215
Reviewed-on: https://go-review.googlesource.com/c/sys/+/606155
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-08-20 16:08:27 +00:00
Koichi Shiraishi 4cafe5c66f unix: implements RenamexNp and RenameatxNp for darwin
Fixes golang/go#48425

Change-Id: Ib3619863e238eadf09da479bd2e1e47d9ab6f274
Reviewed-on: https://go-review.googlesource.com/c/sys/+/361958
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-07-09 14:51:42 +00:00
Dmitri Shuralyov 1bfbee0e20 all: update go directive to 1.18
Done with:

go get go@1.18
go mod tidy
go fix ./...

Using go1.21.3.

Also update code generators to use only the new go:build lines,
not the old +build ones.

For golang/go#60268.

Change-Id: I6aabc42efb6ab3329981100e1db2263aac5e92a6
Reviewed-on: https://go-review.googlesource.com/c/sys/+/534222
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2023-10-11 21:54:30 +00:00
Ed Schouten 64840c112d unix: add bindings for setattrlist() on macOS
The setattrlist() function can be used to mutate the attributes of files through a single call. For example, one can perform a chmod(), chown(), chflags(), [...] all at once.

This change also adds bindings for the UF_* and SF_* flags that are accepted by chflags(). This makes it possible to use setattrlist() to perform the equivalent of lchflags(), for which we currently have no binding.

Change-Id: Ib5a604503a984b95a02b65ad1a437246cd170584
GitHub-Last-Rev: 45dd9d475a
GitHub-Pull-Request: golang/sys#155
Reviewed-on: https://go-review.googlesource.com/c/sys/+/481815
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
2023-04-04 14:21:21 +00:00
Koichi Shiraishi 2c5d950f24 unix: support vsock for darwin
Change-Id: Id53e2b0d0dc3b83762bb4ccc001d4e40f738de73
Reviewed-on: https://go-review.googlesource.com/c/sys/+/352209
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2021-10-04 09:30:28 +00:00
Tobias Klauser f52c844e1c unix: add RTF_GLOBAL on darwin
Fixes golang/go#45848

Change-Id: Iadd8499a66d5c5b7940df1477d88926f4b30cdb0
Reviewed-on: https://go-review.googlesource.com/c/sys/+/343509
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2021-08-19 13:52:13 +00:00
Ed Schouten e2b7044e8c unix: add SEEK_* constants on Darwin, FreeBSD, Linux
The Go "os" package already provides bindings for SEEK_CUR, SEEK_SET and
SEEK_END. Most operating systems also support SEEK_HOLE and SEEK_DATA,
which you can use to skip sparse regions in a file. Let's add bindings,
so we can also do this from within Go.

Change-Id: If9243b05a8f563b4bce2452aa4bff145d9442cc2
GitHub-Last-Rev: ac8aed2d4a
GitHub-Pull-Request: golang/sys#112
Reviewed-on: https://go-review.googlesource.com/c/sys/+/328170
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2021-06-16 04:58:30 +00:00
Tobias Klauser 47abb65194 unix: add RFC3542 IPv6 socket option constants on darwin
Change-Id: I7056c1d8805c080e50d832b5d6a3e3323f692525
Reviewed-on: https://go-review.googlesource.com/c/sys/+/303929
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-03-24 05:16:08 +00:00
Russ Cox 9a76102bfb all: go fmt ./...
Make all our package sources use Go 1.17 gofmt format
(adding //go:build lines).

Not strictly necessary but will avoid spurious changes
as files are edited.

Part of //go:build change (#41184).
See https://golang.org/design/draft-gobuild

Change-Id: I01667f826428426a39c84717d02efa25fa44553c
Reviewed-on: https://go-review.googlesource.com/c/sys/+/294490
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Russ Cox <rsc@golang.org>
2021-02-20 05:07:31 +00:00
Brad Fitzpatrick f992740a1b unix: add Xucred, GetsockoptXucred on darwin
Test adapted from CL 134535 from Tyler Julian (@APTy).

For posterity, the auto-generated parts were updated with:

    GOARCH_TARGET=amd64 go tool cgo -godefs types_darwin.go | GOOS=darwin GOARCH_TARGET=amd64 go run mkpost.go > ztypes_darwin_amd64.go
    GOARCH_TARGET=arm64 go tool cgo -godefs types_darwin.go | GOOS=darwin GOARCH_TARGET=arm64 go run mkpost.go > ztypes_darwin_arm64.go
    GOOS=darwin GOARCH=amd64 ./mkerrors.sh -m64 > zerrors_darwin_amd64.go ; gofmt -w zerrors_darwin_amd64.go
    GOOS=darwin GOARCH=arm64 ./mkerrors.sh -m64 > zerrors_darwin_arm64.go ; gofmt -w zerrors_darwin_arm64.go
    perl -i -npe 's,( cgo -godefs(?: -- -m64)? )/.+/(\S+.go),$$1$$2,' zerrors_darwin_amd64.go zerrors_darwin_arm64.go ztypes_darwin_amd64.go ztypes_darwin_arm64.go

Fixes golang/go#27613

Change-Id: Ie41b3da840cb9c8c140c57ecfb78e7abc4f70bea
Reviewed-on: https://go-review.googlesource.com/c/sys/+/292330
Trust: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2021-02-16 22:45:49 +00:00
Brad Fitzpatrick f7da38b97c unix: re-generate darwin output on Big Sur (11.2.1)
For posterity, I ran:

    GOARCH_TARGET=amd64 go tool cgo -godefs types_darwin.go | GOOS=darwin GOARCH_TARGET=amd64 go run mkpost.go > ztypes_darwin_amd64.go
    GOARCH_TARGET=arm64 go tool cgo -godefs types_darwin.go | GOOS=darwin GOARCH_TARGET=arm64 go run mkpost.go > ztypes_darwin_arm64.go
    GOOS=darwin GOARCH=amd64 ./mkerrors.sh -m64 > zerrors_darwin_amd64.go ; gofmt -w zerrors_darwin_amd64.go
    GOOS=darwin GOARCH=arm64 ./mkerrors.sh -m64 > zerrors_darwin_arm64.go ; gofmt -w zerrors_darwin_arm64.go
    perl -i -npe 's,( cgo -godefs(?: -- -m64)? )/.+/(\S+.go),$$1$$2,' zerrors_darwin_amd64.go zerrors_darwin_arm64.go ztypes_darwin_amd64.go ztypes_darwin_arm64.go

Change-Id: I17e8fc3bd66f4766d0f5f731151f0b85758c01b0
Reviewed-on: https://go-review.googlesource.com/c/sys/+/292329
Trust: Brad Fitzpatrick <bradfitz@golang.org>
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2021-02-16 16:36:48 +00:00
Tobias Klauser e1471140ff unix: implement AF_SYSTEM/AF_SYS_CONTROL sockets on darwin
See https://developer.apple.com/documentation/kernel/sockaddr_ctl for
details.

AF_SYSTEM is darwin-specific, so the BSD-specific anyToSockaddr func
needs to call GOOS-specific funcs which return nil, EAFNOSUPPORT on all
BSD platforms but darwin.

For golang/go#41868

Change-Id: Id7794aba5988dd9511053b76be5efeb66c104a26
Reviewed-on: https://go-review.googlesource.com/c/sys/+/264638
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2020-10-27 09:04:13 +00:00
Tobias Klauser eeed37f84f unix: add IoctlCtlInfo on darwin
For golang/go#41868

Change-Id: I0f4dbeacfe10b9614caf05633a1de3a98a1fc85f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/262959
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
2020-10-18 23:04:17 +00:00
Tobias Klauser 648f2a0390 unix: add clonefile flags for clonefile syscalls on darwin
These are used with the flags parameter of
Clonefile/Clonefileat/Fclonefileat added by CL 254757.

Change-Id: Ia869315f319003c366f201f82a04b5801be08993
Reviewed-on: https://go-review.googlesource.com/c/sys/+/255197
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2020-09-17 06:19:48 +00:00
Tobias Klauser 2aa67d56cd unix: fix Select to return number of ready fds on Darwin and *BSD
Make Select's signature on Darwin and the BSDs match the one on Linux
and return the number of ready file descriptors.

Fixes golang/go#34458

Change-Id: Ia618ce34ff754f2b731d7f913cab840d7948579c
Reviewed-on: https://go-review.googlesource.com/c/sys/+/196802
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-09-24 06:27:00 +00:00
Tobias Klauser 77b0e43150 unix: add symlink-safe *xattr functions on darwin
Updates golang/go#14456

Change-Id: I04632ef1d302e938a2cc373eb90f600f01404380
Reviewed-on: https://go-review.googlesource.com/114198
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-23 21:11:48 +00:00
Tobias Klauser 6f686a352d unix: add ErrnoName and SignalName
Add ErrnoName and SignalName to get errno and signal name strings from
syscall.Errno and syscall.Signal values, respectively.

This repurposes the errors and signals vars (because they are not used
within x/sys/unix currently) and turns them into slices of struct,
containing errno/signal number, name and description. ErrnoName and
SignalName can then be trivially implemented using sort.Search.

Renaming errors to errorList additionaly allows to avoid package aliases
for the errors package.

Fixes golang/go#25134

Change-Id: Ie195872793f44c437f0f175ccfaa13a2546338c5
Reviewed-on: https://go-review.googlesource.com/110875
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-05-04 06:42:12 +00:00
Tobias Klauser 665f6529cc unix: add Uname on Darwin
Darwin doesn't have a uname syscall but the same information can be
retrieved using sysctls. Use the raw sysctl numbers instead of doing the
roundtrip via SysctlString in order to void the additional sysctl calls
in nametomib and SysctlRaw.

This implementation follows the one in
https://opensource.apple.com/source/Libc/Libc-1244.1.7/gen/uname.c

Change-Id: I19541e2a6700f84ced0549a8fb86faa8cb5e6fbe
Reviewed-on: https://go-review.googlesource.com/77270
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-13 20:21:12 +00:00
Tobias Klauser 8413e589a2 unix: regenerate for macOS 10.13/iOS 11.1
Update the syscall numbers and error constants on macOS 10.13 with iOS
SDK 11.1.

The removed syscalls are all removed or marked as deprecated/old in the
following list

  https://opensource.apple.com/source/xnu/xnu-4570.1.46/bsd/kern/syscalls.master

which according to

  https://opensource.apple.com/release/macos-1013.html

is the kernel version used for macOS 10.13.

The poll function was moved around because I missed to regenerate the
zsyscall_darwin_*.go files in CL 74290.

Change-Id: I747c8c842f78f3db8d25b46759265aa99da9d739
Reviewed-on: https://go-review.googlesource.com/75972
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-06 15:14:41 +00:00
Tobias Klauser 46eaec7899 unix: use setattrlist for UtimesNanoAt on Darwin
Use to setarrlist to implement UtimesNanoAt with nanosecond precision
(on Mac OS 10.13 with APFS). Translate AT_SYMLINK_NOFOLLOW to
FSOPT_NOFOLLOW correspondingly.

Change-Id: I1468a1f4eecb53b2280ff6329b1ec64e204701f1
Reviewed-on: https://go-review.googlesource.com/75650
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-11-02 21:26:49 +00:00
Tobias Klauser feaf45c67f unix: use setattrlist for UtimesNano on Darwin for ns resolution
Follow CL 74952 for x/sys/unix.

Update golang/go#22528

Change-Id: Id146da75b80a64cfa4eac28e9bb7b3befe944718
Reviewed-on: https://go-review.googlesource.com/75610
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-02 20:14:56 +00:00
Tobias Klauser f1e7f7a8ac unix: add MNT_* constants on Darwin
Add the MNT_* constants used for the Mount and Umount functions on
Darwin.

Generated on Mac OS 10.11 (Darwin 15.6.0). This also brings
zerrors_darwin_{arm,arm64} up to date with constants which are already
present for 386 and amd64.

Fixes golang/go#9891

Change-Id: Id77847a2fb805a759aa0f5b36e8954b764e699a5
Reviewed-on: https://go-review.googlesource.com/54210
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-09 13:30:23 +00:00
Aaron Jacobs ec18ccffcd x/sys/unix: regenerate darwin/arm64 outputs with the latest SDK
I did this on OS X 10.10.5 (14F27) using the iOS SDK included in Xcode
6.4 (6E35b). This commit contains the same SYS_SYSCTL -> SYS___SYSCTL
workaround found in commit 9ef4b6c; see its description for more info.

Change-Id: I4dddc2a6d030ce297ee711f4430ec9db3abcda50
Reviewed-on: https://go-review.googlesource.com/14094
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-09-01 13:17:12 +00:00
Shenghou Ma 58e109635f unix: add darwin/arm64 support
Fixes golang/go#10239.

Change-Id: I3ae657b57ca7bef31207780477c44939c0bdc8b5
Signed-off-by: Shenghou Ma <minux@golang.org>
Reviewed-on: https://go-review.googlesource.com/10185
Reviewed-by: Rob Pike <r@golang.org>
2015-05-18 19:16:22 +00:00