summaryrefslogtreecommitdiff
path: root/src/runtime/export_unix_test.go
Commit message (Collapse)AuthorAgeFilesLines
* runtime: consistently define fcntlIan Lance Taylor2023-05-171-0/+1
| | | | | | | | | | | | | | | | Clean up and consolidate on a single consistent definition of fcntl, which takes three int32 arguments and returns either a positive result or a negative errno value. Change-Id: Id9505492712db4b0aab469c6bd15e4fce3c9ff6e Reviewed-on: https://go-review.googlesource.com/c/go/+/495075 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Michael Pratt <mpratt@google.com>
* runtime: add page tracerMichael Knyszek2022-11-181-0/+6
| | | | | | | | | | | | | | | This change adds a new GODEBUG flag called pagetrace that writes a low-overhead trace of how pages of memory are managed by the Go runtime. The page tracer is kept behind a GOEXPERIMENT flag due to a potential security risk for setuid binaries. Change-Id: I6f4a2447d02693c25214400846a5d2832ad6e5c0 Reviewed-on: https://go-review.googlesource.com/c/go/+/444157 Reviewed-by: Austin Clements <austin@google.com> Reviewed-by: David Chase <drchase@google.com> Run-TryBot: Michael Knyszek <mknyszek@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
* runtime: move epoll syscalls to runtime/internal/syscallAndrew Pogrebnoy2022-10-071-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This change moves Linux epoll's syscalls implementation to the "runtime/internal/syscall" package. The intention in this CL was to minimise behavioural changes but make the code more generalised. This also will allow adding new syscalls (like epoll_pwait2) without the need to implement assembly stubs for each arch. It also drops epoll_create as not all architectures provide this call. epoll_create1 was added to the kernel in version 2.6.27 and Go requires Linux kernel version 2.6.32 or later since Go 1.18. So it is safe to always use epoll_create1. This is a resubmit as the previous CL 421994 was reverted due to test failures after the merge with the master. The issue was fixed in CL 438615 For #53824 For #51087 Change-Id: I1bd0f23a85b4f9b80178c5dd36fd3e95ff4f9648 Reviewed-on: https://go-review.googlesource.com/c/go/+/440115 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Michael Pratt <mpratt@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> Run-TryBot: Michael Pratt <mpratt@google.com>
* Revert "runtime: move epoll syscalls to runtime/internal/syscall"Michael Pratt2022-09-301-0/+1
| | | | | | | | | | | | | | | | This reverts CL 421994. Reason for revert: breaks runtime.TestCheckPtr2 For #53824 For #51087 Change-Id: I044ea4d6efdffe0a4b7fb0d2bb3717d9f391fc59 Reviewed-on: https://go-review.googlesource.com/c/go/+/437295 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Michael Pratt <mpratt@google.com> Auto-Submit: Michael Pratt <mpratt@google.com> Reviewed-by: Bryan Mills <bcmills@google.com>
* runtime: move epoll syscalls to runtime/internal/syscallAndrew Pogrebnoy2022-09-301-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | This change moves Linux epoll's syscalls implementation to the "runtime/internal/syscall" package. The intention in this CL was to minimise behavioural changes but make the code more generalised. This also will allow adding new syscalls (like epoll_pwait2) without the need to implement assembly stubs for each arch. It also drops epoll_create as not all architectures provide this call. epoll_create1 was added to the kernel in version 2.6.27 and Go requires Linux kernel version 2.6.32 or later since Go 1.18. So it is safe to always use epoll_create1. For #53824 For #51087 Change-Id: I9a6a26b7f2075a38e041de1bab4691da0ecb94fc Reviewed-on: https://go-review.googlesource.com/c/go/+/421994 Reviewed-by: Michael Pratt <mpratt@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Run-TryBot: Michael Pratt <mpratt@google.com> Auto-Submit: Michael Pratt <mpratt@google.com>
* all: use new "unix" build tag where appropriateIan Lance Taylor2022-03-291-1/+1
| | | | | | | | | | For #20322 For #51572 Change-Id: Id0b4799d097d01128e98ba4cc0092298357bca45 Reviewed-on: https://go-review.googlesource.com/c/go/+/389935 Trust: Ian Lance Taylor <iant@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
* runtime: remove fallback to pipe on platforms with pipe2Tobias Klauser2022-03-031-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | On Linux, the minimum required kernel version for Go 1.18 was be changed to 2.6.32, see #45964. The pipe2 syscall was added in 2.6.27. All other platforms already provide the pipe2 syscall in the minimum supported version: - DragonFly BSD added it in version 4.2, see https://www.dragonflybsd.org/release42/ - FreeBSD added it in version 10.0, see https://www.freebsd.org/cgi/man.cgi?pipe(2)#end - NetBSD added it in version 6.0, see https://man.netbsd.org/pipe2.2#HISTORY - OpenBSD added it in version 5.7, see https://man.openbsd.org/pipe.2#HISTORY - Illumos supports it since 2013, see https://www.illumos.org/issues/3714 - Solaris supports it since 11.4 This also allows to remove setNonblock which was only used in the pipe fallback path on these platforms. Change-Id: I1f40d32fd3065d74e22af77b9ff2292b9cf66706 Reviewed-on: https://go-review.googlesource.com/c/go/+/389354 Trust: Tobias Klauser <tobias.klauser@gmail.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* all: go fix -fix=buildtag std cmd (except for bootstrap deps, vendor)Russ Cox2021-10-281-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | When these packages are released as part of Go 1.18, Go 1.16 will no longer be supported, so we can remove the +build tags in these files. Ran go fix -fix=buildtag std cmd and then reverted the bootstrapDirs as defined in src/cmd/dist/buildtool.go, which need to continue to build with Go 1.4 for now. Also reverted src/vendor and src/cmd/vendor, which will need to be updated in their own repos first. Manual changes in runtime/pprof/mprof_test.go to adjust line numbers. For #41184. Change-Id: Ic0f93f7091295b6abc76ed5cd6e6746e1280861e Reviewed-on: https://go-review.googlesource.com/c/go/+/344955 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
* all: go fmt std cmd (but revert vendor)Russ Cox2021-02-201-0/+1
| | | | | | | | | | | | | | | | Make all our package sources use Go 1.17 gofmt format (adding //go:build lines). Part of //go:build change (#41184). See https://golang.org/design/draft-gobuild Change-Id: Ia0534360e4957e58cd9a18429c39d0e32a6addb4 Reviewed-on: https://go-review.googlesource.com/c/go/+/294430 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* runtime: use pipe2 syscall for Pipe in testsTobias Klauser2020-11-181-1/+0
| | | | | | | | | | | | | | | | On FreeBSD >= 11 with a kernel built with COMPAT_FREEBSD11 but not COMPAT_FREEBSD10, the pipe syscall is not available. Thus, tests using runtime.pipe fail with ENOSYS. As suggested by Ian, fix this by calling pipe2(0) in these tests and fall back to pipe() in case of ENOSYS. Fixes #42659 Change-Id: Ifbb8008884b7901fe87830d162ad326122c5fab9 Reviewed-on: https://go-review.googlesource.com/c/go/+/270917 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>
* runtime: use pipe rather than note in TestSignalMIan Lance Taylor2019-11-121-10/+25
| | | | | | | | | | At least on Darwin notewakeup is not async-signal-safe. Fixes #35276 Change-Id: I1d7523715e8e77dbd7f21d9b1ed131e52d46cc41 Reviewed-on: https://go-review.googlesource.com/c/go/+/206078 Reviewed-by: Austin Clements <austin@google.com>
* runtime: add pipe/pipe2 on SolarisIan Lance Taylor2019-11-081-0/+5
| | | | | | | | | | | | | | This adds pipe/pipe2 on Solaris as they exist on other Unix systems. They were not added previously because Solaris does not need them for netpollBreak. They are added now in preparation for using pipes in TestSignalM. Updates #35276 Change-Id: I53dfdf077430153155f0a79715af98b0972a841c Reviewed-on: https://go-review.googlesource.com/c/go/+/206077 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* runtime: remove write barrier in WaitForSigusr1Austin Clements2019-11-061-9/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | WaitForSigusr1 registers a callback to be called on SIGUSR1 directly from the runtime signal handler. Currently, this callback has a write barrier in it, which can crash with a nil P if the GC is active and the signal arrives on an M that doesn't have a P. Fix this by recording the ID of the M that receives the signal instead of the M itself, since that's all we needed anyway. To make sure there are no other problems, this also lifts the callback into a package function and marks it "go:nowritebarrierrec". Fixes #35248. Updates #35276, since in principle a write barrier at exactly the wrong time while entering the scheduler could cause issues, though I suspect that bug is unrelated. Change-Id: I47b4bc73782efbb613785a93e381d8aaf6850826 Reviewed-on: https://go-review.googlesource.com/c/go/+/204620 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Bryan C. Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* runtime: unblock SIGUSR1 for TestPreemptMAustin Clements2019-10-291-0/+6
| | | | | | | | | | | | | | | | | TestPreemptM tests signal delivery using SIGUSR1, but (for unknown reasons) SIGUSR1 is blocked by default on android/arm and android/arm64, causing the test to fail. This fixes the test by ensuring that SIGUSR1 is unblocked for this test. Updates #10958, #24543. Change-Id: I9f81fbab53f96c74622aabcb6f5276f79e2b6d33 Reviewed-on: https://go-review.googlesource.com/c/go/+/203957 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* runtime: add test for signalMAustin Clements2019-10-261-0/+39
| | | | | | | | | For #10958, #24543. Change-Id: Ib009a83fe02bc623894f4908fe8f6b266382ba95 Reviewed-on: https://go-review.googlesource.com/c/go/+/201404 Run-TryBot: Austin Clements <austin@google.com> Reviewed-by: Cherry Zhang <cherryyz@google.com>
* runtime: add AIX operating systemClément Chigot2018-10-031-1/+1
| | | | | | | | | | | | | | | | This commit adds AIX operating system to runtime package for ppc64 architecture. Only new files and minor changes are in this commit. Others modifications in files like asm_ppc64.s will be in separate commits. Updates: #25893 Change-Id: I9c5e073f5f3debb43b004ad1167694a5afd31cfd Reviewed-on: https://go-review.googlesource.com/c/138716 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* runtime: use SIGKILL if SIGQUIT is blocked; skip tests that need SIGQUITAustin Clements2017-07-201-0/+19
The runtime tests may be invoked from a parent that has SIGQUIT blocked. For example, Java invokes subprocesses this way. In this situation, TestCrashDumpsAllThreads and TestPanicSystemstack will fail because they depend on SIGQUIT to get tracebacks, and any subprocess test that times out will fail to kill the subprocess. Fix this by detecting if SIGQUIT is blocked and, if so, skipping tests that depend on it and using SIGKILL to kill timed-out subprocesses. Based on a fix by Carl Henrik Lunde in https://golang.org/issue/19196#issuecomment-316145733 Fixes #19196. Change-Id: Ia20bf15b96086487d0ef6b75239dcc260c21714c Reviewed-on: https://go-review.googlesource.com/50330 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>