mirror of
https://github.com/containers/podman.git
synced 2025-08-06 03:19:52 +08:00
Store Conmon's PID in our state and display in inspect
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
This commit is contained in:
@ -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 {
|
||||
|
Reference in New Issue
Block a user