summaryrefslogtreecommitdiffhomepage
path: root/pkg/fdnotifier/poll_unsafe.go
diff options
context:
space:
mode:
authorAyush Ranjan <ayushranjan@google.com>2021-03-03 10:23:55 -0800
committergVisor bot <gvisor-bot@google.com>2021-03-03 10:25:58 -0800
commita9441aea2780da8c93da1c73da860219f98438de (patch)
tree8b12915756f5bfb926218214cd7bc0b3281605fd /pkg/fdnotifier/poll_unsafe.go
parentb8a5420f49a2afd622ec08b5019e1bf537f7da82 (diff)
[op] Replace syscall package usage with golang.org/x/sys/unix in pkg/.
The syscall package has been deprecated in favor of golang.org/x/sys. Note that syscall is still used in the following places: - pkg/sentry/socket/hostinet/stack.go: some netlink related functionalities are not yet available in golang.org/x/sys. - syscall.Stat_t is still used in some places because os.FileInfo.Sys() still returns it and not unix.Stat_t. Updates #214 PiperOrigin-RevId: 360701387
Diffstat (limited to 'pkg/fdnotifier/poll_unsafe.go')
-rw-r--r--pkg/fdnotifier/poll_unsafe.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/pkg/fdnotifier/poll_unsafe.go b/pkg/fdnotifier/poll_unsafe.go
index ec2f997a2..493ea8375 100644
--- a/pkg/fdnotifier/poll_unsafe.go
+++ b/pkg/fdnotifier/poll_unsafe.go
@@ -17,9 +17,9 @@
package fdnotifier
import (
- "syscall"
"unsafe"
+ "golang.org/x/sys/unix"
"gvisor.dev/gvisor/pkg/waiter"
)
@@ -35,16 +35,16 @@ func NonBlockingPoll(fd int32, mask waiter.EventMask) waiter.EventMask {
events: int16(mask.ToLinux()),
}
- ts := syscall.Timespec{
+ ts := unix.Timespec{
Sec: 0,
Nsec: 0,
}
for {
- n, _, err := syscall.RawSyscall6(syscall.SYS_PPOLL, uintptr(unsafe.Pointer(&e)), 1,
+ n, _, err := unix.RawSyscall6(unix.SYS_PPOLL, uintptr(unsafe.Pointer(&e)), 1,
uintptr(unsafe.Pointer(&ts)), 0, 0, 0)
// Interrupted by signal, try again.
- if err == syscall.EINTR {
+ if err == unix.EINTR {
continue
}
// If an error occur we'll conservatively say the FD is ready for
@@ -66,14 +66,14 @@ func NonBlockingPoll(fd int32, mask waiter.EventMask) waiter.EventMask {
// epollWait performs a blocking wait on epfd.
//
// Preconditions: len(events) > 0
-func epollWait(epfd int, events []syscall.EpollEvent, msec int) (int, error) {
+func epollWait(epfd int, events []unix.EpollEvent, msec int) (int, error) {
if len(events) == 0 {
panic("Empty events passed to EpollWait")
}
// We actually use epoll_pwait with NULL sigmask instead of epoll_wait
// since that is what the Go >= 1.11 runtime prefers.
- r, _, e := syscall.Syscall6(syscall.SYS_EPOLL_PWAIT, uintptr(epfd), uintptr(unsafe.Pointer(&events[0])), uintptr(len(events)), uintptr(msec), 0, 0)
+ r, _, e := unix.Syscall6(unix.SYS_EPOLL_PWAIT, uintptr(epfd), uintptr(unsafe.Pointer(&events[0])), uintptr(len(events)), uintptr(msec), 0, 0)
if e != 0 {
return 0, e
}