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 9b677d0733
commit bb9eabf1ef

View file

@ -3,6 +3,7 @@ package system
import ( import (
"os/exec" "os/exec"
"syscall" "syscall"
"unsafe"
) )
func Chroot(dir string) error { func Chroot(dir string) error {
@ -122,6 +123,18 @@ func ParentDeathSignal(sig uintptr) error {
return nil 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 { func Setctty() error {
if _, _, err := syscall.RawSyscall(syscall.SYS_IOCTL, 0, uintptr(syscall.TIOCSCTTY), 0); err != 0 { if _, _, err := syscall.RawSyscall(syscall.SYS_IOCTL, 0, uintptr(syscall.TIOCSCTTY), 0); err != 0 {
return err return err