From 277100744ef848287ccfd7c74e08477296331aed Mon Sep 17 00:00:00 2001 From: Nicolas Lacasse Date: Tue, 27 Sep 2022 13:59:55 -0700 Subject: [PATCH] Split SignalContainerArgs out of ContainerArgs. The signal-specific logic is only needed for SignalContainer. PiperOrigin-RevId: 477268167 --- pkg/sentry/control/lifecycle.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pkg/sentry/control/lifecycle.go b/pkg/sentry/control/lifecycle.go index 0593e6c96..f4af623a7 100644 --- a/pkg/sentry/control/lifecycle.go +++ b/pkg/sentry/control/lifecycle.go @@ -344,10 +344,7 @@ func (l *Lifecycle) getInitContainerProcess(containerID string) (*kernel.ThreadG // ContainerArgs is the set of arguments for container related APIs after // starting the container. type ContainerArgs struct { - // ContainerID. ContainerID string `json:"container_id"` - Signo int32 `json:"signo"` - SignalAll bool `json:"signalAll"` } // WaitContainer waits for the container to exit and returns the exit status. @@ -387,9 +384,16 @@ func (l *Lifecycle) IsContainerRunning(args *ContainerArgs, isRunning *bool) err return nil } +// SignalContainerArgs is the set of arguments for signalling a container. +type SignalContainerArgs struct { + ContainerID string `json:"container_id"` + Signo int32 `json:"signo"` + SignalAll bool `json:"signalAll"` +} + // SignalContainer signals the container in multi-container mode. It returns error if the // container hasn't started or has exited. -func (l *Lifecycle) SignalContainer(args *ContainerArgs, _ *struct{}) error { +func (l *Lifecycle) SignalContainer(args *SignalContainerArgs, _ *struct{}) error { tg, err := l.getInitContainerProcess(args.ContainerID) if err != nil { return err