summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/sentry/kernel')
-rwxr-xr-xpkg/sentry/kernel/kernel_state_autogen.go2
-rwxr-xr-xpkg/sentry/kernel/tty.go11
2 files changed, 13 insertions, 0 deletions
diff --git a/pkg/sentry/kernel/kernel_state_autogen.go b/pkg/sentry/kernel/kernel_state_autogen.go
index cd470686a..55c58b036 100755
--- a/pkg/sentry/kernel/kernel_state_autogen.go
+++ b/pkg/sentry/kernel/kernel_state_autogen.go
@@ -1100,11 +1100,13 @@ func (x *timekeeperClock) load(m state.Map) {
func (x *TTY) beforeSave() {}
func (x *TTY) save(m state.Map) {
x.beforeSave()
+ m.Save("Index", &x.Index)
m.Save("tg", &x.tg)
}
func (x *TTY) afterLoad() {}
func (x *TTY) load(m state.Map) {
+ m.Load("Index", &x.Index)
m.Load("tg", &x.tg)
}
diff --git a/pkg/sentry/kernel/tty.go b/pkg/sentry/kernel/tty.go
index 34f84487a..048de26dc 100755
--- a/pkg/sentry/kernel/tty.go
+++ b/pkg/sentry/kernel/tty.go
@@ -21,8 +21,19 @@ import "sync"
//
// +stateify savable
type TTY struct {
+ // Index is the terminal index. It is immutable.
+ Index uint32
+
mu sync.Mutex `state:"nosave"`
// tg is protected by mu.
tg *ThreadGroup
}
+
+// TTY returns the thread group's controlling terminal. If nil, there is no
+// controlling terminal.
+func (tg *ThreadGroup) TTY() *TTY {
+ tg.signalHandlers.mu.Lock()
+ defer tg.signalHandlers.mu.Unlock()
+ return tg.tty
+}