summaryrefslogtreecommitdiff
path: root/libpod/container.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-07-03 12:45:48 +0200
committerGitHub <noreply@github.com>2019-07-03 12:45:48 +0200
commitbf7d5a9ce8455e4480b5e0ef92b02099f119ee71 (patch)
tree6a5cc5d3d9e68940c423e69e81ab375972d72f15 /libpod/container.go
parent2fbf71663248c578acd68fe393fb04fa3b2606e4 (diff)
parent38c6199b80c5de5d965ab1bcf05820567a36813c (diff)
downloadpodman-bf7d5a9ce8455e4480b5e0ef92b02099f119ee71.tar.gz
podman-bf7d5a9ce8455e4480b5e0ef92b02099f119ee71.tar.bz2
podman-bf7d5a9ce8455e4480b5e0ef92b02099f119ee71.zip
Merge pull request #3483 from mheon/get_conmon_pid
Store and print PID of conmon
Diffstat (limited to 'libpod/container.go')
-rw-r--r--libpod/container.go20
1 files changed, 19 insertions, 1 deletions
diff --git a/libpod/container.go b/libpod/container.go
index 713386477..bfbc47d76 100644
--- a/libpod/container.go
+++ b/libpod/container.go
@@ -168,6 +168,8 @@ type ContainerState struct {
OOMKilled bool `json:"oomKilled,omitempty"`
// PID is the PID of a running container
PID int `json:"pid,omitempty"`
+ // ConmonPID is the PID of the container's conmon
+ ConmonPID int `json:"conmonPid,omitempty"`
// ExecSessions contains active exec sessions for container
// Exec session ID is mapped to PID of exec process
ExecSessions map[string]*ExecSession `json:"execSessions,omitempty"`
@@ -849,7 +851,7 @@ func (c *Container) OOMKilled() (bool, error) {
return c.state.OOMKilled, nil
}
-// PID returns the PID of the container
+// PID returns the PID of the container.
// If the container is not running, a pid of 0 will be returned. No error will
// occur.
func (c *Container) PID() (int, error) {
@@ -865,6 +867,22 @@ func (c *Container) PID() (int, error) {
return c.state.PID, nil
}
+// ConmonPID Returns the PID of the container's conmon process.
+// If the container is not running, a PID of 0 will be returned. No error will
+// occur.
+func (c *Container) ConmonPID() (int, error) {
+ if !c.batched {
+ c.lock.Lock()
+ defer c.lock.Unlock()
+
+ if err := c.syncContainer(); err != nil {
+ return -1, err
+ }
+ }
+
+ return c.state.ConmonPID, nil
+}
+
// ExecSessions retrieves active exec sessions running in the container
func (c *Container) ExecSessions() ([]string, error) {
if !c.batched {