new-api: implement Wait, WaitProcess

Signed-off-by: Andrew Vagin <avagin@openvz.org>
This commit is contained in:
Andrew Vagin
2015-01-21 18:41:30 +03:00
parent e79e87e426
commit 61fef16f4a
2 changed files with 21 additions and 20 deletions

View File

@@ -181,11 +181,16 @@ func (c *linuxContainer) Signal(pid, signal int) error {
}
func (c *linuxContainer) Wait() (int, error) {
glog.Info("wait container")
panic("not implemented")
return c.WaitProcess(c.state.InitPid)
}
func (c *linuxContainer) WaitProcess(pid int) (int, error) {
glog.Infof("wait process %d", pid)
panic("not implemented")
var status syscall.WaitStatus
_, err := syscall.Wait4(pid, &status, 0, nil)
if err != nil {
return -1, newGenericError(err, SystemError)
}
return int(status), err
}