The accept4 symbol is provided in libsocket.so on illumos. Follow-up fix
for CL 254717.
Change-Id: Iad70e998ea4ab80763288a300797eae8bed7de1a
Reviewed-on: https://go-review.googlesource.com/c/sys/+/256277
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>
The syscall wrapper generator utility is platform independent and can in
principle be run on a GOOS other than the one we're generating the
syscall wrappers for. Allow overriding GOOS by setting GOOS_TARGET,
similar to other generator programs in the repo.
Also remove the unused GOARCH_TARGET override in the same file.
Change-Id: I91459113af9f662f12a99b99c581c7f2615cb394
Reviewed-on: https://go-review.googlesource.com/c/sys/+/256278
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>
This allows to perform a fcntl syscall with the F_PREALLOCATE command.
See man fcntl(2) on macOS for details.
Change-Id: I21f95b91269513064859425ab7adc42a73d6adb5
Reviewed-on: https://go-review.googlesource.com/c/sys/+/255917
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>
The clonefile syscalls added by CL 254757 might fail on certain macOS
versions and/or file systems according to the clonefile(2) manpage. Skip
the corresponding tests in these cases.
This fixes the test failure on the darwin-amd64-10_12 builder.
Change-Id: Iae1d2b6d8e2fcddc129d639f003fbb1817b45006
Reviewed-on: https://go-review.googlesource.com/c/sys/+/255198
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>
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>
This commit adds support for three Darwin-specific calls that accelerate
the copying of files:
* clonefile()
* clonefileat()
* fclonefileat()
Fixesgolang/go#41366
Change-Id: I7e6c525fc23d8474ea85feff24314d3d672d87ed
Reviewed-on: https://go-review.googlesource.com/c/sys/+/254757
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>
Trust: Tobias Klauser <tobias.klauser@gmail.com>
Wrap the accept syscall which is available on illumos.
Also use tabs instead of spaces in the //sys comments in
syscall_illumos.go
Change-Id: Ic7fbfe29b44c6a168b9be4d4679a6321cc891bf1
Reviewed-on: https://go-review.googlesource.com/c/sys/+/254717
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Trust: Tobias Klauser <tobias.klauser@gmail.com>
openat2 is a new syscall added to Linux 5.6. It provides a superset of
openat(2) functionality, extending it with flags telling the kernel how
to resolve the paths.
For more info, see https://lwn.net/Articles/803237/
NOTE that this is a second attempt to add the call; the previous one
(https://golang.org/cl/227280) was reverted
(https://golang.org/cl/227846) due to the test case failure on ARM
(https://golang.org/issue/38357).
This CL has the test case reworked to be less assumptive to the testing
environment. In particular, it first tries if the most simplistic
openat2() call succeeds, and skips the test otherwise. It is done that
way because CI can be under under different kernels and in various
envrionments -- in particular, Docker+seccomp can result in EPERM from a
system call (which is not expected otherwise).
For previous discussions about the test case, see
https://golang.org/cl/227865.
Change-Id: I4276cf13dc29ecbdbdc9c58da0f76270f585a67f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/253057
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Add test for CL 251197.
Updates golang/go#41001
Change-Id: I6317678057eb8b18a1f7564842a92682c0c9930f
Reviewed-on: https://go-review.googlesource.com/c/sys/+/253097
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
The Windows compilers appear to align JOBOBJECT_BASIC_LIMIT_INFORMATION
to an 8-byte boundary, which on 32-bit systems means adding 32 bits of
padding. Unfortunately we can't always add a padding field, because
no padding is required on a 64-bit system. So use different versions
of the struct for different targets.
Fixesgolang/go#41001
Change-Id: I38d14edfd3f3a80da22825455f20e1f7de136638
Reviewed-on: https://go-review.googlesource.com/c/sys/+/251197
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Marc-Antoine Ruel <maruel@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
CL 250437 removed all SYS_* consts on darwin as direct syscalls are no
longer supported on this platform. However, some external packages (e.g.
github.com/shirou/gopsutil) still seem to rely on SYS___SYSCTL being
defined to implement their own sysctl wrappers. Re-add SYS___SYSCTL to
avoid breaking these packages.
Change-Id: I1ef1c05ba47a4b89be61ee8919d1651b7531d9c7
Reviewed-on: https://go-review.googlesource.com/c/sys/+/251738
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
CL 250437 broke the build with Go 1.12 on darwin, due to
SYS_GETDIRENTRIES64 being removed. However, this is still needed to
implement Getdirentries for Go 1.12 because it does not provide
syscall_syscallPtr for fdopendir. Thus, add _SYS_GETDIRENTRIES64 as an
unexported const.
Change-Id: I52b420095deeb50d7fac002702dfce01cbf34bb7
Reviewed-on: https://go-review.googlesource.com/c/sys/+/251317
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Since CL 250437 this package no longer supports non-libc, direct
syscalls. Thus the corresponding special cases can be removed from
the generating mksyscall.go program.
Change-Id: I54be144de8ffd483f10c7b3a69b0761b83542c55
Reviewed-on: https://go-review.googlesource.com/c/sys/+/251318
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Go 1.12 and newer are using libSystem for syscalls on darwin.
Go 1.11 is the last release to use direct syscalls. It hasn't been
supported since the release of Go 1.13 in September 2019, so drop
support for direct syscalls.
Change-Id: I2baf6f3d1031de8e474dc770369a25147e5efe2a
Reviewed-on: https://go-review.googlesource.com/c/sys/+/250437
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
On some machines, kern.maxfilesperproc is 4096. If Rlimit.Cur is larger
than that, Setrlimit will get an errEINVAL.
Same as CL 246658 did in package syscall.
Updates golang/go#40564
Change-Id: I8c45a23352fa2039772e04205680640e8a0e1840
Reviewed-on: https://go-review.googlesource.com/c/sys/+/250000
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
This may be used with unix.TIOCSPGRP which is available on platforms
other than linux.
Fixesgolang/go#40986
Change-Id: Ic96b119e68395e5b6c5f33504ad40f3dfd4804f7
Reviewed-on: https://go-review.googlesource.com/c/sys/+/250001
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
PIM support was removed from OpenBSD in 2016 and as such, the referenced headers
and sysctl names no longer exist.
Change-Id: I7f3e63741b0d4acb8a43e3615b86381f8071e836
Reviewed-on: https://go-review.googlesource.com/c/sys/+/249618
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
The code in this file is specific to linux and does not build on other
mips64x platforms.
Change-Id: Ic27eedf06f39a7d2c51f5b261d957eed04e5df0b
Reviewed-on: https://go-review.googlesource.com/c/sys/+/249318
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This was the intention from the start, but due to a logic error in the
handling of slices the implementation only handled minimum 8 character
strings.
This commit also improves the tests.
Change-Id: I6b0ed00bbd8a2faf90ca4a3ebe6218d3c5d6e8bf
GitHub-Last-Rev: 5b6dbc0682
GitHub-Pull-Request: golang/sys#77
Reviewed-on: https://go-review.googlesource.com/c/sys/+/248778
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
On z series machines the IUCV address family is used to communicate
between parts of the machine and other VMs that may be running.
This adds support for addressing these services using AF_IUCV.
Fixesgolang/go#40826
Change-Id: I3aba3beb5cb98d9c548d7abc874ca86fb25c8a52
GitHub-Last-Rev: b964d186b4
GitHub-Pull-Request: golang/sys#76
Reviewed-on: https://go-review.googlesource.com/c/sys/+/248777
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
This interface is used by devicemapper framework to manage its block
devices.
Change-Id: If86a679461867dac18b56bdf005567ffc4b7f951
Reviewed-on: https://go-review.googlesource.com/c/sys/+/247437
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Some systems (e.g. the linux-arm and linux-arm64-packet builders) return
EPERM instead of ENOSYS on unimplemented syscalls. Fall back to the
existing glibc-like implementation in Faccessat in this case as well.
This fixes tests on the linux-arm and linux-arm64-packet builders after
CL 246537.
Change-Id: I7d7598f9694a2db19bd17e79f333d5de3a31c6e2
Reviewed-on: https://go-review.googlesource.com/c/sys/+/246817
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This is used to convert the loadavg values read using Sysinfo into
float.
Change-Id: I3866c17c908a463373db89690152acc720c73ef3
Reviewed-on: https://go-review.googlesource.com/c/sys/+/246897
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
The GODEBUG environment variable can be used to disable usage of
specific processor features of Go programs that use the sys/cpu package.
This is useful for testing and benchmarking different code paths that
are guarded by sys/cpu variable checks.
Use of processor features can not be enabled through GODEBUG.
To disable usage of AVX and SSE41 cpu features on GOARCH amd64 use:
GODEBUG=cpu.avx=off,cpu.sse41=off
The special "all" option can be used to disable all options:
GODEBUG=all=off
This aligns the support of GODEBUG for sys/cpu with existing support
for GODEBUG in the Go standard library package internal/cpu.
Fixesgolang/go#33963
Change-Id: I618b71af397bf06c57a49b2a300d032a16d05664
Reviewed-on: https://go-review.googlesource.com/c/sys/+/245237
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Linux kernel 5.8 added the faccessat2 syscall taking a flags argument.
Attempt to use it in Faccessat and fall back to the existing
implementation mimicking glibc faccessat.
Tested on Debian Buster with manually built Linux kernel 5.8
Suggested by Ian Lance Taylor.
Change-Id: Ia14f744a63dde7ff2dea34935cabc62937de9cb5
Reviewed-on: https://go-review.googlesource.com/c/sys/+/246537
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
I noticed that we call syscall in servicemain without aligning stack.
That is against Windows rules, so align the stack as required.
I tried running this code with specifically non-aligned stack (I aligned
stack, and then subtracted 1 from SP) on my Windows 10 to test this
change. But it makes no difference on my Windows 10 PC - I built and run
golang.org/x/sys/windows/svc/example, and it runs successfully
regardless of stack alignment. But alignment might make difference on
other computers.
Maybe fixesgolang/go#40160
Change-Id: I351f7f730fba4aa6dc409a79de4ad737b4a0a7d4
Reviewed-on: https://go-review.googlesource.com/c/sys/+/246317
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Generated on NetBSD 9.0
Also add the sys/sched.h include in includes_FreeBSD in mkerrors.sh
which was missing in CL 244518.
Change-Id: I257e103849f9e0c6bbf1061eaaa187e277188f84
Reviewed-on: https://go-review.googlesource.com/c/sys/+/245217
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
This verifies that go tool cgo -godefs in Go 1.15 is able to generate all
consts and types in this package.
Change-Id: Ic63d15427f27527d7a6f8dc780ab560cde434bc8
Reviewed-on: https://go-review.googlesource.com/c/sys/+/244977
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matt Layher <mdlayher@gmail.com>
These are Linux-specific system calls for efficiently reading and
writing memory in foreign processes.
A new RemoteIovec type is added for use in these wrappers, as Iovec's
Base field is a pointer, and creating invalid pointers is invalid in
Go.
Change-Id: I329501ab7b4df9d0aebe289369d3a5f77120af02
GitHub-Last-Rev: 262aabed02
GitHub-Pull-Request: golang/sys#74
Reviewed-on: https://go-review.googlesource.com/c/sys/+/243497
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>