diff options
author | Brian Geffon <bgeffon@google.com> | 2018-06-11 15:33:07 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-06-11 15:34:08 -0700 |
commit | 0412f17e06670fb1f1d1d85ddd73bbadde40c087 (patch) | |
tree | f05a04fafde4d7fa75c071f5e069b77e9badf1a7 /pkg/sentry/socket/rpcinet/socket.go | |
parent | 7260363751915d21538c13b08b5bb6a48d0f4f8e (diff) |
rpcinet is treating EAGAIN and EWOULDBLOCK as different errnos.
PiperOrigin-RevId: 200124614
Change-Id: I38a7b083f1464a2a586fe24db648e624c455fec5
Diffstat (limited to 'pkg/sentry/socket/rpcinet/socket.go')
-rw-r--r-- | pkg/sentry/socket/rpcinet/socket.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/pkg/sentry/socket/rpcinet/socket.go b/pkg/sentry/socket/rpcinet/socket.go index a9dd1780a..ffe947500 100644 --- a/pkg/sentry/socket/rpcinet/socket.go +++ b/pkg/sentry/socket/rpcinet/socket.go @@ -228,7 +228,7 @@ func (s *socketOperations) Accept(t *kernel.Task, peerRequested bool, flags int, payload, se := rpcAccept(t, s.fd, peerRequested) // Check if we need to block. - if blocking && se == syserr.ErrWouldBlock { + if blocking && se == syserr.ErrTryAgain { // Register for notifications. e, ch := waiter.NewChannelEntry(nil) s.EventRegister(&e, waiter.EventIn) @@ -237,7 +237,7 @@ func (s *socketOperations) Accept(t *kernel.Task, peerRequested bool, flags int, // Try to accept the connection again; if it fails, then wait until we // get a notification. for { - if payload, se = rpcAccept(t, s.fd, peerRequested); se != syserr.ErrWouldBlock { + if payload, se = rpcAccept(t, s.fd, peerRequested); se != syserr.ErrTryAgain { break } @@ -471,7 +471,7 @@ func (s *socketOperations) RecvMsg(t *kernel.Task, dst usermem.IOSequence, flags } return int(res.Length), res.Address.GetAddress(), res.Address.GetLength(), socket.ControlMessages{}, syserr.FromError(e) } - if err != syserr.ErrWouldBlock || flags&linux.MSG_DONTWAIT != 0 { + if err != syserr.ErrWouldBlock && err != syserr.ErrTryAgain || flags&linux.MSG_DONTWAIT != 0 { return 0, nil, 0, socket.ControlMessages{}, err } @@ -490,7 +490,7 @@ func (s *socketOperations) RecvMsg(t *kernel.Task, dst usermem.IOSequence, flags } return int(res.Length), res.Address.GetAddress(), res.Address.GetLength(), socket.ControlMessages{}, syserr.FromError(e) } - if err != syserr.ErrWouldBlock { + if err != syserr.ErrWouldBlock && err != syserr.ErrTryAgain { return 0, nil, 0, socket.ControlMessages{}, err } @@ -546,7 +546,7 @@ func (s *socketOperations) SendMsg(t *kernel.Task, src usermem.IOSequence, to [] }} n, err := rpcSendMsg(t, req) - if err != syserr.ErrWouldBlock || flags&linux.MSG_DONTWAIT != 0 { + if err != syserr.ErrWouldBlock && err != syserr.ErrTryAgain || flags&linux.MSG_DONTWAIT != 0 { return int(n), err } @@ -558,7 +558,7 @@ func (s *socketOperations) SendMsg(t *kernel.Task, src usermem.IOSequence, to [] for { n, err := rpcSendMsg(t, req) - if err != syserr.ErrWouldBlock { + if err != syserr.ErrWouldBlock && err != syserr.ErrTryAgain { return int(n), err } |