Add all pids to state output
Also update libcontainer dep Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
d6bd304c92
commit
532697f32f
123 changed files with 11277 additions and 547 deletions
|
@ -10,6 +10,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/opencontainers/runc/libcontainer"
|
||||
"github.com/opencontainers/specs"
|
||||
)
|
||||
|
||||
|
@ -42,6 +43,8 @@ type Container interface {
|
|||
DeleteCheckpoint(name string) error
|
||||
// Labels are user provided labels for the container
|
||||
Labels() []string
|
||||
// Pids returns all pids inside the container
|
||||
Pids() ([]int, error)
|
||||
// Stats returns realtime container stats and resource information
|
||||
// Stats() (*Stat, error) // OOM signals the channel if the container received an OOM notification
|
||||
// OOM() (<-chan struct{}, error)
|
||||
|
@ -353,6 +356,18 @@ func (c *container) DeleteCheckpoint(name string) error {
|
|||
return os.RemoveAll(filepath.Join(c.bundle, "checkpoints", name))
|
||||
}
|
||||
|
||||
func (c *container) Pids() ([]int, error) {
|
||||
f, err := libcontainer.New(specs.LinuxStateDirectory, libcontainer.Cgroupfs)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
container, err := f.Load(c.id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return container.Processes()
|
||||
}
|
||||
|
||||
func getRootIDs(s *specs.LinuxSpec) (int, int, error) {
|
||||
if s == nil {
|
||||
return 0, 0, nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue