summaryrefslogtreecommitdiff
path: root/cmd/podman/top.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman/top.go')
-rw-r--r--cmd/podman/top.go21
1 files changed, 11 insertions, 10 deletions
diff --git a/cmd/podman/top.go b/cmd/podman/top.go
index cdf270fa7..2512631c1 100644
--- a/cmd/podman/top.go
+++ b/cmd/podman/top.go
@@ -18,23 +18,23 @@ func getDescriptorString() string {
descriptors, err := libpod.GetContainerPidInformationDescriptors()
if err == nil {
return fmt.Sprintf(`
-Format Descriptors:
-%s`, strings.Join(descriptors, ","))
+ Format Descriptors:
+ %s`, strings.Join(descriptors, ","))
}
return ""
}
var (
topCommand cliconfig.TopValues
- topDescription = fmt.Sprintf(`Display the running processes of the container. Specify format descriptors
-to alter the output. You may run "podman top -l pid pcpu seccomp" to print
-the process ID, the CPU percentage and the seccomp mode of each process of
-the latest container.
-%s
-`, getDescriptorString())
+ topDescription = fmt.Sprintf(`Similar to system "top" command.
+
+ Specify format descriptors to alter the output.
+
+ Running "podman top -l pid pcpu seccomp" will print the process ID, the CPU percentage and the seccomp mode of each process of the latest container.
+%s`, getDescriptorString())
_topCommand = &cobra.Command{
- Use: "top [flags] CONTAINER [FORMAT-DESCRIPTIOS]",
+ Use: "top [flags] CONTAINER [FORMAT-DESCRIPTORS]",
Short: "Display the running processes of a container",
Long: topDescription,
RunE: func(cmd *cobra.Command, args []string) error {
@@ -50,6 +50,7 @@ the latest container.
func init() {
topCommand.Command = _topCommand
+ topCommand.SetHelpTemplate(HelpTemplate())
topCommand.SetUsageTemplate(UsageTemplate())
flags := topCommand.Flags()
flags.BoolVar(&topCommand.ListDescriptors, "list-descriptors", false, "")
@@ -108,7 +109,7 @@ func topCmd(c *cliconfig.TopValues) error {
if err != nil {
return err
}
- became, ret, err := rootless.JoinNS(uint(pid))
+ became, ret, err := rootless.JoinNS(uint(pid), 0)
if err != nil {
return err
}