diff --git a/container.go b/container.go index cb4e25b1d..a65d7b13a 100644 --- a/container.go +++ b/container.go @@ -51,7 +51,7 @@ type State struct { Config configs.Config `json:"config"` // Container's standard descriptors (std{in,out,err}), needed for checkpoint and restore - StdFds [3]string `json:"std_fds,omitempty"` + ExternalDescriptors [3]string `json:"external_descriptors,omitempty"` } // A libcontainer container object. diff --git a/container_linux.go b/container_linux.go index c70663e5c..3b1351730 100644 --- a/container_linux.go +++ b/container_linux.go @@ -371,7 +371,7 @@ func (c *linuxContainer) Checkpoint(criuOpts *CriuOpts) error { // Write the FD info to a file in the image directory - fdsJSON, err := json.Marshal(c.initProcess.stdFds()) + fdsJSON, err := json.Marshal(c.initProcess.externalDescriptors()) if err != nil { return err } @@ -563,7 +563,7 @@ func (c *linuxContainer) criuSwrk(process *Process, req *criurpc.CriuReq, opts * if err != nil { return err } - c.initProcess.setStdFds(fds) + c.initProcess.setExternalDescriptors(fds) } data, err := proto.Marshal(req) @@ -700,7 +700,7 @@ func (c *linuxContainer) criuNotifications(resp *criurpc.CriuResp, process *Proc case notify.GetScript() == "post-restore": pid := notify.GetPid() - r, err := newRestoredProcess(int(pid), c.initProcess.stdFds()) + r, err := newRestoredProcess(int(pid), c.initProcess.externalDescriptors()) if err != nil { return err } @@ -771,7 +771,7 @@ func (c *linuxContainer) currentState() (*State, error) { InitProcessStartTime: startTime, CgroupPaths: c.cgroupManager.GetPaths(), NamespacePaths: make(map[configs.NamespaceType]string), - StdFds: c.initProcess.stdFds(), + ExternalDescriptors: c.initProcess.externalDescriptors(), } for _, ns := range c.config.Namespaces { state.NamespacePaths[ns.Type] = ns.GetPath(c.initProcess.pid()) diff --git a/factory_linux.go b/factory_linux.go index 70abb1a59..a1c7289f9 100644 --- a/factory_linux.go +++ b/factory_linux.go @@ -182,7 +182,7 @@ func (l *LinuxFactory) Load(id string) (Container, error) { r := &nonChildProcess{ processPid: state.InitProcessPid, processStartTime: state.InitProcessStartTime, - fds: state.StdFds, + fds: state.ExternalDescriptors, } return &linuxContainer{ initProcess: r, diff --git a/process_linux.go b/process_linux.go index b37e88303..ac2264365 100644 --- a/process_linux.go +++ b/process_linux.go @@ -34,9 +34,9 @@ type parentProcess interface { signal(os.Signal) error - stdFds() [3]string + externalDescriptors() [3]string - setStdFds(fds [3]string) + setExternalDescriptors(fds [3]string) } type setnsProcess struct { @@ -149,11 +149,11 @@ func (p *setnsProcess) pid() int { return p.cmd.Process.Pid } -func (p *setnsProcess) stdFds() [3]string { +func (p *setnsProcess) externalDescriptors() [3]string { return p.fds } -func (p *setnsProcess) setStdFds(newFds [3]string) { +func (p *setnsProcess) setExternalDescriptors(newFds [3]string) { p.fds = newFds } @@ -171,7 +171,7 @@ func (p *initProcess) pid() int { return p.cmd.Process.Pid } -func (p *initProcess) stdFds() [3]string { +func (p *initProcess) externalDescriptors() [3]string { return p.fds } @@ -189,7 +189,7 @@ func (p *initProcess) start() error { if err != nil { return newSystemError(err) } - p.setStdFds(fds); + p.setExternalDescriptors(fds); // Do this before syncing with child so that no children // can escape the cgroup @@ -281,7 +281,7 @@ func (p *initProcess) signal(sig os.Signal) error { return syscall.Kill(p.cmd.Process.Pid, s) } -func (p *initProcess) setStdFds(newFds [3]string) { +func (p *initProcess) setExternalDescriptors(newFds [3]string) { p.fds = newFds } diff --git a/restored_process.go b/restored_process.go index ebf96d9fe..142b3fe89 100644 --- a/restored_process.go +++ b/restored_process.go @@ -68,11 +68,11 @@ func (p *restoredProcess) signal(s os.Signal) error { return p.proc.Signal(s) } -func (p *restoredProcess) stdFds() [3]string { +func (p *restoredProcess) externalDescriptors() [3]string { return p.fds } -func (p *restoredProcess) setStdFds(newFds [3]string) { +func (p *restoredProcess) setExternalDescriptors(newFds [3]string) { p.fds = newFds } @@ -109,10 +109,10 @@ func (p *nonChildProcess) signal(s os.Signal) error { return newGenericError(fmt.Errorf("restored process cannot be signaled"), SystemError) } -func (p *nonChildProcess) stdFds() [3]string { +func (p *nonChildProcess) externalDescriptors() [3]string { return p.fds } -func (p *nonChildProcess) setStdFds(newFds [3]string) { +func (p *nonChildProcess) setExternalDescriptors(newFds [3]string) { p.fds = newFds }