metropolis/node: use concise logging in tty0/ttyS1
Change-Id: I28ad4418a05a7962d61160583b2e210f73ff8c51
Reviewed-on: https://review.monogon.dev/c/monogon/+/1360
Reviewed-by: Leopold Schabel <leo@monogon.tech>
Tested-by: Jenkins CI
diff --git a/metropolis/node/core/panichandler.go b/metropolis/node/core/panichandler.go
index fe0e2e1..3f17ffc 100644
--- a/metropolis/node/core/panichandler.go
+++ b/metropolis/node/core/panichandler.go
@@ -20,6 +20,7 @@
// This hooks into a global variable which is checked by runtime.write and used
// instead of runtime.write1 if populated.
+//
//go:linkname overrideWrite runtime.overrideWrite
var overrideWrite func(fd uintptr, p unsafe.Pointer, n int32) int32
@@ -30,6 +31,7 @@
// runtime.write1, just with a hardcoded file descriptor and using the assembly
// function unix.RawSyscall to not get a dependency on Go's calling convention
// and needing an implementation for every architecture.
+//
//go:nosplit
func runtimeWrite(fd uintptr, p unsafe.Pointer, n int32) int32 {
// Only redirect writes to stderr.
@@ -55,7 +57,7 @@
const runtimeLogPath = "/esp/core_runtime.log"
-func initPanicHandler(lt *logtree.LogTree, consoles []string) {
+func initPanicHandler(lt *logtree.LogTree, consoles []console) {
rl := lt.MustRawFor("panichandler")
l := lt.MustLeveledFor("panichandler")
@@ -82,11 +84,11 @@
runtimeFds = append(runtimeFds, fd)
}
- for _, s := range consoles {
- fd, err := unix.Open(s, os.O_WRONLY, 0)
+ for _, console := range consoles {
+ fd, err := unix.Open(console.path, os.O_WRONLY, 0)
if err == nil {
runtimeFds = append(runtimeFds, fd)
- l.Infof("Panic console: %s", s)
+ l.Infof("Panic console: %s", console.path)
}
}