Don't fix the size of the ExternalDescriptors array
In a future we may want to have more external descriptors. Signed-off-by: Andrey Vagin <avagin@openvz.org>
This commit is contained in:
parent
655f1ce09c
commit
8f0cad54ac
|
@ -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
|
||||
ExternalDescriptors [3]string `json:"external_descriptors,omitempty"`
|
||||
ExternalDescriptors []string `json:"external_descriptors,omitempty"`
|
||||
}
|
||||
|
||||
// A libcontainer container object.
|
||||
|
|
|
@ -34,9 +34,9 @@ type parentProcess interface {
|
|||
|
||||
signal(os.Signal) error
|
||||
|
||||
externalDescriptors() [3]string
|
||||
externalDescriptors() []string
|
||||
|
||||
setExternalDescriptors(fds [3]string)
|
||||
setExternalDescriptors(fds []string)
|
||||
}
|
||||
|
||||
type setnsProcess struct {
|
||||
|
@ -45,7 +45,7 @@ type setnsProcess struct {
|
|||
childPipe *os.File
|
||||
cgroupPaths map[string]string
|
||||
config *initConfig
|
||||
fds [3]string
|
||||
fds []string
|
||||
}
|
||||
|
||||
func (p *setnsProcess) startTime() (string, error) {
|
||||
|
@ -149,11 +149,11 @@ func (p *setnsProcess) pid() int {
|
|||
return p.cmd.Process.Pid
|
||||
}
|
||||
|
||||
func (p *setnsProcess) externalDescriptors() [3]string {
|
||||
func (p *setnsProcess) externalDescriptors() []string {
|
||||
return p.fds
|
||||
}
|
||||
|
||||
func (p *setnsProcess) setExternalDescriptors(newFds [3]string) {
|
||||
func (p *setnsProcess) setExternalDescriptors(newFds []string) {
|
||||
p.fds = newFds
|
||||
}
|
||||
|
||||
|
@ -164,14 +164,14 @@ type initProcess struct {
|
|||
config *initConfig
|
||||
manager cgroups.Manager
|
||||
container *linuxContainer
|
||||
fds [3]string
|
||||
fds []string
|
||||
}
|
||||
|
||||
func (p *initProcess) pid() int {
|
||||
return p.cmd.Process.Pid
|
||||
}
|
||||
|
||||
func (p *initProcess) externalDescriptors() [3]string {
|
||||
func (p *initProcess) externalDescriptors() []string {
|
||||
return p.fds
|
||||
}
|
||||
|
||||
|
@ -281,12 +281,14 @@ func (p *initProcess) signal(sig os.Signal) error {
|
|||
return syscall.Kill(p.cmd.Process.Pid, s)
|
||||
}
|
||||
|
||||
func (p *initProcess) setExternalDescriptors(newFds [3]string) {
|
||||
func (p *initProcess) setExternalDescriptors(newFds []string) {
|
||||
p.fds = newFds
|
||||
}
|
||||
|
||||
func getPipeFds(pid int) ([3]string, error) {
|
||||
var fds [3]string;
|
||||
func getPipeFds(pid int) ([]string, error) {
|
||||
var fds []string
|
||||
|
||||
fds = make([]string, 3)
|
||||
|
||||
dirPath := filepath.Join("/proc", strconv.Itoa(pid), "/fd")
|
||||
for i := 0; i < 3; i++ {
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"github.com/docker/libcontainer/system"
|
||||
)
|
||||
|
||||
func newRestoredProcess(pid int, fds [3]string) (*restoredProcess, error) {
|
||||
func newRestoredProcess(pid int, fds []string) (*restoredProcess, error) {
|
||||
var (
|
||||
err error
|
||||
)
|
||||
|
@ -31,7 +31,7 @@ func newRestoredProcess(pid int, fds [3]string) (*restoredProcess, error) {
|
|||
type restoredProcess struct {
|
||||
proc *os.Process
|
||||
processStartTime string
|
||||
fds [3]string
|
||||
fds []string
|
||||
}
|
||||
|
||||
func (p *restoredProcess) start() error {
|
||||
|
@ -68,11 +68,11 @@ func (p *restoredProcess) signal(s os.Signal) error {
|
|||
return p.proc.Signal(s)
|
||||
}
|
||||
|
||||
func (p *restoredProcess) externalDescriptors() [3]string {
|
||||
func (p *restoredProcess) externalDescriptors() []string {
|
||||
return p.fds
|
||||
}
|
||||
|
||||
func (p *restoredProcess) setExternalDescriptors(newFds [3]string) {
|
||||
func (p *restoredProcess) setExternalDescriptors(newFds []string) {
|
||||
p.fds = newFds
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ func (p *restoredProcess) setExternalDescriptors(newFds [3]string) {
|
|||
type nonChildProcess struct {
|
||||
processPid int
|
||||
processStartTime string
|
||||
fds [3]string
|
||||
fds []string
|
||||
}
|
||||
|
||||
func (p *nonChildProcess) start() error {
|
||||
|
@ -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) externalDescriptors() [3]string {
|
||||
func (p *nonChildProcess) externalDescriptors() []string {
|
||||
return p.fds
|
||||
}
|
||||
|
||||
func (p *nonChildProcess) setExternalDescriptors(newFds [3]string) {
|
||||
func (p *nonChildProcess) setExternalDescriptors(newFds []string) {
|
||||
p.fds = newFds
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue