Merge pull request #175 from crosbymichael/container-signal

Add signal API to Container interface
diff --git a/libcontainer/container.go b/libcontainer/container.go
index 567fc68..a24b71b 100644
--- a/libcontainer/container.go
+++ b/libcontainer/container.go
@@ -5,6 +5,8 @@
 package libcontainer
 
 import (
+	"os"
+
 	"github.com/opencontainers/runc/libcontainer/configs"
 )
 
@@ -159,4 +161,10 @@
 	// errors:
 	// Systemerror - System error.
 	NotifyOOM() (<-chan struct{}, error)
+
+	// Signal sends the provided signal code to the container's initial process.
+	//
+	// errors:
+	// Systemerror - System error.
+	Signal(s os.Signal) error
 }
diff --git a/libcontainer/container_linux.go b/libcontainer/container_linux.go
index 108c58f..9a27eb4 100644
--- a/libcontainer/container_linux.go
+++ b/libcontainer/container_linux.go
@@ -118,6 +118,13 @@
 	return nil
 }
 
+func (c *linuxContainer) Signal(s os.Signal) error {
+	if err := c.initProcess.signal(s); err != nil {
+		return newSystemError(err)
+	}
+	return nil
+}
+
 func (c *linuxContainer) newParentProcess(p *Process, doInit bool) (parentProcess, error) {
 	parentPipe, childPipe, err := newPipe()
 	if err != nil {
diff --git a/libcontainer/restored_process.go b/libcontainer/restored_process.go
index 89dfa04..a96f4ca 100644
--- a/libcontainer/restored_process.go
+++ b/libcontainer/restored_process.go
@@ -106,7 +106,11 @@
 }
 
 func (p *nonChildProcess) signal(s os.Signal) error {
-	return newGenericError(fmt.Errorf("restored process cannot be signaled"), SystemError)
+	proc, err := os.FindProcess(p.processPid)
+	if err != nil {
+		return err
+	}
+	return proc.Signal(s)
 }
 
 func (p *nonChildProcess) externalDescriptors() []string {