Dave Anderson wrote:
Guy Streeter wrote:
How can I find out what other tasks are threads of (or with) a given
task?

--Guy


There's no direct command to do it.  But, for example,
all threads of a task should have the same name and the
same task->tgid right?

So for example, I just executed a task named "mkthreads", pid 27610,
which in turn creates 10 threads of itself, all of which will have
the same task->tgid:

crash> foreach mkthreads task | grep -e COMMAND -e tgid
PID: 27610  TASK: ddb2c000  CPU: 0   COMMAND: "mkthreads"
  tgid = 27610,
PID: 27611  TASK: c82de000  CPU: 0   COMMAND: "mkthreads"
  tgid = 27610,
PID: 27612  TASK: d016a000  CPU: 0   COMMAND: "mkthreads"
  tgid = 27610,
PID: 27613  TASK: c3f2e000  CPU: 0   COMMAND: "mkthreads"
  tgid = 27610,
PID: 27614  TASK: db95e000  CPU: 0   COMMAND: "mkthreads"
  tgid = 27610,
PID: 27615  TASK: d6dfa000  CPU: 0   COMMAND: "mkthreads"
  tgid = 27610,
PID: 27616  TASK: ddad6000  CPU: 0   COMMAND: "mkthreads"
  tgid = 27610,
PID: 27617  TASK: cd1a4000  CPU: 0   COMMAND: "mkthreads"
  tgid = 27610,
PID: 27618  TASK: d45de000  CPU: 0   COMMAND: "mkthreads"
  tgid = 27610,
PID: 27619  TASK: cef58000  CPU: 0   COMMAND: "mkthreads"
  tgid = 27610,
PID: 27620  TASK: cdc38000  CPU: 0   COMMAND: "mkthreads"
  tgid = 27610,
crash>

Dave

I'll whip up a "ps -g" option for the next release, whlch will look
like "ps -c" in that, for each task whose pid equals its tgid, will
then list its threads indented underneath.

(BTW, I've implemented your previous suggestion for a ps
option to dump the full command line and all of a task's
environment variable dumps as well...)

Thanks,
  Dave