summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/link/rawfile/blockingpoll_unsafe.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/tcpip/link/rawfile/blockingpoll_unsafe.go')
-rw-r--r--pkg/tcpip/link/rawfile/blockingpoll_unsafe.go45
1 files changed, 8 insertions, 37 deletions
diff --git a/pkg/tcpip/link/rawfile/blockingpoll_unsafe.go b/pkg/tcpip/link/rawfile/blockingpoll_unsafe.go
index eeca47d78..84dc0e918 100644
--- a/pkg/tcpip/link/rawfile/blockingpoll_unsafe.go
+++ b/pkg/tcpip/link/rawfile/blockingpoll_unsafe.go
@@ -12,49 +12,20 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-// +build linux,amd64 linux,arm64
-// +build go1.12
-// +build !go1.14
-
-// Check go:linkname function signatures when updating Go version.
+// +build linux,!amd64
package rawfile
import (
"syscall"
- _ "unsafe" // for go:linkname
+ "unsafe"
)
-//go:noescape
-func BlockingPoll(fds *PollEvent, nfds int, timeout *syscall.Timespec) (int, syscall.Errno)
-
-// Use go:linkname to call into the runtime. As of Go 1.12 this has to
-// be done from Go code so that we make an ABIInternal call to an
-// ABIInternal function; see https://golang.org/issue/27539.
-
-// We need to call both entersyscallblock and exitsyscall this way so
-// that the runtime's check on the stack pointer lines up.
-
-// Note that calling an unexported function in the runtime package is
-// unsafe and this hack is likely to break in future Go releases.
-
-//go:linkname entersyscallblock runtime.entersyscallblock
-func entersyscallblock()
-
-//go:linkname exitsyscall runtime.exitsyscall
-func exitsyscall()
-
-// These forwarding functions must be nosplit because 1) we must
-// disallow preemption between entersyscallblock and exitsyscall, and
-// 2) we have an untyped assembly frame on the stack which can not be
-// grown or moved.
-
-//go:nosplit
-func callEntersyscallblock() {
- entersyscallblock()
-}
+// BlockingPoll is just a stub function that forwards to the ppoll() system call
+// on non-amd64 platforms.
+func BlockingPoll(fds *PollEvent, nfds int, timeout *syscall.Timespec) (int, syscall.Errno) {
+ n, _, e := syscall.Syscall6(syscall.SYS_PPOLL, uintptr(unsafe.Pointer(fds)),
+ uintptr(nfds), uintptr(unsafe.Pointer(timeout)), 0, 0, 0)
-//go:nosplit
-func callExitsyscall() {
- exitsyscall()
+ return int(n), e
}