summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/fsimpl/devpts
diff options
context:
space:
mode:
authorBhasker Hariharan <bhaskerh@google.com>2021-03-24 12:08:24 -0700
committergVisor bot <gvisor-bot@google.com>2021-03-24 12:11:44 -0700
commite7ca2a51a89a8ff2c9f5adfdfa5b51be1b3faeb3 (patch)
tree1abf748d2755526978f560abb67f29b6f83496c7 /pkg/sentry/fsimpl/devpts
parent72ff6a1cac6ab35132b4f79b1149590e103e5291 (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/fsimpl/devpts')
-rw-r--r--pkg/sentry/fsimpl/devpts/line_discipline.go16
-rw-r--r--pkg/sentry/fsimpl/devpts/queue.go4
2 files changed, 10 insertions, 10 deletions
diff --git a/pkg/sentry/fsimpl/devpts/line_discipline.go b/pkg/sentry/fsimpl/devpts/line_discipline.go
index ae95fdd08..e94a5bac3 100644
--- a/pkg/sentry/fsimpl/devpts/line_discipline.go
+++ b/pkg/sentry/fsimpl/devpts/line_discipline.go
@@ -141,7 +141,7 @@ func (l *lineDiscipline) setTermios(task *kernel.Task, args arch.SyscallArgument
l.inQueue.pushWaitBufLocked(l)
l.inQueue.readable = true
l.inQueue.mu.Unlock()
- l.replicaWaiter.Notify(waiter.EventIn)
+ l.replicaWaiter.Notify(waiter.ReadableEvents)
}
return 0, err
@@ -185,9 +185,9 @@ func (l *lineDiscipline) inputQueueRead(ctx context.Context, dst usermem.IOSeque
return 0, err
}
if n > 0 {
- l.masterWaiter.Notify(waiter.EventOut)
+ l.masterWaiter.Notify(waiter.WritableEvents)
if pushed {
- l.replicaWaiter.Notify(waiter.EventIn)
+ l.replicaWaiter.Notify(waiter.ReadableEvents)
}
return n, nil
}
@@ -202,7 +202,7 @@ func (l *lineDiscipline) inputQueueWrite(ctx context.Context, src usermem.IOSequ
return 0, err
}
if n > 0 {
- l.replicaWaiter.Notify(waiter.EventIn)
+ l.replicaWaiter.Notify(waiter.ReadableEvents)
return n, nil
}
return 0, syserror.ErrWouldBlock
@@ -220,9 +220,9 @@ func (l *lineDiscipline) outputQueueRead(ctx context.Context, dst usermem.IOSequ
return 0, err
}
if n > 0 {
- l.replicaWaiter.Notify(waiter.EventOut)
+ l.replicaWaiter.Notify(waiter.WritableEvents)
if pushed {
- l.masterWaiter.Notify(waiter.EventIn)
+ l.masterWaiter.Notify(waiter.ReadableEvents)
}
return n, nil
}
@@ -237,7 +237,7 @@ func (l *lineDiscipline) outputQueueWrite(ctx context.Context, src usermem.IOSeq
return 0, err
}
if n > 0 {
- l.masterWaiter.Notify(waiter.EventIn)
+ l.masterWaiter.Notify(waiter.ReadableEvents)
return n, nil
}
return 0, syserror.ErrWouldBlock
@@ -397,7 +397,7 @@ func (*inputQueueTransformer) transform(l *lineDiscipline, q *queue, buf []byte)
// Anything written to the readBuf will have to be echoed.
if l.termios.LEnabled(linux.ECHO) {
l.outQueue.writeBytes(cBytes, l)
- l.masterWaiter.Notify(waiter.EventIn)
+ l.masterWaiter.Notify(waiter.ReadableEvents)
}
// If we finish a line, make it available for reading.
diff --git a/pkg/sentry/fsimpl/devpts/queue.go b/pkg/sentry/fsimpl/devpts/queue.go
index 55bff3e60..47b0f1599 100644
--- a/pkg/sentry/fsimpl/devpts/queue.go
+++ b/pkg/sentry/fsimpl/devpts/queue.go
@@ -69,7 +69,7 @@ func (q *queue) readReadiness(t *linux.KernelTermios) waiter.EventMask {
q.mu.Lock()
defer q.mu.Unlock()
if len(q.readBuf) > 0 && q.readable {
- return waiter.EventIn
+ return waiter.ReadableEvents
}
return waiter.EventMask(0)
}
@@ -79,7 +79,7 @@ func (q *queue) writeReadiness(t *linux.KernelTermios) waiter.EventMask {
q.mu.Lock()
defer q.mu.Unlock()
if q.waitBufLen < waitBufMaxBytes {
- return waiter.EventOut
+ return waiter.WritableEvents
}
return waiter.EventMask(0)
}