diff options
Diffstat (limited to 'pkg/shim')
-rw-r--r-- | pkg/shim/proc/exec.go | 3 | ||||
-rw-r--r-- | pkg/shim/proc/init.go | 8 | ||||
-rw-r--r-- | pkg/shim/proc/io.go | 10 | ||||
-rw-r--r-- | pkg/shim/runsc/runsc.go | 6 | ||||
-rw-r--r-- | pkg/shim/service.go | 3 | ||||
-rw-r--r-- | pkg/shim/service_linux.go | 8 |
6 files changed, 18 insertions, 20 deletions
diff --git a/pkg/shim/proc/exec.go b/pkg/shim/proc/exec.go index 1d1d90488..e7968d9d5 100644 --- a/pkg/shim/proc/exec.go +++ b/pkg/shim/proc/exec.go @@ -22,7 +22,6 @@ import ( "os" "path/filepath" "sync" - "syscall" "time" "github.com/containerd/console" @@ -216,7 +215,7 @@ func (e *execProcess) start(ctx context.Context) (err error) { return e.parent.runtimeError(err, "OCI runtime exec failed") } if e.stdio.Stdin != "" { - sc, err := fifo.OpenFifo(context.Background(), e.stdio.Stdin, syscall.O_WRONLY|syscall.O_NONBLOCK, 0) + sc, err := fifo.OpenFifo(context.Background(), e.stdio.Stdin, unix.O_WRONLY|unix.O_NONBLOCK, 0) if err != nil { return fmt.Errorf("failed to open stdin fifo %s: %w", e.stdio.Stdin, err) } diff --git a/pkg/shim/proc/init.go b/pkg/shim/proc/init.go index cacaade88..664465e0d 100644 --- a/pkg/shim/proc/init.go +++ b/pkg/shim/proc/init.go @@ -23,7 +23,6 @@ import ( "path/filepath" "strings" "sync" - "syscall" "time" "github.com/containerd/console" @@ -35,6 +34,7 @@ import ( "github.com/containerd/fifo" runc "github.com/containerd/go-runc" specs "github.com/opencontainers/runtime-spec/specs-go" + "golang.org/x/sys/unix" "gvisor.dev/gvisor/pkg/shim/runsc" ) @@ -81,7 +81,7 @@ func NewRunsc(root, path, namespace, runtime string, config map[string]string) * } return &runsc.Runsc{ Command: runtime, - PdeathSignal: syscall.SIGKILL, + PdeathSignal: unix.SIGKILL, Log: filepath.Join(path, "log.json"), LogFormat: runc.JSON, Root: filepath.Join(root, namespace), @@ -136,7 +136,7 @@ func (p *Init) Create(ctx context.Context, r *CreateConfig) (err error) { return p.runtimeError(err, "OCI runtime create failed") } if r.Stdin != "" { - sc, err := fifo.OpenFifo(context.Background(), r.Stdin, syscall.O_WRONLY|syscall.O_NONBLOCK, 0) + sc, err := fifo.OpenFifo(context.Background(), r.Stdin, unix.O_WRONLY|unix.O_NONBLOCK, 0) if err != nil { return fmt.Errorf("failed to open stdin fifo %s: %w", r.Stdin, err) } @@ -366,7 +366,7 @@ func (p *Init) KillAll(context context.Context) error { } func (p *Init) killAll(context context.Context) error { - p.runtime.Kill(context, p.id, int(syscall.SIGKILL), &runsc.KillOpts{ + p.runtime.Kill(context, p.id, int(unix.SIGKILL), &runsc.KillOpts{ All: true, }) // Ignore error handling for `runsc kill --all` for now. diff --git a/pkg/shim/proc/io.go b/pkg/shim/proc/io.go index 34d825fb7..0e8a1a8cb 100644 --- a/pkg/shim/proc/io.go +++ b/pkg/shim/proc/io.go @@ -22,11 +22,11 @@ import ( "os" "sync" "sync/atomic" - "syscall" "github.com/containerd/containerd/log" "github.com/containerd/fifo" runc "github.com/containerd/go-runc" + "golang.org/x/sys/unix" ) // TODO(random-liu): This file can be a util. @@ -89,10 +89,10 @@ func copyPipes(ctx context.Context, rio runc.IO, stdin, stdout, stderr string, w fr io.Closer ) if ok { - if fw, err = fifo.OpenFifo(ctx, i.name, syscall.O_WRONLY, 0); err != nil { + if fw, err = fifo.OpenFifo(ctx, i.name, unix.O_WRONLY, 0); err != nil { return fmt.Errorf("gvisor-containerd-shim: opening %s failed: %s", i.name, err) } - if fr, err = fifo.OpenFifo(ctx, i.name, syscall.O_RDONLY, 0); err != nil { + if fr, err = fifo.OpenFifo(ctx, i.name, unix.O_RDONLY, 0); err != nil { return fmt.Errorf("gvisor-containerd-shim: opening %s failed: %s", i.name, err) } } else { @@ -101,7 +101,7 @@ func copyPipes(ctx context.Context, rio runc.IO, stdin, stdout, stderr string, w i.dest(sameFile, nil) continue } - if fw, err = os.OpenFile(i.name, syscall.O_WRONLY|syscall.O_APPEND, 0); err != nil { + if fw, err = os.OpenFile(i.name, unix.O_WRONLY|unix.O_APPEND, 0); err != nil { return fmt.Errorf("gvisor-containerd-shim: opening %s failed: %s", i.name, err) } if stdout == stderr { @@ -116,7 +116,7 @@ func copyPipes(ctx context.Context, rio runc.IO, stdin, stdout, stderr string, w if stdin == "" { return nil } - f, err := fifo.OpenFifo(context.Background(), stdin, syscall.O_RDONLY|syscall.O_NONBLOCK, 0) + f, err := fifo.OpenFifo(context.Background(), stdin, unix.O_RDONLY|unix.O_NONBLOCK, 0) if err != nil { return fmt.Errorf("gvisor-containerd-shim: opening %s failed: %s", stdin, err) } diff --git a/pkg/shim/runsc/runsc.go b/pkg/shim/runsc/runsc.go index 3c4cbf223..ff0521d73 100644 --- a/pkg/shim/runsc/runsc.go +++ b/pkg/shim/runsc/runsc.go @@ -26,12 +26,12 @@ import ( "os/exec" "path/filepath" "strconv" - "syscall" "time" "github.com/containerd/containerd/log" runc "github.com/containerd/go-runc" specs "github.com/opencontainers/runtime-spec/specs-go" + "golang.org/x/sys/unix" ) // DefaultCommand is the default command for Runsc. @@ -63,7 +63,7 @@ func (l *LogMonitor) Wait(cmd *exec.Cmd, ch chan runc.Exit) (int, error) { // Runsc is the client to the runsc cli. type Runsc struct { Command string - PdeathSignal syscall.Signal + PdeathSignal unix.Signal Setpgid bool Root string Log string @@ -530,7 +530,7 @@ func (r *Runsc) command(context context.Context, args ...string) *exec.Cmd { command = DefaultCommand } cmd := exec.CommandContext(context, command, append(r.args(), args...)...) - cmd.SysProcAttr = &syscall.SysProcAttr{ + cmd.SysProcAttr = &unix.SysProcAttr{ Setpgid: r.Setpgid, } if r.PdeathSignal != 0 { diff --git a/pkg/shim/service.go b/pkg/shim/service.go index eff55df53..9d9fa8ef6 100644 --- a/pkg/shim/service.go +++ b/pkg/shim/service.go @@ -23,7 +23,6 @@ import ( "os/exec" "path/filepath" "sync" - "syscall" "time" "github.com/BurntSushi/toml" @@ -193,7 +192,7 @@ func (s *service) newCommand(ctx context.Context, containerdBinary, containerdAd cmd := exec.Command(self, args...) cmd.Dir = cwd cmd.Env = append(os.Environ(), "GOMAXPROCS=2") - cmd.SysProcAttr = &syscall.SysProcAttr{ + cmd.SysProcAttr = &unix.SysProcAttr{ Setpgid: true, } return cmd, nil diff --git a/pkg/shim/service_linux.go b/pkg/shim/service_linux.go index 11622ed60..829f69282 100644 --- a/pkg/shim/service_linux.go +++ b/pkg/shim/service_linux.go @@ -22,10 +22,10 @@ import ( "fmt" "io" "sync" - "syscall" "github.com/containerd/console" "github.com/containerd/fifo" + "golang.org/x/sys/unix" ) type linuxPlatform struct { @@ -43,7 +43,7 @@ func (p *linuxPlatform) CopyConsole(ctx context.Context, console console.Console } if stdin != "" { - in, err := fifo.OpenFifo(context.Background(), stdin, syscall.O_RDONLY|syscall.O_NONBLOCK, 0) + in, err := fifo.OpenFifo(context.Background(), stdin, unix.O_RDONLY|unix.O_NONBLOCK, 0) if err != nil { return nil, err } @@ -54,11 +54,11 @@ func (p *linuxPlatform) CopyConsole(ctx context.Context, console console.Console }() } - outw, err := fifo.OpenFifo(ctx, stdout, syscall.O_WRONLY, 0) + outw, err := fifo.OpenFifo(ctx, stdout, unix.O_WRONLY, 0) if err != nil { return nil, err } - outr, err := fifo.OpenFifo(ctx, stdout, syscall.O_RDONLY, 0) + outr, err := fifo.OpenFifo(ctx, stdout, unix.O_RDONLY, 0) if err != nil { return nil, err } |