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:
parent
8887e00630
commit
002aa8fc20
1 changed files with 13 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue