From 172860a059ce2cff68aa85a3f66319ee52bdec13 Mon Sep 17 00:00:00 2001 From: Fabricio Voznika Date: Fri, 7 Sep 2018 16:58:19 -0700 Subject: 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 --- pkg/sentry/kernel/syslog.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'pkg/sentry/kernel/syslog.go') 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)) -- cgit v1.2.3