summaryrefslogtreecommitdiffhomepage
path: root/runsc/cmd
diff options
context:
space:
mode:
authorAndrei Vagin <avagin@google.com>2019-12-11 10:30:43 -0800
committergVisor bot <gvisor-bot@google.com>2019-12-11 11:05:41 -0800
commitf8c5ad061bb529e0314bde17f4f1b4ddc82c0120 (patch)
tree33aaa576478c588539991b4345b7c045a6e1b41c /runsc/cmd
parent1643224af0f099d55d7ae7934606ec1987658dfc (diff)
runsc/debug: add an option to list all processes
runsc debug --ps list all processes with all threads. This option is added to the debug command but not to the ps command, because it is going to be used for debug purposes and we want to add any useful information without thinking about backward compatibility. This will help to investigate syzkaller issues. PiperOrigin-RevId: 285013668
Diffstat (limited to 'runsc/cmd')
-rw-r--r--runsc/cmd/debug.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/runsc/cmd/debug.go b/runsc/cmd/debug.go
index 38da7ee02..f37415810 100644
--- a/runsc/cmd/debug.go
+++ b/runsc/cmd/debug.go
@@ -42,6 +42,7 @@ type Debug struct {
logLevel string
logPackets string
duration time.Duration
+ ps bool
}
// Name implements subcommands.Command.
@@ -71,6 +72,7 @@ func (d *Debug) SetFlags(f *flag.FlagSet) {
f.StringVar(&d.strace, "strace", "", `A comma separated list of syscalls to trace. "all" enables all traces, "off" disables all`)
f.StringVar(&d.logLevel, "log-level", "", "The log level to set: warning (0), info (1), or debug (2).")
f.StringVar(&d.logPackets, "log-packets", "", "A boolean value to enable or disable packet logging: true or false.")
+ f.BoolVar(&d.ps, "ps", false, "lists processes")
}
// Execute implements subcommands.Command.Execute.
@@ -240,6 +242,17 @@ func (d *Debug) Execute(_ context.Context, f *flag.FlagSet, args ...interface{})
}
log.Infof("Logging options changed")
}
+ if d.ps {
+ pList, err := c.Processes()
+ if err != nil {
+ Fatalf("getting processes for container: %v", err)
+ }
+ o, err := control.ProcessListToJSON(pList)
+ if err != nil {
+ Fatalf("generating JSON: %v", err)
+ }
+ log.Infof(o)
+ }
if delay {
time.Sleep(d.duration)