summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/kernel
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2019-12-06 22:36:35 +0000
committergVisor bot <gvisor-bot@google.com>2019-12-06 22:36:35 +0000
commitb2e153db1d367345e9fa381ebf76bd92f04d384b (patch)
tree00243f6b4d645a62a89dd52a3ba71f5c442fd61b /pkg/sentry/kernel
parent9c549c975847ef6d4d1e07c69bf2fb5721ab5c09 (diff)
parent663fe840f79ac3d8e2ce1a1f1409d84cf2a9d37e (diff)
Merge release-20191129.0-14-g663fe84 (automated)
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
+}