From a9441aea2780da8c93da1c73da860219f98438de Mon Sep 17 00:00:00 2001 From: Ayush Ranjan Date: Wed, 3 Mar 2021 10:23:55 -0800 Subject: [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 --- pkg/p9/client.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'pkg/p9/client.go') diff --git a/pkg/p9/client.go b/pkg/p9/client.go index 3f4324ac1..764f1f970 100644 --- a/pkg/p9/client.go +++ b/pkg/p9/client.go @@ -17,7 +17,6 @@ package p9 import ( "errors" "fmt" - "syscall" "golang.org/x/sys/unix" "gvisor.dev/gvisor/pkg/flipcall" @@ -180,7 +179,7 @@ func NewClient(socket *unet.Socket, messageSize uint32, version string) (*Client }, &rversion) // The server told us to try again with a lower version. - if err == syscall.EAGAIN { + if err == unix.EAGAIN { if requested == lowestSupportedVersion { return nil, ErrVersionsExhausted } @@ -250,7 +249,7 @@ func (c *Client) watch(socket *unet.Socket) { // Wait for a shutdown event. for { n, err := unix.Ppoll(events, nil, nil) - if err == syscall.EINTR || err == syscall.EAGAIN { + if err == unix.EINTR || err == unix.EAGAIN { continue } if err != nil { @@ -437,7 +436,7 @@ func (c *Client) sendRecvLegacySyscallErr(t message, r message) error { received, err := c.sendRecvLegacy(t, r) if !received { log.Warningf("p9.Client.sendRecvChannel: %v", err) - return syscall.EIO + return unix.EIO } return err } @@ -485,7 +484,7 @@ func (c *Client) sendRecvLegacy(t message, r message) (bool, error) { // For convenience, we transform these directly // into errors. Handlers need not handle this case. if rlerr, ok := resp.r.(*Rlerror); ok { - return true, syscall.Errno(rlerr.Error) + return true, unix.Errno(rlerr.Error) } // At this point, we know it matches. @@ -524,7 +523,7 @@ func (c *Client) sendRecvChannel(t message, r message) error { // Map all transport errors to EIO, but ensure that the real error // is logged. log.Warningf("p9.Client.sendRecvChannel: flipcall.Endpoint.Connect: %v", err) - return syscall.EIO + return unix.EIO } } @@ -537,14 +536,14 @@ func (c *Client) sendRecvChannel(t message, r message) error { c.channelsMu.Unlock() c.channelsWg.Done() log.Warningf("p9.Client.sendRecvChannel: p9.channel.send: %v", err) - return syscall.EIO + return unix.EIO } // Parse the server's response. resp, retErr := ch.recv(r, rsz) if resp == nil { log.Warningf("p9.Client.sendRecvChannel: p9.channel.recv: %v", retErr) - retErr = syscall.EIO + retErr = unix.EIO } // Release the channel. -- cgit v1.2.3