Upgrade libcontainer to 1d3b2589d734dc94a1719a3af4

Correct exit code when dying on a signal (fixes #9979).

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
This commit is contained in:
Arnaud Porterie 2015-01-12 17:36:06 -08:00
parent 9b0072a7e6
commit 009041cdfd
5 changed files with 47 additions and 5 deletions

View File

@ -68,7 +68,7 @@ if [ "$1" = '--go' ]; then
mv tmp-tar src/code.google.com/p/go/src/pkg/archive/tar
fi
clone git github.com/docker/libcontainer 6460fd79667466d2d9ec03f77f319a241c58d40b
clone git github.com/docker/libcontainer 1d3b2589d734dc94a1719a3af40b87ed8319f329
# see src/github.com/docker/libcontainer/update-vendor.sh which is the "source of truth" for libcontainer deps (just like this file)
rm -rf src/github.com/docker/libcontainer/vendor
eval "$(grep '^clone ' src/github.com/docker/libcontainer/update-vendor.sh | grep -v 'github.com/codegangsta/cli')"

View File

@ -13,4 +13,8 @@ Our goal is to make libcontainer run everywhere, but currently libcontainer requ
## Cross-architecture support
Our goal is to make libcontainer run everywhere. However currently libcontainer only runs on x86_64 systems. We plan on expanding architecture support, so that libcontainer containers can be created and used on more architectures.
Our goal is to make libcontainer run everywhere. Recently libcontainer has
expanded from its initial support for x86_64 systems to include POWER (ppc64
little and big endian variants), IBM System z (s390x 64-bit), and ARM. We plan
to continue expanding architecture support such that libcontainer containers
can be created and used on more architectures.

View File

@ -17,6 +17,10 @@ import (
"github.com/docker/libcontainer/system"
)
const (
EXIT_SIGNAL_OFFSET = 128
)
// TODO(vishh): This is part of the libcontainer API and it does much more than just namespaces related work.
// Move this to libcontainer package.
// Exec performs setup outside of a namespace so that a container can be
@ -113,7 +117,12 @@ func Exec(container *libcontainer.Config, stdin io.Reader, stdout, stderr io.Wri
if !container.Namespaces.Contains(libcontainer.NEWPID) {
killAllPids(container)
}
return command.ProcessState.Sys().(syscall.WaitStatus).ExitStatus(), nil
waitStatus := command.ProcessState.Sys().(syscall.WaitStatus)
if waitStatus.Signaled() {
return EXIT_SIGNAL_OFFSET + int(waitStatus.Signal()), nil
}
return waitStatus.ExitStatus(), nil
}
// killAllPids itterates over all of the container's processes

View File

@ -53,11 +53,12 @@ func main() {
app.Before = preload
app.Commands = []cli.Command{
configCommand,
execCommand,
initCommand,
statsCommand,
configCommand,
oomCommand,
pauseCommand,
statsCommand,
unpauseCommand,
}

View File

@ -0,0 +1,28 @@
package main
import (
"log"
"github.com/codegangsta/cli"
"github.com/docker/libcontainer"
)
var oomCommand = cli.Command{
Name: "oom",
Usage: "display oom notifications for a container",
Action: oomAction,
}
func oomAction(context *cli.Context) {
state, err := libcontainer.GetState(dataPath)
if err != nil {
log.Fatal(err)
}
n, err := libcontainer.NotifyOnOOM(state)
if err != nil {
log.Fatal(err)
}
for _ = range n {
log.Printf("OOM notification received")
}
}