hst/container: rename constants
All checks were successful
Test / Create distribution (push) Successful in 1m16s
Test / Sandbox (push) Successful in 3m4s
Test / Hakurei (push) Successful in 4m1s
Test / Sandbox (race detector) (push) Successful in 4m50s
Test / Hpkg (push) Successful in 5m4s
Test / Hakurei (race detector) (push) Successful in 5m38s
Test / Flake checks (push) Successful in 1m30s

The shim is an implementation detail and should not be mentioned in the API.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
Ophestra 2025-10-16 00:27:00 +09:00
parent 5e0f15d76b
commit 425421d9b1
Signed by: cat
SSH Key Fingerprint: SHA256:gQ67O0enBZ7UdZypgtspB2FDM1g3GVw8nX0XSdcFw8Q
2 changed files with 13 additions and 13 deletions

View File

@ -27,22 +27,22 @@ const (
) )
const ( const (
// ShimExitFailure is returned if the container fails to start. // ExitFailure is returned if the container fails to start.
ShimExitFailure = iota + 1 ExitFailure = iota + 1
// ShimExitCancel is returned if the container is terminated by a shim-directed signal which cancels its context. // ExitCancel is returned if the container is terminated by a shim-directed signal which cancels its context.
ShimExitCancel ExitCancel
// ShimExitOrphan is returned when the shim is orphaned before priv side delivers a signal. // ExitOrphan is returned when the shim is orphaned before priv side delivers a signal.
ShimExitOrphan ExitOrphan
// ShimExitRequest is returned when the priv side process requests shim exit. // ExitRequest is returned when the priv side process requests shim exit.
ShimExitRequest = 254 ExitRequest = 254
) )
const ( const (
// FMultiarch unblocks syscalls required for multiarch to work on applicable targets. // FMultiarch unblocks syscalls required for multiarch to work on applicable targets.
FMultiarch uintptr = 1 << iota 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 FSeccompCompat
// FDevel unblocks ptrace and friends. // FDevel unblocks ptrace and friends.
FDevel FDevel

View File

@ -128,12 +128,12 @@ func ShimMain() {
// setup has not completed, terminate immediately // setup has not completed, terminate immediately
msg.Resume() msg.Resume()
os.Exit(hst.ShimExitRequest) os.Exit(hst.ExitRequest)
return return
case 1: // got SIGCONT after adoption: monitor died before delivering signal case 1: // got SIGCONT after adoption: monitor died before delivering signal
msg.BeforeExit() msg.BeforeExit()
os.Exit(hst.ShimExitOrphan) os.Exit(hst.ExitOrphan)
return return
case 2: // unreachable case 2: // unreachable
@ -169,7 +169,7 @@ func ShimMain() {
if err := z.Start(); err != nil { if err := z.Start(); err != nil {
printMessageError("cannot start container:", err) printMessageError("cannot start container:", err)
os.Exit(hst.ShimExitFailure) os.Exit(hst.ExitFailure)
} }
if err := z.Serve(); err != nil { if err := z.Serve(); err != nil {
printMessageError("cannot configure container:", err) printMessageError("cannot configure container:", err)
@ -186,7 +186,7 @@ func ShimMain() {
var exitError *exec.ExitError var exitError *exec.ExitError
if !errors.As(err, &exitError) { if !errors.As(err, &exitError) {
if errors.Is(err, context.Canceled) { if errors.Is(err, context.Canceled) {
os.Exit(hst.ShimExitCancel) os.Exit(hst.ExitCancel)
} }
log.Printf("wait: %v", err) log.Printf("wait: %v", err)
os.Exit(127) os.Exit(127)