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

22 Коммитов

Автор SHA1 Сообщение Дата
Koichi Shiraishi 4dd72447c2 unix: add stdint.h for mkall.sh on darwin/arm64
currently occured below error:
  In file included from /Users/zchee/go/src/golang.org/x/sys/unix/types_darwin.go:24:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/signal.h:63:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/signal.h:146:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/machine/_mcontext.h:34:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/arm/_mcontext.h:36:
  In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/mach/machine/_structs.h:35:
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/mach/arm/_structs.h:482:2: error: unknown type name 'uint32_t'
  	uint32_t    fpsr;
  	^
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/mach/arm/_structs.h:483:2: error: unknown type name 'uint32_t'
  	uint32_t    fpcr;
  	^
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/mach/arm/_structs.h:489:2: error: unknown type name 'uint32_t'
  	uint32_t    fpsr;
  	^
  /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/mach/arm/_structs.h:490:2: error: unknown type name 'uint32_t'
  	uint32_t    fpcr;
  	^
  4 errors generated.

Change-Id: Iba2520fbf600914d3e8ed54b073039a6470846f7
Reviewed-on: https://go-review.googlesource.com/c/sys/+/357070
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-11-02 19:28:58 +00:00
Koichi Shiraishi b3129d9d10 unix: fix difference Stat_t type and Statfs_t type per GOARCH on darwin
In darwin/arm64, has the libc_fstat{fs} trampoline, not libc_fstat{fs}64.
But types_darwin.go defined same C types.

Change-Id: Ia33c60029eb59360e421f42ef79efe890eba3e3e
Reviewed-on: https://go-review.googlesource.com/c/sys/+/357071
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Tobias Klauser <tobias.klauser@gmail.com>
2021-10-30 16:08:13 +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
Dustin Spicuzza 969570ce7c unix: add Sysv shared memory support
Implements proposed API from https://golang.org/issue/46084. I chose
`SysvShmDesc` since it's a clearer name than `SysvShm`. Initially supports Darwin and Linux.

Solaris support has a blocker (https://golang.org/issue/46084#issuecomment-836980018)

For golang/go#46084

Change-Id: Ied0f768a74c448254adc3315348417825a7ec63e
GitHub-Last-Rev: befbd7af6b
GitHub-Pull-Request: golang/sys#110
Reviewed-on: https://go-review.googlesource.com/c/sys/+/327830
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
2021-09-30 14:19:18 +00:00
Ed Schouten 59db8d763f unix: add bindings for kinfo_proc on Darwin
On Linux, we can extract a list of all the processes on the system by
calling readdir() against /proc. On BSD-like systems, this information
needs to be extracted from sysctl in the form of kinfo_proc structures.

This change adds bindings for this structure and adds a method for
reading an array of these structures from sysctl.

Change-Id: Iaaed27cdbbf13d7c2cc6a6787667ac04d65bf41c
GitHub-Last-Rev: 34926f8474
GitHub-Pull-Request: golang/sys#111
Reviewed-on: https://go-review.googlesource.com/c/sys/+/328169
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2021-06-16 09:43:52 +00:00
Tobias Klauser 04245dca01 unix: add IPMreqn and {Get,Set}sockoptIPMreqn on darwin
Change-Id: Id145cc8d86b71ff3ef603b5d0aae4bdd0e4c3f2b
Reviewed-on: https://go-review.googlesource.com/c/sys/+/312410
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-04-23 08:28:22 +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
Tobias Klauser ef89a241cc unix: add SizeofIovec on darwin
Change-Id: I50909f3b731b4c0ef7f37788e8132930bb865c2b
Reviewed-on: https://go-review.googlesource.com/c/sys/+/274452
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-12-01 14:50:00 +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 9d91bd6205 unix: implement Getwd using getcwd from libSystem on darwin
Directly wrap the getcwd implementation provided by libSystem.dylib on
darwin and use it to implement Getwd like on the BSDs. This allows to
drop the custom implementation using getAttrList and to merge the
implementation of Getwd for darwin and the BSDs in syscall_bsd.go.

Change-Id: I62d38a239a7279fb95c912344bda2830856d4da4
Reviewed-on: https://go-review.googlesource.com/c/sys/+/257497
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-26 10:08:07 +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
Tobias Klauser 8469e31483 unix: export sizeof consts
Export the sizeof(Ptr|Short|Int|Long|LongLong) consts. This allows users
to get this information (e.g. for alignment purposes) without using cgo
or generating these constants themselves.

Change-Id: I8640482bf67b89c2f2b6e9a116ba7bc268f8135a
Reviewed-on: https://go-review.googlesource.com/c/139617
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-04 14:53:25 +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 f0d39a4bd5 unix: add Poll function on Darwin
Tested with TestPoll extracted from syscall_linux_test.go. Once Poll is
supported on all OSes this test can be moved to syscall_unix_test.go.

Change-Id: Ia57e3a92e6a50cb22edde8a31e1c4e70d894dc4c
Reviewed-on: https://go-review.googlesource.com/73310
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-10-25 12:55:06 +00:00
Tobias Klauser 396c9fc8fb unix: add ioctl functions on Darwin
Add IoctlGetInt/IoctlSetInt, IoctlGetTermios/IoctlSetTermios and
IoctlGetWinsize/IoctlSetWinsize on Darwin. These are similar to the
already existing implementations on Linux and Solaris.

Generated on Mac OS 10.11 (Darwin 15.6.0).

Change-Id: I2d4cc957c840836fcc2ccb71c67631420f4a2eb1
Reviewed-on: https://go-review.googlesource.com/52410
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-08-01 17:37:36 +00:00
Tobias Klauser c4489faa6e unix: add *at functions (POSIX.1-2008) on Darwin
Add the Faccessat, Fchownat, Linkat, Mkdirat, Openat, Readlinkat,
Renameat, Symlinkat and Unlinkat functions (to conform to POSIX.1-2008)
and make Fchmodat available on all architectures, not just amd64. Also
add the missing AT_* constants.

Generated on Mac OS 10.11 (Darwin 15.6.0) for darwin/amd64 and
darwin/386 only.

Fixes golang/go#14458

Change-Id: I6d9258864383ea77f9cad058ee8ba2c728213b40
Reviewed-on: https://go-review.googlesource.com/50450
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-07-21 16:35:17 +00:00
Joe Richey ea9bcade75 unix: generate all Linux go files from source
Right now the process for adding in new constants, errors, or syscalls
for Linux is a pain and unreliable. The scripts are designed to be run
on the target architecture and use the header files installed on the
user's system. This makes it hard to generate files for all the
architectures or to have consistency between users. See golang/go#15282.

This CL fixes this issue by making all of the files for the 11 supported
architectures directly from source checkouts of Linux, glibc, and bluez.
This is done using Docker, the gcc cross-compilers, and qemu emulation.
Previously discussed here:
    https://go-review.googlesource.com/c/37589/

A README.md file is also added to explain how all the parts of the build
system work.

In order to get the build working for all the architectures, I made
some changes to the other scripts called from mkall_linux.go:
  - Files only used for generating linux code, moved to linux/
  - linux/mksysnum.pl supports a specified CC compiler.
  - The generated C code in mkerrors.sh changed to avoid a warning
  - mkerrors.sh headers changed to fix powerpc64 bug in sys/ioctl.h
  - linux/types.go no longer needs to export Ptrace structs in lowercase

Build instructions:
  - Host system needs to be x86-64 Linux
  - Install Docker (https://docs.docker.com/engine/installation/)
  - ./mkall.sh (That's it!!!)

Change-Id: I87067c14442ba12f8d51991349a43a9d73f38ae0
Reviewed-on: https://go-review.googlesource.com/37943
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-04-21 00:52:44 +00:00
Aaron Jacobs e6e5e023fc x/sys/unix: expose fchmodat(2) and related constants on darwin/amd64
These are already exposed on Linux. I believe they were left out of
darwin because fchmodat didn't exist on older versions of XNU.

Change-Id: I166f2b23270937c1b6cc3bd73e7f7b72d2d488e9
Reviewed-on: https://go-review.googlesource.com/14092
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-09-02 01:16:36 +00:00
Rob Pike 8442dd2c63 go.sys: update package names
Semi-automatic migration from package syscall to package {plan9,windows,unix}.
No builds attempted yet, but this gets a lot of noise behind us so subsequent
CLs will be more concise and easier to follow.
Subsequent CLs will have semantic content.

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/121520043
2014-08-11 15:58:26 -07:00
Rob Pike 20acc5cf31 go.sys: copy files from syscall package to go.sys/{plan9,windows,unix}
This CL copies to each package of go.sys the files from syscall it will need.
Different directories have different files, but these:
        mkall.sh
        str.go
        syscall.go
        mksyscall.pl
        race.go
        race0.go
        syscall_test.go
are copied to all three.
No changes yet, these are just copies. They are not ready to use yet:
package names are wrong, for starters. But this clean copy will make
it easier to follow the changes as the packages are enabled.

LGTM=rsc
R=golang-codereviews, rsc
CC=golang-codereviews
https://golang.org/cl/126960043
2014-08-11 14:48:46 -07:00