Add GetParentDeathSignal() to pkg/system

Docker-DCO-1.1-Signed-off-by: Bernerd Schaefer <bj.schaefer@gmail.com> (github: bernerdschaefer)
This commit is contained in:
Bernerd Schaefer 2014-05-14 11:48:10 +02:00
parent 8887e00630
commit 002aa8fc20

View file

@ -3,6 +3,7 @@ package system
import (
"os/exec"
"syscall"
"unsafe"
)
func Chroot(dir string) error {
@ -122,6 +123,18 @@ func ParentDeathSignal(sig uintptr) error {
return nil
}
func GetParentDeathSignal() (int, error) {
var sig int
_, _, err := syscall.RawSyscall(syscall.SYS_PRCTL, syscall.PR_GET_PDEATHSIG, uintptr(unsafe.Pointer(&sig)), 0)
if err != 0 {
return -1, err
}
return sig, nil
}
func Setctty() error {
if _, _, err := syscall.RawSyscall(syscall.SYS_IOCTL, 0, uintptr(syscall.TIOCSCTTY), 0); err != 0 {
return err