diff options
Diffstat (limited to 'pkg/fdnotifier')
-rw-r--r-- | pkg/fdnotifier/BUILD | 5 | ||||
-rw-r--r-- | pkg/fdnotifier/fdnotifier.go | 3 | ||||
-rw-r--r-- | pkg/fdnotifier/poll_unsafe.go | 8 |
3 files changed, 13 insertions, 3 deletions
diff --git a/pkg/fdnotifier/BUILD b/pkg/fdnotifier/BUILD index d0552c06e..aca2d8a82 100644 --- a/pkg/fdnotifier/BUILD +++ b/pkg/fdnotifier/BUILD @@ -10,5 +10,8 @@ go_library( ], importpath = "gvisor.dev/gvisor/pkg/fdnotifier", visibility = ["//:sandbox"], - deps = ["//pkg/waiter"], + deps = [ + "//pkg/waiter", + "@org_golang_x_sys//unix:go_default_library", + ], ) diff --git a/pkg/fdnotifier/fdnotifier.go b/pkg/fdnotifier/fdnotifier.go index 58529f99f..f4aae1953 100644 --- a/pkg/fdnotifier/fdnotifier.go +++ b/pkg/fdnotifier/fdnotifier.go @@ -25,6 +25,7 @@ import ( "sync" "syscall" + "golang.org/x/sys/unix" "gvisor.dev/gvisor/pkg/waiter" ) @@ -72,7 +73,7 @@ func (n *notifier) waitFD(fd int32, fi *fdInfo, mask waiter.EventMask) error { } e := syscall.EpollEvent{ - Events: mask.ToLinux() | -syscall.EPOLLET, + Events: mask.ToLinux() | unix.EPOLLET, Fd: fd, } diff --git a/pkg/fdnotifier/poll_unsafe.go b/pkg/fdnotifier/poll_unsafe.go index ab8857b5e..4225b04dd 100644 --- a/pkg/fdnotifier/poll_unsafe.go +++ b/pkg/fdnotifier/poll_unsafe.go @@ -35,8 +35,14 @@ func NonBlockingPoll(fd int32, mask waiter.EventMask) waiter.EventMask { events: int16(mask.ToLinux()), } + ts := syscall.Timespec{ + Sec: 0, + Nsec: 0, + } + for { - n, _, err := syscall.RawSyscall(syscall.SYS_POLL, uintptr(unsafe.Pointer(&e)), 1, 0) + n, _, err := syscall.RawSyscall6(syscall.SYS_PPOLL, uintptr(unsafe.Pointer(&e)), 1, + uintptr(unsafe.Pointer(&ts)), 0, 0, 0) // Interrupted by signal, try again. if err == syscall.EINTR { continue |