Skip to content

Commit

Permalink
rootless: make JoinUserAndMountNS private
Browse files Browse the repository at this point in the history
as it is used only by the rootless package now.

Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed May 25, 2019
1 parent c4dedd3 commit 153503e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
8 changes: 4 additions & 4 deletions pkg/rootless/rootless_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,10 @@ func enableLinger(pausePid string) {
}
}

// JoinUserAndMountNS re-exec podman in a new userNS and join the user and mount
// joinUserAndMountNS re-exec podman in a new userNS and join the user and mount
// namespace of the specified PID without looking up its parent. Useful to join directly
// the conmon process.
func JoinUserAndMountNS(pid uint, pausePid string) (bool, int, error) {
func joinUserAndMountNS(pid uint, pausePid string) (bool, int, error) {
enableLinger(pausePid)

if os.Geteuid() == 0 || os.Getenv("_CONTAINERS_USERNS_CONFIGURED") != "" {
Expand Down Expand Up @@ -357,7 +357,7 @@ func becomeRootInUserNS(pausePid, fileToRead string, fileOutput *os.File) (bool,
if err == nil {
pid, err := strconv.ParseUint(string(data), 10, 0)
if err == nil {
return JoinUserAndMountNS(uint(pid), "")
return joinUserAndMountNS(uint(pid), "")
}
}
return false, -1, errors.Wrapf(err, "error setting up the process")
Expand Down Expand Up @@ -480,5 +480,5 @@ func TryJoinFromFilePaths(pausePidPath string, needNewNamespace bool, paths []st
return false, 0, lastErr
}

return JoinUserAndMountNS(uint(pausePid), pausePidPath)
return joinUserAndMountNS(uint(pausePid), pausePidPath)
}
8 changes: 0 additions & 8 deletions pkg/rootless/rootless_unsupported.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,6 @@ func GetRootlessGID() int {
return -1
}

// JoinUserAndMountNS re-exec podman in a new userNS and join the user and mount
// namespace of the specified PID without looking up its parent. Useful to join directly
// the conmon process. It is a convenience function for JoinUserAndMountNSWithOpts
// with a default configuration.
func JoinUserAndMountNS(pid uint, pausePid string) (bool, int, error) {
return false, -1, errors.New("this function is not supported on this os")
}

// TryJoinFromFilePaths attempts to join the namespaces of the pid files in paths.
// This is useful when there are already running containers and we
// don't have a pause process yet. We can use the paths to the conmon
Expand Down

0 comments on commit 153503e

Please sign in to comment.