From 425421d9b1641036d300dc965e597ec6c7648537 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Thu, 16 Oct 2025 00:27:00 +0900 Subject: [PATCH] hst/container: rename constants The shim is an implementation detail and should not be mentioned in the API. Signed-off-by: Ophestra --- hst/container.go | 18 +++++++++--------- internal/app/shim.go | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/hst/container.go b/hst/container.go index 08fb8fa..94017bf 100644 --- a/hst/container.go +++ b/hst/container.go @@ -27,22 +27,22 @@ const ( ) const ( - // ShimExitFailure is returned if the container fails to start. - ShimExitFailure = iota + 1 - // ShimExitCancel is returned if the container is terminated by a shim-directed signal which cancels its context. - ShimExitCancel - // ShimExitOrphan is returned when the shim is orphaned before priv side delivers a signal. - ShimExitOrphan + // ExitFailure is returned if the container fails to start. + ExitFailure = iota + 1 + // ExitCancel is returned if the container is terminated by a shim-directed signal which cancels its context. + ExitCancel + // ExitOrphan is returned when the shim is orphaned before priv side delivers a signal. + ExitOrphan - // ShimExitRequest is returned when the priv side process requests shim exit. - ShimExitRequest = 254 + // ExitRequest is returned when the priv side process requests shim exit. + ExitRequest = 254 ) const ( // FMultiarch unblocks syscalls required for multiarch to work on applicable targets. FMultiarch uintptr = 1 << iota - // FSeccompCompat causes emitted seccomp filter programs to be identical to Flatpak. + // FSeccompCompat changes emitted seccomp filter programs to be identical to that of Flatpak. FSeccompCompat // FDevel unblocks ptrace and friends. FDevel diff --git a/internal/app/shim.go b/internal/app/shim.go index 992215f..6902816 100644 --- a/internal/app/shim.go +++ b/internal/app/shim.go @@ -128,12 +128,12 @@ func ShimMain() { // setup has not completed, terminate immediately msg.Resume() - os.Exit(hst.ShimExitRequest) + os.Exit(hst.ExitRequest) return case 1: // got SIGCONT after adoption: monitor died before delivering signal msg.BeforeExit() - os.Exit(hst.ShimExitOrphan) + os.Exit(hst.ExitOrphan) return case 2: // unreachable @@ -169,7 +169,7 @@ func ShimMain() { if err := z.Start(); err != nil { printMessageError("cannot start container:", err) - os.Exit(hst.ShimExitFailure) + os.Exit(hst.ExitFailure) } if err := z.Serve(); err != nil { printMessageError("cannot configure container:", err) @@ -186,7 +186,7 @@ func ShimMain() { var exitError *exec.ExitError if !errors.As(err, &exitError) { if errors.Is(err, context.Canceled) { - os.Exit(hst.ShimExitCancel) + os.Exit(hst.ExitCancel) } log.Printf("wait: %v", err) os.Exit(127)