summaryrefslogtreecommitdiffhomepage
path: root/pkg/tcpip/link/sharedmem/rx.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/tcpip/link/sharedmem/rx.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/tcpip/link/sharedmem/rx.go')
-rw-r--r--pkg/tcpip/link/sharedmem/rx.go46
1 files changed, 23 insertions, 23 deletions
diff --git a/pkg/tcpip/link/sharedmem/rx.go b/pkg/tcpip/link/sharedmem/rx.go
index eec11e4cb..8e6f3e5e3 100644
--- a/pkg/tcpip/link/sharedmem/rx.go
+++ b/pkg/tcpip/link/sharedmem/rx.go
@@ -18,8 +18,8 @@ package sharedmem
import (
"sync/atomic"
- "syscall"
+ "golang.org/x/sys/unix"
"gvisor.dev/gvisor/pkg/tcpip/link/rawfile"
"gvisor.dev/gvisor/pkg/tcpip/link/sharedmem/queue"
)
@@ -46,43 +46,43 @@ func (r *rx) init(mtu uint32, c *QueueConfig) error {
rxPipe, err := getBuffer(c.RxPipeFD)
if err != nil {
- syscall.Munmap(txPipe)
+ unix.Munmap(txPipe)
return err
}
data, err := getBuffer(c.DataFD)
if err != nil {
- syscall.Munmap(txPipe)
- syscall.Munmap(rxPipe)
+ unix.Munmap(txPipe)
+ unix.Munmap(rxPipe)
return err
}
sharedData, err := getBuffer(c.SharedDataFD)
if err != nil {
- syscall.Munmap(txPipe)
- syscall.Munmap(rxPipe)
- syscall.Munmap(data)
+ unix.Munmap(txPipe)
+ unix.Munmap(rxPipe)
+ unix.Munmap(data)
return err
}
// Duplicate the eventFD so that caller can close it but we can still
// use it.
- efd, err := syscall.Dup(c.EventFD)
+ efd, err := unix.Dup(c.EventFD)
if err != nil {
- syscall.Munmap(txPipe)
- syscall.Munmap(rxPipe)
- syscall.Munmap(data)
- syscall.Munmap(sharedData)
+ unix.Munmap(txPipe)
+ unix.Munmap(rxPipe)
+ unix.Munmap(data)
+ unix.Munmap(sharedData)
return err
}
// Set the eventfd as non-blocking.
- if err := syscall.SetNonblock(efd, true); err != nil {
- syscall.Munmap(txPipe)
- syscall.Munmap(rxPipe)
- syscall.Munmap(data)
- syscall.Munmap(sharedData)
- syscall.Close(efd)
+ if err := unix.SetNonblock(efd, true); err != nil {
+ unix.Munmap(txPipe)
+ unix.Munmap(rxPipe)
+ unix.Munmap(data)
+ unix.Munmap(sharedData)
+ unix.Close(efd)
return err
}
@@ -99,12 +99,12 @@ func (r *rx) init(mtu uint32, c *QueueConfig) error {
// called if init() has previously succeeded.
func (r *rx) cleanup() {
a, b := r.q.Bytes()
- syscall.Munmap(a)
- syscall.Munmap(b)
+ unix.Munmap(a)
+ unix.Munmap(b)
- syscall.Munmap(r.data)
- syscall.Munmap(r.sharedData)
- syscall.Close(r.eventFD)
+ unix.Munmap(r.data)
+ unix.Munmap(r.sharedData)
+ unix.Close(r.eventFD)
}
// postAndReceive posts the provided buffers (if any), and then tries to read