containerd build clean on Solaris (#203)
* containerd build clean on Solaris Signed-off-by: Amit Krishnan <krish.amit@gmail.com> * Vendor golang.org/x/sys Signed-off-by: Amit Krishnan <krish.amit@gmail.com>
This commit is contained in:
committed by
Michael Crosby
parent
b5981e004f
commit
62e1370f91
@@ -1,3 +1,5 @@
|
||||
// +build !solaris
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
|
||||
14
containerd-shim/console_solaris.go
Normal file
14
containerd-shim/console_solaris.go
Normal file
@@ -0,0 +1,14 @@
|
||||
// +build solaris
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
)
|
||||
|
||||
// NewConsole returns an initalized console that can be used within a container by copying bytes
|
||||
// from the master side to the slave that is attached as the tty for the container's init process.
|
||||
func newConsole(uid, gid int) (*os.File, string, error) {
|
||||
return nil, "", errors.New("newConsole not implemented on Solaris")
|
||||
}
|
||||
@@ -166,11 +166,9 @@ func (p *process) start() error {
|
||||
cmd.Stdin = p.stdio.stdin
|
||||
cmd.Stdout = p.stdio.stdout
|
||||
cmd.Stderr = p.stdio.stderr
|
||||
// set the parent death signal to SIGKILL so that if the shim dies the container
|
||||
// process also dies
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
||||
Pdeathsig: syscall.SIGKILL,
|
||||
}
|
||||
// Call out to setPDeathSig to set SysProcAttr as elements are platform specific
|
||||
cmd.SysProcAttr = setPDeathSig()
|
||||
|
||||
if err := cmd.Start(); err != nil {
|
||||
if exErr, ok := err.(*exec.Error); ok {
|
||||
if exErr.Err == exec.ErrNotFound || exErr.Err == os.ErrNotExist {
|
||||
|
||||
15
containerd-shim/process_pdeathsig.go
Normal file
15
containerd-shim/process_pdeathsig.go
Normal file
@@ -0,0 +1,15 @@
|
||||
// +build !solaris
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
)
|
||||
|
||||
// setPDeathSig sets the parent death signal to SIGKILL so that if the
|
||||
// shim dies the container process also dies.
|
||||
func setPDeathSig() *syscall.SysProcAttr {
|
||||
return &syscall.SysProcAttr{
|
||||
Pdeathsig: syscall.SIGKILL,
|
||||
}
|
||||
}
|
||||
12
containerd-shim/process_pdeathsig_unsupported.go
Normal file
12
containerd-shim/process_pdeathsig_unsupported.go
Normal file
@@ -0,0 +1,12 @@
|
||||
// +build solaris
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
)
|
||||
|
||||
// setPDeathSig is a no-op on Solaris as Pdeathsig is not defined.
|
||||
func setPDeathSig() *syscall.SysProcAttr {
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user