shared/subprocess: Don't use internal packages

Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
This commit is contained in:
Stéphane Graber 2023-09-13 16:20:39 -04:00
parent 63afa662ad
commit b81af5098b
No known key found for this signature in database
GPG Key ID: C638974D64792D67
2 changed files with 3 additions and 17 deletions

View File

@ -4,19 +4,17 @@ package subprocess
import (
"syscall"
"github.com/lxc/incus/internal/idmap"
)
// SetUserns allows running inside of a user namespace.
func (p *Process) SetUserns(userns *idmap.IdmapSet) {
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: userns.ToUidMappings(),
GidMappings: userns.ToGidMappings(),
UidMappings: uidMap,
GidMappings: gidMap,
}
}

View File

@ -1,12 +0,0 @@
//go:build (!linux || !cgo) && !windows
package subprocess
import (
"github.com/lxc/incus/internal/idmap"
)
// SetUserns allows running inside of a user namespace.
func (p *Process) SetUserns(userns *idmap.IdmapSet) {
return
}