aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/outcome/shim.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-03-11 21:04:02 +0900
committerOphestra <cat@gensokyo.uk>2026-03-11 21:04:02 +0900
commit5c540f90aa5ac069a370cbef0ddd81fa268b43c5 (patch)
treea57f2347c1c797b649248068aa00b4b6a28ddc43 /internal/outcome/shim.go
parent1e8ac5f68ef6911c278b4c48722a1924d996206c (diff)
internal/outcome: improve doc comments
This improves readability on smaller displays. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/outcome/shim.go')
-rw-r--r--internal/outcome/shim.go30
1 files changed, 21 insertions, 9 deletions
diff --git a/internal/outcome/shim.go b/internal/outcome/shim.go
index a569e7a6..8fc46f2a 100644
--- a/internal/outcome/shim.go
+++ b/internal/outcome/shim.go
@@ -37,9 +37,12 @@ const (
shimMsgBadPID = C.HAKUREI_SHIM_BAD_PID
)
-// setupContSignal sets up the SIGCONT signal handler for the cross-uid shim exit hack.
-// The signal handler is implemented in C, signals can be processed by reading from the returned reader.
-// The returned function must be called after all signal processing concludes.
+// setupContSignal sets up the SIGCONT signal handler for the cross-uid shim
+// exit hack.
+//
+// The signal handler is implemented in C, signals can be processed by reading
+// from the returned reader. The returned function must be called after all
+// signal processing concludes.
func setupContSignal(pid int) (io.ReadCloser, func(), error) {
if r, w, err := os.Pipe(); err != nil {
return nil, nil, err
@@ -51,22 +54,28 @@ func setupContSignal(pid int) (io.ReadCloser, func(), error) {
}
}
-// shimEnv is the name of the environment variable storing decimal representation of
-// setup pipe fd for [container.Receive].
+// shimEnv is the name of the environment variable storing decimal representation
+// of setup pipe fd for [container.Receive].
const shimEnv = "HAKUREI_SHIM"
// shimParams is embedded in outcomeState and transmitted from priv side to shim.
type shimParams struct {
- // Priv side pid, checked against ppid in signal handler for the syscall.SIGCONT hack.
+ // Priv side pid, checked against ppid in signal handler for the
+ // syscall.SIGCONT hack.
PrivPID int
- // Duration to wait for after the initial process receives os.Interrupt before the container is killed.
+ // Duration to wait for after the initial process receives os.Interrupt
+ // before the container is killed.
+ //
// Limits are enforced on the priv side.
WaitDelay time.Duration
// Verbosity pass through from [message.Msg].
Verbose bool
+ // Copied from [hst.Config].
+ SchedPolicy std.SchedPolicy
+
// Outcome setup ops, contains setup state. Populated by outcome.finalise.
Ops []outcomeOp
}
@@ -77,7 +86,9 @@ func (p *shimParams) valid() bool { return p != nil && p.PrivPID > 0 }
// shimName is the prefix used by log.std in the shim process.
const shimName = "shim"
-// Shim is called by the main function of the shim process and runs as the unconstrained target user.
+// Shim is called by the main function of the shim process and runs as the
+// unconstrained target user.
+//
// Shim does not return.
func Shim(msg message.Msg) {
if msg == nil {
@@ -131,7 +142,8 @@ func (sp *shimPrivate) destroy() {
}
const (
- // shimPipeWireTimeout is the duration pipewire-pulse is allowed to run before its socket becomes available.
+ // shimPipeWireTimeout is the duration pipewire-pulse is allowed to run
+ // before its socket becomes available.
shimPipeWireTimeout = 5 * time.Second
)