diff options
author | Ayush Ranjan <ayushranjan@google.com> | 2021-03-03 10:23:55 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-03-03 10:25:58 -0800 |
commit | a9441aea2780da8c93da1c73da860219f98438de (patch) | |
tree | 8b12915756f5bfb926218214cd7bc0b3281605fd /pkg/p9/client.go | |
parent | b8a5420f49a2afd622ec08b5019e1bf537f7da82 (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/p9/client.go')
-rw-r--r-- | pkg/p9/client.go | 15 |
1 files changed, 7 insertions, 8 deletions
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. |