зеркало из https://github.com/microsoft/docker.git
Merge pull request #4676 from crosbymichael/no-sig-kill
Send sigterm to child instead of sigkill
This commit is contained in:
Коммит
f9090567af
|
@ -48,7 +48,9 @@ func (ns *linuxNs) Init(container *libcontainer.Container, uncleanRootfs, consol
|
|||
return fmt.Errorf("setctty %s", err)
|
||||
}
|
||||
}
|
||||
if err := system.ParentDeathSignal(); err != nil {
|
||||
// this is our best effort to let the process know that the parent has died and that it
|
||||
// should it should act on it how it sees fit
|
||||
if err := system.ParentDeathSignal(uintptr(syscall.SIGTERM)); err != nil {
|
||||
return fmt.Errorf("parent death signal %s", err)
|
||||
}
|
||||
if err := setupNewMountNamespace(rootfs, container.Mounts, console, container.ReadonlyFs, container.NoPivotRoot); err != nil {
|
||||
|
|
|
@ -115,8 +115,8 @@ func Mknod(path string, mode uint32, dev int) error {
|
|||
return syscall.Mknod(path, mode, dev)
|
||||
}
|
||||
|
||||
func ParentDeathSignal() error {
|
||||
if _, _, err := syscall.RawSyscall(syscall.SYS_PRCTL, syscall.PR_SET_PDEATHSIG, uintptr(syscall.SIGKILL), 0); err != 0 {
|
||||
func ParentDeathSignal(sig uintptr) error {
|
||||
if _, _, err := syscall.RawSyscall(syscall.SYS_PRCTL, syscall.PR_SET_PDEATHSIG, sig, 0); err != 0 {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
|
Загрузка…
Ссылка в новой задаче