summaryrefslogtreecommitdiff
path: root/pkg/rootless/rootless.go
diff options
context:
space:
mode:
authorW. Trevor King <wking@tremily.us>2018-06-30 15:52:01 -0700
committerAtomic Bot <atomic-devel@projectatomic.io>2018-07-06 00:48:39 +0000
commit83968de28c37117d5e2ae6d713b30535fa6a163c (patch)
tree1e5d848e8ee2419104af65f744935d05076a08dd /pkg/rootless/rootless.go
parent4b54a471a49cfae617c65b2027ae1e7cc1671cfc (diff)
downloadpodman-83968de28c37117d5e2ae6d713b30535fa6a163c.tar.gz
podman-83968de28c37117d5e2ae6d713b30535fa6a163c.tar.bz2
podman-83968de28c37117d5e2ae6d713b30535fa6a163c.zip
rootless: Merge rootless.go back into rootless_linux.go
The files were split apart by b96be3af (changes to allow for darwin compilation, 2018-06-20, #1015), but the C import and two functions left in rootless.go are all Linux-specific as well. This commit moves all of the pre-b96be3af rootless.go into rootless_linux.go, just adding the '// +build linux' header (b96be3af also scrambled the + in that header) and keeping the new GetRootlessUID from a1545fe6 (rootless: add function to retrieve the original UID, 2018-07-05, #1048). Signed-off-by: W. Trevor King <wking@tremily.us> Closes: #1034 Approved by: baude
Diffstat (limited to 'pkg/rootless/rootless.go')
-rw-r--r--pkg/rootless/rootless.go43
1 files changed, 0 insertions, 43 deletions
diff --git a/pkg/rootless/rootless.go b/pkg/rootless/rootless.go
deleted file mode 100644
index ca851f9bc..000000000
--- a/pkg/rootless/rootless.go
+++ /dev/null
@@ -1,43 +0,0 @@
-package rootless
-
-import (
- "fmt"
- "github.com/containers/storage/pkg/idtools"
- "os"
- "os/exec"
-)
-
-/*
-extern int reexec_in_user_namespace(int ready);
-extern int reexec_in_user_namespace_wait(int pid);
-*/
-import "C"
-
-func runInUser() error {
- os.Setenv("_LIBPOD_USERNS_CONFIGURED", "done")
- return nil
-}
-
-func tryMappingTool(tool string, pid int, hostID int, mappings []idtools.IDMap) error {
- path, err := exec.LookPath(tool)
- if err != nil {
- return err
- }
-
- appendTriplet := func(l []string, a, b, c int) []string {
- return append(l, fmt.Sprintf("%d", a), fmt.Sprintf("%d", b), fmt.Sprintf("%d", c))
- }
-
- args := []string{path, fmt.Sprintf("%d", pid)}
- args = appendTriplet(args, 0, hostID, 1)
- if mappings != nil {
- for _, i := range mappings {
- args = appendTriplet(args, i.ContainerID+1, i.HostID, i.Size)
- }
- }
- cmd := exec.Cmd{
- Path: path,
- Args: args,
- }
- return cmd.Run()
-}