1
0
mirror of https://github.com/lxc/incus.git synced 2026-02-05 09:46:19 +01:00
Files
incus/shared/subprocess/proc_linux.go
Stéphane Graber b81af5098b shared/subprocess: Don't use internal packages
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
2023-09-13 23:24:40 -04:00

21 lines
421 B
Go

//go:build linux && cgo
package subprocess
import (
"syscall"
)
// SetUserns allows running inside of a user namespace.
func (p *Process) SetUserns(uidMap []syscall.SysProcIDMap, gidMap []syscall.SysProcIDMap) {
p.SysProcAttr = &syscall.SysProcAttr{
Cloneflags: syscall.CLONE_NEWUSER,
Credential: &syscall.Credential{
Uid: uint32(0),
Gid: uint32(0),
},
UidMappings: uidMap,
GidMappings: gidMap,
}
}