diff options
author | Bhasker Hariharan <bhaskerh@google.com> | 2021-03-24 12:08:24 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-03-24 12:11:44 -0700 |
commit | e7ca2a51a89a8ff2c9f5adfdfa5b51be1b3faeb3 (patch) | |
tree | 1abf748d2755526978f560abb67f29b6f83496c7 /pkg/sentry/fs/host | |
parent | 72ff6a1cac6ab35132b4f79b1149590e103e5291 (diff) |
Add POLLRDNORM/POLLWRNORM support.
On Linux these are meant to be equivalent to POLLIN/POLLOUT. Rather
than hack these on in sys_poll etc it felt cleaner to just cleanup
the call sites to notify for both events. This is what linux does
as well.
Fixes #5544
PiperOrigin-RevId: 364859977
Diffstat (limited to 'pkg/sentry/fs/host')
-rw-r--r-- | pkg/sentry/fs/host/socket.go | 4 | ||||
-rw-r--r-- | pkg/sentry/fs/host/wait_test.go | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/pkg/sentry/fs/host/socket.go b/pkg/sentry/fs/host/socket.go index f2d96d1ec..0b3d0617f 100644 --- a/pkg/sentry/fs/host/socket.go +++ b/pkg/sentry/fs/host/socket.go @@ -248,7 +248,7 @@ func (c *ConnectedEndpoint) Writable() bool { c.mu.RLock() defer c.mu.RUnlock() - return fdnotifier.NonBlockingPoll(int32(c.file.FD()), waiter.EventOut)&waiter.EventOut != 0 + return fdnotifier.NonBlockingPoll(int32(c.file.FD()), waiter.WritableEvents)&waiter.WritableEvents != 0 } // Passcred implements transport.ConnectedEndpoint.Passcred. @@ -345,7 +345,7 @@ func (c *ConnectedEndpoint) Readable() bool { c.mu.RLock() defer c.mu.RUnlock() - return fdnotifier.NonBlockingPoll(int32(c.file.FD()), waiter.EventIn)&waiter.EventIn != 0 + return fdnotifier.NonBlockingPoll(int32(c.file.FD()), waiter.ReadableEvents)&waiter.ReadableEvents != 0 } // SendQueuedSize implements transport.Receiver.SendQueuedSize. diff --git a/pkg/sentry/fs/host/wait_test.go b/pkg/sentry/fs/host/wait_test.go index 5925c85ea..bd6188e03 100644 --- a/pkg/sentry/fs/host/wait_test.go +++ b/pkg/sentry/fs/host/wait_test.go @@ -41,13 +41,13 @@ func TestWait(t *testing.T) { defer file.DecRef(ctx) - r := file.Readiness(waiter.EventIn) + r := file.Readiness(waiter.ReadableEvents) if r != 0 { t.Fatalf("File is ready for read when it shouldn't be.") } e, ch := waiter.NewChannelEntry(nil) - file.EventRegister(&e, waiter.EventIn) + file.EventRegister(&e, waiter.ReadableEvents) defer file.EventUnregister(&e) // Check that there are no notifications yet. |