Implement container signaling
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
0c1919c427
commit
9dcbc4f3f8
|
@ -230,7 +230,7 @@ func (c *linuxContainer) Resume() error {
|
|||
|
||||
func (c *linuxContainer) Signal(signal os.Signal) error {
|
||||
glog.Infof("sending signal %d to pid %d", signal, c.initProcess.pid())
|
||||
panic("not implemented")
|
||||
return c.initProcess.signal(signal)
|
||||
}
|
||||
|
||||
// TODO: rename to be more descriptive
|
||||
|
|
|
@ -224,3 +224,7 @@ func (p *restoredProcess) wait() (*os.ProcessState, error) {
|
|||
func (p *restoredProcess) startTime() (string, error) {
|
||||
return p.processStartTime, nil
|
||||
}
|
||||
|
||||
func (p *restoredProcess) signal(s os.Signal) error {
|
||||
return newGenericError(fmt.Errorf("restored process cannot be signaled"), SystemError)
|
||||
}
|
||||
|
|
|
@ -32,6 +32,8 @@ type parentProcess interface {
|
|||
|
||||
// startTime return's the process start time.
|
||||
startTime() (string, error)
|
||||
|
||||
signal(os.Signal) error
|
||||
}
|
||||
|
||||
type setnsProcess struct {
|
||||
|
@ -47,6 +49,10 @@ func (p *setnsProcess) startTime() (string, error) {
|
|||
return system.GetProcessStartTime(p.pid())
|
||||
}
|
||||
|
||||
func (p *setnsProcess) signal(s os.Signal) error {
|
||||
return p.forkedProcess.Signal(s)
|
||||
}
|
||||
|
||||
func (p *setnsProcess) start() (err error) {
|
||||
defer p.parentPipe.Close()
|
||||
if p.forkedProcess, err = p.execSetns(); err != nil {
|
||||
|
@ -260,3 +266,7 @@ func (p *initProcess) newUsernsSetupProcess() (parentProcess, error) {
|
|||
config: p.config,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (p *initProcess) signal(s os.Signal) error {
|
||||
return p.cmd.Process.Signal(s)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue