Merge pull request #4317 from KentaTada/modify-pdeathsignal-type

Change the type of PdeathSignal
This commit is contained in:
Michael Crosby 2020-06-12 11:34:17 -04:00 committed by GitHub
commit 185ea541d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,7 +27,6 @@ import (
"path/filepath" "path/filepath"
"strings" "strings"
"sync" "sync"
"syscall"
"time" "time"
"github.com/containerd/console" "github.com/containerd/console"
@ -39,6 +38,7 @@ import (
google_protobuf "github.com/gogo/protobuf/types" google_protobuf "github.com/gogo/protobuf/types"
specs "github.com/opencontainers/runtime-spec/specs-go" specs "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors" "github.com/pkg/errors"
"golang.org/x/sys/unix"
) )
// Init represents an initial process for a container // Init represents an initial process for a container
@ -87,7 +87,7 @@ func NewRunc(root, path, namespace, runtime, criu string, systemd bool) *runc.Ru
Command: runtime, Command: runtime,
Log: filepath.Join(path, "log.json"), Log: filepath.Join(path, "log.json"),
LogFormat: runc.JSON, LogFormat: runc.JSON,
PdeathSignal: syscall.SIGKILL, PdeathSignal: unix.SIGKILL,
Root: filepath.Join(root, namespace), Root: filepath.Join(root, namespace),
Criu: criu, Criu: criu,
SystemdCgroup: systemd, SystemdCgroup: systemd,
@ -176,7 +176,7 @@ func (p *Init) Create(ctx context.Context, r *CreateConfig) error {
} }
func (p *Init) openStdin(path string) error { func (p *Init) openStdin(path string) error {
sc, err := fifo.OpenFifo(context.Background(), path, syscall.O_WRONLY|syscall.O_NONBLOCK, 0) sc, err := fifo.OpenFifo(context.Background(), path, unix.O_WRONLY|unix.O_NONBLOCK, 0)
if err != nil { if err != nil {
return errors.Wrapf(err, "failed to open stdin fifo %s", path) return errors.Wrapf(err, "failed to open stdin fifo %s", path)
} }
@ -361,7 +361,7 @@ func (p *Init) KillAll(ctx context.Context) error {
p.mu.Lock() p.mu.Lock()
defer p.mu.Unlock() defer p.mu.Unlock()
err := p.runtime.Kill(ctx, p.id, int(syscall.SIGKILL), &runc.KillOpts{ err := p.runtime.Kill(ctx, p.id, int(unix.SIGKILL), &runc.KillOpts{
All: true, All: true,
}) })
return p.runtimeError(err, "OCI runtime killall failed") return p.runtimeError(err, "OCI runtime killall failed")