ctr: update task kill to take exec-id

Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
This commit is contained in:
Jess Valarezo
2017-11-13 10:47:15 -08:00
parent 17093c2f6a
commit 1966f9f1b7
4 changed files with 31 additions and 15 deletions

View File

@@ -65,13 +65,23 @@ type KillInfo struct {
// All kills all processes inside the task
// only valid on tasks, ignored on processes
All bool
// ExecID is the ID of a process to kill
ExecID string
}
// KillOpts allows options to be set for the killing of a process
type KillOpts func(context.Context, Process, *KillInfo) error
type KillOpts func(context.Context, *KillInfo) error
// WithKillAll kills all processes for a task
func WithKillAll(ctx context.Context, p Process, i *KillInfo) error {
func WithKillAll(ctx context.Context, i *KillInfo) error {
i.All = true
return nil
}
// WithKillExecID specifies the process ID
func WithKillExecID(execID string) KillOpts {
return func(ctx context.Context, i *KillInfo) error {
i.ExecID = execID
return nil
}
}