You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
starainrt/starshell_linux.go

35 lines
643 B
Go

// +build linux
package starainrt
import "syscall"
func (starcli *StarShell) SetRunUser(uid, gid uint32) {
starcli.cmd.SysProcAttr = &syscall.SysProcAttr{
Credential: &syscall.Credential{
Uid: uid,
Gid: gid,
},
Setsid: true,
}
}
func (starcli *StarShell) Release() error {
if err := starcli.cmd.Start(); err != nil {
return err
}
starcli.cmd.SysProcAttr = &syscall.SysProcAttr{
Setsid: true,
}
starcli.cmd.Process.Release()
return nil
}
func (starcli *StarShell) SetKeepCaps() error {
_, _, err := syscall.RawSyscall(157 /*SYS PRCTL */, 0x8 /*PR SET KEEPCAPS*/, 1, 0)
if 0 != err {
return err
}
return nil
}