Remove command factory and NsInit interface from libcontainer
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
This commit is contained in:
parent
2db754f3ee
commit
8cd88f75fa
7 changed files with 94 additions and 126 deletions
|
@ -16,7 +16,7 @@ import (
|
|||
)
|
||||
|
||||
// ExecIn uses an existing pid and joins the pid's namespaces with the new command.
|
||||
func (ns *linuxNs) ExecIn(container *libcontainer.Container, nspid int, args []string) (int, error) {
|
||||
func ExecIn(container *libcontainer.Container, nspid int, args []string) (int, error) {
|
||||
for _, nsv := range container.Namespaces {
|
||||
// skip the PID namespace on unshare because it it not supported
|
||||
if nsv.Key != "NEWPID" {
|
||||
|
@ -25,7 +25,7 @@ func (ns *linuxNs) ExecIn(container *libcontainer.Container, nspid int, args []s
|
|||
}
|
||||
}
|
||||
}
|
||||
fds, err := ns.getNsFds(nspid, container)
|
||||
fds, err := getNsFds(nspid, container)
|
||||
closeFds := func() {
|
||||
for _, f := range fds {
|
||||
system.Closefd(f)
|
||||
|
@ -95,7 +95,7 @@ dropAndExec:
|
|||
panic("unreachable")
|
||||
}
|
||||
|
||||
func (ns *linuxNs) getNsFds(pid int, container *libcontainer.Container) ([]uintptr, error) {
|
||||
func getNsFds(pid int, container *libcontainer.Container) ([]uintptr, error) {
|
||||
fds := make([]uintptr, len(container.Namespaces))
|
||||
for i, ns := range container.Namespaces {
|
||||
f, err := os.OpenFile(filepath.Join("/proc/", strconv.Itoa(pid), "ns", ns.File), os.O_RDONLY, 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue