summaryrefslogtreecommitdiff
path: root/src/runtime/export_linux_test.go
Commit message (Collapse)AuthorAgeFilesLines
* runtime: move epoll syscalls to runtime/internal/syscallAndrew Pogrebnoy2022-10-071-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-4/+6
| | | | | | | | | | | | | | | | 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-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* runtime: add padding to Linux kernel structuresRhys Hiltner2021-11-021-0/+5
| | | | | | | | | | | | | | | | | | | Go exchanges siginfo and sigevent structures with the kernel. They contain unions, but Go's use is limited to the first few fields. Pad out the rest so the size Go sees is the same as what the Linux kernel sees. This is a follow-up to CL 342052 which added the sigevent struct without padding, and to CL 353136 which added the padding but with an assertion that confused several type-checkers. It updates the siginfo struct as well so there are no bad examples in the defs_linux_*.go files. Reviewed-on: https://go-review.googlesource.com/c/go/+/353136 Change-Id: I9610632ff0ec43eba91f560536f5441fa907b36f Reviewed-on: https://go-review.googlesource.com/c/go/+/360094 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Michael Pratt <mpratt@google.com>
* runtime: fix unsafe.Pointer alignment on LinuxCuong Manh Le2019-10-221-0/+3
| | | | | | | | | | | | | | | | | | | | | Caught by go test -a -short -gcflags=all=-d=checkptr runtime TestMincoreErrorSign intentionally uses uintptr(1) to get -EINVAL, but it violates unsafe pointer rules 2. So use another misaligned pointer add(new(int32), 1), but do not violate unsafe pointer rules. TestEpollctlErrorSign passes an unsafe.Pointer of &struct{}{} to Epollctl, which is then casted to epollevent, causes mis-alignment. Fixing it by exporting epollevent on runtime_test package, so it can be passed to Epollctl. Updates #34972 Change-Id: I78ebfbeaf706fd1d372272af0bbc4e2cabca4631 Reviewed-on: https://go-review.googlesource.com/c/go/+/202157 Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* runtime: fix errno sign for epollctl on mips, mips64 and ppc64Wèi Cōngruì2018-04-241-0/+6
| | | | | | | | | | | | | | | The caller of epollctl expects it to return a negative errno value, but it returns a positive errno value on mips, mips64 and ppc64. The change fixes this. Updates #23446 Change-Id: Ie6372eca6c23de21964caaaa433c9a45ef93531e Reviewed-on: https://go-review.googlesource.com/89235 Reviewed-by: Carlos Eduardo Seo <cseo@linux.vnet.ibm.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* all: make copyright headers consistent with one space after periodBrad Fitzpatrick2016-03-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | This is a subset of https://golang.org/cl/20022 with only the copyright header lines, so the next CL will be smaller and more reviewable. Go policy has been single space after periods in comments for some time. The copyright header template at: https://golang.org/doc/contribute.html#copyright also uses a single space. Make them all consistent. Change-Id: Icc26c6b8495c3820da6b171ca96a74701b4a01b0 Reviewed-on: https://go-review.googlesource.com/20111 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* runtime: fix errno sign for some mmap and mincore casesIan Lance Taylor2016-02-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | The caller of mmap expects it to return a positive errno value, but the linux-arm64 and nacl-386 system calls returned a negative errno value. Correct them to negate the errno value. The caller of mincore expects it to return a negative errno value (yes, this is inconsistent), but the linux-mips64x and linux-ppc64x system call returned a positive errno value. Correct them to negate the errno value. Add a test that mmap returns errno with the correct sign. Brad added a test for mincore's errno value in https://golang.org/cl/19457. Fixes #14297. Change-Id: I2b93f32e679bd1eae1c9aef9ae7bcf0ba39521b5 Reviewed-on: https://go-review.googlesource.com/19455 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Minux Ma <minux@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* runtime: merge clone0 and cloneSrdjan Petrovic2015-04-221-0/+9
We initially added clone0 to handle the case when G or M don't exist, but it turns out that we could have just modified clone. (It also helps that the function we're invoking in clone0 no longer needs arguments.) As a side-effect, newosproc0 is now supported on all linux archs. Change-Id: Ie603af75d8f164310fc16446052d83743961f3ca Reviewed-on: https://go-review.googlesource.com/9164 Reviewed-by: David Crawshaw <crawshaw@golang.org>