mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #10055 from icecrime/upgrade_libcontainer
Upgrade libcontainer to 1d3b2589d734dc94a1719a3af4
This commit is contained in:
commit
9f2c486144
5 changed files with 47 additions and 5 deletions
|
@ -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')"
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -53,11 +53,12 @@ func main() {
|
|||
app.Before = preload
|
||||
|
||||
app.Commands = []cli.Command{
|
||||
configCommand,
|
||||
execCommand,
|
||||
initCommand,
|
||||
statsCommand,
|
||||
configCommand,
|
||||
oomCommand,
|
||||
pauseCommand,
|
||||
statsCommand,
|
||||
unpauseCommand,
|
||||
}
|
||||
|
||||
|
|
28
vendor/src/github.com/docker/libcontainer/nsinit/oom.go
vendored
Normal file
28
vendor/src/github.com/docker/libcontainer/nsinit/oom.go
vendored
Normal 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")
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue