summaryrefslogtreecommitdiffhomepage
path: root/rwcancel
diff options
context:
space:
mode:
Diffstat (limited to 'rwcancel')
-rw-r--r--rwcancel/poll_linux.go17
-rw-r--r--rwcancel/poll_unix.go15
-rw-r--r--rwcancel/rwcancel.go4
3 files changed, 2 insertions, 34 deletions
diff --git a/rwcancel/poll_linux.go b/rwcancel/poll_linux.go
deleted file mode 100644
index d9938c5..0000000
--- a/rwcancel/poll_linux.go
+++ /dev/null
@@ -1,17 +0,0 @@
-/* SPDX-License-Identifier: MIT
- *
- * Copyright (C) 2017-2021 WireGuard LLC. All Rights Reserved.
- */
-
-package rwcancel
-
-import "golang.org/x/sys/unix"
-
-func poll(fds []unix.PollFd, timeout int) (n int, err error) {
- var ts *unix.Timespec
- if timeout >= 0 {
- ts = new(unix.Timespec)
- *ts = unix.NsecToTimespec(int64(timeout) * 1e6)
- }
- return unix.Ppoll(fds, ts, nil)
-}
diff --git a/rwcancel/poll_unix.go b/rwcancel/poll_unix.go
deleted file mode 100644
index 37e9686..0000000
--- a/rwcancel/poll_unix.go
+++ /dev/null
@@ -1,15 +0,0 @@
-//go:build !windows && !linux
-// +build !windows,!linux
-
-/* SPDX-License-Identifier: MIT
- *
- * Copyright (C) 2017-2021 WireGuard LLC. All Rights Reserved.
- */
-
-package rwcancel
-
-import "golang.org/x/sys/unix"
-
-func poll(fds []unix.PollFd, timeout int) (n int, err error) {
- return unix.Poll(fds, timeout)
-}
diff --git a/rwcancel/rwcancel.go b/rwcancel/rwcancel.go
index 45cc73b..7013b16 100644
--- a/rwcancel/rwcancel.go
+++ b/rwcancel/rwcancel.go
@@ -49,7 +49,7 @@ func (rw *RWCancel) ReadyRead() bool {
pollFds := []unix.PollFd{{Fd: int32(rw.fd), Events: unix.POLLIN}, {Fd: closeFd, Events: unix.POLLIN}}
var err error
for {
- _, err = poll(pollFds, -1)
+ _, err = unix.Poll(pollFds, -1)
if err == nil || !RetryAfterError(err) {
break
}
@@ -68,7 +68,7 @@ func (rw *RWCancel) ReadyWrite() bool {
pollFds := []unix.PollFd{{Fd: int32(rw.fd), Events: unix.POLLOUT}, {Fd: closeFd, Events: unix.POLLOUT}}
var err error
for {
- _, err = poll(pollFds, -1)
+ _, err = unix.Poll(pollFds, -1)
if err == nil || !RetryAfterError(err) {
break
}