diff options
author | Fabricio Voznika <fvoznika@google.com> | 2018-09-07 16:58:19 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-09-07 16:59:27 -0700 |
commit | 172860a059ce2cff68aa85a3f66319ee52bdec13 (patch) | |
tree | 04473a36e4d7de303f4ecf9b0bb473a9a94e7262 /pkg/sentry/kernel | |
parent | 6cfb5cd56d4660cc0de6cd991a7ed4601824a7e6 (diff) |
Add 'Starting gVisor...' message to syslog
This allows applications to verify they are running with gVisor. It
also helps debugging when running with a mix of container runtimes.
Closes #54
PiperOrigin-RevId: 212059457
Change-Id: I51d9595ee742b58c1f83f3902ab2e2ecbd5cedec
Diffstat (limited to 'pkg/sentry/kernel')
-rw-r--r-- | pkg/sentry/kernel/syslog.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/pkg/sentry/kernel/syslog.go b/pkg/sentry/kernel/syslog.go index 125312b6a..6531bd5d2 100644 --- a/pkg/sentry/kernel/syslog.go +++ b/pkg/sentry/kernel/syslog.go @@ -86,14 +86,18 @@ func (s *syslog) Log() []byte { return m } - time := 0.0 + const format = "<6>[%11.6f] %s\n" + + s.msg = append(s.msg, []byte(fmt.Sprintf(format, 0.0, "Starting gVisor..."))...) + + time := 0.1 for i := 0; i < 10; i++ { time += rand.Float64() / 2 - s.msg = append(s.msg, []byte(fmt.Sprintf("<6>[%11.6f] %s\n", time, selectMessage()))...) + s.msg = append(s.msg, []byte(fmt.Sprintf(format, time, selectMessage()))...) } time += rand.Float64() / 2 - s.msg = append(s.msg, []byte(fmt.Sprintf("<6>[%11.6f] Ready!\n", time))...) + s.msg = append(s.msg, []byte(fmt.Sprintf(format, time, "Ready!"))...) // Return a copy. o := make([]byte, len(s.msg)) |