diff options
author | gVisor bot <gvisor-bot@google.com> | 2021-06-03 21:26:32 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-06-03 21:26:32 +0000 |
commit | c43691a05306e48d6d1623b32073f8453ad994ef (patch) | |
tree | 030f0568719be5914b375c78a78eb2bdb754139f /pkg/sentry | |
parent | 2bc4d6f47b85728727ffa62ee308d34c75a1a0a6 (diff) | |
parent | b3c608ef8593bad15f9560899febe3ab1e654a73 (diff) |
Merge release-20210518.0-70-gb3c608ef8 (automated)
Diffstat (limited to 'pkg/sentry')
-rw-r--r-- | pkg/sentry/kernel/task_exit.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/pkg/sentry/kernel/task_exit.go b/pkg/sentry/kernel/task_exit.go index b1af1a7ef..385385d1e 100644 --- a/pkg/sentry/kernel/task_exit.go +++ b/pkg/sentry/kernel/task_exit.go @@ -28,6 +28,7 @@ import ( "errors" "fmt" "strconv" + "strings" "gvisor.dev/gvisor/pkg/abi/linux" "gvisor.dev/gvisor/pkg/sentry/arch" @@ -50,6 +51,23 @@ type ExitStatus struct { Signo int } +func (es ExitStatus) String() string { + var b strings.Builder + if code := es.Code; code != 0 { + if b.Len() != 0 { + b.WriteByte(' ') + } + _, _ = fmt.Fprintf(&b, "Code=%d", code) + } + if signal := es.Signo; signal != 0 { + if b.Len() != 0 { + b.WriteByte(' ') + } + _, _ = fmt.Fprintf(&b, "Signal=%d", signal) + } + return b.String() +} + // Signaled returns true if the ExitStatus indicates that the exiting task or // thread group was killed by a signal. func (es ExitStatus) Signaled() bool { |