aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/app/shim.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-09-29 02:33:10 +0900
committerOphestra <cat@gensokyo.uk>2025-09-29 06:11:47 +0900
commit46cd3a28c83e93b5d66c52d06a8366c11910d5c0 (patch)
tree6e25c5078b5cd9de78b7a6c9b253f1132358812b /internal/app/shim.go
parentad1bc6794f0053c3e63eab408a0d530d53e8b51c (diff)
container: remove global msg
This frees all container instances of side effects. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/app/shim.go')
-rw-r--r--internal/app/shim.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/internal/app/shim.go b/internal/app/shim.go
index e38104c9..8c860e1b 100644
--- a/internal/app/shim.go
+++ b/internal/app/shim.go
@@ -15,8 +15,6 @@ import (
"hakurei.app/container"
"hakurei.app/container/seccomp"
- "hakurei.app/internal"
- "hakurei.app/internal/hlog"
)
//#include "shim-signal.h"
@@ -53,7 +51,9 @@ const (
// ShimMain is the main function of the shim process and runs as the unconstrained target user.
func ShimMain() {
- hlog.Prepare("shim")
+ log.SetPrefix("shim: ")
+ log.SetFlags(0)
+ msg := container.NewMsg(log.Default())
if err := container.SetDumpable(container.SUID_DUMP_DISABLE); err != nil {
log.Fatalf("cannot set SUID_DUMP_DISABLE: %s", err)
@@ -73,7 +73,7 @@ func ShimMain() {
log.Fatalf("cannot receive shim setup params: %v", err)
} else {
- internal.InstallOutput(params.Verbose)
+ msg.SwapVerbose(params.Verbose)
closeSetup = f
}
@@ -111,12 +111,12 @@ func ShimMain() {
}
// setup has not completed, terminate immediately
- hlog.Resume()
+ msg.Resume()
os.Exit(ShimExitRequest)
return
case 1: // got SIGCONT after adoption: monitor died before delivering signal
- hlog.BeforeExit()
+ msg.BeforeExit()
os.Exit(ShimExitOrphan)
return
@@ -144,7 +144,7 @@ func ShimMain() {
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
cancelContainer.Store(&stop)
- z := container.New(ctx)
+ z := container.New(ctx, msg)
z.Params = *params.Container
z.Stdin, z.Stdout, z.Stderr = os.Stdin, os.Stdout, os.Stderr